# HG changeset patch # User Mikael Laine # Date 1264765997 -7200 # Node ID edfc90759b9f90465d5de8760fdda915f536f911 # Parent 57d4cdd99204767911e34da7a94601ed6c9bc6ea Committing the Image Editor package under the Eclipse Public License diff -r 57d4cdd99204 -r edfc90759b9f group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + + +#include + +#include "../imgeditor_plat/group/bld.inf" +#include "../imageeditor/group/bld.inf" +#include "../imageeditorengine/group/bld.inf" + + +PRJ_EXPORTS + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/data/ImageEditorProvider.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/data/ImageEditorProvider.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,82 @@ +/* +* 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: +* Resource definitions for ImageEditorProvider. +* +*/ + + +#include +#include +#include "ImageEditorUids.hrh" +#include "ImageEditorProvider.hrh" + +RESOURCE REGISTRY_INFO r_theinfo +{ + resource_format_version = RESOURCE_FORMAT_VERSION_2; + dll_uid = UID_AIW_ECOM_DLL; + interfaces = + { + INTERFACE_INFO + { + // Interface UID of resolvers + interface_uid = KAiwClassMenu; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KAiwCmdRotate; + version_no = 1; + display_name = "Rotator Menu Provider"; + default_data = "image/jpeg"; + opaque_data = KAiwCmdRotateStr; + }, + IMPLEMENTATION_INFO + { + implementation_uid = UID_AIW_ECOM_IMPL; + version_no = 1; + display_name = "Edit Menu Provider"; + default_data = "image/*"; + opaque_data = KAiwCmdEditStr; + } + }; + }, + INTERFACE_INFO + { + // Interface UID of resolvers + interface_uid = KAiwClassBase; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = UID_AIW_ECOM_IMPL; + version_no = 1; + display_name = "Editor Base Provider"; + default_data = "image/*"; + opaque_data = KAiwCmdEditStr; + }, + IMPLEMENTATION_INFO + { + implementation_uid = KAiwCmdRotate; + version_no = 1; + display_name = "Rotator Base Provider"; + default_data = "image/jpeg"; + opaque_data = KAiwCmdRotateStr; + } + }; + } + }; +} + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/data/ImageEditorProviderInternal.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/data/ImageEditorProviderInternal.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,135 @@ +/* +* 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: +* Resource definitions for EditorProvider. +* +*/ + + + +#include +#include +#include +#include +#include +#include +#include + +#include "ImageEditorUids.hrh" +#include "ImageEditorProvider.hrh" +#include "editorprovider_gen.loc" + +#include + +NAME EDPR + +RESOURCE RSS_SIGNATURE { } + +RESOURCE MENU_PANE r_editorprovider_menu +{ + items= + { + MENU_ITEM + { + command = AIW_SUBMENU_TITLE; + txt = qtn_sie_options_edit; + }, + MENU_ITEM + { + command = EEditorProviderCmdIdEdit; + txt = qtn_sie_options_edit; + } + }; +} + +RESOURCE MENU_PANE r_jpeg_rotator_menu +{ + items= + { + MENU_ITEM + { + command = AIW_SUBMENU_TITLE; + txt = qtn_sie_options_rotate; + }, + MENU_ITEM + { + command = EEditorProviderCmdIdRotateLeft; + txt = qtn_album_cmd_rotate_left; + }, + MENU_ITEM + { + command = EEditorProviderCmdIdRotateRight; + txt = qtn_album_cmd_rotate_right; + } + }; +} + +//---------------------------------------------------- +// +// r_provider_progress_dialog +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_provider_progress_dialog +{ + flags = EAknWaitNoteFlags|EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control= AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_gen_note_processing; + }; + } + }; +} + +//---------------------------------------------------- +// +// r_provider_wait_dialog +// +//---------------------------------------------------- +// +RESOURCE DIALOG r_provider_wait_dialog +{ + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = EGeneralNote; + control= AVKON_NOTE + { + layout = EWaitLayout; + singular_label = qtn_gen_note_processing; + imagefile = AVKON_ICON_FILE; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; +} + +// End of file + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/group/ImageEditorProvider.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/group/ImageEditorProvider.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,119 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../inc/definitions.def" +#include "../../inc/imageeditoruids.hrh" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + + +MACRO DRM_SUPPORT + + +#if defined( __FILE_TIME_STAMP_UPDATE__ ) +MACRO FILE_TIME_STAMP_UPDATE +#endif + +#if defined( __JPEG_ROTATOR_AIW_PROVIDER_SUPPORT__ ) +MACRO JPEG_ROTATOR_AIW_PROVIDER_SUPPORT +LIBRARY JpegRotator.lib +#endif + +#if defined( __JPEG_SCALER_AIW_PROVIDER_SUPPORT__ ) +MACRO JPEG_SCALER_AIW_PROVIDER_SUPPORT +LIBRARY JpegScaler.lib +#endif + +#if defined( __AIW_MULTIPLE_FILE_SUPPORT__ ) +MACRO AIW_MULTIPLE_FILE_SUPPORT +#endif + + +TARGET ImageEditorProvider.dll +TARGETTYPE PLUGIN +TARGETPATH SHARED_LIB_DIR +CAPABILITY CAP_ECOM_PLUGIN +VENDORID VID_DEFAULT + +UID 0x10009D8D UID_AIW_ECOM_DLL // 0x101FFA9E + +SOURCEPATH ../src +SOURCE ImageEditorProvider.cpp +SOURCE DllMain.cpp +#if defined( __JPEG_ROTATOR_AIW_PROVIDER_SUPPORT__ ) +SOURCE JpegRotatorHelper.cpp +SOURCE ImageRotaterProvider.cpp +#endif + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE /epoc32/include/caf +SYSTEMINCLUDE /epoc32/include/ecom +SYSTEMINCLUDE /epoc32/include/mmf/server + +START RESOURCE ../data/ImageEditorProvider.rss +HEADER +TARGETPATH ECOM_RESOURCE_DIR +END + +START RESOURCE ../data/ImageEditorProviderInternal.rss +HEADER +TARGET ImageEditorProviderInternal.rsc +TARGETPATH RESOURCE_FILES_DIR +LANGUAGE_IDS +END + +LIBRARY apgrfx.lib +LIBRARY apmime.lib +LIBRARY apparc.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY CommonEngine.lib +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY ImageConversion.lib +LIBRARY ImageEditorUtils.lib +LIBRARY PlatformEnv.lib +LIBRARY servicehandler.lib +LIBRARY commonui.lib + +LIBRARY caf.lib // CAF + + +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,46 @@ +/* +* 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 provider bld.inf file. +* +*/ + + +#include +#include + +#include "../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// mmp files +PRJ_MMPFILES + +ImageEditorProvider.mmp + + +// test project mmp files +PRJ_TESTMMPFILES + + +// project exports +PRJ_EXPORTS +../rom/ImageEditorProvider.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorProvider.iby) + +// End of File + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/inc/EditorProvider_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/inc/EditorProvider_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,24 @@ +/* +* 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: +* +*/ + + +#include + +#define qtn_sie_provider_note_rotating qtn_gen_note_processing + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/inc/ImageEditorProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/inc/ImageEditorProvider.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,229 @@ +/* +* 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: +* +*/ + + +#ifndef IMEGEEDITORPROVIDER_H +#define IMEGEEDITORPROVIDER_H + +// INCLUDES +#include +#include +#include +#include + + +// FORWARD DECLARATIONS + +class MAiwNotifyCallback; +class CAknOpenFileService; +class TDataType; + +/** CEditorProvider +* +* CEditorProvider acts as a service provider of Image Editor in +* Series 60 2.8 platform. It implements the base and menu service classes +* as an ECom component. +* +*/ +class CEditorProvider : public CAiwServiceIfMenu, public MAknServerAppExitObserver +{ + +public: + + /** New factory method + * + * + * @param - + * @return - pointer to a new instance of CEditorProvider + */ + static CEditorProvider * NewL(); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CEditorProvider(); + + /** InitialiseL + * + * @see CAiwServiceIfBase + */ + virtual void InitialiseL ( + MAiwNotifyCallback & aFrameworkCallback, + const RCriteriaArray & aInterest + ); + + /** HandleServiceCmdL + * + * @see CAiwServiceIfBase + */ + virtual void HandleServiceCmdL ( + const TInt & aCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ); + + /** InitializeMenuPaneL + * + * @see CAiwServiceIfMenu + */ + virtual void InitializeMenuPaneL ( + CAiwMenuPane & aMenuPane, + TInt aIndex, + TInt aCascadeId, + const CAiwGenericParamList & aInParamList + ); + + /** HandleMenuCmdL + * + * @see CAiwServiceIfMenu + */ + virtual void HandleMenuCmdL ( + TInt aMenuCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ); + + /** HandleServerAppExit + * + * @see MAknServerAppExitObserver + */ + virtual void HandleServerAppExit (TInt aReason); + +protected: + + /** Default constructor + * + * @param - + * @return - + */ + CEditorProvider(); + + /** + * @param aInParamList + * @return CDesCArray* + */ + CDesCArray* CheckInputFilesLC ( + const CAiwGenericParamList & aInParamList + ); + + /** + * @param aOutParamList + * @param aCallback + * @return - + */ + void CheckAiwCallBackL ( + CAiwGenericParamList & aOutParamList, + const MAiwNotifyCallback * aCallback + ); + + /** + * @param aFileName + * @param aFsSession + * @return - + */ + void LaunchImageEditorL( + const TDesC & aFileName, + const CAiwGenericParamList & aInParamList + ); + + + /** CheckDRMProtectionL + * + * Checks if file is DRM protected. + * + * @param aFileName - file name + * @return - ETrue if protected, otherwise EFalse, + */ + TBool CheckDRMProtectionL(const TDesC& aFileName) const; + + /** IsSupportedImageFile + * + * @param aDataType + * @return TBool + */ + TBool IsSupportedImageFile (const TDataType& aDataType) const; + + /** IsJpeg + * + * @param aDataType + * @return TBool + */ + TBool IsJpeg (const TDataType& aDataType) const; + + /** CheckDiskSpaceL + * + * Checks if there is enough space in the disk (MMC/PhoneMemory). + * + * @param aFsSession - file server session + * @param aFileName - file name + * @return - ETrue if enough free memory, otherwise EFalse + */ + TBool CheckDiskSpaceL(RFs& aFsSession, const TDesC& aFileName) const; + + /** CheckDiskSpaceL + * + * Checks if there is enough space in the disk (MMC/PhoneMemory). + * + * @param aFsSession - file server session + * @param aFileList - list of file names + * @return - ETrue if enough free memory, otherwise EFalse + */ + TBool CheckDiskSpaceL(RFs& aFsSession, const CDesCArray* aFileList) const; + + /** HandleCmdsL + * + * Handle menu and service commands + * + * @see HandleMenuCmdL + * @see HandleServiceCmdL + */ + void HandleCmdsL ( + TInt aMenuCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ); + +private: + + TFileName iResourceFile; + RConeResourceLoader iResLoader; + TBool iResLoaderOpen; + TBool iFileServerConnected; + TBool iUseCallBack; + CAknOpenFileService * iOpenFileService; + RFs iSharableFS; + + const MAiwNotifyCallback* iCallback; + CAiwGenericParamList* iInParamList; + CAiwGenericParamList* iOutParamList; + + CDesCArray* iInputFileList; + CDesCArray* iTargetFileList; + +}; + + +#endif // EOF EditorServiceProvider.h diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/inc/ImageEditorProvider.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/inc/ImageEditorProvider.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,57 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPROVIDER_HRH +#define IMAGEEDITORPROVIDER_HRH + +#include +/* +#ifndef KAiwCmdRotate +#define KAiwCmdRotate 0x10207436 +#endif +#ifndef KAiwCmdRotateStr +#define KAiwCmdRotateStr "10207436" +#endif +*/ +enum TEditorProviderCmdId +{ + // Invalid + EEditorProviderCmdIdMin = 0, + // Edit command + EEditorProviderCmdIdEdit, + // Rotate left + EEditorProviderCmdIdRotateLeft, + // Rotate right + EEditorProviderCmdIdRotateRight, + // Scale image + EEditorProviderCmdIdScale, + // Noise reduction + EEditorProviderCmdIdNoiseReduction, + // Automatic enhace + EEditorProviderCmdIdAutoFix, + // Invalid + EEditorProviderCmdIdMax +}; + +#endif + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/inc/ImageRotaterProvider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/inc/ImageRotaterProvider.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,224 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEROTATERPROVIDER_H +#define IMAGEROTATERPROVIDER_H + +// INCLUDES +#include +#include +#include +#include "JpegRotatorHelperObserver.h" + + + +// FORWARD DECLARATIONS +class CJpegRotatorHelper; +class MAiwNotifyCallback; +class TDataType; + +/** CRotateProvider +* +* CRotateProvider acts as a service provider of Image Editor in +* Series 60 2.8 platform. It implements the base and menu service classes +* as an ECom component. +* +*/ +class CRotateProvider : public CAiwServiceIfMenu, public MJpegRotatorHelperObserver +{ + +public: + + /** New factory method + * + * + * @param - + * @return - pointer to a new instance of CRotateProvider + */ + static CRotateProvider * NewL(); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CRotateProvider(); + + /** InitialiseL + * + * @see CAiwServiceIfBase + */ + virtual void InitialiseL ( + MAiwNotifyCallback & aFrameworkCallback, + const RCriteriaArray & aInterest + ); + + /** HandleServiceCmdL + * + * @see CAiwServiceIfBase + */ + virtual void HandleServiceCmdL ( + const TInt & aCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ); + + /** InitializeMenuPaneL + * + * @see CAiwServiceIfMenu + */ + virtual void InitializeMenuPaneL ( + CAiwMenuPane & aMenuPane, + TInt aIndex, + TInt aCascadeId, + const CAiwGenericParamList & aInParamList + ); + + /** HandleMenuCmdL + * + * @see CAiwServiceIfMenu + */ + virtual void HandleMenuCmdL ( + TInt aMenuCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ); + +protected: + + /** Default constructor + * + * @param - + * @return - + */ + CRotateProvider(); + + /** + * @param aInParamList + * @return CDesCArray* + */ + CDesCArray* CheckInputFilesLC ( + const CAiwGenericParamList & aInParamList + ); + + /** + * @param aOutParamList + * @param aCallback + * @return - + */ + void CheckAiwCallBackL ( + CAiwGenericParamList & aOutParamList, + const MAiwNotifyCallback * aCallback + ); + + /** + * @param aFileName + * @param aCmdId + * @return - + */ + void LaunchJpegRotatorL( + const CDesCArray * aInputFileList, + TInt aCmdId + ); + + /** CheckDRMProtectionL + * + * Checks if file is DRM protected. + * + * @param aFileName - file name + * @return - ETrue if protected, otherwise EFalse, + */ + TBool CheckDRMProtectionL(const TDesC& aFileName) const; + + /** IsJpeg + * + * @param aDataType + * @return TBool + */ + TBool IsJpeg (const TDataType& aDataType) const; + + /** CheckDiskSpaceL + * + * Checks if there is enough space in the disk (MMC/PhoneMemory). + * + * @param aFsSession - file server session + * @param aFileName - file name + * @return - ETrue if enough free memory, otherwise EFalse + */ + TBool CheckDiskSpaceL(RFs& aFsSession, const TDesC& aFileName) const; + + /** CheckDiskSpaceL + * + * Checks if there is enough space in the disk (MMC/PhoneMemory). + * + * @param aFsSession - file server session + * @param aFileList - list of file names + * @return - ETrue if enough free memory, otherwise EFalse + */ + TBool CheckDiskSpaceL(RFs& aFsSession, const CDesCArray* aFileList) const; + + /** HandleCmdsL + * + * Handle menu and service commands + * + * @see HandleMenuCmdL + * @see HandleServiceCmdL + */ + void HandleCmdsL ( + TInt aMenuCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ); + +private: // from MJpegRotatorHelperObserver + + /** RotateOperationReadyL + * + * @see MJpegRotatorHelperObserver + */ + virtual void RotateOperationReadyL (TInt aError); + +private: + + TFileName iResourceFile; + RConeResourceLoader iResLoader; + TBool iResLoaderOpen; + TBool iFileServerConnected; + TBool iUseCallBack; + RFs iSharableFS; + RFile iFileHandle; + + const MAiwNotifyCallback* iCallback; + CAiwGenericParamList* iInParamList; + CAiwGenericParamList* iOutParamList; + + CJpegRotatorHelper* iJpegRotatorHelper; + CDesCArray* iInputFileList; + CDesCArray* iTargetFileList; + +}; + + +#endif // EOF EditorServiceProvider.h diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/inc/JpegRotatorHelper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/inc/JpegRotatorHelper.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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: +* Active object to wait for asynchronous service completion. +* +*/ + + +#ifndef JPEGROTATORHELPER_H +#define JPEGROTATORHELPER_H + +// INCLUDES +#include +#include +#include +#include "JpegRotator.h" +#include "JpegRotatorHelperObserver.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +// CLASS DECLARATIONS + +/** +* CJpegRotatorHelper +* An active object. +* +*/ +NONSHARABLE_CLASS(CJpegRotatorHelper) : public CActive, public MProgressDialogCallback +{ + public: // New functions + + /** + * Constructor + */ + CJpegRotatorHelper(RFs& aFsSession, MJpegRotatorHelperObserver& aObserver); + + + /** + * Destructor + */ + ~CJpegRotatorHelper(); + + /** + * Start waiting + */ + void StartRotateL ( + const CDesCArray* aSourceFileList, + CDesCArray* aTargetFileList, + CJpegRotator::TRotationMode aMode, + TBool aPreserveOriginalFiles + ); + + public: // Functions from base classes + + /** + * Callback method + * Get's called when a dialog is dismissed. + */ + virtual void DialogDismissedL( TInt aButtonId ); + + private: // Functions from base classes + + /** + * From CActive + */ + void RunL(); + + /** + * From CActive + */ + void DoCancel(); + + /** + * + */ + void FinalizeRotatedFileL( TInt aCurrentFileIndex ); + + private: // Data + + RFs& iFsSession; + MJpegRotatorHelperObserver& iObserver; + CJpegRotator* iJpegRotator; + CAknWaitDialog* iWaitDialog; + const CDesCArray* iSourceFileList; // not owned + CDesCArray* iTargetFileList; // not owned + TInt iMode; + TBool iPreserveOriginalFiles; + TInt iCounter; + }; + +#endif + + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/inc/JpegRotatorHelperObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/inc/JpegRotatorHelperObserver.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* Interface for observing rotator readiness. +* +*/ + + +#ifndef JPEGROTATORHELPEROBSERVER_H +#define JPEGROTATORHELPEROBSERVER_H + +// INCLUDES + +// CLASS DECLARATION + +/** +* +*/ +class MJpegRotatorHelperObserver +{ + public: + virtual void RotateOperationReadyL (TInt aError) = 0; +}; + +#endif + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/rom/ImageEditorProvider.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/rom/ImageEditorProvider.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IMAGEEDITORPROVIDER_IBY__ +#define __IMAGEEDITORPROVIDER_IBY__ + +// Provider DLL +ECOM_PLUGIN(ImageEditorProvider.dll,ImageEditorProvider.rsc) + +#endif // __IMAGEEDITORPROVIDER_IBY__ + +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/src/Dllmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/src/Dllmain.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,57 @@ +/* +* 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: +* +*/ + + + +/// INCLUDES +#include +#include +#include +#include "ImageEditorProvider.h" +#include "ImageEditorUids.hrh" +#include "ImageRotaterProvider.h" +#include "ImageEditorProvider.hrh" + +const TImplementationProxy ImplementationTable[] = + { + IMPLEMENTATION_PROXY_ENTRY (UID_AIW_ECOM_IMPL,CEditorProvider::NewL), + +#if defined( JPEG_ROTATOR_AIW_PROVIDER_SUPPORT ) + IMPLEMENTATION_PROXY_ENTRY (KAiwCmdRotate,CRotateProvider::NewL) +#endif + }; + + +// The one and only exported function that is the ECom entry point +EXPORT_C const TImplementationProxy* ImplementationGroupProxy (TInt& aTableCount) + { + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; + } + +#ifndef EKA2 +/** + * Standard Symbian OS DLL entry point. + */ +TBool E32Dll(TDllReason) + { + return ETrue; + } +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/src/ImageEditorProvider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/src/ImageEditorProvider.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,625 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ImageEditorProvider.h" +#include "ImageEditorProvider.hrh" + +#include "ImageEditorUids.hrh" +#include "ImageEditorUtils.h" +#include "commondefs.h" + +#include +#include +#include +#include +#include +#include + +// LOCAL CONSTANTS AND MACROS +//#ifdef DRM_SUPPORT +#include +#define DRM_FILE_ARG(x) x +//#else +//#define DRM_FILE_ARG(x) +//#endif + + +// debug log +#include "imageeditordebugutils.h" + +using namespace ContentAccess; + +_LIT(KEditorServiceProviderLogFile,"EditorServiceProvider.log"); + +// resource file +_LIT (KResourceFile, "\\resource\\imageeditorproviderinternal.rsc"); + +// application +const TUid KImageEditorUID = {UID_IMAGE_EDITOR}; + + +//============================================================================= +CEditorProvider * CEditorProvider::NewL() +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::NewL"); + + return new (ELeave) CEditorProvider; +} + +//============================================================================= +CEditorProvider::CEditorProvider() +: iResLoader(*CEikonEnv::Static()), + iResLoaderOpen(EFalse), + iFileServerConnected(EFalse) +{ + +} + +//============================================================================= +CEditorProvider::~CEditorProvider() +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::~CEditorProvider"); + + iCallback = NULL; + + if (iInParamList) + { + iInParamList->Reset(); + delete iInParamList; + } + if (iOutParamList) + { + iOutParamList->Reset(); + delete iOutParamList; + } + delete iOpenFileService; + iOpenFileService = 0; + +#ifdef VERBOSE + TInt count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); + iSharableFS.ResourceCountMarkEnd(); +#endif + + delete iInputFileList; + delete iTargetFileList; + + + iSharableFS.Close(); + iResLoader.Close(); +} + +//============================================================================= +void CEditorProvider::InitialiseL ( + MAiwNotifyCallback & /*aFrameworkCallback*/, + const RCriteriaArray & /*aInterest*/ + ) +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::InitialiseL"); + + if (!iInParamList) + { + iInParamList = CAiwGenericParamList::NewL(); + } + + if (!iOutParamList) + { + iOutParamList = CAiwGenericParamList::NewL(); + } + + if (!iResLoaderOpen) + { + // Load AIW edit provider internal resource file + TFileName fileName; + TParse p; + + Dll::FileName(fileName); + p.Set(KResourceFile, &fileName, NULL); + iResourceFile = p.FullName(); + BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), iResourceFile ); + + LOGFMT(KEditorServiceProviderLogFile, "\tLoading resource file: %S", &iResourceFile); + + iResLoader.OpenL ( iResourceFile ); + iResLoaderOpen = ETrue; + + LOG(KEditorServiceProviderLogFile, "\tResources loaded succesfully"); + } + + // Connect to file server + if (!iFileServerConnected) + { + User::LeaveIfError(iSharableFS.Connect()); + iFileServerConnected = ETrue; + +#ifdef VERBOSE + iSharableFS.ResourceCountMarkStart(); +#endif + + // Share file server sessions with other processes. Needed for Open File service. + User::LeaveIfError(iSharableFS.ShareProtected()); + } + + // Publish & Subscribe API used for delivering document name to AIW provider + TInt err = RProperty::Define(KImageEditorProperties, EPropertyFilename, RProperty::EText); + + if (err != KErrAlreadyExists) + { + User::LeaveIfError(err); + } + + LOG(KEditorServiceProviderLogFile, "\tInitialized."); +} + +//============================================================================= +void CEditorProvider::InitializeMenuPaneL ( + CAiwMenuPane & aMenuPane, + TInt aIndex, + TInt /*aCascadeId*/, + const CAiwGenericParamList & aInParamList + ) + { + LOG(KEditorServiceProviderLogFile, "CEditorProvider::InitializeMenuPaneL: In"); + + if (BaflUtils::FileExists(iSharableFS, iResourceFile)) + { + // Check how many input files & examine the MIME types + CDesCArray* fileList = CheckInputFilesLC( aInParamList ); + RArray mimeTypeList; + CleanupClosePushL(mimeTypeList); + + if( fileList && fileList->Count()) + { + // If we support multiple selection, all the files are opened here. + // This migh be very slow. + TInt inputFileCount = fileList->MdcaCount(); + + LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider::InitializeMenuPaneL: inputFileCount: %d", inputFileCount); + + // Get the MIME type(s) of the file(s) + RApaLsSession lsSession; + TInt err = lsSession.Connect(); + CleanupClosePushL (lsSession); + for( TInt i = 0; i < inputFileCount; i++ ) + { + TDataRecognitionResult dataType; + RFile file; + err = file.Open (iSharableFS, fileList->MdcaPoint(i), EFileShareReadersOnly); + if (KErrNone != err) + { + // second try... + err = file.Open (iSharableFS, fileList->MdcaPoint(i), EFileShareAny); + } + if (KErrNone == err) + { + CleanupClosePushL( file ); + User::LeaveIfError( lsSession.RecognizeData(file, dataType) ); + mimeTypeList.AppendL( dataType.iDataType ); + CleanupStack::PopAndDestroy(); // file + } + else + { + mimeTypeList.AppendL( TDataType() ); + } + } + CleanupStack::PopAndDestroy(); // lsSession + + LOG(KEditorServiceProviderLogFile, "CEditorProvider::InitializeMenuPaneL: AIW parameter list content analyzed"); + + // Based on the MIME type, decice whether we support this file. + // Show the menu only if the single file is selected + if( (fileList->MdcaCount() == 1) && IsSupportedImageFile(mimeTypeList[0]) ) + { + // Check that file is supported by ICL + TPtrC filename = fileList->MdcaPoint(0); + TRAPD(err, + CImageDecoder* decoder = CImageDecoder::FileNewL(iSharableFS, filename); + delete decoder; + ); + + // Check if file is DRM protected + if ( !CheckDRMProtectionL( filename ) && + err == KErrNone) + { + aMenuPane.AddMenuItemsL ( + iResourceFile, + R_EDITORPROVIDER_MENU, + KAiwCmdEdit, + aIndex); + } + } + } + + CleanupStack::PopAndDestroy(2); // fileList, mimeTypeList + } + + LOG(KEditorServiceProviderLogFile, "CEditorProvider::InitializeMenuPaneL: Out"); + } + +//============================================================================= +void CEditorProvider::HandleServiceCmdL ( + const TInt & aCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider::HandleServiceCmdL (%d)", aCmdId); + HandleCmdsL(aCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback); +} + +//============================================================================= +void CEditorProvider::HandleMenuCmdL ( + TInt aMenuCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider::HandleMenuCmdL (%d)", aMenuCmdId); + + HandleCmdsL(aMenuCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback); +} + +//============================================================================= +void CEditorProvider::HandleCmdsL ( + TInt aCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint /*aCmdOptions*/, + const MAiwNotifyCallback * aCallback + ) +{ + switch (aCmdId) + { + case KAiwCmdEdit: + case EEditorProviderCmdIdEdit: + { + // Check how many input files + delete iInputFileList; + iInputFileList = NULL; + iInputFileList = CheckInputFilesLC( aInParamList ); + CleanupStack::Pop(iInputFileList); + CheckAiwCallBackL( aOutParamList, aCallback ); + + // "Edit" command available only if a single file is selected + if( iInputFileList->MdcaCount() == 1 ) + { + TPtrC filename = iInputFileList->MdcaPoint(0); +// if( CheckDiskSpaceL(iSharableFS, filename) ) +// { + LaunchImageEditorL( filename, aInParamList ); +// } +// else +// { +// LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider: not enough disk space to start editing %S", &filename); +// +// delete iInputFileList; +// iInputFileList = NULL; +// User::Leave (KErrDiskFull); +// } + } + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CEditorProvider::CheckAiwCallBackL ( + CAiwGenericParamList & aOutParamList, + const MAiwNotifyCallback * aCallback + ) +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckAiwCallBackL: In"); + + if (aCallback) + { + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckAiwCallBackL: Callback used"); + iCallback = aCallback; + iOutParamList->Reset(); + iOutParamList->AppendL(aOutParamList); + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckAiwCallBackL: Using AIW call back"); + iUseCallBack = ETrue; + } + else + { + iCallback = NULL; + iUseCallBack = EFalse; + } + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckAiwCallBackL: Out"); +} + +//============================================================================= +CDesCArray* CEditorProvider::CheckInputFilesLC ( + const CAiwGenericParamList & aInParamList + ) +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckInputFilesLC: In"); + + iInParamList->Reset(); + iInParamList->AppendL(aInParamList); + + // Create array for input files. + CDesCArray* inputFileList = new (ELeave) CDesCArraySeg(4); + CleanupStack::PushL( inputFileList ); + + // Count number of files in param list and store the file names. + // Assuming that the files were already checked in + // InitializeMenuPaneL; no need to check them here. + TInt count = aInParamList.Count(); + TInt index; + TInt fileCount = 0; + for (index = 0; index < count; ++index) + { + const TAiwGenericParam& param = aInParamList[index]; + if (param.SemanticId() == EGenericParamFile) + { +#ifndef AIW_MULTIPLE_FILE_SUPPORT + if (fileCount) + { + inputFileList->Reset(); + break; + } +#endif + // Get file name + TPtrC fileName = param.Value().AsDes(); + inputFileList->AppendL( fileName ); + fileCount++; + LOGFMT(KEditorServiceProviderLogFile, "\tfile: %S", &fileName); + } + } + + // Check that the files exist + TBool filesExist = ETrue; + for( TInt i = 0; i < inputFileList->MdcaCount(); i++ ) + { + filesExist = BaflUtils::FileExists( iSharableFS, inputFileList->MdcaPoint(i) ); + if( !filesExist ) + { + inputFileList->Reset(); + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckInputFilesLC: file list deleted"); + break; + } + } + + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckInputFilesLC: Out"); + return inputFileList; +} + + +//============================================================================= +void CEditorProvider::LaunchImageEditorL ( + const TDesC & aFileName, + const CAiwGenericParamList & /*aInParamList*/ + ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider::LaunchEditorL: file: %S", &aFileName); + +#ifdef VERBOSE + TInt count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); +#endif + + RFile fileHandle; + + TInt err = + fileHandle.Open ( + iSharableFS, + aFileName, + EFileWrite | EFileShareReadersOrWriters + ); + if (KErrNone != err) + { + User::LeaveIfError ( + fileHandle.Open ( + iSharableFS, + aFileName, + EFileRead | EFileShareReadersOrWriters + )); + } + + LOG(KEditorServiceProviderLogFile, "Filehandle opened"); + + // fileHandle has to be closed to enable overwriting the original image + CleanupClosePushL (fileHandle); + +#ifdef VERBOSE + count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); +#endif + + iOpenFileService = CAknOpenFileService::NewL ( + KImageEditorUID, + fileHandle, + (MAknServerAppExitObserver *)this, + iInParamList + ); + + if (iCallback && iUseCallBack) + { + LOG(KEditorServiceProviderLogFile, "CEditorProvider: Calling HandleNotifyL"); + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventStarted, *iOutParamList, *iInParamList); + } + +#ifdef VERBOSE + count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); +#endif + + CleanupStack::PopAndDestroy(); // close fileHandle + +} + +//============================================================================= +void CEditorProvider::HandleServerAppExit (TInt aReason) +{ + LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider::HandleServerAppExit: %d", aReason); + + delete iOpenFileService; + iOpenFileService = 0; + + if (iCallback && iUseCallBack) + { + LOG(KEditorServiceProviderLogFile, "CEditorProvider: Calling HandleNotifyL"); + + // Copy the name of the created image file to the output parameter list + TFileName newFileName; + User::LeaveIfError(RProperty::Get(KImageEditorProperties, EPropertyFilename, newFileName)); + + iOutParamList->Reset(); + TAiwVariant variant(newFileName); + TAiwGenericParam param(EGenericParamFile, variant); + iOutParamList->AppendL(param); + + // Non-leaving function shall use TRAP + TRAP_IGNORE ( + LOG(KEditorServiceProviderLogFile, "CEditorProvider: Call HandleNotifyL 1"); + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventCompleted, *iOutParamList, *iInParamList); + LOG(KEditorServiceProviderLogFile, "CEditorProvider: Call HandleNotifyL 2"); + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventStopped, *iOutParamList, *iInParamList); + LOG(KEditorServiceProviderLogFile, "CEditorProvider: Call HandleNotifyL 3"); + ); + + // Reset new filename property and out paramlist + User::LeaveIfError(RProperty::Set(KImageEditorProperties, EPropertyFilename, KNullDesC)); + iOutParamList->Reset(); + } + + MAknServerAppExitObserver::HandleServerAppExit(aReason); + +#ifdef VERBOSE + TInt count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); +#endif + +} + +//============================================================================= +TBool CEditorProvider::CheckDRMProtectionL(const TDesC& DRM_FILE_ARG(aFileName)) const +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckDRMProtectionL: In"); + + //: Replace DRM checking with DRM utility for better performance once it's available + + TBool isDRMProtected = EFalse; + + // Create CContent-object + CContent* pContent = CContent::NewLC(aFileName); + + // See if the content object is protected + User::LeaveIfError( pContent->GetAttribute( EIsProtected, isDRMProtected ) ); + + CleanupStack::PopAndDestroy (pContent); + + LOGFMT(KEditorServiceProviderLogFile, "CEditorProvider::CheckDRMProtectionL: Out (result: %d)", isDRMProtected); + + return isDRMProtected; +} + +//============================================================================= +TBool CEditorProvider::IsSupportedImageFile (const TDataType& aDataType) const +{ + _LIT(KMimeAllImages, "image/"); + + TBool supported = EFalse; + + // CompareC return 0 if equal + if ( aDataType.Des().Left(6).CompareF( KMimeAllImages ) ) + { + supported = EFalse; + } + else + { + supported = ETrue; + } + + return supported; +} + +//============================================================================= +TBool CEditorProvider::IsJpeg (const TDataType& aDataType) const +{ + _LIT(KMimeJpeg, "image/jpeg"); + + // CompareC return 0 if equal + return 0 == ( aDataType.Des().Left(10).CompareF( KMimeJpeg ) ); +} + +//============================================================================= +TBool CEditorProvider::CheckDiskSpaceL(RFs& aFsSession, const TDesC& aFileName) const +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckDiskSpaceL"); + + TBool enoughFreeSpace = ETrue; + + TFileName targetDrive = PathInfo::MemoryCardRootPath(); + + if (!ImageEditorUtils::ImageFitsToDriveL (aFsSession, aFileName, targetDrive)) + { + targetDrive = PathInfo::PhoneMemoryRootPath(); + + if (!ImageEditorUtils::ImageFitsToDriveL (aFsSession, aFileName, targetDrive)) + { + enoughFreeSpace = EFalse; + } + } + + return enoughFreeSpace; +} + +//============================================================================= +TBool CEditorProvider::CheckDiskSpaceL(RFs& aFsSession, const CDesCArray* aFileList) const +{ + LOG(KEditorServiceProviderLogFile, "CEditorProvider::CheckDiskSpaceL"); + + // Check if the files fit onto the drive. Do this initial check assuming + // that each rotated file is saved to the same drive than the original file + return ImageEditorUtils::ImagesFitToDriveL (aFsSession, *aFileList, *aFileList); +} + + + + + + + + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/src/ImageRotaterProvider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/src/ImageRotaterProvider.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,610 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "ImageEditorProvider.hrh" +#include "JpegRotatorHelper.h" +#include "ImageRotaterProvider.h" +#include "ImageEditorUids.hrh" +#include "ImageEditorUtils.h" +#include "commondefs.h" + +#include +#include +#include +#include +#include + + +#include + +// LOCAL CONSTANTS AND MACROS +#ifdef DRM_SUPPORT +#include +#define DRM_FILE_ARG(x) x +#else +#define DRM_FILE_ARG(x) +#endif + +#ifdef JPEG_ROTATOR_AIW_PROVIDER_SUPPORT +#define JPEG_ROTATOR_AIW_PROVIDER_SUPPORT_ARG(x) x +#else +#define JPEG_ROTATOR_AIW_PROVIDER_SUPPORT_ARG(x) +#endif + +#ifdef AIW_MULTIPLE_FILE_SUPPORT +const TBool KMultipleFileSupport = ETrue; +#else +const TBool KMultipleFileSupport = EFalse; +#endif + +// debug log +#include "imageeditordebugutils.h" +_LIT(KEditorServiceProviderLogFile,"EditorServiceProvider.log"); + +// resource file +_LIT (KResourceFile, "\\resource\\imageeditorproviderinternal.rsc"); + +// application + + +//============================================================================= +CRotateProvider * CRotateProvider::NewL() +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::NewL"); + + return new (ELeave) CRotateProvider; +} + +//============================================================================= +CRotateProvider::CRotateProvider() +: iResLoader(*CEikonEnv::Static()), + iResLoaderOpen(EFalse), + iFileServerConnected(EFalse) +{ + +} + +//============================================================================= +CRotateProvider::~CRotateProvider() +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::~CRotateProvider"); + + iCallback = NULL; + + if (iInParamList) + { + iInParamList->Reset(); + delete iInParamList; + } + if (iOutParamList) + { + iOutParamList->Reset(); + delete iOutParamList; + } + + iFileHandle.Close(); + +#ifdef VERBOSE + TInt count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); + iSharableFS.ResourceCountMarkEnd(); +#endif + + delete iInputFileList; + delete iTargetFileList; + + delete iJpegRotatorHelper; + + iSharableFS.Close(); + iResLoader.Close(); +} + +//============================================================================= +void CRotateProvider::InitialiseL ( + MAiwNotifyCallback & /*aFrameworkCallback*/, + const RCriteriaArray & /*aInterest*/ + ) +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::InitialiseL"); + + if (!iInParamList) + { + iInParamList = CAiwGenericParamList::NewL(); + } + + if (!iOutParamList) + { + iOutParamList = CAiwGenericParamList::NewL(); + } + + if (!iResLoaderOpen) + { + // Load AIW edit provider internal resource file + TFileName fileName; + TParse p; + + Dll::FileName(fileName); + p.Set(KResourceFile, &fileName, NULL); + iResourceFile = p.FullName(); + BaflUtils::NearestLanguageFile( CEikonEnv::Static()->FsSession(), iResourceFile ); + + LOGFMT(KEditorServiceProviderLogFile, "\tLoading resource file: %S", &iResourceFile); + + iResLoader.OpenL ( iResourceFile ); + iResLoaderOpen = ETrue; + + LOG(KEditorServiceProviderLogFile, "\tResources loaded succesfully"); + } + + // Connect to file server + if (!iFileServerConnected) + { + User::LeaveIfError(iSharableFS.Connect()); + iFileServerConnected = ETrue; + +#ifdef VERBOSE + iSharableFS.ResourceCountMarkStart(); +#endif + + // Share file server sessions with other processes. Needed for Open File service. + User::LeaveIfError(iSharableFS.ShareProtected()); + } + + LOG(KEditorServiceProviderLogFile, "\tInitialized."); +} + +//============================================================================= +void CRotateProvider::InitializeMenuPaneL ( + CAiwMenuPane & aMenuPane, + TInt aIndex, + TInt /*aCascadeId*/, + const CAiwGenericParamList & aInParamList + ) + { + LOG(KEditorServiceProviderLogFile, "CRotateProvider::InitializeMenuPaneL: In"); + + if (BaflUtils::FileExists(iSharableFS, iResourceFile)) + { + // Check how many input files & examine the MIME types + CDesCArray* fileList = CheckInputFilesLC( aInParamList ); + RArray mimeTypeList; + CleanupClosePushL(mimeTypeList); + + if( fileList && fileList->Count()) + { + // If we support multiple selection, all the files are opened here. + // This migh be very slow. + TInt inputFileCount = fileList->MdcaCount(); + + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::InitializeMenuPaneL: inputFileCount: %d", inputFileCount); + + // Get the MIME type(s) of the file(s) + RApaLsSession lsSession; + TInt err = lsSession.Connect(); + CleanupClosePushL (lsSession); + for( TInt i = 0; i < inputFileCount; i++ ) + { + TDataRecognitionResult dataType; + RFile file; + err = file.Open (iSharableFS, fileList->MdcaPoint(i), EFileShareReadersOnly); + if (KErrNone != err) + { + // second try... + err = file.Open (iSharableFS, fileList->MdcaPoint(i), EFileShareAny); + } + if (KErrNone == err) + { + CleanupClosePushL( file ); + User::LeaveIfError( lsSession.RecognizeData(file, dataType) ); + mimeTypeList.AppendL( dataType.iDataType ); + CleanupStack::PopAndDestroy(); // file + } + else + { + mimeTypeList.AppendL( TDataType() ); + } + } + CleanupStack::PopAndDestroy(); // lsSession + + LOG(KEditorServiceProviderLogFile, "CRotateProvider::InitializeMenuPaneL: AIW parameter list content analyzed"); + TBool displayJpegRotatorMenu = EFalse; + TInt count = fileList->MdcaCount(); + if( (KMultipleFileSupport && count > 0) || count == 1 ) + { + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::InitializeMenuPaneL: count %d ", count); + for (TInt index = 0; index < count; ++index) + { + // Check if file is DRM protected + displayJpegRotatorMenu = !CheckDRMProtectionL( fileList->MdcaPoint(index) ); + if (displayJpegRotatorMenu) + { + // Check that it is JPEG + displayJpegRotatorMenu = IsJpeg( mimeTypeList[0] ); + } + if (!displayJpegRotatorMenu) + { + break; + } + } + } + // Show the menu if all selected files were of supported type + if (displayJpegRotatorMenu) + { + aMenuPane.AddMenuItemsL (iResourceFile, R_JPEG_ROTATOR_MENU,KAiwCmdRotate,aIndex); + } + } + CleanupStack::PopAndDestroy(2); // fileList, mimeTypeList + } + + LOG(KEditorServiceProviderLogFile, "CRotateProvider::InitializeMenuPaneL: Out"); + } + +//============================================================================= +void CRotateProvider::HandleServiceCmdL ( + const TInt & aCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::HandleServiceCmdL (%d)", aCmdId); + HandleCmdsL(aCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback); +} + +//============================================================================= +void CRotateProvider::HandleMenuCmdL ( + TInt aMenuCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint aCmdOptions, + const MAiwNotifyCallback * aCallback + ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::HandleMenuCmdL (%d)", aMenuCmdId); + + HandleCmdsL(aMenuCmdId, aInParamList, aOutParamList, aCmdOptions, aCallback); +} + +//============================================================================= +void CRotateProvider::HandleCmdsL ( + TInt aCmdId, + const CAiwGenericParamList & aInParamList, + CAiwGenericParamList & aOutParamList, + TUint /*aCmdOptions*/, + const MAiwNotifyCallback * aCallback + ) +{ + switch (aCmdId) + { + case EEditorProviderCmdIdRotateLeft: + case EEditorProviderCmdIdRotateRight: + { + delete iInputFileList; + iInputFileList = NULL; + iInputFileList = CheckInputFilesLC( aInParamList ); + CleanupStack::Pop(iInputFileList); + CheckAiwCallBackL( aOutParamList, aCallback ); + + // Check that there is enough disk space and launch the rotator + if( iInputFileList ) + { + if( CheckDiskSpaceL(iSharableFS, iInputFileList) ) + { + LaunchJpegRotatorL( iInputFileList, aCmdId ); + } + else + { + LOG(KEditorServiceProviderLogFile, "CRotateProvider::HandleCmdsL: not enough disk space to start editing"); + delete iInputFileList; + iInputFileList = NULL; + User::Leave (KErrDiskFull); + } + } + + break; + } + case EEditorProviderCmdIdScale: + { + User::Leave(KErrNotSupported); + break; + } + case EEditorProviderCmdIdNoiseReduction: + { + User::Leave(KErrNotSupported); + break; + } + case EEditorProviderCmdIdAutoFix: + { + User::Leave(KErrNotSupported); + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CRotateProvider::CheckAiwCallBackL ( + CAiwGenericParamList & aOutParamList, + const MAiwNotifyCallback * aCallback + ) +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckAiwCallBackL: In"); + + if (aCallback) + { + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckAiwCallBackL: Callback used"); + iCallback = aCallback; + iOutParamList->Reset(); + iOutParamList->AppendL(aOutParamList); + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckAiwCallBackL: Using AIW call back"); + iUseCallBack = ETrue; + } + else + { + iCallback = NULL; + iUseCallBack = EFalse; + } + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckAiwCallBackL: Out"); +} + +//============================================================================= +CDesCArray* CRotateProvider::CheckInputFilesLC ( + const CAiwGenericParamList & aInParamList + ) +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckInputFilesLC: in"); + + iInParamList->Reset(); + iInParamList->AppendL(aInParamList); + + // Create array for input files. + CDesCArray* inputFileList = new (ELeave) CDesCArraySeg(4); + CleanupStack::PushL( inputFileList ); + + // Count number of files in param list and store the file names. + // Assuming that the files were already checked in + // InitializeMenuPaneL; no need to check them here. + TInt count = aInParamList.Count(); + TInt index = 0; + TInt fileCount = 0; + for (index = 0; index < count; ++index) + { + const TAiwGenericParam& param = aInParamList[index]; + if (param.SemanticId() == EGenericParamFile) + { +#ifndef AIW_MULTIPLE_FILE_SUPPORT + if (fileCount) + { + inputFileList->Reset(); + break; + } +#endif + + // Get file name + TPtrC fileName = param.Value().AsDes(); + inputFileList->AppendL( fileName ); + fileCount++; + LOGFMT(KEditorServiceProviderLogFile, "\tfile: %S", &fileName); + } + } + + // Check that the files exist + TBool filesExist = ETrue; + for( TInt i = 0; i < inputFileList->MdcaCount(); i++ ) + { + filesExist = BaflUtils::FileExists( iSharableFS, inputFileList->MdcaPoint(i) ); + if( !filesExist ) + { + inputFileList->Reset(); + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckInputFilesLC: file list deleted"); + break; + } + } + + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckInputFilesLC: out"); + return inputFileList; +} + + +//============================================================================= +void CRotateProvider::LaunchJpegRotatorL ( + const CDesCArray* aInputFileList, + TInt aCmdId + ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::LaunchJpegRotatorL: number of files: %d", aInputFileList->MdcaCount()); + + ASSERT( EEditorProviderCmdIdRotateLeft == aCmdId || EEditorProviderCmdIdRotateRight == aCmdId); + + // Notify that the rotating has been started + if (iCallback) + { + LOG(KEditorServiceProviderLogFile, "CRotateProvider: Calling HandleNotifyL"); + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdEdit, KAiwEventStarted, *iOutParamList, *iInParamList); + } + + // Set the rotation mode + CJpegRotator::TRotationMode mode = CJpegRotator::ERotModeCounterClockwise; + if (EEditorProviderCmdIdRotateRight == aCmdId) + { + mode = CJpegRotator::ERotModeClockwise; + } + + // Start the asyncronous rotate operation + delete iTargetFileList; + iTargetFileList = NULL; + iTargetFileList = new (ELeave) CDesCArraySeg(4); + delete iJpegRotatorHelper; + iJpegRotatorHelper = NULL; + iJpegRotatorHelper = new (ELeave) CJpegRotatorHelper( iSharableFS, *this ); + + // Start rotate, replacing original file(s) + TRAPD( err, iJpegRotatorHelper->StartRotateL( aInputFileList, iTargetFileList, mode, EFalse ) ); // replace original files + if (KErrNone != err) + { + iJpegRotatorHelper->Cancel(); + } + +#ifdef VERBOSE + count = iSharableFS.ResourceCount(); + LOGFMT(KEditorServiceProviderLogFile, "Resource count: %d", count); +#endif + +} + +//============================================================================= +TBool CRotateProvider::CheckDRMProtectionL(const TDesC& DRM_FILE_ARG(aFileName)) const +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckDRMProtectionL: In"); + + TBool isDRMProtected = EFalse; + +#ifdef DRM_SUPPORT + + DRMCommon* drm = DRMCommon::NewL(); + CleanupStack::PushL (drm); + drm->IsProtectedFile( aFileName, isDRMProtected ); + CleanupStack::PopAndDestroy (drm); + +#endif + + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::CheckDRMProtectionL: Out (result: %d)", isDRMProtected); + + return isDRMProtected; +} + + +//============================================================================= +TBool CRotateProvider::IsJpeg (const TDataType& aDataType) const +{ + _LIT(KMimeJpeg, "image/jpeg"); + + // CompareC return 0 if equal + return 0 == ( aDataType.Des().Left(10).CompareF( KMimeJpeg ) ); +} + +//============================================================================= +TBool CRotateProvider::CheckDiskSpaceL(RFs& aFsSession, const TDesC& aFileName) const +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckDiskSpaceL"); + + TBool enoughFreeSpace = ETrue; + + TFileName targetDrive = PathInfo::MemoryCardRootPath(); + + if (!ImageEditorUtils::ImageFitsToDriveL (aFsSession, aFileName, targetDrive)) + { + targetDrive = PathInfo::PhoneMemoryRootPath(); + + if (!ImageEditorUtils::ImageFitsToDriveL (aFsSession, aFileName, targetDrive)) + { + enoughFreeSpace = EFalse; + } + } + + return enoughFreeSpace; +} + +//============================================================================= +TBool CRotateProvider::CheckDiskSpaceL(RFs& aFsSession, const CDesCArray* aFileList) const +{ + LOG(KEditorServiceProviderLogFile, "CRotateProvider::CheckDiskSpaceL"); + + // Check if the files fit onto the drive. Do this initial check assuming + // that each rotated file is saved to the same drive than the original file + return ImageEditorUtils::ImagesFitToDriveL (aFsSession, *aFileList, *aFileList); +} + +//============================================================================= +void CRotateProvider::RotateOperationReadyL( TInt JPEG_ROTATOR_AIW_PROVIDER_SUPPORT_ARG(aError) ) +{ + LOGFMT(KEditorServiceProviderLogFile, "CRotateProvider::OperationReadyL: %d", aError); + + if (iCallback) + { + LOG(KEditorServiceProviderLogFile, "CRotateProvider: Calling MAiwNotifyCallback::HandleNotifyL"); + + iOutParamList->Reset(); + if( KErrNone == aError ) + { + // Pass the new file names to the AIW consumer. + // In error cases pass empty list. + for( TInt i = 0; i < iTargetFileList->MdcaCount(); i++ ) + { + TAiwVariant variant( iTargetFileList->MdcaPoint(i) ); + TAiwGenericParam param( EGenericParamFile, variant ); + iOutParamList->AppendL( param ); + } + // Non-leaving function shall use TRAP + TRAP_IGNORE ( + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdRotate, KAiwEventCompleted, *iOutParamList, *iInParamList); + ); + + } + else + { + + // Show error + CErrorUI* errorUi = CErrorUI::NewLC(*CEikonEnv::Static()); + TBool errorShown = errorUi->ShowGlobalErrorNoteL(aError); + if (errorShown == EFalse) + { + User::Leave(aError); + } + + CleanupStack::PopAndDestroy(); + + TRAP_IGNORE ( + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdRotate, KAiwEventError, *iOutParamList, *iInParamList); + ); + } + + TRAP_IGNORE ( + ((MAiwNotifyCallback*)iCallback)->HandleNotifyL(KAiwCmdRotate, KAiwEventStopped, *iOutParamList, *iInParamList); + ); + } + + delete iJpegRotatorHelper; + iJpegRotatorHelper = NULL; + + +} + + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/EditorProvider/src/JpegRotatorHelper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/EditorProvider/src/JpegRotatorHelper.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,294 @@ +/* +* 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: +* +*/ + + + +// INCLUDE FILES +#include "JpegRotatorHelper.h" +#include "JpegRotator.h" +#include "ImageEditorUtils.h" +#include +#include +#include + +// debug log +#include +_LIT(KEditorServiceProviderLogFile,"EditorServiceProvider.log"); + +// ================= MEMBER FUNCTIONS ======================= + +// --------------------------------------------------------- +// Default constructor +// +// --------------------------------------------------------- +// +CJpegRotatorHelper::CJpegRotatorHelper( + RFs& aFsSession, + MJpegRotatorHelperObserver& aObserver) : + CActive (EPriorityIdle), + iFsSession (aFsSession), + iObserver (aObserver) + { + CActiveScheduler::Add(this); + } + +// --------------------------------------------------------- +// Destructor +// +// --------------------------------------------------------- +// +CJpegRotatorHelper::~CJpegRotatorHelper() + { + Cancel(); + delete iJpegRotator; + } + +// --------------------------------------------------------- +// Rotate +// +// --------------------------------------------------------- +// +void CJpegRotatorHelper::StartRotateL ( + const CDesCArray* aSourceFileList, + CDesCArray* aTargetFileList, + CJpegRotator::TRotationMode aMode, + TBool aPreserveOriginalFiles ) + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::StartRotateL: In"); + + __ASSERT_DEBUG(!IsActive(), User::Panic(_L("CJpegRotatorHelper"),EReqAlreadyActive)); + + // ownership not taken + iTargetFileList = aTargetFileList; + iSourceFileList = aSourceFileList; + iMode = aMode; + iPreserveOriginalFiles = aPreserveOriginalFiles; + + // instantiate JpegRotator + delete iJpegRotator; + iJpegRotator = NULL; + iJpegRotator = CJpegRotator::NewL( iFsSession ); + + // Generate names for the rotated images + for( TInt i = 0; i < iSourceFileList->MdcaCount(); i++ ) + { + TPtrC source( iSourceFileList->MdcaPoint(i) ); + + TFileName target; + if (!aPreserveOriginalFiles) + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::StartRotateL: Not preserve original files"); + // If we intend to replace the original file, the generated + // file must be on the same drive. + TInt drive; + User::LeaveIfError( RFs::CharToDrive(source[0], drive) ); + if (EDriveC == drive) + { + User::LeaveIfError( ImageEditorUtils::GenerateNewDocumentNameL( iFsSession, source, target, NULL, iTargetFileList, ImageEditorUtils::ESelectPhone) ); + } + else if (EDriveE == drive) + { + User::LeaveIfError( ImageEditorUtils::GenerateNewDocumentNameL( iFsSession, source, target, NULL, iTargetFileList, ImageEditorUtils::ESelectMmc) ); + } + else + { + User::Leave(KErrArgument); + } + } + else + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::StartRotateL: Preserve original files"); + User::LeaveIfError( ImageEditorUtils::GenerateNewDocumentNameL( iFsSession, source, target, NULL, iTargetFileList) ); + } + iTargetFileList->AppendL( target ); + } + + // Start waiting for rotator completion + iStatus = KRequestPending; + SetActive(); + + // Start rotating the first file + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::StartRotateL: Starting rotate..."); + iCounter = 0; + iJpegRotator->RotateImageL (iStatus, iSourceFileList->MdcaPoint(iCounter), iTargetFileList->MdcaPoint(iCounter), aMode ); + + // Launch wait dialog + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::StartRotateL: Launching wait note"); + iWaitDialog = new (ELeave) CAknWaitDialog (reinterpret_cast(&iWaitDialog), ETrue ); + iWaitDialog->PrepareLC( R_PROVIDER_WAIT_DIALOG ); + iWaitDialog->SetCallback( this ); + iWaitDialog->RunLD(); + + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::StartRotateL: Out"); + } + +// --------------------------------------------------------- +// CJpegRotatorHelper::FinalizeRotatedFileL +// +// --------------------------------------------------------- +// +void CJpegRotatorHelper::FinalizeRotatedFileL( TInt aCurrentFileIndex ) + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::FinalizeRotatedFileL"); + +#ifdef FILE_TIME_STAMP_UPDATE + // Set the timestamp of the saved file to original file's timestamp + 1 second. + // The idea is to make the original and edited images appear next to each other. + TEntry original; + TInt err = iFsSession.Entry( iSourceFileList->MdcaPoint(aCurrentFileIndex), original ); + if (KErrNone == err) + { + TTime newTime = original.iModified; + + CFileMan* fileMan = CFileMan::NewL( iFsSession ); + CleanupStack::PushL (fileMan); + fileMan->Attribs( iTargetFileList->MdcaPoint(aCurrentFileIndex), 0, 0, newTime ); // do not set or clear anything, mofify time + CleanupStack::PopAndDestroy (fileMan); + } +#endif + + if (!iPreserveOriginalFiles) + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::FinalizeRotatedFileL 2"); + // Delete the source file and rename the temporary + // target file to the source file name + TFileName sourceFile( iSourceFileList->MdcaPoint(aCurrentFileIndex) ); + TInt err = BaflUtils::DeleteFile( iFsSession, sourceFile ); + err = BaflUtils::RenameFile ( + iFsSession, + iTargetFileList->MdcaPoint(aCurrentFileIndex), + sourceFile ); + User::LeaveIfError( err ); + + // Replace the file name in the target file list + iTargetFileList->Delete(aCurrentFileIndex); + iTargetFileList->InsertL(aCurrentFileIndex, sourceFile); + } + } + +// --------------------------------------------------------- +// CJpegRotatorHelper::RunL +// +// --------------------------------------------------------- +// +void CJpegRotatorHelper::RunL() + { + LOGFMT( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL (status: %d)", iStatus.Int()); + + if( KErrNone == iStatus.Int() ) + { + FinalizeRotatedFileL( iCounter ); + + if( (iCounter + 1) < iSourceFileList->MdcaCount() ) + { + // Start rotating the next file + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: Starting rotate next..."); + + iStatus = KRequestPending; + SetActive(); + + iCounter++; + iJpegRotator->RotateImageL (iStatus, iSourceFileList->MdcaPoint(iCounter), iTargetFileList->MdcaPoint(iCounter), (CJpegRotator::TRotationMode)iMode ); + } + else + { + // All files rotated. Finish operation. + delete iJpegRotator; + iJpegRotator = NULL; + iTargetFileList = NULL; + + // Dismiss wait dialog + if (iWaitDialog) + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: deleting wait note" ); + TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: process finished" ); + delete iWaitDialog; + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: dialog deleted" ); + iWaitDialog = NULL; + } + + // Notify completion to observer + iObserver.RotateOperationReadyL ( iStatus.Int() ); + } + } + else + { + + // Try delete failed target file + BaflUtils::DeleteFile( iFsSession, iTargetFileList->MdcaPoint(iCounter)); + + delete iJpegRotator; + iJpegRotator = NULL; + iTargetFileList = NULL; // not owned + + // Dismiss wait dialog + if (iWaitDialog) + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: deleting wait note" ); + TRAP_IGNORE( iWaitDialog->ProcessFinishedL() ); + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: process finished" ); + delete iWaitDialog; + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::RunL: dialog deleted" ); + iWaitDialog = NULL; + } + + iObserver.RotateOperationReadyL ( iStatus.Int() ); + + } + } + +// ---------------------------------------------------- +// MProgressDialogCallBack +// +// ---------------------------------------------------- +// +void CJpegRotatorHelper::DialogDismissedL( TInt aButtonId ) + { + LOGFMT(KEditorServiceProviderLogFile, "CJpegRotatorHelper::DialogDismissedL( %d )", aButtonId); + + if( EAknSoftkeyCancel == aButtonId ) + { + Cancel(); + } + } + +// --------------------------------------------------------- +// CJpegRotatorHelper::DoCancel() +// +// --------------------------------------------------------- +// +void CJpegRotatorHelper::DoCancel() + { + LOG( KEditorServiceProviderLogFile, "CJpegRotatorHelper::DoCancel"); + + iJpegRotator->Cancel(); + + // Try delete failed target file + BaflUtils::DeleteFile( iFsSession, iTargetFileList->MdcaPoint(iCounter)); + + + if( KRequestPending == iStatus.Int() ) + { + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrCancel); + } + } + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/EABI/iepb.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/EABI/iepb.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,23 @@ +EXPORTS + _ZN22CImageEditorPluginBase10ConstructLERK7TDesC16S2_ @ 1 NONAME + _ZN22CImageEditorPluginBase11GetPropertyEiR6TDes16 @ 2 NONAME + _ZN22CImageEditorPluginBase11InitPluginLERK5TRectP11CCoeControlRS4_ @ 3 NONAME + _ZN22CImageEditorPluginBase11SetPropertyEiR7TDesC16 @ 4 NONAME + _ZN22CImageEditorPluginBase13ProcessImageLEP12CEditorImage @ 5 NONAME + _ZN22CImageEditorPluginBase13ReleasePluginEv @ 6 NONAME + _ZN22CImageEditorPluginBase13ShowPopupNoteEv @ 7 NONAME + _ZN22CImageEditorPluginBase30ReservedImageEditorBaseMethod1Ev @ 8 NONAME + _ZN22CImageEditorPluginBase30ReservedImageEditorBaseMethod2Ev @ 9 NONAME + _ZN22CImageEditorPluginBase4NewLERK7TDesC16S2_ @ 10 NONAME + _ZN22CImageEditorPluginBaseC1Ev @ 11 NONAME + _ZN22CImageEditorPluginBaseC2Ev @ 12 NONAME + _ZN22CImageEditorPluginBaseD0Ev @ 13 NONAME + _ZN22CImageEditorPluginBaseD1Ev @ 14 NONAME + _ZN22CImageEditorPluginBaseD2Ev @ 15 NONAME + _ZTI15CPluginResource @ 16 NONAME ; ## + _ZTI22CImageEditorPluginBase @ 17 NONAME ; ## + _ZTI25CImageEditorPluginBaseInt @ 18 NONAME ; ## + _ZTV15CPluginResource @ 19 NONAME ; ## + _ZTV22CImageEditorPluginBase @ 20 NONAME ; ## + _ZTV25CImageEditorPluginBaseInt @ 21 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/bwins/iepb.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/bwins/iepb.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,14 @@ +EXPORTS + ??0CImageEditorPluginBase@@QAE@XZ @ 1 NONAME ; CImageEditorPluginBase::CImageEditorPluginBase(void) + ??1CImageEditorPluginBase@@UAE@XZ @ 2 NONAME ; CImageEditorPluginBase::~CImageEditorPluginBase(void) + ?ConstructL@CImageEditorPluginBase@@QAEXABVTDesC16@@0@Z @ 3 NONAME ; void CImageEditorPluginBase::ConstructL(class TDesC16 const &, class TDesC16 const &) + ?GetProperty@CImageEditorPluginBase@@UAEHHAAVTDes16@@@Z @ 4 NONAME ; int CImageEditorPluginBase::GetProperty(int, class TDes16 &) + ?InitPluginL@CImageEditorPluginBase@@UAEHABVTRect@@PAVCCoeControl@@AAPAV3@@Z @ 5 NONAME ; int CImageEditorPluginBase::InitPluginL(class TRect const &, class CCoeControl *, class CCoeControl * &) + ?NewL@CImageEditorPluginBase@@SAPAV1@ABVTDesC16@@0@Z @ 6 NONAME ; class CImageEditorPluginBase * CImageEditorPluginBase::NewL(class TDesC16 const &, class TDesC16 const &) + ?ProcessImageL@CImageEditorPluginBase@@UAEXPAVCEditorImage@@@Z @ 7 NONAME ; void CImageEditorPluginBase::ProcessImageL(class CEditorImage *) + ?ReleasePlugin@CImageEditorPluginBase@@UAEXXZ @ 8 NONAME ; void CImageEditorPluginBase::ReleasePlugin(void) + ?ReservedImageEditorBaseMethod1@CImageEditorPluginBase@@UAEXXZ @ 9 NONAME ; void CImageEditorPluginBase::ReservedImageEditorBaseMethod1(void) + ?ReservedImageEditorBaseMethod2@CImageEditorPluginBase@@UAEXXZ @ 10 NONAME ; void CImageEditorPluginBase::ReservedImageEditorBaseMethod2(void) + ?SetProperty@CImageEditorPluginBase@@UAEHHAAVTDesC16@@@Z @ 11 NONAME ; int CImageEditorPluginBase::SetProperty(int, class TDesC16 &) + ?ShowPopupNote@CImageEditorPluginBase@@UAEXXZ @ 12 NONAME ; void CImageEditorPluginBase::ShowPopupNote(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/data/imageeditorpluginbase.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/data/imageeditorpluginbase.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,112 @@ +/* +* 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: +* Resource definition file for ImageEditorPluginBase. +* +*/ + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include + +#include "imageeditorpluginbase.hrh" +#include "imageeditorpluginbase.rh" + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid=0x00000000; + uitype=EPluginUiTypeMin; + plugintype=EPluginFilterTypeMin; + plugindisplayorder=0; + pluginname="NA"; + iconfile="NA"; + filterfile="NA"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_msk; + } + }; +} +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,41 @@ +/* +* 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: +* IEPB bld.inf file. +* +*/ + + +#include +#include + +#include "../../inc/definitions.def" + + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorIEPB.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorIEPB.iby) + +// mmp files +PRJ_MMPFILES +imageeditorpluginbase.mmp + +// test project mmp files +PRJ_TESTMMPFILES + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/group/imageeditorpluginbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/group/imageeditorpluginbase.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,73 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../inc/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET iepb.dll +TARGETTYPE dll +UID 0x1000008d + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE iepb.cpp +SOURCE iepbint.cpp +SOURCE iepbres.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../PB/inc +USERINCLUDE ../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/imageeditorpluginbase.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + + +LIBRARY avkon.lib // CompleteWithAppPath +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY charconv.lib +LIBRARY commonengine.lib + +LIBRARY pb.lib + +//#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/inc/iepbint.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/inc/iepbint.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,126 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORPLUGINBASEINTERNAL_HPP +#define IMAGEEDITORPLUGINBASEINTERNAL_HPP + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CPluginResource; + +/* CLASS: CImageEditorPluginBaseInt +* +* CImageEditorPluginBaseInt acts as internal representation of +* CImageEditorPluginBase class. All the generic functionality of +* Image Editor plug-in base is implemented here. +* +*/ +class CImageEditorPluginBaseInt : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aResourcePath - plug-in resource path + * @param aResourceFile - plug-in resource file + * @return pointer to created CImageEditorPluginBaseInt object + */ + static CImageEditorPluginBaseInt * NewL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ); + + /** Destructor + * + * @param - + * @return - + */ + ~CImageEditorPluginBaseInt (); + + /** GetPluginResource + * + * @param - + * @return CPluginResource * - pointer to plug-in resource + */ + CPluginResource * GetPluginResource() const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorPluginBaseInt (); + + /** Second phase constructor, may leave + * + * @param aResourcePath - plug-in resource path + * @param aResourceFile - plug-in resource file + * @return - + */ + void ConstructL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ); + + /** Copy constructor, disabled + */ + CImageEditorPluginBaseInt (const CImageEditorPluginBaseInt & rhs); + + /** Assignment operator, disabled + */ + CImageEditorPluginBaseInt & operator= (const CImageEditorPluginBaseInt & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in resource + CPluginResource * iResource; +//@} + +}; + + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/inc/iepbres.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/inc/iepbres.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,296 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINRESOURCE_H +#define IMAGEEDITORPLUGINRESOURCE_H + +// INCLUDES +#include +#include +#include + +#include "ImageEditorPluginBaseDefs.h" +#include "ImageEditorPluginBase.hrh" + +// TYPEDEFS +typedef CArrayFixSeg CMenuItemArray; + +/* CLASS: CPluginResource +* +* CPluginResource acts as constructable container object for Image Editor +* plug-in. +* +*/ +class CPluginResource : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aResourcePath - plug-in resource path + * @param aResourceFile - plug-in resource file + * @return CPluginResource *, pointer to created CPluginResource object + */ + static CPluginResource * NewL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ); + + /** Destructor + * @param - + * @return - + */ + virtual ~CPluginResource (); + + /** PluginUID - const + * + * Getter for plug-in UID + * + * @param - + * @return const reference to plug-in UID + */ + const TPluginInt & PluginUID () const; + + /** PluginUiType - const + * + * Getter for plug-in UI type + * + * @param - + * @return const reference to plug-in UI type + */ + const TPluginUiType & PluginUiType() const; + + /** PluginFilterType - const + * + * Getter for plug-in filter type + * + * @param - + * @return const reference to plug-in filter type + */ + const TPluginFilterType & PluginFilterType() const; + + /** PluginScope - const + * + * Getter for plug-in scope + * + * @param - + * @return const reference to plug-in scope + */ + const TPluginScope & PluginScope() const; + + /** PluginDisplayOrder - const + * + * Getter for plug-in display order + * + * @param - + * @return const reference to plug-in display order + */ + const TPluginInt & PluginDisplayOrder() const; + + /** PluginName - const + * + * Getter for plug-in name + * + * @param - + * @return const reference to plug-in name descriptor + */ + const TPtrC PluginName () const; + + /** IconFileName - const + * + * Getter for plug-in icon file name + * + * @param - + * @return const reference to plug-in icon file name + */ + const TPtrC IconFileName () const; + + /** FilterFileName - const + * + * Getter for plug-in filter DLL name + * + * @param - + * @return const reference to plug-in filter DLL name + */ + const TPtrC FilterFileName () const; + + /** GetParameters + * + * Gets parameter descriptor array. + * + * @param - + * @return the parameter name descriptor array + */ + const CDesCArray * GetParameters () const; + + /** GetSk1Text + * + * Gets soft key 1 text. + * + * @param - + * @return the soft key name + */ + const CDesCArray * Sk1Texts () const; + + /** GetSk1CommandId + * + * Gets soft key 1 command ID. + * + * @param - + * @return the soft key name + */ + const CArrayFix * Sk1CommandIds() const; + + /** GetSk2Text + * + * Gets soft key 2 text. + * + * @param - + * @return the soft key command ID + */ + const CDesCArray * Sk2Texts() const; + + /** GetSk2CommandId + * + * Gets soft key 2 command ID. + * + * @param - + * @return the soft key command ID + */ + const CArrayFix * Sk2CommandIds() const; + + /** GetMSKText + * + * Gets Middle softkey text. + * + * @param - + * @return the soft key command ID + */ + const CDesCArray * MSKTexts() const; + + /** GetMSKCommandId + * + * Gets Middle soft key command ID. + * + * @param - + * @return the soft key command ID + */ + const CArrayFix * MSKCommandIds() const; + + /** GetMenuItems + * + * Gets menu items. + * + * @param - + * @return - pointer to menu item array + */ + const CMenuItemArray * MenuItems() const; + + //@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CPluginResource (); + + /** Second phase constructor, may leave + * + * @param aResourcePath - plug-in resource path + * @param aResourceFile - plug-in resource file + * @return - + */ + void ConstructL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ); + + /** Copy constructor, disabled + */ + CPluginResource (const CPluginResource & rhs); + + /** Assignment operator, disabled + */ + CPluginResource & operator= (const CPluginResource & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UID + TPluginInt iPluginUID; + /// Plug-in UI type + TPluginUiType iPluginUIType; + /// Plug-in filter type + TPluginFilterType iPluginFilterType; + /// Plug-in scope + TPluginScope iPluginScope; + /// Plug-in display order + TPluginInt iPluginDisplayOrder; + /// Plug-in name + HBufC * iPluginName; + /// Plug-in icon name + HBufC * iPluginIconFileName; + /// Plug-in filter DLL name + HBufC * iPluginFilterDllName; + /// Plug-in parameters + CDesCArray * iParameters; + /// Soft key 1 text + CDesCArray * iSk1Texts; + /// Soft key 1 command id + CArrayFix * iSk1Cmds; + /// Soft key 2 text + CDesCArray * iSk2Texts; + /// Soft key 2 command id + CArrayFix * iSk2Cmds; + /// Middle softkey text + CDesCArray * iMSKTexts; + /// Middle softkey command id + CArrayFix * iMSKCmds; + /// Menu items + CMenuItemArray * iMenuItems; +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/rom/ImageEditorIEPB.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/rom/ImageEditorIEPB.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IEPB_IBY__ +#define __IEPB_IBY__ + +// DLL +file=ABI_DIR\BUILD_DIR\iepb.dll SHARED_LIB_DIR\iepb.dll + +#endif // __IEPB_IBY__ + +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/src/iepb.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/src/iepb.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,258 @@ +/* +* 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: +* +*/ + + + +#include + +#include "pluginbasedefs.h" +#include "imageeditorpluginbasedefs.h" +#include "iepb.h" +#include "iepbint.h" +#include "iepbres.h" + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CImageEditorPluginBase::NewL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ) +{ + CImageEditorPluginBase * self = new (ELeave) CImageEditorPluginBase; + CleanupStack::PushL (self); + self->ConstructL (aResourcePath, aResourceFile); + CleanupStack::Pop(); + return self; +} + +//============================================================================= +EXPORT_C CImageEditorPluginBase::~CImageEditorPluginBase () +{ + delete (CImageEditorPluginBaseInt *)iEditorPluginBaseInternalRepresentation; +} + +//============================================================================= +EXPORT_C TInt CImageEditorPluginBase::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return TPropRetErrNotSupported; +} + +//============================================================================= +EXPORT_C TInt CImageEditorPluginBase::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + + aPropertyValue.Zero(); + CPluginResource * res = + ((CImageEditorPluginBaseInt *)iEditorPluginBaseInternalRepresentation)->GetPluginResource(); + + switch (aPropertyId) + { + case KPluginCapabilityUID: + { + aPropertyValue.AppendNum ( res->PluginUID() ); + return KErrNone; + } + case KCapPluginUiType: + { + aPropertyValue.AppendNum ( (TInt)res->PluginUiType() ); + return KErrNone; + } + case KCapPluginFilterType: + { + aPropertyValue.AppendNum ( (TInt)res->PluginFilterType() ); + return KErrNone; + } + case KCapPluginScope: + { + aPropertyValue.AppendNum ( (TInt)res->PluginScope() ); + return KErrNone; + } + case KCapPluginDisplayOrder: + { + aPropertyValue.AppendNum ( (TInt)res->PluginDisplayOrder() ); + return KErrNone; + } + case KCapPluginName: + { + aPropertyValue.Copy ( res->PluginName() ); + return KErrNone; + } + case KCapIconName: + { + aPropertyValue.Copy ( res->IconFileName() ); + return KErrNone; + } + case KCapFilterName: + { + aPropertyValue.Copy ( res->FilterFileName() ); + return KErrNone; + } + case KCapPluginParamNames: + { + aPropertyValue.AppendNum ( (TInt)res->GetParameters() ); + return KErrNone; + } + case KPluginCapabilityPluginType: + { + aPropertyValue.AppendNum ( (TInt)KPluginTypeImageEditor ); + return KErrNone; + } + case KCapPluginSk1Cmd: + { + aPropertyValue.AppendNum ( (TInt)res->Sk1CommandIds() ); + return KErrNone; + } + case KCapPluginSk1Text: + { + aPropertyValue.AppendNum ( (TInt)res->Sk1Texts() ); + return KErrNone; + } + case KCapPluginSk2Cmd: + { + aPropertyValue.AppendNum ( (TInt)res->Sk2CommandIds() ); + return KErrNone; + } + case KCapPluginSk2Text: + { + aPropertyValue.AppendNum ( (TInt)res->Sk2Texts() ); + return KErrNone; + } + + case KCapPluginMSKCmd: + { + aPropertyValue.AppendNum ( (TInt)res->MSKCommandIds() ); + return KErrNone; + } + case KCapPluginMSKText: + { + aPropertyValue.AppendNum ( (TInt)res->MSKTexts() ); + return KErrNone; + } + + case KCapPluginMenuItems: + { + aPropertyValue.AppendNum ( (TInt)res->MenuItems() ); + return KErrNone; + } + case KCapGlobalZoomDisabled: + { + aPropertyValue.AppendNum ( (TInt)EFalse ); + return KErrNone; + } + case KPluginCapabilityAPIMajorVersion: + { + aPropertyValue.AppendNum ( KImageEditorPluginAPIMajor ); + return KErrNone; + } + case KPluginCapabilityAPIMinorVersion: + { + aPropertyValue.AppendNum ( KImageEditorPluginAPIMinor ); + return KErrNone; + } + case KPluginCapabilityAPIBuildVersion: + { + aPropertyValue.AppendNum ( KImageEditorPluginAPIBuild ); + return KErrNone; + } + case KCapReadyToRender: + { + aPropertyValue.AppendNum ( (TInt)ETrue ); + return KErrNone; + } + case KCapIsLandscapeEnabled: + { + aPropertyValue.AppendNum ( (TInt)ETrue ); + return KErrNone; + } + case KCapIsSlowPlugin: + { + aPropertyValue.AppendNum ((TInt)EFalse); + return KErrNone; + } + default: + { + return CPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +EXPORT_C void CImageEditorPluginBase::ShowPopupNote () +{ + +} + +//============================================================================= +EXPORT_C TInt CImageEditorPluginBase::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +EXPORT_C void CImageEditorPluginBase::ProcessImageL (CEditorImage * /*aImage*/) +{ + +} + +//============================================================================= +EXPORT_C void CImageEditorPluginBase::ReleasePlugin () +{ + +} + +//============================================================================= +EXPORT_C void CImageEditorPluginBase::ReservedImageEditorBaseMethod1 () +{ + +} + +//============================================================================= +EXPORT_C void CImageEditorPluginBase::ReservedImageEditorBaseMethod2 () +{ + +} + +//============================================================================= +EXPORT_C CImageEditorPluginBase::CImageEditorPluginBase () : +CPluginBase() +{ + +} + +//============================================================================= +EXPORT_C void CImageEditorPluginBase::ConstructL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ) +{ + iEditorPluginBaseInternalRepresentation = (CImageEditorPluginBaseInt*) + CImageEditorPluginBaseInt::NewL (aResourcePath, aResourceFile); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/src/iepbint.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/src/iepbint.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,67 @@ +/* +* 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: +* +*/ + + +// INCLUDES +#include "iepbint.h" +#include "iepbres.h" + +#include + +//============================================================================= +CImageEditorPluginBaseInt * CImageEditorPluginBaseInt::NewL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ) +{ + CImageEditorPluginBaseInt * self = new (ELeave) CImageEditorPluginBaseInt; + CleanupStack::PushL (self); + self->ConstructL (aResourcePath, aResourceFile); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +CImageEditorPluginBaseInt::~CImageEditorPluginBaseInt () +{ + delete iResource; +} + +//============================================================================= +CPluginResource * CImageEditorPluginBaseInt::GetPluginResource() const +{ + return iResource; +} + +//============================================================================= +CImageEditorPluginBaseInt::CImageEditorPluginBaseInt () +{ + +} + +//============================================================================= +void CImageEditorPluginBaseInt::ConstructL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ) +{ + TFileName resourcePath ( aResourcePath ); + User::LeaveIfError( CompleteWithAppPath( resourcePath ) ); + iResource = CPluginResource::NewL (resourcePath, aResourceFile); +} + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/IEPB/src/iepbres.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/IEPB/src/iepbres.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,488 @@ +/* +* 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: +* +*/ + + + +#include +#include +#include +#include + + +#include +#include "iepbres.h" +#include "ImageEditorPluginBase.hrh" + +//============================================================================= +CPluginResource * CPluginResource::NewL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ) +{ + CPluginResource * self = new (ELeave) CPluginResource; + CleanupStack::PushL (self); + self->ConstructL (aResourcePath, aResourceFile); + CleanupStack::Pop (); // self; + return self; +} + +//============================================================================= +CPluginResource::~CPluginResource () +{ + delete iPluginName; + delete iPluginIconFileName; + delete iPluginFilterDllName; + + if (iParameters) + { + iParameters->Reset(); + } + delete iParameters; + + if (iSk1Cmds) + { + iSk1Cmds->Reset(); + } + delete iSk1Cmds; + + if (iSk1Texts) + { + iSk1Texts->Reset(); + } + delete iSk1Texts; + + if (iSk2Cmds) + { + iSk2Cmds->Reset(); + } + delete iSk2Cmds; + + if (iSk2Texts) + { + iSk2Texts->Reset(); + } + delete iSk2Texts; + + if (iMSKCmds) + { + iMSKCmds->Reset(); + } + delete iMSKCmds; + + if (iMSKTexts) + { + iMSKTexts->Reset(); + } + delete iMSKTexts; + + if (iMenuItems) + { + iMenuItems->Reset(); + } + delete iMenuItems; +} + +//============================================================================= +const TPluginInt & CPluginResource::PluginUID () const +{ + return iPluginUID; +} + +//============================================================================= +const TPluginUiType & CPluginResource::PluginUiType() const +{ + return iPluginUIType; +} + +//============================================================================= +const TPluginFilterType & CPluginResource::PluginFilterType() const +{ + return iPluginFilterType; +} + +//============================================================================= +const TPluginScope & CPluginResource::PluginScope() const +{ + return iPluginScope; +} + +//============================================================================= +const TPluginInt & CPluginResource::PluginDisplayOrder() const +{ + return iPluginDisplayOrder; +} + +//============================================================================= +const TPtrC CPluginResource::PluginName () const +{ + return iPluginName->Des(); +} + +//============================================================================= +const TPtrC CPluginResource::IconFileName() const +{ + return iPluginIconFileName->Des(); +} + +//============================================================================= +const TPtrC CPluginResource::FilterFileName () const +{ + return iPluginFilterDllName->Des(); +} + +//============================================================================= +const CDesCArray * CPluginResource::GetParameters () const +{ + return (CDesCArray *)iParameters; +} + +//============================================================================= +const CDesCArray * CPluginResource::Sk1Texts () const +{ + return iSk1Texts; +} + +//============================================================================= +const CArrayFix * CPluginResource::Sk1CommandIds() const +{ + return iSk1Cmds; +} + +//============================================================================= +const CDesCArray * CPluginResource::Sk2Texts () const +{ + return iSk2Texts; +} + +//============================================================================= +const CArrayFix * CPluginResource::Sk2CommandIds() const +{ + return iSk2Cmds; +} + +//============================================================================= +const CDesCArray * CPluginResource::MSKTexts () const +{ + return iMSKTexts; +} + +//============================================================================= +const CArrayFix * CPluginResource::MSKCommandIds() const +{ + return iMSKCmds; +} + +//============================================================================= +const CMenuItemArray * CPluginResource::MenuItems() const +{ + return iMenuItems; +} + +//============================================================================= +CPluginResource::CPluginResource() +{ + +} + +//============================================================================= +void CPluginResource::ConstructL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ) +{ + + CEikonEnv* env = CEikonEnv::Static(); + + /** + * + * PLUG-IN INFO + * + */ + + // Create resource utility + TFileName file_name; + file_name.Copy (aResourcePath); + file_name.Append (aResourceFile); + BaflUtils::NearestLanguageFile( env->FsSession(), file_name ); + + RConeResourceLoader res_loader ( *env ); + CleanupClosePushL (res_loader); + res_loader.OpenL ( file_name ); + + // Construct resource reader + HBufC8 * res8 = env->AllocReadResourceAsDes8LC (R_PLUGIN_INFO); + TResourceReader resource; + resource.SetBuffer (res8); + + // Read plug-in UID + iPluginUID = resource.ReadInt32(); + + // Read plug-in UID + iPluginUIType = (TPluginUiType)resource.ReadInt32(); + + // Read plug-in UID + iPluginFilterType = (TPluginFilterType)resource.ReadInt32(); + + // Read plug-in UID + iPluginScope = (TPluginScope)resource.ReadInt32(); + + // Read plug-in display priority + iPluginDisplayOrder = resource.ReadInt32(); + + // Read plug-in name + iPluginName = resource.ReadHBufCL(); + if ( !iPluginName ) + { + User::Leave (KErrGeneral); + } + + // Read icon file name + iPluginIconFileName = resource.ReadHBufCL(); + if ( !iPluginIconFileName ) + { + User::Leave (KErrGeneral); + } + + // Read filter file name + iPluginFilterDllName = resource.ReadHBufCL(); + + CleanupStack::PopAndDestroy(); // res8 + + + /** + * + * PLUG-IN PARAMETERS + * + */ + + // Read resource to descriptor + res8 = env->AllocReadResourceAsDes8LC (R_PLUGIN_PARS); + + // Set resource reader buffer + resource.SetBuffer (res8); + + // Read extra parameter count + TInt16 arraycount = (TInt16)resource.ReadInt16(); + + if (arraycount > 0) + { + // Construct a new descriptor array + if (!iParameters) + { + iParameters = new (ELeave) CDesCArraySeg(16); + } + + // Read extra parameters to array + for (TInt i = 0; i < arraycount; ++i) + { + // Construct a flat descriptor array and read all the parameter names + HBufC * parameter = resource.ReadHBufCL(); + CleanupStack::PushL(parameter); + TPtrC ptr = parameter->Des(); + iParameters->AppendL (ptr); + CleanupStack::PopAndDestroy(); // parameter + } + } + CleanupStack::PopAndDestroy(); // res8 + + + /** + * + * SOFT KEY 1 + * + */ + + // Read resource to descriptor + res8 = env->AllocReadResourceAsDes8LC (R_SK1_ITEMS); + + // Set resource reader buffer + resource.SetBuffer (res8); + + // Read menu item + arraycount = (TInt16)resource.ReadInt16(); + + if (arraycount > 0) + { + + // Construct a new descriptor array + if (!iSk1Cmds) + { + iSk1Cmds = new (ELeave) CArrayFixSeg(8); + } + if (!iSk1Texts) + { + iSk1Texts = new (ELeave) CDesCArraySeg(8); + } + + // Read extra parameters to array + for (TInt i = 0; i < arraycount; ++i) + { + // Read command ID + TInt cmd = resource.ReadInt32(); + iSk1Cmds->AppendL(cmd); + + // Read the menu item text + HBufC * menutext = resource.ReadHBufCL(); + CleanupStack::PushL (menutext); + TPtrC ptr = menutext->Des(); + iSk1Texts->AppendL ( ptr ); + CleanupStack::PopAndDestroy(); // menutext + } + } + CleanupStack::PopAndDestroy(); // res8 + + /** + * + * SOFT KEY 2 + * + */ + + // Read resource to descriptor + res8 = env->AllocReadResourceAsDes8LC (R_SK2_ITEMS); + + // Set resource reader buffer + resource.SetBuffer (res8); + + // Read menu item + arraycount = (TInt16)resource.ReadInt16(); + + if (arraycount > 0) + { + + // Construct a new descriptor array + if (!iSk2Cmds) + { + iSk2Cmds = new (ELeave) CArrayFixSeg(8); + } + if (!iSk2Texts) + { + iSk2Texts = new (ELeave) CDesCArraySeg(8); + } + + // Read extra parameters to array + for (TInt i = 0; i < arraycount; ++i) + { + // Read command ID + TInt cmd = resource.ReadInt32(); + iSk2Cmds->AppendL(cmd); + + // Read the menu item text + HBufC * menutext = resource.ReadHBufCL(); + CleanupStack::PushL (menutext); + TPtrC ptr = menutext->Des(); + iSk2Texts->AppendL ( ptr ); + CleanupStack::PopAndDestroy(); // menutext + } + } + CleanupStack::PopAndDestroy(); // res8 + + /** + * + * MIDDLE SOFTKEY + * + */ + + // Read resource to descriptor + res8 = env->AllocReadResourceAsDes8LC (R_MSK_ITEMS); + + // Set resource reader buffer + resource.SetBuffer (res8); + + // Read menu item + arraycount = (TInt16)resource.ReadInt16(); + + if (arraycount > 0) + { + + // Construct a new descriptor array + if (!iMSKCmds) + { + iMSKCmds = new (ELeave) CArrayFixSeg(8); + } + if (!iMSKTexts) + { + iMSKTexts = new (ELeave) CDesCArraySeg(8); + } + + // Read extra parameters to array + for (TInt i = 0; i < arraycount; ++i) + { + // Read command ID + TInt cmd = resource.ReadInt32(); + iMSKCmds->AppendL(cmd); + + // Read the menu item text + HBufC * menutext = resource.ReadHBufCL(); + CleanupStack::PushL (menutext); + TPtrC ptr = menutext->Des(); + iMSKTexts->AppendL ( ptr ); + CleanupStack::PopAndDestroy(); // menutext + } + } + CleanupStack::PopAndDestroy(); // res8 + + /** + * + * MENU ITEMS + * + */ + + // Read resource to descriptor + res8 = env->AllocReadResourceAsDes8LC (R_MENU_ITEMS); + + // Set resource reader buffer + resource.SetBuffer (res8); + + // Read menu item + arraycount = (TInt16)resource.ReadInt16(); + + if (arraycount > 0) + { + + // Construct a new descriptor array + if (!iMenuItems) + { + iMenuItems = new (ELeave) CMenuItemArray(8); + } + + // Read extra parameters to array + for (TInt i = 0; i < arraycount; ++i) + { + // Construct and initialize a new menu item + CEikMenuPaneItem::SData item; + item.iFlags = 0; + item.iCascadeId = 0; + + // Read command ID + item.iCommandId = resource.ReadInt32(); + + // Read the menu item text + HBufC * menutext = resource.ReadHBufCL(); + CleanupStack::PushL(menutext); + item.iText.Copy ( menutext->Des() ); + + // Add menu item to array + iMenuItems->AppendL (item); + CleanupStack::PopAndDestroy(menutext); + } + + } + + CleanupStack::PopAndDestroy (2); // res8, res_loader + +} diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/EABI/ImageEditorManager.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/EABI/ImageEditorManager.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,77 @@ +EXPORTS + _ZN14CPluginLocator12ScanPluginsLEv @ 1 NONAME + _ZN14CPluginLocator13GetPluginInfoEi @ 2 NONAME + _ZN14CPluginLocator4NewLEv @ 3 NONAME + _ZN14CPluginLocatorD0Ev @ 4 NONAME + _ZN14CPluginLocatorD1Ev @ 5 NONAME + _ZN14CPluginLocatorD2Ev @ 6 NONAME + _ZN24CImageEditorImageHandler12IsJpegIntactERK7TDesC16 @ 7 NONAME + _ZN24CImageEditorImageHandler15ContinueLoadingEP14TRequestStatus @ 8 NONAME + _ZN24CImageEditorImageHandler15LoadImageAsyncLERK7TDesC16RP10CFbsBitmapP14TRequestStatus @ 9 NONAME + _ZN24CImageEditorImageHandler15SaveImageAsyncLERK7TDesC16RK10CFbsBitmapiP14TRequestStatus @ 10 NONAME + _ZN24CImageEditorImageHandler17CleanupConvertersEv @ 11 NONAME + _ZN24CImageEditorImageHandler21GetJpegQualityFactorLERK7TDesC16 @ 12 NONAME + _ZN24CImageEditorImageHandler4NewLEv @ 13 NONAME + _ZN24CImageEditorImageHandlerD0Ev @ 14 NONAME + _ZN24CImageEditorImageHandlerD1Ev @ 15 NONAME + _ZN24CImageEditorImageHandlerD2Ev @ 16 NONAME + _ZN25CImageEditorPluginManager10LoadImageLEi @ 17 NONAME + _ZN25CImageEditorPluginManager10SaveAbortLEv @ 18 NONAME + _ZN25CImageEditorPluginManager10SaveBlockLEv @ 19 NONAME + _ZN25CImageEditorPluginManager10SaveImageLEiPK5TSize @ 20 NONAME + _ZN25CImageEditorPluginManager11ClosePluginEv @ 21 NONAME + _ZN25CImageEditorPluginManager11GetZoomModeEv @ 22 NONAME + _ZN25CImageEditorPluginManager11OpenPluginLERK7TDesC16 @ 23 NONAME + _ZN25CImageEditorPluginManager12GetFullImageEv @ 24 NONAME + _ZN25CImageEditorPluginManager12GetImageNameEv @ 25 NONAME + _ZN25CImageEditorPluginManager12ResetEngineLEv @ 26 NONAME + _ZN25CImageEditorPluginManager12SetFullImageEP10CFbsBitmap @ 27 NONAME + _ZN25CImageEditorPluginManager12SetImageNameERK7TDesC16 @ 28 NONAME + _ZN25CImageEditorPluginManager13ProcessBlockLEv @ 29 NONAME + _ZN25CImageEditorPluginManager13ProcessImageLEv @ 30 NONAME + _ZN25CImageEditorPluginManager14IsImageChangedEv @ 31 NONAME + _ZN25CImageEditorPluginManager14SetScreenSizeLEv @ 32 NONAME + _ZN25CImageEditorPluginManager15GetPreviewImageEv @ 33 NONAME + _ZN25CImageEditorPluginManager15SetPreviewImageEP10CFbsBitmap @ 34 NONAME + _ZN25CImageEditorPluginManager15ShowPluginPopupEv @ 35 NONAME + _ZN25CImageEditorPluginManager16FinishAsyncSaveLEv @ 36 NONAME + _ZN25CImageEditorPluginManager17PrepareAsyncSaveLEiPK5TSize @ 37 NONAME + _ZN25CImageEditorPluginManager18AddFilterToEngineLEv @ 38 NONAME + _ZN25CImageEditorPluginManager18FinishAsyncProcessEv @ 39 NONAME + _ZN25CImageEditorPluginManager20CreatePluginControlLERK5TRectP11CCoeControlRS4_ @ 40 NONAME + _ZN25CImageEditorPluginManager20PrepareAsyncProcessLERi @ 41 NONAME + _ZN25CImageEditorPluginManager20PurgeUndoRedoHistoryEv @ 42 NONAME + _ZN25CImageEditorPluginManager4NewLEv @ 43 NONAME + _ZN25CImageEditorPluginManager4PanLE10TDirection @ 44 NONAME + _ZN25CImageEditorPluginManager4PanLEii @ 45 NONAME + _ZN25CImageEditorPluginManager5RedoLEv @ 46 NONAME + _ZN25CImageEditorPluginManager5UndoLEv @ 47 NONAME + _ZN25CImageEditorPluginManager5ZoomLE5TZoom @ 48 NONAME + _ZN25CImageEditorPluginManager7CanUndoEv @ 49 NONAME + _ZN25CImageEditorPluginManager7RotateLE9TRotation @ 50 NONAME + _ZN25CImageEditorPluginManagerD0Ev @ 51 NONAME + _ZN25CImageEditorPluginManagerD1Ev @ 52 NONAME + _ZN25CImageEditorPluginManagerD2Ev @ 53 NONAME + _ZNK14CPluginLocator12CountPluginsEv @ 54 NONAME + _ZNK24CImageEditorImageHandler11DeleteImageERK7TDesC16 @ 55 NONAME + _ZNK24CImageEditorImageHandler11RenameImageERK7TDesC16S2_ @ 56 NONAME + _ZNK24CImageEditorImageHandler14IsRajpegImageLERK7TDesC16 @ 57 NONAME + _ZNK25CImageEditorPluginManager14IsPluginLoadedEv @ 58 NONAME + _ZNK25CImageEditorPluginManager14RestoreFilterLEv @ 59 NONAME + _ZNK25CImageEditorPluginManager19GetSystemParametersEv @ 60 NONAME + _ZNK25CImageEditorPluginManager19IsLandscapeEnabledLEv @ 61 NONAME + _ZTI12CEditorImage @ 62 NONAME ; ## + _ZTI13CPluginLoader @ 63 NONAME ; ## + _ZTI14CPluginLocator @ 64 NONAME ; ## + _ZTI14CPluginScanner @ 65 NONAME ; ## + _ZTI14CPluginStorage @ 66 NONAME ; ## + _ZTI24CImageEditorImageHandler @ 67 NONAME ; ## + _ZTI25CImageEditorPluginManager @ 68 NONAME ; ## + _ZTV12CEditorImage @ 69 NONAME ; ## + _ZTV13CPluginLoader @ 70 NONAME ; ## + _ZTV14CPluginLocator @ 71 NONAME ; ## + _ZTV14CPluginScanner @ 72 NONAME ; ## + _ZTV14CPluginStorage @ 73 NONAME ; ## + _ZTV24CImageEditorImageHandler @ 74 NONAME ; ## + _ZTV25CImageEditorPluginManager @ 75 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/bwins/ImageEditorManager.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/bwins/ImageEditorManager.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,57 @@ +EXPORTS + ??1CImageEditorImageHandler@@UAE@XZ @ 1 NONAME ; CImageEditorImageHandler::~CImageEditorImageHandler(void) + ??1CImageEditorPluginManager@@UAE@XZ @ 2 NONAME ; CImageEditorPluginManager::~CImageEditorPluginManager(void) + ??1CPluginLocator@@UAE@XZ @ 3 NONAME ; CPluginLocator::~CPluginLocator(void) + ?AddFilterToEngineL@CImageEditorPluginManager@@QAEXXZ @ 4 NONAME ; void CImageEditorPluginManager::AddFilterToEngineL(void) + ?CanUndo@CImageEditorPluginManager@@QAEHXZ @ 5 NONAME ; int CImageEditorPluginManager::CanUndo(void) + ?CleanupConverters@CImageEditorImageHandler@@QAEXXZ @ 6 NONAME ; void CImageEditorImageHandler::CleanupConverters(void) + ?ClosePlugin@CImageEditorPluginManager@@QAEXXZ @ 7 NONAME ; void CImageEditorPluginManager::ClosePlugin(void) + ?ContinueLoading@CImageEditorImageHandler@@QAEXPAVTRequestStatus@@@Z @ 8 NONAME ; void CImageEditorImageHandler::ContinueLoading(class TRequestStatus *) + ?CountPlugins@CPluginLocator@@QBEHXZ @ 9 NONAME ; int CPluginLocator::CountPlugins(void) const + ?CreatePluginControlL@CImageEditorPluginManager@@QAEHABVTRect@@PAVCCoeControl@@AAPAV3@@Z @ 10 NONAME ; int CImageEditorPluginManager::CreatePluginControlL(class TRect const &, class CCoeControl *, class CCoeControl * &) + ?DeleteImage@CImageEditorImageHandler@@QBEHABVTDesC16@@@Z @ 11 NONAME ; int CImageEditorImageHandler::DeleteImage(class TDesC16 const &) const + ?FinishAsyncProcess@CImageEditorPluginManager@@QAEXXZ @ 12 NONAME ; void CImageEditorPluginManager::FinishAsyncProcess(void) + ?FinishAsyncSaveL@CImageEditorPluginManager@@QAEXXZ @ 13 NONAME ; void CImageEditorPluginManager::FinishAsyncSaveL(void) + ?GetFullImage@CImageEditorPluginManager@@QAEPAVCFbsBitmap@@XZ @ 14 NONAME ; class CFbsBitmap * CImageEditorPluginManager::GetFullImage(void) + ?GetImageName@CImageEditorPluginManager@@QAEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CImageEditorPluginManager::GetImageName(void) + ?GetJpegQualityFactorL@CImageEditorImageHandler@@QAEHABVTDesC16@@@Z @ 16 NONAME ; int CImageEditorImageHandler::GetJpegQualityFactorL(class TDesC16 const &) + ?GetPluginInfo@CPluginLocator@@QAEPAVCPluginInfo@@H@Z @ 17 NONAME ; class CPluginInfo * CPluginLocator::GetPluginInfo(int) + ?GetPreviewImage@CImageEditorPluginManager@@QAEPAVCFbsBitmap@@XZ @ 18 NONAME ; class CFbsBitmap * CImageEditorPluginManager::GetPreviewImage(void) + ?GetSystemParameters@CImageEditorPluginManager@@QBEABVCSystemParameters@@XZ @ 19 NONAME ; class CSystemParameters const & CImageEditorPluginManager::GetSystemParameters(void) const + ?GetZoomMode@CImageEditorPluginManager@@QAE?AW4TZoomMode@@XZ @ 20 NONAME ; enum TZoomMode CImageEditorPluginManager::GetZoomMode(void) + ?IsImageChanged@CImageEditorPluginManager@@QAEHXZ @ 21 NONAME ; int CImageEditorPluginManager::IsImageChanged(void) + ?IsJpegIntact@CImageEditorImageHandler@@QAEHABVTDesC16@@@Z @ 22 NONAME ; int CImageEditorImageHandler::IsJpegIntact(class TDesC16 const &) + ?IsLandscapeEnabledL@CImageEditorPluginManager@@QBEHXZ @ 23 NONAME ; int CImageEditorPluginManager::IsLandscapeEnabledL(void) const + ?IsPluginLoaded@CImageEditorPluginManager@@QBEHXZ @ 24 NONAME ; int CImageEditorPluginManager::IsPluginLoaded(void) const + ?IsRajpegImageL@CImageEditorImageHandler@@QBEHABVTDesC16@@@Z @ 25 NONAME ; int CImageEditorImageHandler::IsRajpegImageL(class TDesC16 const &) const + ?LoadImageAsyncL@CImageEditorImageHandler@@QAEXABVTDesC16@@AAPAVCFbsBitmap@@PAVTRequestStatus@@@Z @ 26 NONAME ; void CImageEditorImageHandler::LoadImageAsyncL(class TDesC16 const &, class CFbsBitmap * &, class TRequestStatus *) + ?LoadImageL@CImageEditorPluginManager@@QAEXH@Z @ 27 NONAME ; void CImageEditorPluginManager::LoadImageL(int) + ?NewL@CImageEditorImageHandler@@SAPAV1@XZ @ 28 NONAME ; class CImageEditorImageHandler * CImageEditorImageHandler::NewL(void) + ?NewL@CImageEditorPluginManager@@SAPAV1@XZ @ 29 NONAME ; class CImageEditorPluginManager * CImageEditorPluginManager::NewL(void) + ?NewL@CPluginLocator@@SAPAV1@XZ @ 30 NONAME ; class CPluginLocator * CPluginLocator::NewL(void) + ?OpenPluginL@CImageEditorPluginManager@@QAEXABVTDesC16@@@Z @ 31 NONAME ; void CImageEditorPluginManager::OpenPluginL(class TDesC16 const &) + ?PanL@CImageEditorPluginManager@@QAEXHH@Z @ 32 NONAME ; void CImageEditorPluginManager::PanL(int, int) + ?PanL@CImageEditorPluginManager@@QAEXW4TDirection@@@Z @ 33 NONAME ; void CImageEditorPluginManager::PanL(enum TDirection) + ?PrepareAsyncProcessL@CImageEditorPluginManager@@QAEXAAH@Z @ 34 NONAME ; void CImageEditorPluginManager::PrepareAsyncProcessL(int &) + ?PrepareAsyncSaveL@CImageEditorPluginManager@@QAEXHPBVTSize@@@Z @ 35 NONAME ; void CImageEditorPluginManager::PrepareAsyncSaveL(int, class TSize const *) + ?ProcessBlockL@CImageEditorPluginManager@@QAEHXZ @ 36 NONAME ; int CImageEditorPluginManager::ProcessBlockL(void) + ?ProcessImageL@CImageEditorPluginManager@@QAEXXZ @ 37 NONAME ; void CImageEditorPluginManager::ProcessImageL(void) + ?PurgeUndoRedoHistory@CImageEditorPluginManager@@QAEXXZ @ 38 NONAME ; void CImageEditorPluginManager::PurgeUndoRedoHistory(void) + ?RedoL@CImageEditorPluginManager@@QAEXXZ @ 39 NONAME ; void CImageEditorPluginManager::RedoL(void) + ?RenameImage@CImageEditorImageHandler@@QBEHABVTDesC16@@0@Z @ 40 NONAME ; int CImageEditorImageHandler::RenameImage(class TDesC16 const &, class TDesC16 const &) const + ?ResetEngineL@CImageEditorPluginManager@@QAEXXZ @ 41 NONAME ; void CImageEditorPluginManager::ResetEngineL(void) + ?RestoreFilterL@CImageEditorPluginManager@@QBEXXZ @ 42 NONAME ; void CImageEditorPluginManager::RestoreFilterL(void) const + ?RotateL@CImageEditorPluginManager@@QAEXW4TRotation@@@Z @ 43 NONAME ; void CImageEditorPluginManager::RotateL(enum TRotation) + ?SaveAbortL@CImageEditorPluginManager@@QAEXXZ @ 44 NONAME ; void CImageEditorPluginManager::SaveAbortL(void) + ?SaveBlockL@CImageEditorPluginManager@@QAEHXZ @ 45 NONAME ; int CImageEditorPluginManager::SaveBlockL(void) + ?SaveImageAsyncL@CImageEditorImageHandler@@QAEXABVTDesC16@@ABVCFbsBitmap@@HPAVTRequestStatus@@@Z @ 46 NONAME ; void CImageEditorImageHandler::SaveImageAsyncL(class TDesC16 const &, class CFbsBitmap const &, int, class TRequestStatus *) + ?SaveImageL@CImageEditorPluginManager@@QAEXHPBVTSize@@@Z @ 47 NONAME ; void CImageEditorPluginManager::SaveImageL(int, class TSize const *) + ?ScanPluginsL@CPluginLocator@@QAEXXZ @ 48 NONAME ; void CPluginLocator::ScanPluginsL(void) + ?SetFullImage@CImageEditorPluginManager@@QAEXPAVCFbsBitmap@@@Z @ 49 NONAME ; void CImageEditorPluginManager::SetFullImage(class CFbsBitmap *) + ?SetImageName@CImageEditorPluginManager@@QAEXABVTDesC16@@@Z @ 50 NONAME ; void CImageEditorPluginManager::SetImageName(class TDesC16 const &) + ?SetPreviewImage@CImageEditorPluginManager@@QAEXPAVCFbsBitmap@@@Z @ 51 NONAME ; void CImageEditorPluginManager::SetPreviewImage(class CFbsBitmap *) + ?SetScreenSizeL@CImageEditorPluginManager@@QAEXXZ @ 52 NONAME ; void CImageEditorPluginManager::SetScreenSizeL(void) + ?ShowPluginPopup@CImageEditorPluginManager@@QAEXXZ @ 53 NONAME ; void CImageEditorPluginManager::ShowPluginPopup(void) + ?UndoL@CImageEditorPluginManager@@QAEXXZ @ 54 NONAME ; void CImageEditorPluginManager::UndoL(void) + ?ZoomL@CImageEditorPluginManager@@QAEXW4TZoom@@@Z @ 55 NONAME ; void CImageEditorPluginManager::ZoomL(enum TZoom) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/group/ImageEditorManager.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/group/ImageEditorManager.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,83 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../inc/definitions.def" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + +TARGET ImageEditorManager.dll +TARGETTYPE dll +UID 0x1000008d + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorPluginLocator.cpp +SOURCE ImageEditorPluginScanner.cpp +SOURCE ImageEditorPluginStorage.cpp +SOURCE ImageEditorPluginManager.cpp +SOURCE ImageEditorImageHandler.cpp + +SOURCE PluginLoader.cpp +SOURCE EditorImage.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +LANG SC + +LIBRARY avkon.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY cone.lib +LIBRARY imageconversion.lib +LIBRARY bafl.lib +LIBRARY fbscli.lib +LIBRARY charconv.lib +LIBRARY estor.lib +LIBRARY aknicon.lib + +LIBRARY imageeditorutils.lib +LIBRARY enginewrapper.lib + +//#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* ImageEditorManager bld.inf file. +* +*/ + + +#include +#include + +#include "../../inc/definitions.def" + + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorManager.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorManager.iby) + +// mmp files +PRJ_MMPFILES +ImageEditorManager.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/EditorImage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/EditorImage.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,155 @@ +/* +* 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: +* +*/ + + + +#ifndef EDITORIMAGE_H +#define EDITORIMAGE_H + +// INCLUDES +#include +#include + +// FORWARD DECLARATIONS + + +/* CLASS: CEditorImage +* +* CEditorImage class represents an image in Image Editor. The image can +* be loaded with RAJPEG engine (JPEG) or Symbian MMF (other formats). +* When image is loaded with RAJPEG, the image is represented as file name. +* When image is loaded with MMF, the image is represented as CFbsBitmap. +*/ +class CEditorImage : public CBase +{ + +public: + + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return pointer to created CEditorImage object + */ + static CEditorImage * NewL (); + + /** NewLC factory method, does not pop cleanupstack + * + * @param - + * @return pointer to created CEditorImage object + */ + static CEditorImage * NewLC (); + + /** Destructor + * + * @param - + * @return - + */ + ~CEditorImage (); + + /** GetPreviewData + * + * @param - + * @return pointer to preview bitmap + */ + CFbsBitmap *& GetPreviewData(); + + /** GetFullData + * + * @param - + * @return pointer to full sized bitmap + */ + CFbsBitmap *& GetFullData(); + + /** GetImageName + * + * @param - + * @return pointer to bitmap + */ + TFileName & GetImageName(); + + /** LockHeapLC + * + * Locks bitmap heap + * + * @param - + * @return - + */ + void LockHeapLC() const; + + /** LockHeapL + * + * Releases bitmap heap. + * + * @param - + * @return - + */ + void ReleaseHeap() const; + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CEditorImage (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); +//@} + +/** @name Members:*/ +//@{ + /// Preview + CFbsBitmap * iPreview; + /// Full + CFbsBitmap * iFull; + /// File name + TFileName iFileName; +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/ImageEditorImageHandler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/ImageEditorImageHandler.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,262 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORIMAGEHANDLER_HPP +#define IMAGEEDITORIMAGEHANDLER_HPP + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CImageDecoder; +class CImageEncoder; +class CFbsBitmap; +class MImageHandlerObserver; +class TRequestStatus; +class CFileExtensionMIMEType; +class CFrameImageData; + + +/* CLASS: CImageEditorImageHandler +* +* CImageEditorImageHandler represents image handling unit in Image Editor. +* It includes functionality to asynchronously load and save images. Also, +* it provides other image managing functionality. +* +*/ +class CImageEditorImageHandler : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + enum TImageFormat + { + EImageFormatInvalid, + EImageFormatBmp, + EImageFormatJpg, + EImageFormatMbm, + EImageFormatGif, + EImageFormatPng, + EImageFormatTiff, + EImageFormatMax + }; + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return pointer to created CImageEditorImageHandler object + */ + IMPORT_C static CImageEditorImageHandler * NewL (); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CImageEditorImageHandler (); + + /** LoadImageAsync + * + * Loads image asyncronically. Calls RunL method of an active object + * when loading complete. + * + * @param aFileName - name of the image file to be loaded + * @param aBitmap - bitmap to which image is loaded, must be created + * @param aStatus - status indicator + * and set to wanted size and displaymode + * @return - + */ + IMPORT_C void LoadImageAsyncL ( + const TDesC & aFileName, + CFbsBitmap *& aBitmap, + TRequestStatus * aStatus + ); + + /** ContinueLoading + * + * Continues loading of image data, if KErrUnderflow occurs. + * + * @param aStatus - request status + * @return - + */ + IMPORT_C void ContinueLoading (TRequestStatus * aStatus); + + /** SaveImageAsync + * + * Saves image asyncronically. Calls RunL method of an active object + * when saving complete. + * + * @param aFileName - saved image name + * @param aBitmap - bitmap to be saved + * @param aImageQuality - JPEG image quality (0,100) + * @param aStatus - status indicator + * @return - + */ + IMPORT_C void SaveImageAsyncL ( + const TDesC & aFileName, + const CFbsBitmap & aBitmap, + const TInt aImageQuality, + TRequestStatus * aStatus + ); + + /** GetJpegQualityFactorL + * + * Gets the JPEG quality factor. + * + * @param aFileName - saved image name + * @return - the quality factor + */ + IMPORT_C TInt GetJpegQualityFactorL (const TDesC & aFileName); + + /** RenameImage + * + * Renames image. + * + * @param aFileNameSrc - source image name + * @param aFileNameDst - destination image name + * @return KErrNone if no errors, system wide error code otherwise + */ + IMPORT_C TInt RenameImage ( + const TDesC & aFileNameSrc, + const TDesC & aFileNameDst + ) const; + + /** DeleteImage + * + * Deletes image. + * + * @param aFileName - image name to be deleted + * @return KErrNone if no errors, system wide error code otherwise + */ + IMPORT_C TInt DeleteImage (const TDesC & aFileName) const; + + /** CleanupConverters + * + * Cancels the asynchronous requests and cleans up image converters. + * + * @param - + * @return - + */ + IMPORT_C void CleanupConverters (); + + /** IsRajpegImageL + * + * Checks whether an image is a RAJPEG image or not. + * + * @param aFileName - file name + * @return ETrue if RAJPEG image, EFalse otherwise + */ + IMPORT_C TBool IsRajpegImageL (const TDesC & aFileName) const; + + /** IsJpegIntact + * + * Verifies JPEG image content. + * + * @param aFileName - file name + * @return ETrue if intact, EFalse if broken + */ + IMPORT_C TBool IsJpegIntact (const TDesC & aFileName); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorImageHandler (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** GetMIMETypeLC + * + * Finds and create CFileExtensionMIMEType type based on file extension. + * + * @param aFileName - image file name + * @return MIME type instance + */ + CFileExtensionMIMEType * GetMIMETypeL (const TDesC & aFileName); + + /* GetFrameImageDataL + * + * Gets CFrameImageData instance. + * + * @param aExt - image name extension + * @param aQuality - JPEG quality + * @return CFrameImageData instance + */ + CFrameImageData * GetFrameImageDataL ( + const TDesC & aExt, + const TInt aQuality + ) const; + + /** Copy constructor, disabled + */ + CImageEditorImageHandler (const CImageEditorImageHandler & rhs); + + /** Assignment operator, disabled + */ + CImageEditorImageHandler & operator= (const CImageEditorImageHandler & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Image decoder instance (used in loading) + CImageDecoder * iImageDecoder; + + /// Image encoder instance (used in saving) + CImageEncoder * iImageEncoder; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/ImageEditorManagerDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/ImageEditorManagerDef.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,43 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORMANAGERDEF_H +#define IMAGEEDITORMANAGERDEF_H + +// Plug-in search path +_LIT (KPluginPath, "\\sys\\bin\\"); +_LIT (KPluginDriveAndPath, "z:\\sys\\bin\\"); +_LIT (KPluginResourcePath, "\\private\\101ffa91\\plugins\\"); +_LIT (KPluginBitmapPath, "\\resource\\apps\\"); + +// Image Editor resource file +_LIT (KImageEditorResourceFile, "\\resource\\apps\\ImageEditor.RSC"); + +// Plug-in extension +_LIT(KPluginExtension, ".pgn"); + +// Plug-in search wildcard +_LIT (KPluginWild, "*.pgn"); +_LIT (KResourceWild, "*.rsc"); + + +#endif // IMAGEEDITORMANAGERDEF_H + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/ImageEditorPluginLocator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/ImageEditorPluginLocator.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,165 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINLOCATOR_H +#define IMAGEEDITORPLUGINLOCATOR_H + +// INCLUDES +#include +#include + +#include "imageeditordebugutils.h" + +// FORWARD DECLARATIONS +class CPluginScanner; +class CPluginStorage; +class CPluginInfo; + +/* CLASS: CPluginLocator +* +* CPluginLocator represents plugin locator API for Image Editor software. +* It implements a facade design pattern to accommodate pluginlocator and +* pluginstorage classes and their functionality under the same API. Also, +* the facade further disconnects the implementation of the plug-in locating +* part and the application itself +* +*/ +class CPluginLocator : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return pointer to created CPluginLocator object + */ + IMPORT_C static CPluginLocator * NewL (); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CPluginLocator (); + + + /* + * + * GENERAL PLUG-IN MANAGEMENT METHODS + * + */ + + + /** ScanPlugins + * + * Scans all available plug-ins + * + * @return - + */ + IMPORT_C void ScanPluginsL (); + + /** CountPlugins + * + * Counts the number of found plug-ins. + * + * @param - + * @return TInt - count of plug-ins + */ + IMPORT_C TInt CountPlugins() const; + + + /* + * + * PLUGIN QUERY METHODS + * + */ + + + /** GetPluginInfo + * + * Returns a pointer to plug-in info object. + * + * @param aID - plug-in run-time ID [0, CountPlugins - 1] + * @return - plug-in DLL file name + */ + IMPORT_C CPluginInfo * GetPluginInfo (const TInt aID); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CPluginLocator (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** Copy constructor, disabled + */ + CPluginLocator (const CPluginLocator & rhs); + + /** Assignment operator, disabled + */ + CPluginLocator & operator= (const CPluginLocator & rhs); + +//@} + +/** @name Members:*/ +//@{ + + /// Plug-in locator + CPluginScanner * iScanner; + + /// Plug-in storage + CPluginStorage * iStorage; + +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/ImageEditorPluginManager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/ImageEditorPluginManager.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,527 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINMANAGER_H +#define IMAGEEDITORPLUGINMANAGER_H + +// INCLUDES +#include + +#include "imageeditordebugutils.h" +#include "commondefs.h" + +/// FORWARD DECLARATIONS +class CCoeControl; +class CFbsBitmap; +class CPluginLoader; +class CEditorImage; +class CEngineWrapper; +class CSystemParameters; +class CArrayFixedFlat; + +#ifdef RD_CONTENTNOTIFICATION +class CContentNotification; +#endif + +/* CLASS: CImageEditorPluginManager +* +* CImageEditorPluginManager functions as Model of the application in +* MVC design pattern sense. It includes an instance of Scalado's MIA +* image processing engine and manages plug-in communication with the +* application controller. +*/ +class CImageEditorPluginManager : public CBase +{ +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return pointer to created CImageEditorPluginManager object + */ + IMPORT_C static CImageEditorPluginManager * NewL (); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CImageEditorPluginManager (); + + /** OpenPluginL + * + * Loads and opens plug-in + * + * @param aFileName - plug-in file name + * @return - + */ + IMPORT_C void OpenPluginL (const TDesC & aFileName); + + /** CreatePluginControlL + * + * Creates UI control for the plug-in in question. + * + * @param aRect - control rectangle + * @param aParent - parent control + * @param aPluginControl - reference to plug-in control + * @return pointer to plug-in control + */ + IMPORT_C TInt CreatePluginControlL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ClosePlugin + * + * Deletes current plug-in and unloads it. + * + * @param - + * @return - + */ + IMPORT_C void ClosePlugin (); + + /** ShowPluginPopup + * + * Shows plugin-related popup note. + * + * @param - + * @return - + */ + IMPORT_C void ShowPluginPopup (); + + /** UndoL + * + * Undoes last operation performed to the image. + * + * @param - + * @return - + */ + IMPORT_C void UndoL(); + + /** RedoL + * + * Redoes the last removed operation to the image. + * + * @param - + * @return - + */ + IMPORT_C void RedoL(); + + /** LoadImageL + * + * Loads image with MIA engine. + * + * @param aUseIPECodec - ImageEditor's own codec should be used + * @return - + */ + IMPORT_C void LoadImageL (const TBool aUseIPECodec); + + /** SaveImageL + * + * Saves image with MIA engine. + * + * @param aQuality - JPEG quality factor + * @param aSize - if not NULL includes the custom output size + * @return - + */ + IMPORT_C void SaveImageL ( + const TInt aQuality, + const TSize * aSize = NULL + ); + + /** PrepareAsyncSaveL + * + * Prepares to save the image by block + * + * @param aBlockCount - Number of blocks to save + * @param aQuality - JPEG quality factor + * @param aSize - if not NULL includes the custom output size + * @return - + */ + IMPORT_C void PrepareAsyncSaveL ( + const TInt aQuality, + const TSize * aSize = NULL + ); + + /** SaveBlock + * + * Saves a block + * + * @param - + * @return - returns percentage of image data saved, 100 when ready + */ + IMPORT_C TInt SaveBlockL(); + + /** SaveAbortL + * + * Must be called after aborting block saving + * + * @param - + */ + EXPORT_C void SaveAbortL(); + + /** FinishAsyncSave + * + * Finishes asynchronous saving with MIA engine. + * + * @param - + * @return - + */ + IMPORT_C void FinishAsyncSaveL(); + + /** ProcessImageL + * + * Processes image with MIA engine. + * + * @param - + * @return - + */ + IMPORT_C void ProcessImageL(); + + /** PrepareAsyncProcessL + * + * Prepares to process the image by block + * + * @param aBlockCount - Number of blocks to process + * @return - + */ + IMPORT_C void PrepareAsyncProcessL(TInt& aBlockCount); + + /** ProcessBlockL + * + * Render a block + * + * @param - + * @return - error code, KErrNone until whole image is saved and KErrCompletion + * when ready + */ + IMPORT_C TInt ProcessBlockL(); + + /** FinishAsyncProcessL + * + * Finishes asynchronous processing with MIA engine. + * + * @param - + * @return - + */ + IMPORT_C void FinishAsyncProcess(); + + /** GetPreviewImage + * + * Getter for preview bitmap. + * + * @param - + * @return pointer to CFbsBitmap + */ + IMPORT_C CFbsBitmap * GetPreviewImage(); + + /** GetFullImage + * + * Getter for bfull size bitmap. + * + * @param - + * @return pointer to CFbsBitmap + */ + IMPORT_C CFbsBitmap * GetFullImage(); + + /** GetImageName + * + * Getter for image file name + * + * @param - + * @return reference to the file name + */ + IMPORT_C const TDesC & GetImageName(); + + /** SetPreviewImage + * + * Setter for preview bitmap. + * + * @param aBitmap - pointer to preview bitmap + * @return - + */ + IMPORT_C void SetPreviewImage (CFbsBitmap * aBitmap); + + /** SetFullImage + * + * Setter for preview bitmap. + * + * @param aBitmap - pointer to full size bitmap + * @return - + */ + IMPORT_C void SetFullImage (CFbsBitmap * aBitmap); + + /** SetImageName + * + * Setter for image file name + * + * @param aFileName - new file name + * @return - + */ + IMPORT_C void SetImageName (const TDesC & aFileName); + + /** SetScreenSizeL + * + * Set current screen size to the engine + * + * @param - + * @return - + */ + IMPORT_C void SetScreenSizeL (); + + /** ResetEngine + * + * Resets MIA engine. + * + * @param - + * @return - + */ + IMPORT_C void ResetEngineL(); + + /** PurgeUndoRedoHistory + * + * Purges undo / redo history. + * + * @param - + * @return - + */ + IMPORT_C void PurgeUndoRedoHistory(); + + /** CanUndo + * + * Checks, if undoable changes are made. + * + * @param - + * @return - ETrue if we can undo, EFalse otherwise + */ + IMPORT_C TBool CanUndo(); + + /** IsImageChanged + * + * Checks, if image is changed. + * + * @param - + * @return - ETrue if image changed, EFalse otherwise + */ + IMPORT_C TBool IsImageChanged(); + + /** IsLandscapeEnabledL + * + * Checks, if plugin is landscape enabled. + * + * @param - + * @return - ETrue if landscape enabled, EFalse otherwise + */ + IMPORT_C TBool IsLandscapeEnabledL() const; + + + /** ZoomL + * + * Zooms image. + * + * @param aZoom - zoom mode to be set + * @return - + */ + IMPORT_C void ZoomL (const TZoom aZoom); + + /** GetZoomMode + * Returns current zoom mode. + * + * @since S60 v5.0 + * @param - + * @return TZoomMode current zooming mode + */ + IMPORT_C TZoomMode GetZoomMode(); + + /** PanL + * + * Pans image. + * + * @param aDir - direction + * @return - + * @see commondefs.h + */ + IMPORT_C void PanL (const TDirection aDir); + + /** Pan + * + * Pans image. + * + * @param aXChange x-directional change on the screen + * @param aYChange y-directional change on the screen + * @return - + */ + IMPORT_C void PanL( TInt aXChange, TInt aYChange ); + + + /** RotateL + * + * Rotates image. + * + * @param aRot - rotate direction + * @return - + * @see commondefs.h + */ + IMPORT_C void RotateL (const TRotation aRot); + + /** AddFilterToEngineL + * + * Adds filter to MIA engine. Sets undo/redo point. + * + * @param - + * @return - + */ + IMPORT_C void AddFilterToEngineL(); + + /** GetSystemParameters + * + * Gets system parameters. + * + * @param - + * @return const CSystemParameters & + */ + IMPORT_C const CSystemParameters & GetSystemParameters() const; + + /** IsPluginLoaded + * + * Check if a plug-in is loaded + * + * @param - + * @return - ETrue if plug-in is loaded, EFalse otherwise + */ + IMPORT_C TBool IsPluginLoaded() const; + + /** RestoreFilterL + * + * Restores current filter to main engine. + * + * @param - + * @return - + */ + IMPORT_C void RestoreFilterL() const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorPluginManager (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** SetParameters + * + * Sets engine parameters depending on the filter type + * + * @param - + * @return - + */ + void SetParametersL(); + + /** RenderL + * + * Renders image. + * + * @param aMultiSessionBlockCount - Has two purposes: + * 1) If not null, marks a request to render + * calling RenderBlock several times + * 2) On return, contains the number of blocks to save + * @return - + */ + void RenderL(TInt* aMultiSessionBlockCount = NULL); + + /** Cleanup + * + * Deletes current plug-in, editor image, engine and cleans up wrapper + * parameters. + * + * @param - + * @return - + */ + void Cleanup(); + + /** Copy constructor, disabled + */ + CImageEditorPluginManager (const CImageEditorPluginManager & rhs); + + /** Assignment operator, disabled + */ + CImageEditorPluginManager & operator= (const CImageEditorPluginManager & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in loader + CPluginLoader * iPluginLoader; + /// Edited image as CEditorImage + CEditorImage * iImage; + /// MIA engine wrapper + CEngineWrapper * iEngineWrapper; + + #ifdef RD_CONTENTNOTIFICATION + // Notification for Media Gallery + CContentNotification * iEventNotifier; + #endif + + /// Loaded filter type + TInt iFilterType; + /// Loaded UI type + TInt iUiType; + /// Is global zoom disabled + TBool iGlobalZoomDisabled; + /// Closing + TBool iOnTheWayToDestruction; + /// Plug-in scope + TInt iPluginScope; +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/ImageEditorPluginScanner.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/ImageEditorPluginScanner.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,169 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINSCANNER_H +#define IMAGEEDITORPLUGINSCANNER_H + + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CPluginStorage; + + +/* CLASS: CPluginScanner +* +* CPluginScanner loads plug-ins of type CPluginType. The plug-in +* information is stored into plug-in storage. +* +*/ +class CPluginScanner : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return - pointer to created CPluginScanner object + */ + static CPluginScanner * NewL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CPluginScanner (); + + /** ScanPluginsL + * + * Scans all available plugins and stores plug-in information to + * plug-in storage. DOES NOT load the bitmaps of the plugin icons, + * this must be done separately by calling LoadIconBitmapsL. + * + * @param - aPluginStorageNeedsUpdate + * @return - + */ + void ScanPluginsL ( TBool& aPluginStorageNeedsUpdate ); + + /** LoadIconBitmapsL + * + * Scans all plugin in the plug-in storage and load the icon + * bitmaps, using the bitmap file path stored for each plugin. + * + * @param - + * @return - + */ + void LoadIconBitmapsL(); + + /** SetPluginStorage + * + * Sets plug-in storage reference. + * + * @param aStorage - pointer to plug-in storage + * @return - + */ + inline void SetPluginStorage (CPluginStorage * aStorage) + { + iStorage = aStorage; + } + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CPluginScanner (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** DoScanPluginsL + * + * Scans all available plugins and stores plug-in information to + * plug-in storage. + * + * @param - + * @return - + */ + void DoScanPluginsL (); + + /** PluginStorageNeedsUpdateL + * + * Perform "light" plug-in scan. Compare the plug-in dll file names + * from the plug-in storage and directory scan to determine + * if the information in the storage is valid. + * + * @param - + * @return - TBool + */ + TBool PluginStorageNeedsUpdateL () const; + + /** Copy constructor, disabled + */ + CPluginScanner (const CPluginScanner & rhs); + + /** Assignment operator, disabled + */ + CPluginScanner & operator= (const CPluginScanner & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in storage + CPluginStorage * iStorage; + /// Last used plug-in RID + TInt iLastRID; +//@} +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/ImageEditorPluginStorage.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/ImageEditorPluginStorage.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,184 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINSTORAGE_H +#define IMAGEEDITORPLUGINSTORAGE_H + +// INCLUDES +#include +#include + +#include "imageeditordebugutils.h" + +// FORWARD DECLARATIONS +class CPluginInfo; +class RReadStream; +class RWriteStream; + +/* CLASS: CPluginStorage +* +* +*/ +class CPluginStorage : public CBase +{ + +public: + +/** @name Typedefs:*/ +//@{ + /// Plug-in group array + typedef RPointerArray RPluginInfoArray; +//@} + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return pointer to created CPluginStorage object + */ + static CPluginStorage * NewL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CPluginStorage (); + + /** CountPlugins + * + * Counts the number of found plug-ins. + * + * @param - + * @return TInt - count of plug-ins + */ + TInt CountPlugins() const; + + /** ResetAndDestroy + * + * Empty the storage and free allocated resources. + * + * @param - + * @return + */ + void ResetAndDestroy(); + + /** FindPluginDll + * + * Finds plug-in with DLL file name aPluginDll + * + * @param aPluginDll - plug-in run-time ID + * @param aPos - index of the located element + * @return Zero, if a matching descriptor is found. Non-zero otherwise. + */ + TInt FindPluginDll(const TDesC& aPluginDll, TInt& aPos ) const; + + /** GetPluginInfo + * + * Returns plug-in information in group aGroup at position aPlugin. + * + * @param aID - plug-in run-time ID + * @return plug-in information class + */ + CPluginInfo * GetPluginInfo (const TInt aID); + + /** AddPluginInfoL + * + * Add a new CPluginInfo instance to the storage. + * + * @param aGroup - plug-in group index + * @param aPlugin - plug-in index + * @return - + */ + void AddPluginInfoL (const CPluginInfo * aPluginInfo); + + /** ExternalizeL + * + * Externalizes object. + * + * @param aStream - write stream + * @return - + */ + void ExternalizeL(RWriteStream& aStream) const; + + /** InternalizeL + * + * Internalizes object. + * + * @param aStream - read stream + * @return - + */ + void InternalizeL(RReadStream& aStream); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CPluginStorage (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** Copy constructor, disabled + */ + CPluginStorage (const CPluginStorage & rhs); + + /** Assignment operator, disabled + */ + CPluginStorage & operator= (const CPluginStorage & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in array + RPluginInfoArray iPlugins; +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/inc/PluginLoader.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/inc/PluginLoader.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,155 @@ +/* +* 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: +* +*/ + + + +#ifndef PLUGINLOADER_HPP +#define PLUGINLOADER_HPP + +// INCLUDES +#include + +#include "imageeditordebugutils.h" + +// PLUGIN TYPE DEFINITIONS +#include "plugintypedef.h" + + +/* CLASS: CPluginLoader +* +* CPluginLoader is a class loading a polymorphic DLL plug-in. +*/ +class CPluginLoader : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aFileName - plug-in name + * @param aUID2 - pointer to UID2, if NULL not checked + * @param aUID3 - pointer to UID3, if NULL not checked + * @return pointer to created object + */ + static CPluginLoader * NewL ( + const TDesC & aFileName, + const TUid * aUID2, + const TUid * aUID3 + ); + + /** NewL factory method, does not pop cleanupstack + * + * @param aFileName - plug-in name + * @param aUID2 - pointer to UID2, if NULL not checked + * @param aUID3 - pointer to UID3, if NULL not checked + * @return pointer to created object + */ + static CPluginLoader * NewLC ( + const TDesC & aFileName, + const TUid * aUID2, + const TUid * aUID3 + ); + + /** Destructor + * @param - + * @return - + */ + virtual ~CPluginLoader (); + + /** GetPlugin + * + * Returns plug-in. + * + * @param - + * @return - the loaded and created plug-in + */ + CPluginType * GetPlugin () const; + + /** GetPluginDll + * + * Returns reference to the RLibrary object that has loaded the plug-in. + * + * @param - + * @return - RLibrary + */ + const RLibrary & GetPluginDll () const; + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CPluginLoader (); + + /** Second phase constructor, may leave + * + * @param aFileName - plug-in name + * @param aUID2 - pointer to UID2, if NULL not checked + * @param aUID3 - pointer to UID3, if NULL not checked + */ + void ConstructL ( + const TDesC & aFileName, + const TUid * aUID2, + const TUid * aUID3 + ); + + /** Copy constructor, disabled + */ + CPluginLoader (const CPluginLoader & rhs); + + /** Assignment operator, disabled + */ + CPluginLoader & operator= (const CPluginLoader & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// DLL loader + RLibrary iLibrary; + /// Plugin + CPluginType * iPlugin; +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/rom/ImageEditorManager.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/rom/ImageEditorManager.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IMAGEEDITORMANAGER_IBY__ +#define __IMAGEEDITORMANAGER_IBY__ + +file=ABI_DIR\BUILD_DIR\ImageEditorManager.dll SHARED_LIB_DIR\ImageEditorManager.dll + +#endif // __IMAGEEDITORMANAGER_IBY__ + +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/EditorImage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/EditorImage.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,93 @@ +/* +* 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: +* +*/ + + +#include "EditorImage.h" + +//============================================================================= +CEditorImage * CEditorImage::NewL () +{ + CEditorImage * self = CEditorImage::NewLC (); + CleanupStack::Pop(); // self; + return self; +} + +//============================================================================= +CEditorImage * CEditorImage::NewLC () +{ + CEditorImage * self = new (ELeave) CEditorImage; + CleanupStack::PushL (self); + self->ConstructL (); + return self; +} + +//============================================================================= +CEditorImage::~CEditorImage () +{ + iPreview = 0; + iFull = 0; +} + +//============================================================================= +CFbsBitmap *& CEditorImage::GetPreviewData() +{ + return iPreview; +} + +//============================================================================= +CFbsBitmap *& CEditorImage::GetFullData() +{ + return iFull; +} + +//============================================================================= +TFileName & CEditorImage::GetImageName() +{ + return iFileName; +} + +//============================================================================= +void CEditorImage::LockHeapLC() const +{ + if ( iPreview ) + { + iPreview->LockHeapLC(); + } +} + +//============================================================================= +void CEditorImage::ReleaseHeap() const +{ + if (iPreview) + { + iPreview->UnlockHeap(); + } +} + +//============================================================================= +CEditorImage::CEditorImage () +{ + +} + +//============================================================================= +void CEditorImage::ConstructL () +{ + iFileName.Zero(); +} + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/ImageEditorImageHandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/ImageEditorImageHandler.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,329 @@ +/* +* 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: +* +*/ + + + +#include +#include +#include + +#include "imageeditordebugutils.h" +#include "commondefs.h" +#include "ImageEditorError.h" +#include "ImageEditorImageHandler.h" + +//============================================================================= +EXPORT_C CImageEditorImageHandler * CImageEditorImageHandler::NewL () +{ + CImageEditorImageHandler * self = new (ELeave) CImageEditorImageHandler; + CleanupStack::PushL(self); + self->ConstructL (); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +EXPORT_C CImageEditorImageHandler::~CImageEditorImageHandler () +{ + CleanupConverters(); +} + +//============================================================================= +EXPORT_C void CImageEditorImageHandler::LoadImageAsyncL ( + const TDesC & aFileName, + CFbsBitmap *& aBitmap, + TRequestStatus * aStatus + ) +{ + LOG(KImageEditorLogFile, "CImageEditorImageHandler::LoadImageAsyncL()"); + + // Clean up old converters + CleanupConverters(); + + // Create a new image decoder + iImageDecoder = CImageDecoder::FileNewL ( + CEikonEnv::Static()->FsSession(), + aFileName + ); + + // Create the bitmap for containing the decoded image + TFrameInfo frame_info = iImageDecoder->FrameInfo(); + CFbsBitmap * bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL (bitmap); + TInt err = bitmap->Create (frame_info.iOverallSizeInPixels, EColor16M) ; + if (err != KErrNone) + { + LOG(KImageEditorLogFile, "CImageEditorImageHandler: Failed to create CFbsBitmap"); + User::Leave(KSIEEInternalNonRecoverable); + } + CleanupStack::Pop(); // bitmap + aBitmap = bitmap; + + // Start decoding + iImageDecoder->Convert (aStatus, *aBitmap); +} + +//============================================================================= +EXPORT_C void CImageEditorImageHandler::ContinueLoading (TRequestStatus * aStatus) +{ + iImageDecoder->ContinueConvert (aStatus); +} + +//============================================================================= +EXPORT_C void CImageEditorImageHandler::SaveImageAsyncL ( + const TDesC & aFileName, + const CFbsBitmap & aBitmap, + const TInt aImageQuality, + TRequestStatus * aStatus + ) +{ + LOG(KImageEditorLogFile, "CImageEditorImageHandler::SaveImageAsyncL()"); + // Clean up old converters + CleanupConverters(); + + // Get MIME type based in file extension + CFileExtensionMIMEType * mime = GetMIMETypeL (aFileName); + + // Create a new image decoder for MIME type mime + iImageEncoder = CImageEncoder::FileNewL ( + CEikonEnv::Static()->FsSession(), + aFileName, + mime->MIMEType() + ); + + CFrameImageData * frame = GetFrameImageDataL ( + mime->FileExtension(), + aImageQuality + ); + + // Start encoding + iImageEncoder->Convert (aStatus, aBitmap, frame); + +} + +//============================================================================= +EXPORT_C TInt CImageEditorImageHandler::GetJpegQualityFactorL ( + const TDesC & aFileName + ) +{ + LOG(KImageEditorLogFile, "CImageEditorImageHandler::GetJpegQualityFactorL()"); + + // Clean up old converters + CleanupConverters(); + + // Create a new image decoder + iImageDecoder = CImageDecoder::FileNewL ( + CEikonEnv::Static()->FsSession(), + aFileName + ); + + // Get reference to frame image data + const CFrameImageData & image_data = iImageDecoder->FrameData(); + + // Get JPEG quality factor + TInt qualityfactor = 100; + if ( image_data.ImageDataCount() > 0 ) + { + qualityfactor = ((const TJpegImageData*)image_data.GetImageData(0))->iQualityFactor; + } + + // Clean up old converters + CleanupConverters(); + + return qualityfactor; +} + +//============================================================================= +EXPORT_C TInt CImageEditorImageHandler::RenameImage ( + const TDesC & aFileNameSrc, + const TDesC & aFileNameDst + ) const +{ + return BaflUtils::RenameFile ( + CEikonEnv::Static()->FsSession(), + aFileNameSrc, + aFileNameDst, + 0 + ); +} + +//============================================================================= +EXPORT_C TInt CImageEditorImageHandler::DeleteImage (const TDesC & aFileName) const +{ + return BaflUtils::DeleteFile ( + CEikonEnv::Static()->FsSession(), + aFileName, + 0 + ); +} + +//============================================================================= +EXPORT_C void CImageEditorImageHandler::CleanupConverters() +{ + LOG(KImageEditorLogFile, "CImageEditorImageHandler::CleanupConverters()"); + + if (iImageDecoder) + { + LOG(KImageEditorLogFile, "CImageEditorImageHandler::CleanupConverters(): cancelling iImageDecoder"); + + iImageDecoder->Cancel(); + delete iImageDecoder; + iImageDecoder = NULL; + } + if (iImageEncoder) + { + LOG(KImageEditorLogFile, "CImageEditorImageHandler::CleanupConverters(): cancelling iImageEncoder"); + + iImageEncoder->Cancel(); + delete iImageEncoder; + iImageEncoder = NULL; + } +} + +//============================================================================= +EXPORT_C TBool CImageEditorImageHandler::IsRajpegImageL (const TDesC & aFileName) const +{ + _LIT8 (KMimeJpeg, "image/jpeg"); + + TBuf8<256> mime; + + RFs fs; + User::LeaveIfError(fs.Connect()); + CleanupClosePushL(fs); + + CImageDecoder::GetMimeTypeFileL (fs, aFileName, mime); + + CleanupStack::PopAndDestroy(); + +#ifdef ENABLE_DEBUGLOG + TBuf16 <100> mime16; + mime16.Copy(mime); + LOGFMT(KImageEditorLogFile, "CImageEditorImageHandler::IsRajpegImageL: MIME type: %S", &mime16); +#endif + + // Images with the mime type image/jpeg can be rajpeg images. + return ( mime.CompareF (KMimeJpeg) == 0 ); +} + +//============================================================================= +EXPORT_C TBool CImageEditorImageHandler::IsJpegIntact (const TDesC & aFileName) +{ + // Clean up old converters + CleanupConverters(); + + TRAPD (err, + // Create a new image decoder + iImageDecoder = CImageDecoder::FileNewL ( + CEikonEnv::Static()->FsSession(), + aFileName + ); + ); + CleanupConverters(); + if (err != KErrNone) + { + return EFalse; + } + else + { + return ETrue; + } +} + +//============================================================================= +CImageEditorImageHandler::CImageEditorImageHandler () +{ + +} + +//============================================================================= +void CImageEditorImageHandler::ConstructL () +{ + +} + + +//============================================================================= +CFileExtensionMIMEType * CImageEditorImageHandler::GetMIMETypeL ( + const TDesC & aFileName + ) +{ + + // Extract the file extension from aFullFileName + TParsePtrC fileparser (aFileName); + TBuf<12> ext; + if (fileparser.ExtPresent()) + { + ext.Append (fileparser.Ext()); + } + + // Get all supported mime types with file extensions + RFileExtensionMIMETypeArray mimes; + iImageEncoder->GetFileTypesL (mimes); + + // Get correct mime type based on file extension + CFileExtensionMIMEType * ret = 0; + for (TInt i = 0; i < mimes.Count(); ++i) + { + if (ext == mimes[i]->FileExtension()) + { + ret = mimes[i]; + mimes.Remove(i); + break; + } + } + + // Delete pointer array + mimes.ResetAndDestroy(); + + return ret; +} + +//============================================================================= +CFrameImageData * CImageEditorImageHandler::GetFrameImageDataL ( + const TDesC & aExt, + const TInt aQuality + ) const +{ + LOG(KImageEditorLogFile, "CImageEditorImageHandler::GetFrameImageDataL()"); + + CFrameImageData * frameData = CFrameImageData::NewL(); + CleanupStack::PushL (frameData); + + if (aExt.CompareF (KJpegExtension)) + { + TJpegImageData * data = new (ELeave) TJpegImageData(); + data->iQualityFactor = (100 - aQuality); + data->iSampleScheme = TJpegImageData::EColor422; + frameData->AppendImageData (data); // ownership transferred + } + else if (aExt.CompareF (KBmpExtension)) + { + TBmpImageData * data = new (ELeave) TBmpImageData(); + data->iBitsPerPixel = 24; + frameData->AppendImageData (data); // ownership transferred + } + else + { + + } + + CleanupStack::Pop(); // frameData + return frameData; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/ImageEditorPluginLocator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/ImageEditorPluginLocator.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,148 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include + +#include "ImageEditorPluginLocator.h" +#include "ImageEditorPluginScanner.h" +#include "ImageEditorPluginStorage.h" +#include "PluginInfo.h" +#include "ImageEditorUIDs.hrh" + +// CONSTANTS +_LIT( KPluginStorageExternalizeFile, "c:\\private\\101FFA91\\PluginStorage.ini"); + + +//============================================================================= +EXPORT_C CPluginLocator * CPluginLocator::NewL () +{ + CPluginLocator * self = new (ELeave) CPluginLocator; + CleanupStack::PushL (self); + self->ConstructL (); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +EXPORT_C CPluginLocator::~CPluginLocator () +{ + delete iScanner; + delete iStorage; +} + +//============================================================================= +EXPORT_C void CPluginLocator::ScanPluginsL () +{ + LOG(KImageEditorLogFile, "CPluginLocator: Scanning plugins"); + + ASSERT( iScanner ); + ASSERT( iStorage ); + + // Internalize the plug-in storage + RFs& fs = CEikonEnv::Static()->FsSession(); + BaflUtils::EnsurePathExistsL( fs, KPluginStorageExternalizeFile() ); + if( BaflUtils::FileExists(fs, KPluginStorageExternalizeFile()) ) + { + RFileReadStream stream; + stream.PushL(); + + LOGFMT(KImageEditorLogFile, "CPluginLocator: Internalizing plug-in storage from %S", &KPluginStorageExternalizeFile()); + + User::LeaveIfError ( + stream.Open ( + fs, + KPluginStorageExternalizeFile(), + EFileRead | EFileShareReadersOnly + )); + + stream >> *iStorage; + + stream.Release(); + stream.Pop(); + } + + // Scan for plug-ins + TBool pluginStorageNeedsUpdate = EFalse; + iScanner->ScanPluginsL ( pluginStorageNeedsUpdate ); + + // If the plugin content has changed compared to the previously + // internalized one, we need to externalize the plug-in storage + if( pluginStorageNeedsUpdate ) + { + LOGFMT(KImageEditorLogFile, "CPluginLocator: Externalizing plug-in storage to %S", &KPluginStorageExternalizeFile()); + + RFileWriteStream stream; + stream.PushL(); + + User::LeaveIfError ( + stream.Replace ( + fs, + KPluginStorageExternalizeFile(), + EFileWrite + )); + + stream << *iStorage; + + stream.Close(); + stream.Pop(); + } + + // iScanner is not needed after this + delete iScanner; + iScanner = NULL; +} + +//============================================================================= +EXPORT_C TInt CPluginLocator::CountPlugins() const +{ + return iStorage->CountPlugins(); +} + +//============================================================================= +EXPORT_C CPluginInfo * CPluginLocator::GetPluginInfo (const TInt aID) +{ + return iStorage->GetPluginInfo (aID); +} + +//============================================================================= +CPluginLocator::CPluginLocator () +{ + +} + +//============================================================================= +void CPluginLocator::ConstructL () +{ + LOG(KImageEditorLogFile, "CPluginLocator: Creating locator"); + + // Create a new plug-in storage + iStorage = CPluginStorage::NewL (); + + // Create a new plug-in locator + iScanner = CPluginScanner::NewL (); + + // Set storage + iScanner->SetPluginStorage (iStorage); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/ImageEditorPluginManager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/ImageEditorPluginManager.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,651 @@ +/* +* 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: +* +*/ + + + +#include +#include +#include + +#include "ImageEditorPluginManager.h" +#include "ImageEditorManagerDef.h" + +#include "PluginBaseDefs.h" +#include "ImageEditorPluginBaseDefs.h" +#include "ImageEditorPluginBase.hrh" +#include "iepb.h" +#include "ImageEditorError.h" + +#include "ImageEditorEngineWrapper.h" +#include "PluginLoader.h" +#include "EditorImage.h" +#include "SystemParameters.h" +#include "ResolutionUtil.h" + +#ifdef RD_CONTENTNOTIFICATION + +// For notifying Media Gallery of new files +//#include // notification event type definitions +#include +#include + +#endif //RD_CONTENTNOTIFICATION +// LOCAL CONSTANTS + +_LIT( KComponentName, "ImageEditorPluginManager"); // Panic category +const TInt KImageEditorPluginManagerPanicNoPluginLoaded = 0; + + +//============================================================================= +EXPORT_C CImageEditorPluginManager * CImageEditorPluginManager::NewL () +{ + CImageEditorPluginManager * self = new (ELeave) CImageEditorPluginManager; + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +EXPORT_C CImageEditorPluginManager::~CImageEditorPluginManager () +{ + Cleanup(); + delete iPluginLoader; + #ifdef RD_CONTENTNOTIFICATION + delete iEventNotifier; + #endif +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::OpenPluginL (const TDesC & aFileName) +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Opening plugin"); + + // Load plug-in + iPluginLoader = CPluginLoader::NewL (aFileName, &TUid2, NULL); + + // Get the plug-in filter type + TBuf<256> iobuf; + iPluginLoader->GetPlugin()->GetProperty (KCapPluginFilterType, iobuf); + TLex lex (iobuf); + iFilterType = 0; + lex.Val (iFilterType); + + // Get the plug-in ui type + iobuf.Zero(); + iPluginLoader->GetPlugin()->GetProperty (KCapPluginUiType, iobuf); + lex.Assign (iobuf); + iUiType = 0; + lex.Val (iUiType); + + // Disable global zoom / pan if plug-in does not support it + iobuf.Zero(); + TInt temp = 0; + iGlobalZoomDisabled = EFalse; + iPluginLoader->GetPlugin()->GetProperty (KCapGlobalZoomDisabled, iobuf); + lex.Assign (iobuf); + lex.Val (temp); + iGlobalZoomDisabled = (TBool)temp; + if (iGlobalZoomDisabled) + { + // Store old zoom value for restore + iEngineWrapper->StoreZoomL(); + RenderL(); + } + + // Add filter to the engine. + AddFilterToEngineL(); + + // Add system parameters to plug-in + CSystemParameters * syspars = iEngineWrapper->GetSystemPars(); + iobuf.Zero(); + iobuf.AppendNum ((TInt)((TAny *)(syspars))); + iPluginLoader->GetPlugin()->SetProperty (KCapSystemParameters, iobuf); + + +} + +//============================================================================= +EXPORT_C TInt CImageEditorPluginManager::CreatePluginControlL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Creating plugin control"); + + // Initialize plug-in control + if (iPluginLoader) + { + TInt ret = KErrGeneral; + CPluginType* plugin = iPluginLoader->GetPlugin(); + if ( plugin ) + { + ret = plugin->InitPluginL (aRect, aParent, aPluginControl); + } + return ret; + } + else + { + aPluginControl = 0; + return KErrGeneral; + } +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::ClosePlugin() +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Closing plugin"); + + if (iPluginLoader && !iOnTheWayToDestruction) + { + // Enable zoom if disabled + if (iGlobalZoomDisabled) + { + TRAP_IGNORE(iEngineWrapper->RestoreZoomL()); + } + TRAP_IGNORE(ProcessImageL()); + } + + // Delete and unload current plug-in + delete iPluginLoader; + iPluginLoader = NULL; + iFilterType = NULL; + iUiType = NULL; + iGlobalZoomDisabled = EFalse; +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::ShowPluginPopup() +{ + if (iPluginLoader) + { + CPluginType* plugin = iPluginLoader->GetPlugin(); + if ( plugin ) + { + plugin->ShowPopupNote (); + } + } +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::UndoL() +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Undoing"); + + // Undo step + iEngineWrapper->UndoL(); + + // Render + RenderL(); + +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::RedoL() +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Redoing"); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::LoadImageL(const TBool aUseIPECodec) +{ + + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Loading image"); + + if ( aUseIPECodec ) + { + // Create new jpeg source + iEngineWrapper->CreateJpegSourceL ( iImage->GetImageName() ); + } + else + { + // Create new icl source + iEngineWrapper->CreateIclSourceL ( iImage->GetImageName() ); + } + + // Render + RenderL(); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::SaveImageL ( + const TInt aQuality, + const TSize * aSize + ) +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Saving image"); + + // Create RAJPEG sink + iEngineWrapper->CreateJpegTargetL (iImage->GetImageName(), aQuality, aSize); + + // Render + iEngineWrapper->RenderL (); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::PrepareAsyncSaveL ( + const TInt aQuality, + const TSize * aSize + ) + { + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Preparing for async save"); + + // Disable and store zoom + iEngineWrapper->StoreZoomL(); + + // Create new EXIF thumbnail + iEngineWrapper->CreateExifThumbNailL (); + + // Create RAJPEG sink + iEngineWrapper->CreateJpegTargetL (iImage->GetImageName(), aQuality, aSize); + + // Start rendering + iEngineWrapper->RenderL (); + } + +//============================================================================= +EXPORT_C TInt CImageEditorPluginManager::SaveBlockL () + { + // Render + return iEngineWrapper->RenderBlockL(); + } + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::SaveAbortL () + { + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Saving aborted"); + + iEngineWrapper->RenderAbortL(); + + iEngineWrapper->RestoreZoomL(); + + RenderL(); + } + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::FinishAsyncSaveL () + { + LOG(KImageEditorLogFile, "CImageEditorPluginManager::FinishAsyncSaveL"); + +#ifdef RD_CONTENTNOTIFICATION + TArray eventArray; + + // Nofication about new content + CContentNotificationEvent* event = CContentCreatedEvent::NewLC( iImage->GetImageName() ); + eventArray->AppendL( event ); + CleanupStack::Pop( event ); + + User::LeaveIfError(iEventNotifier->SendNotification( eventArray )); + delete event; + delete eventArray; +#endif + + iEngineWrapper->RestoreZoomL(); + + RenderL(); + } + + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::ProcessImageL() +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Rendering image"); + + // Set filter parameters + SetParametersL(); + + // Render + RenderL (); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::PrepareAsyncProcessL (TInt& aBlockCount) +{ + // Set filter parameters + SetParametersL(); + + // Start rendering + RenderL (&aBlockCount); +} + +//============================================================================= +EXPORT_C TInt CImageEditorPluginManager::ProcessBlockL() +{ + // Render + return iEngineWrapper->RenderBlockL (); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::FinishAsyncProcess() +{ + +} + +//============================================================================= +EXPORT_C CFbsBitmap * CImageEditorPluginManager::GetPreviewImage() +{ + return iImage->GetPreviewData(); +} + +//============================================================================= +EXPORT_C CFbsBitmap * CImageEditorPluginManager::GetFullImage() +{ + return iImage->GetFullData(); +} + +//============================================================================= +EXPORT_C const TDesC & CImageEditorPluginManager::GetImageName() +{ + return iImage->GetImageName(); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::SetPreviewImage (CFbsBitmap * aBitmap) +{ + iImage->GetPreviewData() = aBitmap; +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::SetFullImage (CFbsBitmap * aBitmap) +{ + iImage->GetFullData() = aBitmap; +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::SetImageName (const TDesC & aFileName) +{ + iImage->GetImageName().Copy ( aFileName ); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::ResetEngineL() +{ + // Clean up + Cleanup(); + + // Create a new MIA engine + iEngineWrapper = CEngineWrapper::NewL(); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::PurgeUndoRedoHistory() +{ + iEngineWrapper->InitUndoRedo(); +} + +//============================================================================= +EXPORT_C TBool CImageEditorPluginManager::CanUndo() +{ + return iEngineWrapper->CanUndo(); +} + +//============================================================================= +EXPORT_C TBool CImageEditorPluginManager::IsImageChanged() +{ + return iEngineWrapper->IsImageChanged(); +} + +//============================================================================= +EXPORT_C TBool CImageEditorPluginManager::IsLandscapeEnabledL() const +{ + TBool ret = ETrue; + + if (iPluginLoader) + { + TBuf<256> iobuf; + TInt err = iPluginLoader->GetPlugin()->GetProperty(KCapIsLandscapeEnabled, iobuf); + if (err != KErrNone) + { + User::Leave(KSIEEInternal); + } + else + { + TLex parser(iobuf); + User::LeaveIfError(parser.Val(ret)); + } + } + + return ret; +} + +//============================================================================= +CImageEditorPluginManager::CImageEditorPluginManager () +: iGlobalZoomDisabled(EFalse), iOnTheWayToDestruction (EFalse) +{ + +} + +//============================================================================= +void CImageEditorPluginManager::ConstructL () +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Creating manager"); + // Create new image + iImage = CEditorImage::NewL (); + + // Create a new MIA engine + iEngineWrapper = CEngineWrapper::NewL(); + +#ifdef RD_CONTENTNOTIFICATION + iEventNotifier = CContentNotification::NewL (); +#endif + + // Get the screen size from the Resolution Util + TRect rect; + CResolutionUtil::Self()->GetClientRect(rect); + TSize size = rect.Size(); + + // Set screen size to the engine + iEngineWrapper->SetScreenSizeL (size); +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::SetScreenSizeL () +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Setting new screen size"); + + iEngineWrapper->CreateRGB888TargetL (); + + // Get the screen size from the Resolution Util + TRect rect; + CResolutionUtil::Self()->GetClientRect(rect); + TSize size = rect.Size(); + + // Set screen size to the engine + iEngineWrapper->SetScreenSizeL (size); + + // Render to new screen size + RenderL(); + + // Compute system parameters + iEngineWrapper->GetSystemPars(); +} + + +//============================================================================= +void CImageEditorPluginManager::SetParametersL() +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Setting parameters"); + + if (EPluginFilterTypeABITO == iFilterType) + { + // used as a buffer + TBuf<256> param; + + TInt err = iPluginLoader->GetPlugin()->GetProperty(KCapParamStruct, param); + + // If cancelling, there might not be a control, KErrNotReady returned + // Ignore KErrNotReady + if ( (err != KErrNone) && (err != KErrNotReady) ) + { + User::Leave(KSIEEInternal); + } + + iEngineWrapper->SetParamsL (param); + } +} + +//============================================================================= +void CImageEditorPluginManager::RenderL (TInt * aMultiSessionBlockCount) +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Rendering"); + + TBuf<256> iobuf; + TBool readyToRender = ETrue; + + // Check that filter can be rendered + if ( iPluginLoader && iFilterType == EPluginFilterTypeABITO ) + { + TInt err = iPluginLoader->GetPlugin()->GetProperty(KCapReadyToRender, iobuf); + if (err != KErrNone) + { + User::Leave(KSIEEInternal); + } + else + { + TLex parser(iobuf); + User::LeaveIfError(parser.Val(readyToRender)); + } + } + + if (readyToRender) + { + iEngineWrapper->SetBitmap ( iImage->GetPreviewData() ); + iEngineWrapper->CreateRGB888TargetL (); + iEngineWrapper->RenderL (aMultiSessionBlockCount); + } + + +} + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::AddFilterToEngineL() +{ + LOG(KImageEditorLogFile, "CImageEditorPluginManager: Adding filter to engine"); + + // Add undo-redo step + iEngineWrapper->AddUndoRedoStepL(); + + if (EPluginFilterTypeABITO == iFilterType) + { + + TBuf<256> iobuf; + TLex parser; + + // Add filter to the engine + TFileName filterFile; + CPluginType* plugin = iPluginLoader->GetPlugin(); // must not return null + __ASSERT_ALWAYS( plugin, User::Panic(KComponentName, KImageEditorPluginManagerPanicNoPluginLoaded) ); + + User::LeaveIfError( plugin->GetProperty (KCapFilterName, iobuf) ); + filterFile.Copy ( iobuf ); + + // Construct full dll path + TFileName filterNameAndPath( KPluginDriveAndPath ); + filterNameAndPath.Append( filterFile ); + + LOGFMT( KImageEditorLogFile,"\tPlug-in file: %S", &filterNameAndPath ); + + iobuf.Zero(); + User::LeaveIfError( iPluginLoader->GetPlugin()->GetProperty (KCapPluginScope, iobuf) ); + parser = iobuf; + parser.Val (iPluginScope); + + iEngineWrapper->AddFilterL ( filterNameAndPath ); + } +} + +//============================================================================= +void CImageEditorPluginManager::Cleanup() +{ + iOnTheWayToDestruction = ETrue; + + // Close plug-in + ClosePlugin(); + + // Delete engine + delete iEngineWrapper; + iEngineWrapper = NULL; + + // Delete editor image + delete iImage; + iImage = NULL; +} + + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::ZoomL (const TZoom aZoom) + { + if( !iGlobalZoomDisabled ) + { + iEngineWrapper->ZoomL (aZoom); + } + } + +//============================================================================= +EXPORT_C TZoomMode CImageEditorPluginManager::GetZoomMode() + { + return iEngineWrapper->GetZoomMode(); + } + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::PanL (const TDirection aDir) + { + iEngineWrapper->PanL (aDir); + } + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::PanL( TInt aXChange, TInt aYChange ) + { + iEngineWrapper->PanL( aXChange, aYChange ); + } + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::RotateL (const TRotation aRot) + { + // Rotate image + iEngineWrapper->RotateL (aRot); + } + +//============================================================================= +EXPORT_C const CSystemParameters & CImageEditorPluginManager::GetSystemParameters() const +{ + return *iEngineWrapper->GetSystemPars(); +} + +//============================================================================= +EXPORT_C TBool CImageEditorPluginManager::IsPluginLoaded () const +{ + if (iPluginLoader) + { + return ETrue; + } + else + { + return EFalse; + } +} + + +//============================================================================= +EXPORT_C void CImageEditorPluginManager::RestoreFilterL() const +{ + +} + +// End of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/ImageEditorPluginScanner.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/ImageEditorPluginScanner.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,537 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ImageEditorPluginScanner.h" +#include "ImageEditorPluginStorage.h" +#include "PluginLoader.h" +#include "PluginInfo.h" +#include "ImageEditorPluginBaseDefs.h" +#include "ImageEditorManagerDef.h" +#include "ImageEditorError.h" + +// PLUGIN TYPE DEFINITIONS +#include "plugintypedef.h" + +// DEBUG LOGGER +#include "imageeditordebugutils.h" + +//============================================================================= +CPluginScanner * CPluginScanner::NewL () +{ + CPluginScanner * self = new (ELeave) CPluginScanner; + CleanupStack::PushL (self); + self->ConstructL (); + CleanupStack::Pop(); + return self; +} + +//============================================================================= +CPluginScanner::~CPluginScanner () +{ + iStorage = NULL; + LOG(KImageEditorLogFile, "CPluginScanner: ~CPluginScanner"); +} + +//============================================================================= +void CPluginScanner::ScanPluginsL ( TBool& aPluginStorageNeedsUpdate ) +{ + // Check if the plugin storage internalized from disk is + // valid. If the plugins have changed, we need to perform + // full scan. Otherwise continue with the internalized content. + if ( PluginStorageNeedsUpdateL() ) + { + aPluginStorageNeedsUpdate = ETrue; + DoScanPluginsL(); + } + + // Now the plugin infos are almost ready. Only icon bitmaps + // are missing... + LoadIconBitmapsL(); +} + +//============================================================================= +TBool CPluginScanner::PluginStorageNeedsUpdateL () const +{ + LOG(KImageEditorLogFile, "CPluginScanner: Checking for plugin storage validity"); + + // First check if the plug-in storage is empty, which probably means that + // there was no ini file to internalize (could also mean there are no plug-ins...) + if ( ! iStorage->CountPlugins() ) + { + LOG(KImageEditorLogFile, "CPluginScanner: No internalized plugin storage"); + return ETrue; + } + + RFs & fs = CEikonEnv::Static()->FsSession(); + + TInt matchCount = 0; // number of files from the plug-in storage matching with scanned files + TInt scanCount = 0; // number of files located from the directory scan + + // Find all plugins in installation directory + TFindFile file_finder (fs); + CDir * file_list = 0; + + TBuf<32> wildCard; + wildCard.Append(KResourceWild); + + TInt err = file_finder.FindWildByDir ( + wildCard, + KPluginResourcePath, + file_list + ); + + // if .RSC file does not found, try to find language specific file + if (err) + { + // Find out what is the current language + TFileName resourceFile(KImageEditorResourceFile); + + CompleteWithAppPath(resourceFile); + + BaflUtils::NearestLanguageFile(fs, resourceFile); + + TInt extPosition = resourceFile.LocateReverse(TChar('.')); + + wildCard.Zero(); + wildCard.Append('*'); + wildCard.Append(resourceFile.Mid(extPosition)); + + err = file_finder.FindWildByDir ( + wildCard, + KPluginResourcePath, + file_list + ); + } + + // Go through all drives + while (err == KErrNone) + { + CleanupStack::PushL (file_list); + scanCount += file_list->Count(); + + // Check all plug-in candidates + for (TInt i = 0; i < file_list->Count(); ++i) + { + + /* + * + * GET PLUG-IN FILE NAME + * + */ + + // Create a full file name for plugin + TParse fullentry; + TPtrC name = (*file_list)[i].iName; + const TDesC* related = &(file_finder.File()); + fullentry.Set ( name, related, 0 ); + TFileName filename(fullentry.Name()); + filename.Append(KPluginExtension); + + /* + * + * SEE IF PLUG-IN FILE NAME IS IN THE STORAGE + * + */ + + TInt pos; // not used + if ( 0 == iStorage->FindPluginDll(filename, pos) ) + { + matchCount++; + } + + } + + CleanupStack::PopAndDestroy(); /// file_list + + // Try once again + err = file_finder.FindWild (file_list); + } + + // All plug-in files have been scanned. See the result. + if( scanCount == matchCount && matchCount == iStorage->CountPlugins() ) + { + LOG(KImageEditorLogFile, "CPluginScanner: plug-in storage up to date"); + return EFalse; // no update needed + } + else + { + LOG(KImageEditorLogFile, "CPluginScanner: plug-in storage update needed"); + return ETrue; + } +} + +//============================================================================= +void CPluginScanner::DoScanPluginsL () +{ + LOG(KImageEditorLogFile, "CPluginScanner: Scanning plugins"); + + // iStorage may contain invalidated internalized + // data, so it needs to be emptied first. + iStorage->ResetAndDestroy(); + + // Create a file session + RFs & fs = CEikonEnv::Static()->FsSession(); + + // Find plugin resource files private directory. It is not allowed + // to find plug-in DLLs from /sys/bin/ directory, because of + // Platform Security + TFindFile file_finder (fs); + CDir * file_list = 0; + + TBuf<32> wildCard; + wildCard.Append(KResourceWild); + + TInt err = file_finder.FindWildByDir ( + wildCard, + KPluginResourcePath, + file_list + ); + + // if .RSC file does not found, try to find language specific file + if (err) + { + // Find out what is the current language + TFileName resourceFile(KImageEditorResourceFile); + + CompleteWithAppPath(resourceFile); + + BaflUtils::NearestLanguageFile(fs, resourceFile); + + TInt extPosition = resourceFile.LocateReverse(TChar('.')); + + wildCard.Zero(); + wildCard.Append('*'); + wildCard.Append(resourceFile.Mid(extPosition)); + + err = file_finder.FindWildByDir ( + wildCard, + KPluginResourcePath, + file_list + ); + } + + // Go through all drives + while (err == KErrNone) + { + CleanupStack::PushL (file_list); + + // Check all plug-in candidates + for (TInt i = 0; i < file_list->Count(); ++i) + { + + /* + * + * LOAD PLUG-IN + * + */ + + // Create a full file name for plugin + TParse fullentry; + fullentry.Set ( + (*file_list)[i].iName,& + file_finder.File(), + 0 + ); + + // Use resource filename to compose DLL filename + TFileName name(fullentry.Name()); + name.Append(KPluginExtension); + + LOGFMT(KImageEditorLogFile,"CPluginScanner: Starting to load plug-in file: %S", &name); + + // Load plug-in and perform the DLL checks + CPluginLoader * pluginloader = + CPluginLoader::NewLC (name, &TUid2, 0); + + + // Get pointer to the plugin + CPluginType * plugin = pluginloader->GetPlugin(); + + // Query information and construct CPluginInfo instance + CPluginInfo * plugininfo = CPluginInfo::NewLC (); + + /* + * + * STORE ALL PLUG-IN INFORMATION + * + */ + + // Read buffer and parser + TBuf<256> readbuf; + TBuf<256> ureadbuf; + TLex parser; + + // PLUG-IN DLL NAME + ureadbuf.Copy (name); + plugininfo->PluginDll() = ( ureadbuf.AllocL() ); + + // PLUG-IN UID2 + plugininfo->Uid2() = pluginloader->GetPluginDll().Type()[1]; + + // PLUG-IN UID3 + plugininfo->Uid3() = pluginloader->GetPluginDll().Type()[2]; + + // PLUG-IN UI TYPE + User::LeaveIfError ( plugin->GetProperty (KCapPluginUiType, readbuf) ); + parser.Assign (readbuf); + parser.Val ( plugininfo->PluginUiType() ); + + // PLUG-IN FILTER TYPE + User::LeaveIfError ( plugin->GetProperty (KCapPluginFilterType, readbuf) ); + parser.Assign (readbuf); + parser.Val ( plugininfo->PluginFilterType() ); + + // PLUG-IN FILTER SCOPE + User::LeaveIfError ( plugin->GetProperty (KCapPluginScope, readbuf) ); + parser.Assign (readbuf); + parser.Val ( plugininfo->PluginScope() ); + + // PLUG-IN DISPLAY ORDER VALUE + User::LeaveIfError ( plugin->GetProperty (KCapPluginDisplayOrder, readbuf) ); + parser.Assign (readbuf); + parser.Val ( plugininfo->PluginDisplayOrder() ); + + // PLUG-IN RUN-TIME ID (RID) + plugininfo->PluginRID() = iLastRID++; + + // PLUG-IN NAME + User::LeaveIfError ( plugin->GetProperty (KCapPluginName, readbuf) ); + ureadbuf.Copy( readbuf ); + plugininfo->PluginName() = ureadbuf.AllocL(); + + // PLUG-IN ICON FILE NAME + User::LeaveIfError ( plugin->GetProperty (KCapIconName, readbuf) ); + ureadbuf.Copy( readbuf ); + plugininfo->IconFile() = ureadbuf.AllocL(); + + // PARAMETER DESCRIPTOR ARRAY + User::LeaveIfError ( plugin->GetProperty (KCapPluginParamNames, readbuf) ); + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + CDesCArray * parameters = (CDesCArray *)tempval; + if (parameters) + { + for (TInt j = 0; j < parameters->Count(); ++j) + { + plugininfo->Parameters().AppendL( (*parameters)[j] ); + } + } + + // SOFT KEY 1 COMMAND IDS + User::LeaveIfError ( plugin->GetProperty (KCapPluginSk1Cmd, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + CArrayFix * cmdids = 0; + cmdids = (CArrayFix *)tempval; + if (cmdids) + { + for (TInt j = 0; j < cmdids->Count(); ++j) + { + plugininfo->Sk1Cmds().AppendL( (*cmdids)[j] ); + } + } + + // SOFT KEY 1 TEXTS + User::LeaveIfError ( plugin->GetProperty (KCapPluginSk1Text, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + CDesCArray * texts = 0; + texts = (CDesCArray *)tempval; + if (texts) + { + for (TInt j = 0; j < texts->Count(); ++j) + { + plugininfo->Sk1Texts().AppendL( (*texts)[j] ); + } + } + + // SOFT KEY 2 COMMAND IDS + User::LeaveIfError ( plugin->GetProperty (KCapPluginSk2Cmd, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + cmdids = 0; + cmdids = (CArrayFix *)tempval; + if (cmdids) + { + for (TInt j = 0; j < cmdids->Count(); ++j) + { + plugininfo->Sk2Cmds().AppendL( (*cmdids)[j] ); + } + } + + // SOFT KEY 2 TEXTS + User::LeaveIfError ( plugin->GetProperty (KCapPluginSk2Text, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + texts = 0; + texts = (CDesCArray *)tempval; + if (texts) + { + for (TInt j = 0; j < texts->Count(); ++j) + { + plugininfo->Sk2Texts().AppendL( (*texts)[j] ); + } + } + + // MSK COMMAND IDS + User::LeaveIfError ( plugin->GetProperty (KCapPluginMSKCmd, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + cmdids = 0; + cmdids = (CArrayFix *)tempval; + if (cmdids) + { + for (TInt j = 0; j < cmdids->Count(); ++j) + { + plugininfo->MSKCmds().AppendL( (*cmdids)[j] ); + } + } + + // MSK TEXTS + User::LeaveIfError ( plugin->GetProperty (KCapPluginMSKText, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + texts = 0; + texts = (CDesCArray *)tempval; + if (texts) + { + for (TInt j = 0; j < texts->Count(); ++j) + { + plugininfo->MSKTexts().AppendL( (*texts)[j] ); + } + } + + // MENU ITEMS + User::LeaveIfError ( plugin->GetProperty (KCapPluginMenuItems, readbuf) ); + parser.Assign (readbuf); + tempval = 0; + parser.Val ( tempval ); + CMenuItemArray * menuitems = (CMenuItemArray *)tempval; + if (menuitems) + { + for (TInt j = 0; j < menuitems->Count(); ++j) + { + plugininfo->MenuItems().AppendL ( (*menuitems)[j] ); + } + } + + // Add plugininfo to storage + iStorage->AddPluginInfoL (plugininfo); + + CleanupStack::Pop(); // plugininfo + CleanupStack::PopAndDestroy (); // pluginloader + } + + CleanupStack::PopAndDestroy(); /// file_list + + // Try once again + err = file_finder.FindWild (file_list); + } +} + +//============================================================================= +void CPluginScanner::LoadIconBitmapsL() +{ + ASSERT( iStorage ); + + for ( TInt i = 0; i < iStorage->CountPlugins(); i++) + { + CPluginInfo* plugininfo = iStorage->GetPluginInfo(i); + + TFileName iconfile; + iconfile.Copy ( KPluginBitmapPath ); + iconfile.Append ( plugininfo->IconFile()->Des() ); + + CompleteWithAppPath( iconfile ); + if ( !BaflUtils::FileExists (CEikonEnv::Static()->FsSession(), iconfile) ) + { + LOGFMT(KImageEditorLogFile,"CPluginScanner: File not found: %S", &iconfile); + User::Leave (KSIEEInternal); + } + + LOGFMT(KImageEditorLogFile,"CPluginScanner: Plug-in icon file: %S", &iconfile); + + // Check whether icon file is SVG graphic + if (AknIconUtils::IsMifFile(iconfile)) + { + TInt bitmapId = 0; + TInt maskId = 0; + // Get ids for bitmap and mask + // NOTE: ValidateLogicalAppIconId returns same id for both! + AknIconUtils::ValidateLogicalAppIconId(iconfile, bitmapId, maskId); + AknIconUtils::CreateIconL( + plugininfo->Icon(), + plugininfo->Mask(), + iconfile, + bitmapId, + maskId+1); // TEMPORARY FIX + + //plugininfo->Icon()->Save(_L("icon.mbm")); + //plugininfo->Mask()->Save(_L("mask.mbm")); + } + else + { + // PLUG-IN ICON BITMAP + CFbsBitmap * icon = new (ELeave) CFbsBitmap; + CleanupStack::PushL (icon); + User::LeaveIfError ( icon->Load (iconfile, 0) ); + plugininfo->Icon() = icon; + CleanupStack::Pop(); // icon + + // PLUG-IN MASK BITMAP + CFbsBitmap * mask = new (ELeave) CFbsBitmap; + CleanupStack::PushL (mask); + User::LeaveIfError ( mask->Load (iconfile, 1) ); + plugininfo->Mask() = mask; + CleanupStack::Pop(); // mask + } + } +} + +//============================================================================= +CPluginScanner::CPluginScanner() +{ + +} + +//============================================================================= +void CPluginScanner::ConstructL () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/ImageEditorPluginStorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/ImageEditorPluginStorage.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,149 @@ +/* +* 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: +* +*/ + + + +#include + +#include "ImageEditorPluginStorage.h" +#include "PluginInfo.h" + +//============================================================================= +CPluginStorage * CPluginStorage::NewL () +{ + CPluginStorage * self = new (ELeave) CPluginStorage; + CleanupStack::PushL (self); + self->ConstructL (); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CPluginStorage::~CPluginStorage () +{ + iPlugins.ResetAndDestroy(); +} + +//============================================================================= +TInt CPluginStorage::CountPlugins() const +{ + return iPlugins.Count(); +} + +//============================================================================= +void CPluginStorage::ResetAndDestroy () +{ + iPlugins.ResetAndDestroy(); +} + +//============================================================================= +TInt CPluginStorage::FindPluginDll(const TDesC& aPluginDll, TInt& aPos ) const +{ + for (TInt i = 0, c = iPlugins.Count(); i < c; ++i) + { + aPos = i; + TPtrC plugin = iPlugins[i]->PluginDll()->Des(); + if ( plugin.CompareF(aPluginDll) == 0 ) + { + return 0; + } + } + return KErrNotFound; +} + +//============================================================================= +CPluginInfo * CPluginStorage::GetPluginInfo (const TInt aID) +{ + for (TInt i = 0, c = iPlugins.Count(); i < c; ++i) + { + if (iPlugins[i]->PluginRID() == aID) + { + return iPlugins[i]; + } + } + return 0; +} + +//============================================================================= +CPluginStorage::CPluginStorage () +{ + +} + +//============================================================================= +void CPluginStorage::ConstructL () +{ + LOG(KImageEditorLogFile,"CPluginStorage: Storage created"); +} + +//============================================================================= +void CPluginStorage::AddPluginInfoL (const CPluginInfo * aPluginInfo) +{ + // Add plug-in to storage + TLinearOrder order (CPluginInfo::ComparePluginOrder); + iPlugins.InsertInOrderAllowRepeats (aPluginInfo, order); +} + +//============================================================================= +void CPluginStorage::InternalizeL ( RReadStream& aStream ) +{ + LOG(KImageEditorLogFile,"CPluginStorage::InternalizeL"); + + TRAPD ( err, + + // Internalize the contents of iPlugins + TInt count = aStream.ReadInt32L(); + for ( TInt i=0; i> *info; + User::LeaveIfError( iPlugins.Append( info ) ); + CleanupStack::Pop( info ); + } + ); + + if (err) + { + LOGFMT(KImageEditorLogFile, "CPluginLocator: Internalize failed: %d", err); + iPlugins.ResetAndDestroy(); + } +} + +//============================================================================= +void CPluginStorage::ExternalizeL ( RWriteStream& aStream ) const +{ + LOG(KImageEditorLogFile,"CPluginStorage::ExternalizeL"); + + TRAPD ( err, + + // Externalize the contents of iPlugins + aStream.WriteInt32L( iPlugins.Count() ); + for ( TInt i=0; i< iPlugins.Count(); i++ ) + { + CPluginInfo* info = iPlugins[i]; + aStream << *info; + } + ); + + if (err) + { + LOGFMT(KImageEditorLogFile, "CPluginLocator: Externalize failed: %d", err); + } +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorManager/src/Pluginloader.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorManager/src/Pluginloader.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,124 @@ +/* +* 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: +* +*/ + + + +#include +#include + +#include "PluginLoader.h" +#include "ImageEditorError.h" + +#include "../../ImageEditor/inc/plugintypedef.h" + +//============================================================================= +CPluginLoader * CPluginLoader::NewL ( + const TDesC & aFileName, + const TUid * aUID2, + const TUid * aUID3 + ) +{ + CPluginLoader * self = CPluginLoader::NewLC (aFileName, aUID2, aUID3); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CPluginLoader * CPluginLoader::NewLC ( + const TDesC & aFileName, + const TUid * aUID2, + const TUid * aUID3 + ) +{ + CPluginLoader * self = new (ELeave) CPluginLoader; + CleanupStack::PushL (self); + self->ConstructL (aFileName, aUID2, aUID3); + return self; +} + +//============================================================================= +CPluginLoader::~CPluginLoader () +{ + delete iPlugin; + iLibrary.Close(); +} + +//============================================================================= +CPluginLoader::CPluginLoader () +{ + +} + +//============================================================================= +void CPluginLoader::ConstructL ( + const TDesC & aFileName, + const TUid * aUID2, + const TUid * aUID3 + ) +{ + LOGFMT(KImageEditorLogFile, "CPluginLoader: Loading plugin %S", &aFileName); + + // Dynamically load DLL + TInt err = iLibrary.Load (aFileName); + if (err != KErrNone) + { + LOGFMT(KImageEditorLogFile,"CPluginLoader: Failed to load file: %S", &aFileName); + User::Leave (KSIEEInternal); + } + + // Check UID2 + if (aUID2) + { + if ( iLibrary.Type()[1] != *aUID2 ) + { + LOG(KImageEditorLogFile, "CPluginLoader: Invalid plugin UID"); + User::Leave (KSIEEInternal); + } + + } + + // Check UID3 + if (aUID3) + { + if ( iLibrary.Type()[2] != *aUID3 ) + { + LOG(KImageEditorLogFile, "CPluginLoader: Invalid plugin UID"); + User::Leave (KSIEEInternal); + } + } + + // Create a plugin by calling ordinal 1 factory method + TLibraryFunction entrypoint = iLibrary.Lookup (1); + iPlugin = (CPluginType *) entrypoint(); + +} + +//============================================================================= +CPluginType * CPluginLoader::GetPlugin () const +{ + return iPlugin; +} + +//============================================================================= +const RLibrary & CPluginLoader::GetPluginDll () const +{ + return iLibrary; +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/EABI/ImageEditorUI.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/EABI/ImageEditorUI.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,170 @@ +EXPORTS + _ZN10SDrawUtils11ShowToolTipEP27CAknInfoPopupNoteControllerP11CCoeControl5TRectRK7TDesC16 @ 1 NONAME + _ZN10SDrawUtils11ShowToolTipEP27CAknInfoPopupNoteControllerP11CCoeControl6TPoint18TGulAlignmentValueRK7TDesC16 @ 2 NONAME + _ZN10SDrawUtils12DrawFlatRectER16CGraphicsContextRK5TRectRK4TRgbS7_S7_ @ 3 NONAME + _ZN10SDrawUtils15DrawBeveledRectER16CGraphicsContextRK5TRectRK4TRgbS7_S7_ @ 4 NONAME + _ZN10SDrawUtils15LaunchWaitNoteLEPP14CAknWaitDialogiRK7TDesC16P23MProgressDialogCallback @ 5 NONAME + _ZN10SDrawUtils18LaunchQueryDialogLERK7TDesC16 @ 6 NONAME + _ZN10SDrawUtils19GetIndicatorBitmapLERP10CFbsBitmapS2_ii @ 7 NONAME + _ZN10SDrawUtils19LaunchProgressNoteLEPP18CAknProgressDialogiRK7TDesC16iP23MProgressDialogCallback @ 8 NONAME + _ZN10SDrawUtils22LaunchListQueryDialogLEP12MDesC16ArrayRK7TDesC16 @ 9 NONAME + _ZN10SDrawUtils22LaunchTextQueryDialogLER6TDes16RK7TDesC16 @ 10 NONAME + _ZN10SDrawUtils24LaunchQueryDialogOkOnlyLERK7TDesC16 @ 11 NONAME + _ZN10SDrawUtils25LaunchColorSelectionGridLER4TRgb @ 12 NONAME + _ZN10SDrawUtils26LaunchColorSelectionPopupLEPK10CFbsBitmap5TRectR4TRgb @ 13 NONAME + _ZN10SDrawUtils31LaunchMultiLineTextQueryDialogLER6TDes16RK7TDesC16 @ 14 NONAME + _ZN10SDrawUtils9DrawGuideER16CGraphicsContextRK5TRectNS_10TGuideTypeERK4TRgb @ 15 NONAME + _ZN18CImageEditorUIView10ConstructLEv @ 16 NONAME + _ZN18CImageEditorUIView11DoActivateLERK10TVwsViewId4TUidRK6TDesC8 @ 17 NONAME + _ZN18CImageEditorUIView11SetSaveFlagEi @ 18 NONAME + _ZN18CImageEditorUIView11SetUndoFlagEi @ 19 NONAME + _ZN18CImageEditorUIView12DoDeactivateEv @ 20 NONAME + _ZN18CImageEditorUIView12SetSendAppUiEP7CSendUi @ 21 NONAME + _ZN18CImageEditorUIView12SetSoftKey1LERK7TDesC16i @ 22 NONAME + _ZN18CImageEditorUIView12SetSoftKey2LERK7TDesC16i @ 23 NONAME + _ZN18CImageEditorUIView12SetZoomModeLERK9TZoomMode @ 24 NONAME + _ZN18CImageEditorUIView13SetFullScreenEv @ 25 NONAME + _ZN18CImageEditorUIView14HandleCommandLEi @ 26 NONAME + _ZN18CImageEditorUIView14InZoomingStateEv @ 27 NONAME + _ZN18CImageEditorUIView15ActivatePluginLEP11CCoeControl @ 28 NONAME + _ZN18CImageEditorUIView15ResetFullScreenEv @ 29 NONAME + _ZN18CImageEditorUIView16AddPluginUiItemLEPK11CPluginInfo @ 30 NONAME + _ZN18CImageEditorUIView16DynInitMenuPaneLEiP12CEikMenuPane @ 31 NONAME + _ZN18CImageEditorUIView16SetImageFileNameERK7TDesC16 @ 32 NONAME + _ZN18CImageEditorUIView16SetNaviPaneTextLERK7TDesC16ii @ 33 NONAME + _ZN18CImageEditorUIView17ActivateMainViewLEv @ 34 NONAME + _ZN18CImageEditorUIView17SetMiddleSoftKeyLERK7TDesC16i @ 35 NONAME + _ZN18CImageEditorUIView17SetTitlePaneTextLERK7TDesC16 @ 36 NONAME + _ZN18CImageEditorUIView18ClearNaviPaneTextLEv @ 37 NONAME + _ZN18CImageEditorUIView19ClearTitlePaneTextLEv @ 38 NONAME + _ZN18CImageEditorUIView21GetTouchPanDirectionsERiS0_ @ 39 NONAME + _ZN18CImageEditorUIView22GetSelectedPluginInfoLEv @ 40 NONAME + _ZN18CImageEditorUIView22HandleClientRectChangeEv @ 41 NONAME + _ZN18CImageEditorUIView24ViewScreenModeCompatibleEi @ 42 NONAME + _ZN18CImageEditorUIView26HandleStatusPaneSizeChangeEv @ 43 NONAME + _ZN18CImageEditorUIView7SetBusyEv @ 44 NONAME + _ZN18CImageEditorUIView9ResetBusyEv @ 45 NONAME + _ZN18CImageEditorUIView9SetImageLEP10CFbsBitmap @ 46 NONAME + _ZN18CImageEditorUIViewC1Ev @ 47 NONAME + _ZN18CImageEditorUIViewC2Ev @ 48 NONAME + _ZN18CImageEditorUIViewD0Ev @ 49 NONAME + _ZN18CImageEditorUIViewD1Ev @ 50 NONAME + _ZN18CImageEditorUIViewD2Ev @ 51 NONAME + _ZN19CColorSelectionGrid10ConstructLEPK11CCoeControli @ 52 NONAME + _ZN19CColorSelectionGrid11SizeChangedEv @ 53 NONAME + _ZN19CColorSelectionGridC1Ev @ 54 NONAME + _ZN19CColorSelectionGridC2Ev @ 55 NONAME + _ZN19CColorSelectionGridD0Ev @ 56 NONAME + _ZN19CColorSelectionGridD1Ev @ 57 NONAME + _ZN19CColorSelectionGridD2Ev @ 58 NONAME + _ZN19CPreviewControlBase10ConstructLERK5TRectP11CCoeControl @ 59 NONAME + _ZN19CPreviewControlBase4NewLERK5TRectP11CCoeControl @ 60 NONAME + _ZN19CPreviewControlBase9SetImageLEP10CFbsBitmap @ 61 NONAME + _ZN19CPreviewControlBase9SetImageLEPK10CFbsBitmap @ 62 NONAME + _ZN19CPreviewControlBaseD0Ev @ 63 NONAME + _ZN19CPreviewControlBaseD1Ev @ 64 NONAME + _ZN19CPreviewControlBaseD2Ev @ 65 NONAME + _ZN19CSingleParamControl10ConstructLERK5TRectP11CCoeControli @ 66 NONAME + _ZN19CSingleParamControl10MoveSliderEi @ 67 NONAME + _ZN19CSingleParamControl10SetCaptionERK7TDesC16 @ 68 NONAME + _ZN19CSingleParamControl11SizeChangedEv @ 69 NONAME + _ZN19CSingleParamControl13SetSliderStepEj @ 70 NONAME + _ZN19CSingleParamControl14OfferKeyEventLERK9TKeyEvent10TEventCode @ 71 NONAME + _ZN19CSingleParamControl14SetParObserverEP25MSingleParControlObserver @ 72 NONAME + _ZN19CSingleParamControl16GetNaviPaneTextLERiS0_ @ 73 NONAME + _ZN19CSingleParamControl16GetSoftkeyIndexLEv @ 74 NONAME + _ZN19CSingleParamControl17SetSliderPositionEi @ 75 NONAME + _ZN19CSingleParamControl18SetSelectedUiItemLEP11CPluginInfo @ 76 NONAME + _ZN19CSingleParamControl19HandlePointerEventLERK13TPointerEvent @ 77 NONAME + _ZN19CSingleParamControl19SetSliderStepAmountEh @ 78 NONAME + _ZN19CSingleParamControl20HandlePluginCommandLEi @ 79 NONAME + _ZN19CSingleParamControl26SetSliderMinimumAndMaximumEii @ 80 NONAME + _ZN19CSingleParamControl27CountImageSizesAndPositionsEv @ 81 NONAME + _ZN19CSingleParamControl4NewLERK5TRectP11CCoeControli @ 82 NONAME + _ZN19CSingleParamControl7SetIconEP9CEikImage @ 83 NONAME + _ZN19CSingleParamControl7SetViewEP8CAknView @ 84 NONAME + _ZN19CSingleParamControlC1Ev @ 85 NONAME + _ZN19CSingleParamControlC2Ev @ 86 NONAME + _ZN19CSingleParamControlD0Ev @ 87 NONAME + _ZN19CSingleParamControlD1Ev @ 88 NONAME + _ZN19CSingleParamControlD2Ev @ 89 NONAME + _ZN21CMultiLineQueryDialog14OfferKeyEventLERK9TKeyEvent10TEventCode @ 90 NONAME + _ZN21CMultiLineQueryDialog4NewLER6TDes16RKN15CAknQueryDialog5TToneE @ 91 NONAME + _ZN21CMultiLineQueryDialogC1ER6TDes16RKN15CAknQueryDialog5TToneE @ 92 NONAME + _ZN21CMultiLineQueryDialogC2ER6TDes16RKN15CAknQueryDialog5TToneE @ 93 NONAME + _ZN21CMultiLineQueryDialogD0Ev @ 94 NONAME + _ZN21CMultiLineQueryDialogD1Ev @ 95 NONAME + _ZN21CMultiLineQueryDialogD2Ev @ 96 NONAME + _ZN23CImageEditorControlBase10ConstructLERK5TRectP11CCoeControl @ 97 NONAME + _ZN23CImageEditorControlBase11SizeChangedEv @ 98 NONAME + _ZN23CImageEditorControlBase14OfferKeyEventLERK9TKeyEvent10TEventCode @ 99 NONAME + _ZN23CImageEditorControlBase16GetNaviPaneTextLERiS0_ @ 100 NONAME + _ZN23CImageEditorControlBase16GetSoftkeyIndexLEv @ 101 NONAME + _ZN23CImageEditorControlBase18GetDimmedMenuItemsEv @ 102 NONAME + _ZN23CImageEditorControlBase18SetSelectedUiItemLEP11CPluginInfo @ 103 NONAME + _ZN23CImageEditorControlBase19HandlePointerEventLERK13TPointerEvent @ 104 NONAME + _ZN23CImageEditorControlBase20HandlePluginCommandLEi @ 105 NONAME + _ZN23CImageEditorControlBase24GetContextMenuResourceIdEv @ 106 NONAME + _ZN23CImageEditorControlBase7SetBusyEv @ 107 NONAME + _ZN23CImageEditorControlBase7SetViewEP8CAknView @ 108 NONAME + _ZN23CImageEditorControlBase8PrepareLEv @ 109 NONAME + _ZN23CImageEditorControlBase9ResetBusyEv @ 110 NONAME + _ZN23CImageEditorControlBase9SetImageLEP10CFbsBitmap @ 111 NONAME + _ZN23CImageEditorControlBase9SetImageLEPK10CFbsBitmap @ 112 NONAME + _ZN23CImageEditorControlBaseC1Ev @ 113 NONAME + _ZN23CImageEditorControlBaseC2Ev @ 114 NONAME + _ZN23CImageEditorControlBaseD0Ev @ 115 NONAME + _ZN23CImageEditorControlBaseD1Ev @ 116 NONAME + _ZN23CImageEditorControlBaseD2Ev @ 117 NONAME + _ZNK18CImageEditorUIView12GetContainerEv @ 118 NONAME + _ZNK18CImageEditorUIView13UpdateLayoutLEi @ 119 NONAME + _ZNK18CImageEditorUIView14HideWaitDialogEv @ 120 NONAME + _ZNK18CImageEditorUIView16LaunchSendQueryLERK20TSendingCapabilitiesR4TBufILi256EE @ 121 NONAME + _ZNK18CImageEditorUIView16LaunchSendQueryLERK20TSendingCapabilitiesR5RFile @ 122 NONAME + _ZNK18CImageEditorUIView16LaunchWaitDialogEv @ 123 NONAME + _ZNK18CImageEditorUIView17SetCustomButtonsLEi @ 124 NONAME + _ZNK18CImageEditorUIView20ShowInformationNoteLERK7TDesC16 @ 125 NONAME + _ZNK18CImageEditorUIView21LaunchLoadWaitDialogLEPP14CAknWaitDialogP23MProgressDialogCallback @ 126 NONAME + _ZNK18CImageEditorUIView21LaunchSaveImageQueryLEv @ 127 NONAME + _ZNK18CImageEditorUIView21LaunchSaveWaitDialogLEPP18CAknProgressDialogiP23MProgressDialogCallback @ 128 NONAME + _ZNK18CImageEditorUIView21ShowConfirmationNoteLERK7TDesC16 @ 129 NONAME + _ZNK18CImageEditorUIView23LaunchSaveChangesQueryLEv @ 130 NONAME + _ZNK18CImageEditorUIView27LaunchCancelTextInputQueryLEv @ 131 NONAME + _ZNK18CImageEditorUIView29LaunchExitWithoutSavingQueryLEv @ 132 NONAME + _ZNK18CImageEditorUIView2IdEv @ 133 NONAME + _ZNK19CPreviewControlBase16DrawPreviewImageERK5TRect @ 134 NONAME + _ZNK19CPreviewControlBase4DrawERK5TRect @ 135 NONAME + _ZNK19CSingleParamControl16ComponentControlEi @ 136 NONAME + _ZNK19CSingleParamControl22CountComponentControlsEv @ 137 NONAME + _ZNK19CSingleParamControl4DrawERK5TRect @ 138 NONAME + _ZNK19CSingleParamControl8PositionEv @ 139 NONAME + _ZNK23CImageEditorControlBase16ComponentControlEi @ 140 NONAME + _ZNK23CImageEditorControlBase22CountComponentControlsEv @ 141 NONAME + _ZNK23CImageEditorControlBase4BusyEv @ 142 NONAME + _ZNK23CImageEditorControlBase4DrawERK5TRect @ 143 NONAME + _ZTI11CPluginGrid @ 144 NONAME + _ZTI18CImageEditorUIView @ 145 NONAME + _ZTI19CColorSelectionGrid @ 146 NONAME + _ZTI19CPreviewControlBase @ 147 NONAME + _ZTI19CSingleParamControl @ 148 NONAME + _ZTI20CColorSelectionPopup @ 149 NONAME + _ZTI21CColorSelectionDialog @ 150 NONAME + _ZTI21CMultiLineQueryDialog @ 151 NONAME + _ZTI22CPluginSelectionDialog @ 152 NONAME + _ZTI23CImageEditorControlBase @ 153 NONAME + _ZTI23CImageEditorUIContainer @ 154 NONAME + _ZTV11CPluginGrid @ 155 NONAME + _ZTV18CImageEditorUIView @ 156 NONAME + _ZTV19CColorSelectionGrid @ 157 NONAME + _ZTV19CPreviewControlBase @ 158 NONAME + _ZTV19CSingleParamControl @ 159 NONAME + _ZTV20CColorSelectionPopup @ 160 NONAME + _ZTV21CColorSelectionDialog @ 161 NONAME + _ZTV21CMultiLineQueryDialog @ 162 NONAME + _ZTV22CPluginSelectionDialog @ 163 NONAME + _ZTV23CImageEditorControlBase @ 164 NONAME + _ZTV23CImageEditorUIContainer @ 165 NONAME + _ZThn12_N18CImageEditorUIView16DynInitMenuPaneLEiP12CEikMenuPane @ 166 NONAME + _ZThn4_N18CImageEditorUIView24ViewScreenModeCompatibleEi @ 167 NONAME + _ZN18CImageEditorUIView23IsMemoryInCriticalLevelEv @ 168 NONAME + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/bwins/ImageEditorUI.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/bwins/ImageEditorUI.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,129 @@ +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) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/ImageEditorUI.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/ImageEditorUI.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,571 @@ +/* +* 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: +* Resource definitions for ImageEditorUi. +* +*/ + + +// RESOURCE IDENTIFIER +NAME UICO + +// INCLUDES +#include +#include +#include +#include +#include +#include "definitions.def" + +#ifdef __AIW_PRINT_PROVIDER_USED__ + #include +#endif + +#ifdef __OEM_SDK__ + #include +#endif + +#include "ImageEditorUI.rh" +#include "ImageEditorUI.hrh" +#include "ImageEditorUI_gen.loc" + +#include + +// CONSTANTS + +// MACROS + +// RESOURCE DEFINITIONS +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="uicontrol"; } + +//============================================================================= +// +// DEFINITION FOR AVKON IMAGE FILE +// +//============================================================================= +#ifndef AVKON_ICON_FILE + #define AVKON_ICON_FILE "z:\\resource\\apps\\avkon2.mbm" +#endif + +//============================================================================= +// +// MAIN VIEW +// +//============================================================================= + +RESOURCE AVKON_VIEW r_imageeditorui_view +{ + menubar = r_imageeditorui_menubar; + + // changed to empty bacause plugin grid is opened in app start + //cba = R_AVKON_SOFTKEYS_EMPTY; + cba = r_imageeditorui_sk_options_back_apply; // MSK_PHASE_2 +} + + +//============================================================================= +// +// MAIN VIEW MENUBAR +// +//============================================================================= +RESOURCE MENU_BAR r_imageeditorui_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_imageeditorui_menupane; + txt = "ViewMenu"; + } + }; + } + +//============================================================================= +// +// MAIN VIEW MENUPANE +// +//============================================================================= + +RESOURCE MENU_PANE r_imageeditorui_menupane +{ + items = + { + MENU_ITEM + { + command = EImageEditorMenuCmdApplyEffect; + txt = qtn_sie_options_apply_effect; + }, + MENU_ITEM + { + command = EImageEditorMenuCmdUndo; + txt = qtn_sie_options_undo; + }, + +#ifdef __FULLSCREEN_AVAILABLE__ + MENU_ITEM + { + command = EImageEditorMenuCmdFullScreen; + txt = qtn_sie_options_full_screen; + }, + MENU_ITEM + { + command = EImageEditorMenuCmdNormalScreen; + txt = qtn_sie_options_normal_screen; + }, +#endif // FULLSCREEN_AVAILABLE + + MENU_ITEM + { + command = EImageEditorMenuCmdZoomIn; + txt = qtn_sie_options_zoom_in; + }, + MENU_ITEM + { + command = EImageEditorMenuCmdZoomOut; + txt = qtn_sie_options_zoom_out; + }, + MENU_ITEM + { + command = EImageEditorMenuCmdFitToScreen; + txt = qtn_sie_options_fit_to_screen; + }, + MENU_ITEM + { + command = EImageEditorMenuCmdSave; + txt = qtn_sie_options_save; + }, + MENU_ITEM + { + command = EImageEditorAiwCriteriaPrint; + txt = " "; // text string comes from provider +#ifdef __AIW_PRINT_PROVIDER_USED__ + // let AIW provider provides also text for the menu + // (that's why this is commented away) + // cascade = AIW_INTELLIGENT_CASCADE_ID | AIW_LOCK_SUBMENU_TITLE ; +#endif + }, + MENU_ITEM + { + command = EImageEditorMenuCmdHelp; + txt = qtn_options_help; + }, + MENU_ITEM + { + command = EImageEditorMenuCmdExit; + txt = qtn_options_exit; + } + }; +} + +//============================================================================= +// +// SOFTKEYS +// +//============================================================================= + +// MSK_PHASE_2 +RESOURCE CBA r_imageeditorui_sk_options_back_apply + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = qtn_sie_main_view_softkey_options; + }, + CBA_BUTTON + { + id = EAknSoftkeyBack; + txt = qtn_sie_main_view_softkey_back; + }, + CBA_BUTTON + { + id = EImageEditorMenuCmdApplyEffect; + txt = qtn_sie_msk_apply_effect; + } + }; + } + +RESOURCE CBA r_imageeditorui_sk_options_cancel_zoomin + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = qtn_sie_main_view_softkey_options; + }, + CBA_BUTTON + { + id = EImageEditorMenuCmdFitToScreen; + txt = qtn_sie_main_view_softkey_cancel; + }, + CBA_BUTTON + { + id = EImageEditorMenuCmdZoomIn; + txt = qtn_sie_msk_zoom_in; + } + }; + } + +RESOURCE CBA r_imageeditorui_sk_options_cancel + { + buttons = + { + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = qtn_sie_main_view_softkey_options; + }, + CBA_BUTTON + { + id = EImageEditorMenuCmdFitToScreen; + txt = qtn_sie_main_view_softkey_cancel; + }, + CBA_BUTTON + { + id = EAknSoftkeyOptions; + txt = qtn_sie_main_view_softkey_options; + } + }; + } + +//============================================================================= +// +// MAIN VIEW TITLE (displayed in navi pane) +// +//============================================================================= +// Currently no text is shown in navipane +RESOURCE TBUF r_main_view_title +{ + buf = qtn_sie_navi_edit; +} + +//============================================================================= +// +// LIST QUERY (contents updated dynamically) +// +//============================================================================= +RESOURCE AVKON_LIST_QUERY r_image_editor_list_query +{ + items = + { + AVKON_LIST_QUERY_DLG_LINE + { + control = AVKON_LIST_QUERY_CONTROL + { + listtype = EAknCtSinglePopupMenuListBox; + heading = " "; + listbox = AVKON_LIST_QUERY_LIST + { + // array of items will be defined dynamically + }; + }; + } + }; +} + +//============================================================================= +// +// TEXT DATA QUERY (contents updated dynamically) +// +//============================================================================= +RESOURCE DIALOG r_image_editor_text_query +{ + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_DATA_QUERY + { + layout = EStaticSizeDataLayout; + label = " "; + control = EDWIN + { + lines = 1; + maxlength = 128; + }; + }; + } + }; +} + +// Image Editor specific softkeys for confirmation query +RESOURCE CBA r_imageeditorui_sk_yes_no + { + buttons = + { + CBA_BUTTON + { + id = EImageEditorSoftkeyCmdYes; + txt = text_softkey_yes; + }, + CBA_BUTTON + { + id = EImageEditorSoftkeyCmdNo; + txt = text_softkey_no; + } + }; + } + +//============================================================================= +// +// CONFIRMATION QUERY +// +//============================================================================= +RESOURCE DIALOG r_image_editor_confirmation_query +{ + flags = EGeneralQueryFlags; + buttons = r_imageeditorui_sk_yes_no; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = " "; + }; + } + }; +} + +RESOURCE DIALOG r_image_editor_confirmation_query_ok_only +{ + flags = EGeneralQueryFlags; + buttons = R_AVKON_SOFTKEYS_OK_EMPTY; + items = + { + DLG_LINE + { + type = EAknCtQuery; + id = EGeneralQuery; + control = AVKON_CONFIRMATION_QUERY + { + layout = EConfirmationQueryLayout; + label = " "; + }; + } + }; +} + + + +RESOURCE TBUF r_list_query_exit_without_saving_confirmation +{ + buf = qtn_sie_exit_without_saving_confirmation; +} + +RESOURCE TBUF r_list_query_save_confirmation +{ + buf = qtn_sie_query_conf_save_changes; +} + +RESOURCE TBUF r_list_query_cancel_text_input +{ + // If cancel text input is needed in the future, just a new string has to + // be defined in ImageEditor.loc and append it here + buf = " "; +} + +//============================================================================= +// +// WAIT DIALOGS +// +//============================================================================= +RESOURCE DIALOG r_wait_dialog +{ + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_EMPTY; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = 10; + control= AVKON_NOTE + { + layout = EWaitLayout; + singular_label = " "; + imagefile = AVKON_ICON_FILE; + imageid = EMbmAvkonQgn_note_progress; + imagemask = EMbmAvkonQgn_note_progress_mask; + animation = R_QGN_GRAF_WAIT_BAR_ANIM; + }; + } + }; +} + +RESOURCE DIALOG r_progress_dialog +{ + flags = EAknWaitNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items= + { + DLG_LINE + { + type = EAknCtNote; + id = 10; + control= AVKON_NOTE + { + layout = EProgressLayout; + singular_label = " "; + }; + } + }; +} + +RESOURCE TBUF r_wait_note_saving +{ + buf = qtn_gen_note_saving; +} + +RESOURCE TBUF r_wait_note_saving_to +{ + buf = qtn_fldr_file_saving_wait; +} + +RESOURCE TBUF r_wait_note_loading +{ + buf = qtn_gen_note_opening; +} + +//============================================================================= +// +// COLOR SELECTION GRID (NEW POPUP) +// +//============================================================================= +RESOURCE DIALOG r_image_editor_color_dialog +{ + title = ""; + flags = EEikDialogFlagWait | + EEikDialogFlagNoBackgroundFade | + EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoBackup; + buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; +} + +//============================================================================= +// +// COLOR SELECTION GRID CAPTION +// +//============================================================================= +RESOURCE TBUF r_select_colour +{ + buf = qtn_sie_select_color_promt; +} + +//============================================================================= +// +// PLUG-IN SELECTION GRID +// +//============================================================================= +RESOURCE DIALOG r_image_editor_plugin_dialog +{ + title = ""; + flags = EEikDialogFlagWait | + EEikDialogFlagNoBackgroundFade | + EEikDialogFlagFillAppClientRect | + EEikDialogFlagNoBackup; + buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; +} + +//============================================================================= +// +// PLUG-IN SELECTION GRID HEADING +// +//============================================================================= +RESOURCE TBUF r_heading_apply_effect +{ + buf = qtn_sie_heading_apply_effect; +} + +//============================================================================= +// +// AIW INTEREST +// +//============================================================================= +#ifdef __AIW_PRINT_PROVIDER_USED__ +RESOURCE AIW_INTEREST r_image_editor_interest +{ + items= + { + // This application is interested in printing jpeg images + // from menu. + AIW_CRITERIA_ITEM + { + id = EImageEditorAiwCriteriaPrint; + serviceCmd = KAiwCmdPrint; + serviceClass = KAiwClassMenu; + contentType = "image/jpeg"; + maxProviders = 4; + } + }; +} +#endif + +//============================================================================= +// +// SAVE IMAGE LIST QUERY STRINGS +// +//============================================================================= +RESOURCE TBUF r_sie_list_query_heading_save +{ + buf = qtn_sie_heading_save; +} + +RESOURCE TBUF r_sie_list_query_save_replace +{ +// command = EImageEditorCmdSaveReplace; + buf = qtn_sie_query_save_replace; +} + +RESOURCE TBUF r_sie_list_query_save_new +{ +// command = EImageEditorCmdSaveNew; + buf = qtn_sie_query_save_new; +} + + +//============================================================================= +// +// ZOOM TEXTS (There should be as many zoom texts as there are zoom states) +// +//============================================================================= +RESOURCE TEXT_ARRAY r_zoom_texts + { + parameters= + { + + " ", // EZoomNormal + + qtn_sie_zoom_in2, // EZoomIn1 + + qtn_sie_zoom_in4, // EZoomIn2 + + qtn_sie_zoom_in8 // EZoomIn3 + + }; + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_graf_ied_vslider.bmp Binary file imageeditor/ImageEditorUI/data/qgn_graf_ied_vslider.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_graf_ied_vslider.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_graf_ied_vslider.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_graf_ied_vslider_mask.bmp Binary file imageeditor/ImageEditorUI/data/qgn_graf_ied_vslider_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_graf_ied_vtab.bmp Binary file imageeditor/ImageEditorUI/data/qgn_graf_ied_vtab.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_graf_ied_vtab.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_graf_ied_vtab.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_graf_ied_vtab_mask.bmp Binary file imageeditor/ImageEditorUI/data/qgn_graf_ied_vtab_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_move.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_move.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_move.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_indi_ied_move.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + + +]> + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_move_mask.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_move_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_redeye.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_redeye.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_redeye.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_indi_ied_redeye.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,23 @@ + + + + +]> + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_redeye_mask.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_redeye_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_rotate.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_rotate.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_rotate.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_indi_ied_rotate.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_rotate_mask.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_rotate_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_scale.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_scale.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_scale.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_indi_ied_scale.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,26 @@ + + + + +]> + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_scale_mask.bmp Binary file imageeditor/ImageEditorUI/data/qgn_indi_ied_scale_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/data/qgn_indi_ied_secondary_cursor.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/data/qgn_indi_ied_secondary_cursor.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,23 @@ + + + + +]> + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/group/ImageEditorUI.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/group/ImageEditorUI.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,136 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../inc/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +LIBRARY efsrv.lib +#endif + +#if defined( __LANDSCAPE_SUPPORT__ ) +MACRO LANDSCAPE_SUPPORT +#endif + +MACRO AIW_SUPPORT +LIBRARY servicehandler.lib + +#if defined( __OEM_SDK__ ) +MACRO OEM_SDK +#endif + +#if defined( __AIW_PRINT_PROVIDER_USED__ ) +MACRO AIW_PRINT_PROVIDER_USED +#endif + +#if defined( __SWAP_SOFTKEY_POSITIONS__) +MACRO SWAP_SOFTKEY_POSITIONS +#endif + +#if defined( __FULLSCREEN_AVAILABLE__ ) +MACRO FULLSCREEN_AVAILABLE +#endif + + +TARGET ImageEditorUI.dll +TARGETTYPE dll +UID 0x1000008d + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src + +SOURCE ImageEditorUIView.cpp +SOURCE ImageEditorUIContainer.cpp +SOURCE ImageEditorControlBase.cpp +SOURCE PreviewControlBase.cpp +SOURCE SingleParamControl.cpp +SOURCE ColorSelectionGrid.cpp +SOURCE DrawUtils.cpp +SOURCE PluginGrid.cpp +SOURCE WaitIndicator.cpp +SOURCE TControlItem.cpp +SOURCE ColorSelectionPopup.cpp +SOURCE CMultiLineQueryDialog.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../group + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/ImageEditorUI.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY avkon.lib +LIBRARY fbscli.lib +LIBRARY eikcoctl.lib +LIBRARY bafl.lib +LIBRARY gdi.lib +LIBRARY egul.lib +LIBRARY ws32.lib +LIBRARY sendui.lib +LIBRARY aknnotify.lib +LIBRARY commonengine.lib +LIBRARY imageeditorutils.lib +LIBRARY eikdlg.lib +LIBRARY aknicon.lib +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY eiksrv.lib +LIBRARY PlatformEnv.lib +LIBRARY apgrfx.lib +LIBRARY apparc.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + + +LIBRARY AknLayout2.lib +LIBRARY aknlayout2adaptation.lib +LIBRARY AknLayout2Scalable.lib +LIBRARY CdlEngine.lib // Scalable UI +//#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* ImageEditorUI bld.inf file. +* +*/ + + +#include +#include + +#include "../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorUI.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorUI.iby) + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE ImageEditorUi.mif +OPTION HEADERFILE ImageEditorUi.mbg +OPTION SOURCEFILE iconlist.txt +END +// MMP files +PRJ_MMPFILES + +ImageEditorUI.mmp + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/group/iconlist.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/group/iconlist.txt Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,35 @@ +-c24,8 qgn_graf_ring_wait_01 +-c24,8 qgn_graf_ring_wait_02 +-c24,8 qgn_graf_ring_wait_03 +-c24,8 qgn_graf_ring_wait_04 +-c24,8 qgn_graf_ring_wait_05 +-c24,8 qgn_graf_ring_wait_06 +-c24,8 qgn_graf_ring_wait_07 +-c24,8 qgn_graf_ring_wait_08 +-c24,8 qgn_graf_ring_wait_09 +-c24,8 qgn_graf_ring_wait_10 +-c24,8 qgn_indi_imed_rotate_left_super +-c24,8 qgn_indi_imed_cursor_super +-c24,8 qgn_indi_imed_cursor2_super +-c24,8 qgn_indi_imed_move_super +-c24,8 qgn_indi_imed_resize_super +-c24,8 qgn_graf_popup_trans_center +-c24,8 qgn_graf_popup_trans_corner_tl +-c24,8 qgn_graf_popup_trans_corner_tr +-c24,8 qgn_graf_popup_trans_corner_bl +-c24,8 qgn_graf_popup_trans_corner_br +-c24,8 qgn_graf_popup_trans_side_l +-c24,8 qgn_graf_popup_trans_side_r +-c24,8 qgn_graf_popup_trans_side_t +-c24,8 qgn_graf_popup_trans_side_b +-c24,8 qgn_graf_nslider_imed_end_left +-c24,8 qgn_graf_nslider_imed_end_right +-c24,8 qgn_graf_nslider_imed_middle +-c24,8 qgn_graf_nslider_imed_marker +-c24,8 qgn_graf_nslider_end_left +-c24,8 qgn_graf_nslider_end_right +-c24,8 qgn_graf_nslider_middle +-c24,8 qgn_graf_nslider_marker +-c24,8 qgn_indi_nslider_level_decrease +-c24,8 qgn_indi_nslider_level_increase +-c24,8 qgn_graf_nslider_marker_selected \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/CMultiLineQueryDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/CMultiLineQueryDialog.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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: +* +*/ +#ifndef CMULTILINEQUERYDIALOG_H_ +#define CMULTILINEQUERYDIALOG_H_ + +// INCLUDES +#include + +// CLASS DECLARATION + +/** + * Text query dialog that accepts multiple lines input. + * Wrapper for CAknTextQueryDialog + */ +class CMultiLineQueryDialog : public CAknTextQueryDialog + { + + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @see CAknTextQueryDialog::NewL + */ + IMPORT_C static CMultiLineQueryDialog* NewL( TDes& aDataText, + const TTone& aTone = ENoTone ); + + /** + * Destructor. + */ + ~CMultiLineQueryDialog(); + + public: // Functions from base classes + + /** + * Handle key events. + * @see CAknTextQueryDialog + */ + IMPORT_C TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + private: + + /** + * C++ default constructor. + * @see CAknTextQueryDialog::CAknTextQueryDialog + */ + CMultiLineQueryDialog( TDes& aDataText, const TTone& aTone = ENoTone ); + + private: // Data + + + }; + +#endif /*CMULTILINEQUERYDIALOG_H_*/ diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/ColorSelectionGrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/ColorSelectionGrid.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,161 @@ +/* +* 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: +* +*/ + + +#ifndef COLORSELECTIONGRID_H +#define COLORSELECTIONGRID_H + +// INCLUDES +#include + + +/* CLASS: CColorSelectionGrid +* +* CColorSelectionGrid represents a color selection grid control in +* Nokia Still Image Editor. +*/ +class CColorSelectionGrid : public CAknGrid +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param aParent - parent control + * @param aFlags - grid flags + * @return - + */ + IMPORT_C CColorSelectionGrid (); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CColorSelectionGrid (); + + /** Second phase constructor + * + * @param aParent - parent control + * @param aFlags - grid flags + * @return - + */ + IMPORT_C virtual void ConstructL ( + const CCoeControl * aParent, + TInt aFlags + ); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /* SizeChanged + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void SizeChanged(); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /* SetupGridIconsL + * + * Sets up grid icons. + * + * @param - + * @return - + */ + void SetupGridIconsL (); + + /* SetupGrid + * + * Sets up grid every time the grid size changes. + * + * @param - + * @return - + */ + void SetupGrid(); + + /* HSLtoRGB + * + * HSL to RGB color conversion + * + * @param aH - hue [0.0 - 360.0] + * @param aS - saturation [0.0 - 1.0] + * @param aL - luminance [0.0 - 1.0] + * @return TRgb + */ + TRgb HSLtoRGB ( + const TReal aH, + const TReal aS, + const TReal aL + ) const; + + /* ToRGB + * + * Helper function in color conversion. + * + * @param aRM1 - helper variable + * @param aRM2 - helper variable + * @param aRH - helper variable + * @return TInt + */ + TInt ToRGB ( + TReal aRM1, + TReal aRM2, + TReal aRH + ) const; + + /** Copy constructor, disabled + */ + CColorSelectionGrid (const CColorSelectionGrid & rhs); + + /** Assignment operator, disabled + */ + CColorSelectionGrid & operator= (const CColorSelectionGrid & rhs); + +//@} + +private: + +/** @name Members:*/ +//@{ + TSize iGridSize; + TSize iIconSize; +//@} + +}; + + +#endif // EOF ColorSelectionGrid.h diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/ColorSelectionPopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/ColorSelectionPopup.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,310 @@ +/* +* 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: +* Color selection popup dialog header file. +* +*/ + + +#ifndef COLORSELECTIONPOPUP_H +#define COLORSELECTIONPOPUP_H + +// INCLUDES +#include +#include + +#include "PreviewControlBase.h" + +// FORWARD DECLARATIONS +class CFbsBitmap; +class TAknLayoutText; +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +class CColorSelectionPopup :public CPreviewControlBase +{ + +public: + + /** Default constructor, cannot leave. + * + * @since S60 5.0 + * @param - + * @return - + */ + CColorSelectionPopup(); + + /** Destructor + * + * @since S60 5.0 + * @param - + * @return - + */ + virtual ~CColorSelectionPopup (); + + /** Second phase constructor + * + * @since S60 5.0 + * @param aParent - Parent control + * @return - + */ + virtual void ConstructL ( CCoeControl* aParent ); + + /** OfferKeyEventL + * + * @see CCoeControl + */ + virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + +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; + + /** GetSelectedColor + * + * Returns current highlighted color + * + * @since S60 5.0 + * @param - + * @return TRgb Currently selected color item in RGB format + */ + TRgb GetSelectedColor() const; + + + void SetSelectedColor(TRgb aRgb); + + +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(); + + /** Draw + * + * @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 rgb values + RArray< TRgb > iRGBArray; + + TInt iCurrentItem; + + +}; + + +class CColorSelectionDialog : public CAknDialog + { +public: + + /** RunDlgLD + * + * @param aBitmap - background bitmap + * @param aRect - Rect for the dialog + * @param aRgb - Color value to be returned + * @return - ExecuteLD() return value + */ + static TInt RunDlgLD( const CFbsBitmap* aBitmap, + const TRect& aRect, + TRgb& aRgb ); + + /** Constructor + * + * @param aRgb - Color value to be returned + * @return - + */ + CColorSelectionDialog( TRgb& aRgb ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CColorSelectionDialog(); + + /** 2nd phase constructor + * + * @param aBitmap - background bitmap + * @param aRect - Rect for the dialog + * @return - + */ + void ConstructL( const CFbsBitmap* aBitmap, const TRect& aRect); + + /** 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; + + /** SizeChanged + * + * + * @see CCoeControl + * + */ + virtual void SizeChanged(); + + /** 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(); + + /** CountComponentControls + * + * @see CCoeControl + * + */ + TInt CountComponentControls() const; + + /** ComponentControl + * + * @see CCoeControl + * + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; + +private: + + // popup component + CColorSelectionPopup* iPopup; + + // Selected color + TRgb& iCurrentRgb; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/CustomControlPanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/CustomControlPanics.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* Horizontal slider panics. +* +*/ + + + +#ifndef __CUSTOMCONTROLPANICS_PAN__ +#define __CUSTOMCONTROLPANICS_PAN__ + +enum THorizontalSliderPanic + { + EHorizontalSliderPanicMinMax = -0x100, + EHorizontalSliderPanicBitmapsNotLoaded, + EHorizontalSliderPanicStepNotPositive, + EHorizontalSliderPanicIndexUnderflow, + EHorizontalSliderPanicIndexOverflow, + }; + +void Panic(TInt aCategory) + { + _LIT(KComponentName, "HSLIDER"); + User::Panic(KComponentName, aCategory); + } + +#endif __CUSTOMCONTROLPANICS_PAN__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/ImageEditorUIContainer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/ImageEditorUIContainer.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,324 @@ +/* +* 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: +* ImageEditor container class header file. +* +*/ + + +#ifndef IMAGEEDITORUICONTAINER_H +#define IMAGEEDITORUICONTAINER_H + + +// INCLUDES +#include + +#include "ImageEditorUIView.h" +#include + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +// FORWARD DECLARATIONS +class CImageEditorControlBase; +class CFbsBitmap; +class CPluginInfo; +class CAknsBasicBackgroundControlContext; +class CWaitIndicator; + +/* CLASS: CImageEditorUIContainer +* +* Container control for Image Editor UI. +* +*/ +class CImageEditorUIContainer : public CCoeControl, + public MCoeControlObserver, + public MAknNaviDecoratorObserver +{ + +public: + +/** @name Methods:*/ +//@{ + + /* Second phase constructor + * + * @param aRect - frame rectangle for container + * @return + */ + void ConstructL (const TRect & aRect); + + /* Destructor + * + * @param - + * @return - + */ + ~CImageEditorUIContainer(); + + /* SetImage + * + * Set bitmap for preview pane. + * + * @param aBitmap - pointer to bitmap image + * @return - + */ + void SetImageL (CFbsBitmap * aBitmap); + + /* SetControl + * + * Set plug-in control to UI. + * + * @param aControl - plug-in control + * @return - + */ + void SetControl (CCoeControl * aControl); + + /* Setter for view reference, non-const + * + * @param aView - CImageEditorUIView pointer + * @return - + */ + void SetView (CImageEditorUIView * aView); + + /* OfferKeyEventL + * + * Handles key events. When a key event occurs, the control framework + * calls this function for each control on the control stack, until one + * of them can process the key event (and returns EKeyWasConsumed). + * + * @param aKeyEvent - the key event + * @param aType - type of key event + * @return indicator for event to be handled + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePointerEventL + * + * Handles pointer events gotten from the framework. This function gets + * called whenever a pointer event occurs in the control. + * + * @param aKeyEvent - the key event + * @return - + */ + virtual void CImageEditorUIContainer::HandlePointerEventL( + const TPointerEvent &aPointerEvent ); + + /* CountComponentControls + * + * Gets the number of controls in compound control. + * + * @param - + * @return number of controls + * @see CoeControl + */ + TInt CountComponentControls() const; + + /* ComponentControl + * + * Gets special component control indexed with aIndex. + * + * @param aIndex - component control index + * @return pointer to component control + * @see CoeControl + */ + CCoeControl * ComponentControl (TInt aIndex) const; + + /* SetBusy + * + * Sets busy, when busy UI does not handle key events. + * + * @param - + * @return - + */ + void SetBusy(); + + /* ResetBusy + * + * Resets busy, when busy UI does not handle key events. + * + * @param - + * @return - + */ + void ResetBusy(); + + /* Busy + * + * Returns the busy value, when busy UI does not handle key events + * + * @param - + * @return - + */ + TBool Busy() const; + + /* SetFullScreen + * + * Sets full screen flag. When full screen flag is set, the view is in + * full screen mode. Normal screen item is shown in menu. + * + * @param - + * @return - + */ + void SetFullScreen(); + + /* ResetFullScreen + * + * Resets full screen flag. When full screen flag is reset, the view is + * in normal screen mode. Full screen item is shown in menu. + * + * @param - + * @return - + */ + void ResetFullScreen(); + + /* GetHelpContext + * + * @see CCoeControl + * + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + /* GetDragDirections + * + * Resets full screen flag. When full screen flag is reset, the view is + * in normal screen mode. Full screen item is shown in menu. + * + * @since S60 v5.0 + * @param - xMovement x-directional change on screen + * @param - yMovement y-directional change on screen + * @return - + */ + void GetDragDirections( TInt& xMovement, TInt& yMovement ); + +//@} + +public: //From MAknNaviDecoratorObserver + + /* HandleNaviDecoratorEventL + * + * Method for handling touch events on navigator (navi pane) + * + * @since S60 v5.0 + * @param aEventID Id of the event. + * + */ + void HandleNaviDecoratorEventL( TInt aEventID ); + + void ShowWaitNote(); + + void HideWaitNote(); + +protected: + +/** @name Methods:*/ +//@{ + + /* SizeChanged + * + * Sets the size and position of the contents of the container according + * to container size changes. This methods is called whenever SetExtent, + * SetSize, SetRect, SetCornerAndSize or SetExtentToWholeScreen is called. + * + * @param - + * @return - + * @see CoeControl + */ + virtual void SizeChanged(); + + /* MopSupplyObject + * + * @see CoeControl + */ + virtual TTypeUid::Ptr MopSupplyObject( TTypeUid aId ); + + +//@} + +/** @name Members:*/ +//@{ +//@} + +private: + +/** @name Methods:*/ +//@{ + + /* Draw + * + * Draw controls, called by window server. + * + * @param aRect - region of control in need of redrawing + * @return - + * @see CoeControl + */ + void Draw (const TRect & aRect) const; + + /* HandleControlEventL + * + * Handles an event sent from the observed (this control being observer). + * + * @param aControl - pointer to control that sent the event + * @param aEventType - control event type + * @return - + * @see MCoeControlObserver + */ + void HandleControlEventL ( + CCoeControl * aControl, + TCoeEvent aEventType + ); + +//@} + +/** @name Members:*/ +//@{ + /// Reference to the view class + CImageEditorUIView * iEditorView; + /// Preview image + CFbsBitmap * iPreview; + /// Plug-in control + CCoeControl * iControl; + /// Editor rectangle + TRect iEditorRect; + // Busy flag + TBool iBusy; + // Full screen flag + TBool iFullScreen; + + /// Control context that provides a layout background with a + /// background bitmap and its layout rectangle. + CAknsBasicBackgroundControlContext* iBgContext; + + //TouchPan enablers + TPoint iTappedPosition; + TInt iXDirChange; + TInt iYDirChange; + + // Wait indicator (own) + CWaitIndicator* iWaitIndicator; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ + +//@} +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/ImageEditorUIPanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/ImageEditorUIPanics.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,51 @@ +/* +* 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: +* +*/ + + +#include + +#ifndef __IMAGEEDITORUI_PAN__ +#define __IMAGEEDITORUI_PAN__ + + +/// Image Editor panics +enum TImageEditorPanicIds +{ + /// Trying to access control which is null + EImageEditorPanicControlIsNull, + + /// Menu not accessibe when trying to invoke TryDisplayMenuBarL + EImageEditorPanicMenuNotAccessible, + + /// Cannot access the status pane of the view + EImageEditorPanicStatusPaneNotAccessible, + + /// Cannot access the cba of the view + EImageEditorPanicCbaNotAccessible, + + /// When zoom text count doesn't match with zoom state count + EImageEditorPanicZoomTextCountDoesntMatch, + + /// When everything goes Beverly Hills... + EImageEditorPanicUnexpectedCommand = 90210 +}; + +#endif __IMAGEEDITORUI_PAN__ + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/ImageEditorUI_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/ImageEditorUI_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* +*/ + + +#include + +// MENU TEXTS + +#define qtn_sie_main_view_menu_undo text_pup_option_undo +#define qtn_sie_main_view_menu_help qtn_options_help + +// SOFTKEY TEXTS + +#define qtn_sie_main_view_softkey_options text_softkey_option +#define qtn_sie_main_view_softkey_back text_softkey_back +#define qtn_sie_main_view_softkey_cancel text_softkey_cancel + +// WAIT NOTE TEXTS + +#define qtn_sie_wait_note_saving qtn_gen_note_saving +#define qtn_sie_wait_note_loading qtn_gen_note_opening + +// CONFIRMATION TEXTS + +#define qtn_sie_save_confirmation qtn_form_quest_save_changes diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/ImageEditorUiItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/ImageEditorUiItem.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,228 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORUIITEM_HPP +#define IMAGEEDITORUIITEM_HPP + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CFbsBitmap; + + +/* CLASS: CUiItem +* +* CUiItem represents an UI information item for a single Image Editor +* plug-in. +*/ +class CUiItem : public CBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return pointer to created CUiItem object + */ + IMPORT_C static CUiItem * NewL (); + + /** NewLC factory method, does not pop cleanupstack + * + * @param - + * @return pointer to created CUiItem object + */ + IMPORT_C static CUiItem * NewLC (); + + /** ComparePluginOrder + * + * Comparison method for CUiItem instances. + * + * @param aItem1 - item 1 + * @param aItem2 - item 2 + * @return - -1 if aItem1 is first in plug-in order + * @return - 1 if aItem2 is first in plug-in order + * @return - 0 otherwise + */ + IMPORT_C static TInt ComparePluginOrder ( + const CUiItem & aItem1, + const CUiItem & aItem2 + ); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CUiItem (); + + /** Setter/getter, PluginName, non-const + * + * @param - + * @return - plug-in name + */ + IMPORT_C TDes & PluginName(); + + /** Getter, PluginName, const + * + * @param - + * @return - plug-in name + */ + IMPORT_C const TDesC & PluginName() const; + + /** Setter/getter, PluginRID, non-const + * + * @param - + * @return - plug-in order inside group + */ + IMPORT_C TInt & PluginRID(); + + /** Getter, PluginRID, const + * + * @param - + * @return - plug-in order inside group + */ + IMPORT_C const TInt & PluginRID() const; + + /** Setter/getter, PluginOrder, non-const + * + * @param - + * @return - plug-in order inside group + */ + IMPORT_C TInt & PluginOrder(); + + /** Getter, PluginOrder, const + * + * @param - + * @return - plug-in order inside group + */ + IMPORT_C const TInt & PluginOrder() const; + + /** Setter/getter, GroupOrder, non-const + * + * @param - + * @return - plug-in order inside group + */ + IMPORT_C TInt & GroupOrder(); + + /** Getter, GroupOrder, const + * + * @param - + * @return - plug-in order inside group + */ + IMPORT_C const TInt & GroupOrder() const; + + /** Setter/getter, Icon, non-const + * + * @param - + * @return - icon bitmap + */ + IMPORT_C CFbsBitmap *& Icon(); + + /** Getter, Icon, const + * + * @param - + * @return - icon bitmap + */ + IMPORT_C const CFbsBitmap * Icon() const; + + /** Setter/getter, Mask, non-const + * + * @param - + * @return - icon bitmap + */ + IMPORT_C CFbsBitmap *& Mask(); + + /** Getter, Mask, const + * + * @param - + * @return - icon bitmap + */ + IMPORT_C const CFbsBitmap * Mask() const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + IMPORT_C CUiItem (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + IMPORT_C void ConstructL (); + + /** Copy constructor, disabled + */ + CUiItem (const CUiItem & rhs); + + /** Assignment operator, disabled + */ + CUiItem & operator= (const CUiItem & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in name + TBuf<64> iPluginName; + /// Plug-in run-time ID + TInt iPluginRID; + /// Plug-in order inside group + TInt iPluginOrder; + /// Group order + TInt iGroupOrder; + /// Icon bitmap + CFbsBitmap * iIcon; + /// Icon mask + CFbsBitmap * iMask; + +//@} + +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/PluginGrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/PluginGrid.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,295 @@ +/* +* 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: +* Effect plugin selection dialog that shows icons of available +* plugins. +* +*/ + + +#ifndef PLUGINGRID_H +#define PLUGINGRID_H + +#include +#include + +// FORWARD DECLARATIONS +class CFbsBitmap; +class CPluginInfo; +class CAknInfoPopupNoteController; +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +typedef RPointerArray RPluginArray; + +class CPluginGrid : public CCoeControl +{ + +public: + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CPluginGrid (CFbsBitmap** aBitmap, + const RPluginArray* aItems); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CPluginGrid (); + + /** Second phase constructor + * + * @param - + * @return - + */ + void ConstructL (); + + /** GetSelectedItemIndex + * + * @param - + * @return - Current item + */ + TInt GetSelectedItemIndex() const; + + /** OfferKeyEventL + * + * @see CCoeControl + */ + virtual TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + /** HandlePointerEventL + * + * @see CCoeControl + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + +public: //new methods + + /** GridRect + * + * Returns grids rectangle area + * + * @since S60 5.0 + * @param - + * @return TRect The area of the grid component (text field not included) + */ + TRect GridRect() const; + + /** HighlightedItemPressed + * + * This function can be used to check whether user has pressed (by stylus) + * currently highlighted plugin 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; + + /** ShowTooltip + * + * Shows a tooltip text on the screen next to the currently + * highlighted grid item. + * + * @since S60 5.0 + * @param aPopupController - pointer to popup note controller + * @param aCallingControl - pointer to a calling control + * @return - + */ + void ShowTooltip( CAknInfoPopupNoteController* aPopupController, + CCoeControl* aCallingControl ); + + /** CountComponentControls + * + * @see CCoeControl + * + */ + TInt CountComponentControls() const; + + /** ComponentControl + * + * @see CCoeControl + * + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; + + /** SizeChanged + * + * @see CCoeControl + */ + virtual void SizeChanged(); + +protected: + + /** Draw + * + * @see CCoeControl + */ + virtual void Draw( const TRect& aRect ) const; + +private: + + // Background image + CFbsBitmap** iBitmap; + // Plugin info array + const RPluginArray* iPluginItems; + // Current item index + TInt iCurrentItem; + // popup graphics + RPointerArray iBorders; + // highlight graphics + RPointerArray iHighlight; + // plugin icons + RPointerArray iIcons; + // title text + CEikLabel* iText; + + // Grid resolutions + TInt iNumberOfRows; + TInt iNumberOfColumns; + + // Grid layout + TSize iCellSize; + TRect iTouchGridRect; + TPoint iHighlightPos; + TRect iParentRect; + +}; + + +class CPluginSelectionDialog : public CAknDialog + { +public: + + /** RunDlgLD + * + * @param aBitmap - background bitmap + * @param aSelectedItem - selected item + * @param aItems - Plugin info item array + * @param aRect - Rect for the dialog + * @return - ExecuteLD() return value + */ + static TInt RunDlgLD(CFbsBitmap** aBitmap, + TInt& aSelectedItem, + const RPluginArray* aItems, + const TRect& aRect); + + /** Constructor + * + * @param aBitmap - background bitmap + * @param aSelectedItem - selected item + * @param aItems - Plugin info item array + * @return - + */ + CPluginSelectionDialog(CFbsBitmap** aBitmap, + TInt& aSelectedItem, + const RPluginArray* aItems); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CPluginSelectionDialog(); + + /** 2nd phase constructor + * + * @param aRect - Rect for the dialog + * @return - + */ + void ConstructL(const TRect& aRect); + + /** 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; + + /** SizeChanged + * + * + * @see CCoeControl + * + */ + virtual void SizeChanged(); + + /** OfferKeyEventL + * + * @see CCoeControl + * + */ + virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + /** CountComponentControls + * + * @see CCoeControl + * + */ + TInt CountComponentControls() const; + + /** ComponentControl + * + * @see CCoeControl + * + */ + virtual CCoeControl* ComponentControl(TInt aIndex) const; + +private: + /// Background bitmap + CFbsBitmap** iBitmap; + /// Plugin info array + const RPluginArray* iItems; + /// Selected item + TInt& iSelectedItem; + /// Selection grid + CPluginGrid* iGrid; + // Popup controller + CAknInfoPopupNoteController* iPopupController; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ + + }; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/TControlItem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/TControlItem.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,65 @@ +/* +* 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: +* +*/ + + +#ifndef TCONTROLITEM_H +#define TCONTROLITEM_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CCoeControl; +class CWindowGc; + +// CLASS DECLARATION +/** +* TIVControlItem class. +* +* @lib ImageViewer.dll +*/ +NONSHARABLE_CLASS( TControlItem ) + { + public: // Methods used from parent control + + void SetParent( CCoeControl* aParent ); + void SetItemRect( const TRect& aRect ); + void DrawItem( CWindowGc& aGc ) const; + + protected: // Methods used from derived sub item + + void DrawNow(); + + private: // Methods implemented in sub item + + virtual void Draw( CWindowGc& aGc ) const = 0; + virtual void SizeChanged() = 0; + + protected: // Data + + // Parent control (reference) + CCoeControl* iParent; + + // Sub item rect + TRect iRect; + }; + +#endif // TCONTROLITEM_H + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/inc/WaitIndicator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/inc/WaitIndicator.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,82 @@ +/* +* 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: +* +*/ + + +#ifndef CWAITINDICATOR_H +#define CWAITINDICATOR_H + +// INCLUDES +#include "TControlItem.h" +#include + +// FORWARD DECLARATIONS +class CWindowGc; +class CFbsBitmap; + +// CLASS DECLARATION +/** +* CWaitIndicator control class. +* +* +* @lib ImageEditor.app/ImageEditor.exe +* @since 2.6 +*/ +NONSHARABLE_CLASS( CWaitIndicator ) : private CTimer, public TControlItem + { + public: // Constructors and destructor + + static CWaitIndicator* NewL(); + ~CWaitIndicator(); + + public: // New functions + + TBool IsVisible(); + void Show(); + void Hide(); + + public: + + void SetRect( const TRect& aRect ); + void Draw( CWindowGc& aGc ) const; + + private: // From CTimer + + void RunL(); + + private: // From TIVControlItem + + void Draw( const TRect& aRect ) const; + void SizeChanged(); + + private: // Constructors and destructor + + CWaitIndicator(); + void ConstructL(); + + private: //data + + // Bitmaps and masks for wait note + RPointerArray iBitmaps; + + // Current index of waitnote bitmap animation + TInt iIndex; + + }; +#endif // CWAITINDICATOR_H + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/rom/ImageEditorUI.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/rom/ImageEditorUI.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IMAGEEDITORUI_IBY__ +#define __IMAGEEDITORUI_IBY__ + +// DLL +file=ABI_DIR\BUILD_DIR\ImageEditorUi.dll SHARED_LIB_DIR\ImageEditorUi.dll + +// Resources +data=DATAZ_\APP_BITMAP_DIR\ImageEditorUi.mif APP_BITMAP_DIR\ImageEditorUi.mif + +#endif // __IMAGEEDITORUI_IBY__ + +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/CMultiLineQueryDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/CMultiLineQueryDialog.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,102 @@ +/* +* 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: +* Class implementation. +* +*/ +/* +* ============================================================================ +* Name : CMultiLineQueryDialog.cpp +* Part of : Video Editor +* Interface : +* Description: +* Class implementation. +* Version : +* ============================================================================ +*/ + +// INCLUDES +#include "CMultiLineQueryDialog.h" +//#include "VideoEditorCommon.h" + +// CONSTANTS + +_LIT( KNewLine, "\n" ); + +// MEMBER FUNCTIONS + +// ----------------------------------------------------------------------------- +// CMultiLineQueryDialog::CMultiLineQueryDialog +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMultiLineQueryDialog::CMultiLineQueryDialog( TDes& aDataText, + const TTone& aTone /*= ENoTone*/ ) + : CAknTextQueryDialog( aDataText, aTone ) + { + } + +// ----------------------------------------------------------------------------- +// CMultiLineQueryDialog::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +EXPORT_C CMultiLineQueryDialog* CMultiLineQueryDialog::NewL( TDes& aDataText, + const TTone& aTone /*= ENoTone*/ ) + { + CMultiLineQueryDialog* self = new( ELeave ) CMultiLineQueryDialog( aDataText, aTone ); + return self; + } + + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// + +EXPORT_C CMultiLineQueryDialog::~CMultiLineQueryDialog() + { + } + +// ----------------------------------------------------------------------------- +// CMultiLineQueryDialog::OfferKeyEventL +// ----------------------------------------------------------------------------- +// +EXPORT_C TKeyResponse CMultiLineQueryDialog::OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ) + { + TKeyResponse response; + if ( aType == EEventKey && aKeyEvent.iCode == EKeyEnter ) + { + CAknQueryControl* control = static_cast( ControlOrNull( EGeneralQuery ) ); + CEikEdwin* edWin = static_cast( control->ControlByLayoutOrNull( EDataLayout ) ); + if (edWin) + { + edWin->GetText( iDataText ); + iDataText.Append( KNewLine ); + edWin->SetTextL( &iDataText ); + edWin->ClearSelectionL(); + } + response = EKeyWasConsumed; + } + else + { + response = CAknTextQueryDialog::OfferKeyEventL( aKeyEvent, aType ); + } + + return response; + } + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/ColorSelectionGrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/ColorSelectionGrid.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,384 @@ +/* +* 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: +* +*/ + + +// INCLUDE +#include +#include +#include +#include +#include +#include + +#include "ColorSelectionGrid.h" +#include "ResolutionUtil.h" + +const TInt KColorGridRows = 8; +const TInt KColorGridCols = 14; + +const TInt KStandardGridSizeWidth = 12; +const TInt KStandardGridSizeHeight = 12; +const TInt KQVGAGridSizeWidth = 15; +const TInt KQVGAGridSizeHeight = 15; +const TInt KDoubleGridSizeWidth = 24; +const TInt KDoubleGridSizeHeight = 24; +const TInt KHVGAGridSizeWidth = 20; +const TInt KHVGAGridSizeHeight = 20; +const TInt KVGAGridSizeWidth = 31; +const TInt KVGAGridSizeHeight = 26; +const TInt KQHDGridSizeWidth = 22; +const TInt KQHDGridSizeHeight = 22; + +const TInt KStandardIconSizeWidth = 9; +const TInt KStandardIconSizeHeight = 9; +const TInt KQVGAIconSizeWidth = 11; +const TInt KQVGAIconSizeHeight = 11; +const TInt KDoubleIconSizeWidth = 18; +const TInt KDoubleIconSizeHeight = 18; +const TInt KHVGAIconSizeWidth = 15; +const TInt KHVGAIconSizeHeight = 15; +const TInt KVGAIconSizeWidth = 26; +const TInt KVGAIconSizeHeight = 22; +const TInt KQHDIconSizeWidth = 17; +const TInt KQHDIconSizeHeight = 17; + + + +//============================================================================= +EXPORT_C CColorSelectionGrid::CColorSelectionGrid () +: CAknGrid () +{ + +} + +//============================================================================= +EXPORT_C CColorSelectionGrid::~CColorSelectionGrid () +{ + +} + +//============================================================================= +EXPORT_C void CColorSelectionGrid::ConstructL ( + const CCoeControl * aParent, + TInt aFlags + ) +{ + // Construct base instance + CAknGrid::ConstructL (aParent, aFlags); + + // Get the screen mode from the Resolution Util + TInt screenMode = CResolutionUtil::Self()->GetScreenMode(); + + switch (screenMode) + { + + case CResolutionUtil::EDouble: + case CResolutionUtil::EDoubleFullScreen: + case CResolutionUtil::EDoubleLandscape: + case CResolutionUtil::EDoubleLandscapeFullScreen: + { + iGridSize.SetSize( + KDoubleGridSizeWidth, + KDoubleGridSizeHeight); + + iIconSize.SetSize( + KDoubleIconSizeWidth, + KDoubleIconSizeHeight); + break; + + } + // QVGA + case CResolutionUtil::EQVGA: + case CResolutionUtil::EQVGAFullScreen: + case CResolutionUtil::EQVGALandscape: + case CResolutionUtil::EQVGALandscapeFullScreen: + { + iGridSize.SetSize( + KQVGAGridSizeWidth, + KQVGAGridSizeHeight); + + iIconSize.SetSize( + KQVGAIconSizeWidth, + KQVGAIconSizeHeight); + + break; + } + // HVGA + case CResolutionUtil::EHVGA: + case CResolutionUtil::EHVGAFullScreen: + case CResolutionUtil::EHVGALandscape: + case CResolutionUtil::EHVGALandscapeFullScreen: + { + iGridSize.SetSize( + KHVGAGridSizeWidth, + KHVGAGridSizeHeight); + + iIconSize.SetSize( + KHVGAIconSizeWidth, + KHVGAIconSizeHeight); + + break; + } + // VGA + case CResolutionUtil::EVGA: + case CResolutionUtil::EVGAFullScreen: + case CResolutionUtil::EVGALandscape: + case CResolutionUtil::EVGALandscapeFullScreen: + { + iGridSize.SetSize( + KVGAGridSizeWidth, + KVGAGridSizeHeight); + + iIconSize.SetSize( + KVGAIconSizeWidth, + KVGAIconSizeHeight); + + break; + } + // QHD + case CResolutionUtil::EQHD: + case CResolutionUtil::EQHDFullScreen: + case CResolutionUtil::EQHDLandscape: + case CResolutionUtil::EQHDLandscapeFullScreen: + { + iGridSize.SetSize( + KQHDGridSizeWidth, + KQHDGridSizeHeight); + + iIconSize.SetSize( + KQHDIconSizeWidth, + KQHDIconSizeHeight); + + break; + } + default: + { + iGridSize.SetSize( + KStandardGridSizeWidth, + KStandardGridSizeHeight); + + iIconSize.SetSize( + KStandardIconSizeWidth, + KStandardIconSizeHeight); + + break; + } + } + // Set grid layout + SetLayoutL ( + EFalse, + ETrue, + ETrue, + KColorGridCols, + KColorGridRows, + iGridSize); + + // Set scroll bar invisible + ScrollBarFrame()-> + SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, + CEikScrollBarFrame::EOff ); + + SetPrimaryScrollingType (CAknGridView::EScrollStops); + SetSecondaryScrollingType (CAknGridView::EScrollStops); + + SetCurrentDataIndex (0); + + // Set up the icons + SetupGridIconsL (); + + // Draw the grid + SizeChanged(); +} + +//============================================================================= +EXPORT_C void CColorSelectionGrid::SizeChanged() +{ + CAknGrid::SizeChanged(); + SetupGrid(); +} + +//============================================================================= +void CColorSelectionGrid::SetupGridIconsL () +{ + // Create icon array + CArrayPtr* icons = + new (ELeave) CAknIconArray (KColorGridRows * KColorGridCols); + CleanupStack::PushL(icons); + + // Get reference to grid item text array + MDesCArray * array = Model()->ItemTextArray(); + CDesCArray * cArray = static_cast(array); + + // Create icon bitmaps and add them to the array + TInt index = 0; + for (TInt i = 0; i < KColorGridRows; ++i) + { + for (TInt j = 0; j < KColorGridCols; ++j) + { + // Create grid item bitmap + CFbsBitmap * bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL( bitmap ); + User::LeaveIfError (bitmap->Create (iIconSize, EColor64K) ); + + // Compute color for bitmap + TRgb color (255, 255, 255); + if (j == 0) + { + color = HSLtoRGB (0.0, 0.0, i * (1.0 / 7.0)); + + } + else + { + color = HSLtoRGB (i * (360.0 / 8.0), 1.0, j * (1.0 / 14.0)); + } + + // 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; + } + CleanupStack::PopAndDestroy(); // LockHeapLC() + + // Add item to the grid + icons->AppendL ( CGulIcon::NewL (bitmap, 0) ); + + CleanupStack::Pop(); // bitmap + + // Create grid item text + TBuf<256> buf; + buf.AppendNum (index); + buf.Append(KAknStripTabs); + buf.AppendNum ((TInt)color.Value()); + cArray->AppendL (buf); + ++index; + } + } + CleanupStack::Pop(icons); // icons + + // Set icons to the grid + ItemDrawer()->FormattedCellData()->SetIconArray(icons); + + // Handle item addition + HandleItemAdditionL(); +} + +//============================================================================= +void CColorSelectionGrid::SetupGrid () +{ + // Setup text foreground and background colours to default + AknListBoxLayouts::SetupStandardGrid (*this); + + // Get local copies of data we will need + CFormattedCellListBoxItemDrawer * itemDrawer = this->ItemDrawer(); + TInt cell_w = ColumnWidth(); + TInt cell_h = ItemHeight(); + + // Set up graphics sub-cells + AknListBoxLayouts::SetupFormGfxCell ( + *this, // the grid + itemDrawer, // the grid's drawer + 0, // index of the graphic within item strings + 0, // left position + 0, // top position + 0, // right - unused + 0, // bottom - unused + cell_w , // width of graphic + cell_h, // height of graphic + TPoint (0, 0), // start position + TPoint (cell_w, cell_h) // end position + ); +} + +//============================================================================= +TRgb CColorSelectionGrid::HSLtoRGB ( + const TReal aH, + const TReal aS, + const TReal aL + ) const +{ + TRgb rgb; + + if (aS == 0.0) + { + rgb.SetRed ((TInt)(aL * 255.0)); + rgb.SetGreen((TInt)(aL * 255.0)); + rgb.SetBlue((TInt)(aL * 255.0)); + } + else + { + TReal rm1, rm2; + if (aL <= 0.5) + { + rm2 = aL + aL * aS; + } + else + { + rm2 = aL + aS - aL * aS; + } + rm1 = 2.0 * aL - rm2; + + rgb.SetRed (ToRGB (rm1, rm2, aH + 120.0)); + rgb.SetGreen (ToRGB (rm1, rm2, aH)); + rgb.SetBlue (ToRGB (rm1, rm2, aH - 120.0)); + } + + return rgb; +} + +//============================================================================= +TInt CColorSelectionGrid::ToRGB ( + TReal aRM1, + TReal aRM2, + TReal aRH + ) const +{ + if (aRH > 360.0) + { + aRH -= 360.0; + } + else if (aRH < 0.0) + { + aRH += 360.0; + } + + if (aRH < 60.0) + { + aRM1 = aRM1 + (aRM2 - aRM1) * aRH / 60.0; + } + else if (aRH < 180.0) + { + aRM1 = aRM2; + } + else if (aRH < 240.0) + { + aRM1 = aRM1 + (aRM2 - aRM1) * (240.0f - aRH) / 60.0; + } + return (TInt)(aRM1 * 255.0); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/ColorSelectionPopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/ColorSelectionPopup.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,966 @@ +/* +* 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: +* Color selection popup dialog that shows a color grid. +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include +#include + +#include "ResolutionUtil.h" +#include "ColorSelectionPopup.h" +#include "ImageEditorUiDefs.h" + +// CONSTANTS +const TInt KGridColumnCount = 7; +const TInt KGridRowCount = 5; +const TInt KInitialItemIndex = 0; + +//============================================================================= +CColorSelectionPopup::CColorSelectionPopup() + { + + } + +//============================================================================= +CColorSelectionPopup::~CColorSelectionPopup() + { + + 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(); + iRGBArray.Close(); + } + +//============================================================================= +void CColorSelectionPopup::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 ); + + iCurrentItem = KInitialItemIndex; + + // Activate control + ActivateL(); + + } + +//============================================================================= +void CColorSelectionPopup::CreateColorBitmapsL( TSize aSize ) + { + // Color constants shown on the grid + // R indicates the row index and C the column index + const TRgb KColor_R1C1 (0, 0, 0); + const TRgb KColor_R1C2 (65, 0, 175); + const TRgb KColor_R1C3 (0, 30, 128); + const TRgb KColor_R1C4 (0, 80, 100); + const TRgb KColor_R1C5 (0, 65, 0); + const TRgb KColor_R1C6 (85, 55, 0); + const TRgb KColor_R1C7 (120, 0, 0); + const TRgb KColor_R2C1 (75, 75, 75); + const TRgb KColor_R2C2 (128, 0, 255); + const TRgb KColor_R2C3 (0, 65, 175); + const TRgb KColor_R2C4 (0, 145, 165); + const TRgb KColor_R2C5 (0, 128, 0); + const TRgb KColor_R2C6 (128, 65, 0); + const TRgb KColor_R2C7 (128, 0, 65); + const TRgb KColor_R3C1 (150, 150, 150); + const TRgb KColor_R3C2 (255, 0, 128); + const TRgb KColor_R3C3 (0, 50, 255); + const TRgb KColor_R3C4 (0, 165, 255); + const TRgb KColor_R3C5 (0, 255, 0); + const TRgb KColor_R3C6 (255, 128, 0); + const TRgb KColor_R3C7 (255, 0, 0); + const TRgb KColor_R4C1 (225, 225, 225); + const TRgb KColor_R4C2 (255, 0, 255); + const TRgb KColor_R4C3 (50, 145, 255); + const TRgb KColor_R4C4 (0, 255, 255); + const TRgb KColor_R4C5 (128, 255, 0); + const TRgb KColor_R4C6 (255, 255, 0); + const TRgb KColor_R4C7 (255, 115, 115); + const TRgb KColor_R5C1 (255, 255, 255); + const TRgb KColor_R5C2 (255, 128, 255); + const TRgb KColor_R5C3 (180, 210, 255); + const TRgb KColor_R5C4 (128, 255, 255); + const TRgb KColor_R5C5 (180, 255, 180); + const TRgb KColor_R5C6 (255, 255, 128); + const TRgb KColor_R5C7 (255, 128, 180); + + // Read rgb values into an array + iRGBArray.Reset(); + iRGBArray.Append( KColor_R1C1 ); + iRGBArray.Append( KColor_R1C2 ); + iRGBArray.Append( KColor_R1C3 ); + iRGBArray.Append( KColor_R1C4 ); + iRGBArray.Append( KColor_R1C5 ); + iRGBArray.Append( KColor_R1C6 ); + iRGBArray.Append( KColor_R1C7 ); + iRGBArray.Append( KColor_R2C1 ); + iRGBArray.Append( KColor_R2C2 ); + iRGBArray.Append( KColor_R2C3 ); + iRGBArray.Append( KColor_R2C4 ); + iRGBArray.Append( KColor_R2C5 ); + iRGBArray.Append( KColor_R2C6 ); + iRGBArray.Append( KColor_R2C7 ); + iRGBArray.Append( KColor_R3C1 ); + iRGBArray.Append( KColor_R3C2 ); + iRGBArray.Append( KColor_R3C3 ); + iRGBArray.Append( KColor_R3C4 ); + iRGBArray.Append( KColor_R3C5 ); + iRGBArray.Append( KColor_R3C6 ); + iRGBArray.Append( KColor_R3C7 ); + iRGBArray.Append( KColor_R4C1 ); + iRGBArray.Append( KColor_R4C2 ); + iRGBArray.Append( KColor_R4C3 ); + iRGBArray.Append( KColor_R4C4 ); + iRGBArray.Append( KColor_R4C5 ); + iRGBArray.Append( KColor_R4C6 ); + iRGBArray.Append( KColor_R4C7 ); + iRGBArray.Append( KColor_R5C1 ); + iRGBArray.Append( KColor_R5C2 ); + iRGBArray.Append( KColor_R5C3 ); + iRGBArray.Append( KColor_R5C4 ); + iRGBArray.Append( KColor_R5C5 ); + iRGBArray.Append( KColor_R5C6 ); + iRGBArray.Append( KColor_R5C7 ); + + // Generate color bitmaps + iColorBitmapsArray.ResetAndDestroy(); + for( TInt i = 0; i < iRGBArray.Count(); i++ ) + { + CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap; + CleanupStack::PushL( bitmap ); + User::LeaveIfError ( bitmap->Create ( aSize, EColor64K ) ); + + // Compute color for bitmap + TRgb color( 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 CColorSelectionPopup::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 ); + + // a trick that sets the highligh more or less to correct position in + // right-to-left languages. + if ( !AknLayoutUtils::LayoutMirrored() ) + { + gc.SetPenSize( TSize(2,2) ); + } + else + { + gc.SetPenSize( TSize(1,1) ); + } + + 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 = CEikonEnv::Static()->AllocReadResourceLC ( R_SELECT_COLOUR ); + + 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 CColorSelectionPopup::SizeChanged() + { + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_trans_window(0) ); + TRect parentRect = layoutRect.Rect(); + + TAknLayoutRect iconLayout; + if ( !AknLayoutUtils::LayoutMirrored() ) + { + 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(); + } + else + { + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g1()); + iPopupCenterRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3()); + iPopupCornerTLRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2()); + iPopupCornerTRRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5()); + iPopupCornerBLRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4()); + iPopupCornerBRRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7()); + iPopupSideLRect = iconLayout.Rect(); + + iconLayout.LayoutRect( parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6()); + 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 cellRect = iconLayout.Rect(); + + iconLayout.LayoutRect( cellRect, + AknLayoutScalable_Apps::hgihlgiht_grid_pane_cp016(0)); + + TRect highlightRect = iconLayout.Rect(); + iHighlightRectsArray.Append( highlightRect ); + + iconLayout.LayoutRect( cellRect, + 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 CColorSelectionPopup::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 ( !AknLayoutUtils::LayoutMirrored() ) + { + if (iCurrentItem == 0) + { + iCurrentItem = iGridRectsArray.Count() - 1; + } + else + { + iCurrentItem--; + } + } + else + { + iCurrentItem++; + if (iCurrentItem >= iGridRectsArray.Count()) + { + iCurrentItem = 0; + } + } + + res = EKeyWasConsumed; + break; + } + + case EKeyRightArrow: + case 54: // numeric keypad '6' + { + if ( !AknLayoutUtils::LayoutMirrored() ) + { + iCurrentItem++; + if (iCurrentItem >= iGridRectsArray.Count()) + { + iCurrentItem = 0; + } + } + else + { + if (iCurrentItem == 0) + { + iCurrentItem = iGridRectsArray.Count() - 1; + } + else + { + iCurrentItem--; + } + } + + 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 CColorSelectionPopup::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 CColorSelectionPopup::GridRect() const + { + return iPopupCenterRect; + } + +//============================================================================= +TBool CColorSelectionPopup::HighlightedItemPressed( TPoint aPosition ) const + { + TRect iconRect = iHighlightRectsArray[ iCurrentItem ]; + + if (iconRect.Contains( aPosition )) + { + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= +TRgb CColorSelectionPopup::GetSelectedColor() const + { + return iRGBArray[iCurrentItem]; + } + +//============================================================================= +void CColorSelectionPopup::SetSelectedColor(TRgb aRgb) + { + for( TInt i = 0; i < iRGBArray.Count(); i++ ) + { + if (iRGBArray[i] == aRgb) + { + iCurrentItem = i; + break; + } + } + } + + +//============================================================================= +// DIALOG +//============================================================================= +TInt CColorSelectionDialog::RunDlgLD( const CFbsBitmap* aBitmap, + const TRect& aRect, + TRgb& aRgb ) + { + CColorSelectionDialog* dialog = + new (ELeave) CColorSelectionDialog ( aRgb ); + dialog->ConstructL( aBitmap, aRect); + return dialog->ExecuteLD( R_IMAGE_EDITOR_COLOR_DIALOG ); + } + +//============================================================================= +CColorSelectionDialog::CColorSelectionDialog( TRgb& aRgb ) +: iCurrentRgb( aRgb ) + { + } + +//============================================================================= +CColorSelectionDialog::~CColorSelectionDialog() + { + delete iPopup; + } + +//============================================================================= + +void CColorSelectionDialog::ConstructL( const CFbsBitmap* aBitmap, + const TRect& aRect ) + { + iPopup = new ( ELeave ) CColorSelectionPopup(); + iPopup->ConstructL( this ); + + SetRect(aRect); + + // Not drawn correctly if calling SetRect() + iPopup->SetSize(aRect.Size()); + iPopup->SetPosition(TPoint(0,0)); + iPopup->SetImageL( aBitmap ); + iPopup->SetSelectedColor( iCurrentRgb ); + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + } + +//============================================================================= +TBool CColorSelectionDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect) + { + iCurrentRgb = iPopup->GetSelectedColor(); + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= +void CColorSelectionDialog::Draw(const TRect& /*aRect*/) const + { + } + +//============================================================================= +void CColorSelectionDialog::SizeChanged() + { + iPopup->SetSize( Rect().Size() ); + } + +//============================================================================= +void CColorSelectionDialog::PreLayoutDynInitL() + { + } + + +//============================================================================= +TInt CColorSelectionDialog::CountComponentControls() const + { + return 1; + } + +//============================================================================= +CCoeControl* CColorSelectionDialog::ComponentControl(TInt /*aIndex*/) const + { + return iPopup; + } + +//============================================================================= +TKeyResponse CColorSelectionDialog::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 CColorSelectionDialog::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 ) ) + { +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::CColorSelectionDialog: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + iPopup->HandlePointerEventL( aPointerEvent ); + draw = ETrue; + } + break; + } + case TPointerEvent::EDrag: + { + if ( iPopup->GridRect().Contains( aPointerEvent.iPosition ) ) + { +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackSensitive ); + RDebug::Printf( "ImageEditor::CColorSelectionDialog: ETouchFeedbackSensitive" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + 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 + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/DrawUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/DrawUtils.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,509 @@ +/* +* 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: +* Utils class for helping in drawing. +* +*/ + + +// CAknTextQueryDialog +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "ResolutionUtil.h" +#include "ImageEditorUiDefs.h" +#include "DrawUtils.h" +#include "ColorSelectionGrid.h" +#include "colorselectionpopup.h" +#include "CMultiLineQueryDialog.h" + +//============================================================================= +EXPORT_C void SDrawUtils::DrawGuide ( + CGraphicsContext & aGc, + const TRect & aRect, + const TGuideType aType, + const TRgb & aColor + ) +{ + + // Set graphics context parameters + aGc.SetPenStyle (CGraphicsContext::ESolidPen); + aGc.SetPenColor (aColor); + aGc.SetBrushStyle (CGraphicsContext::ESolidBrush); + aGc.SetBrushColor (aColor); + + switch (aType) + { + case EGuideTypeUp: + { + TInt colstart = ((aRect.iBr.iX + aRect.iTl.iX) >> 1) + 1; + TInt colstop = colstart + 1; + for (TInt i = aRect.iTl.iY; i <= aRect.iBr.iY; ++i, --colstart, ++colstop) + { + aGc.DrawLine (TPoint (colstart, i), TPoint (colstop, i)); + } + break; + } + case EGuideTypeDown: + { + TInt colstart = ((aRect.iBr.iX + aRect.iTl.iX) >> 1) + 1; + TInt colstop = colstart + 1; + for (TInt i = aRect.iBr.iY; i >= aRect.iTl.iY; --i, --colstart, ++colstop) + { + aGc.DrawLine (TPoint (colstart, i), TPoint (colstop, i)); + } + break; + } + case EGuideTypeLeft: + { + TInt rowstart = ((aRect.iBr.iY + aRect.iTl.iY) >> 1) + 1; + TInt rowstop = rowstart + 1; + for (TInt i = aRect.iTl.iX; i <= aRect.iBr.iX; ++i, --rowstart, ++rowstop) + { + aGc.DrawLine (TPoint (i, rowstart), TPoint (i, rowstop)); + } + break; + } + case EGuideTypeRight: + { + TInt rowstart = ((aRect.iBr.iY + aRect.iTl.iY) >> 1) + 1; + TInt rowstop = rowstart + 1; + for (TInt i = aRect.iBr.iX; i >= aRect.iTl.iX; --i, --rowstart, ++rowstop) + { + aGc.DrawLine (TPoint (i, rowstart), TPoint (i, rowstop)); + } + break; + } + default: + { + break; + } + + } +} + +//============================================================================= +EXPORT_C void SDrawUtils::DrawBeveledRect ( + CGraphicsContext & aGc, + const TRect & aRect, + const TRgb & aColor, + const TRgb & aLight, + const TRgb & aShadow + ) +{ + // Set graphics context parameters + aGc.SetPenStyle (CGraphicsContext::ESolidPen); + aGc.SetPenColor (aShadow); + aGc.SetBrushStyle (CGraphicsContext::ESolidBrush); + aGc.SetBrushColor (aColor); + + // Draw shadow + rectangle area + aGc.DrawRect (aRect); + + // Get corners + TInt ulc = aRect.iTl.iX; + TInt ulr = aRect.iTl.iY; + TInt lrc = aRect.iBr.iX; + TInt lrr = aRect.iBr.iY; + + // Draw light + aGc.SetPenColor (aLight); + aGc.DrawLine ( TPoint(lrc - 1, ulr + 1), TPoint(lrc - 1, lrr)); + aGc.DrawLine ( TPoint(ulc + 1, lrr - 1), TPoint(lrc - 1, lrr - 1)); + +} + +//============================================================================= +EXPORT_C void SDrawUtils::DrawFlatRect ( + CGraphicsContext & aGc, + const TRect & aRect, + const TRgb & aColor, + const TRgb & aLight, + const TRgb & aShadow + ) +{ + // Set graphics context parameters + aGc.SetPenStyle (CGraphicsContext::ESolidPen); + aGc.SetPenColor (aShadow); + aGc.SetBrushStyle (CGraphicsContext::ESolidBrush); + aGc.SetBrushColor (aColor); + + // Get corners + TInt ulc = aRect.iTl.iX; + TInt ulr = aRect.iTl.iY; + TInt lrc = aRect.iBr.iX; + TInt lrr = aRect.iBr.iY; + + // Draw shadow + rectangle area + aGc.DrawRect (TRect (ulc, ulr, lrc - 1, lrr - 1)); + + // Draw light + aGc.SetPenColor (aLight); + aGc.DrawLine ( TPoint(lrc - 1, ulr), TPoint(lrc - 1, lrr)); + aGc.DrawLine ( TPoint(ulc, lrr - 1), TPoint(lrc, lrr - 1)); + aGc.DrawLine ( TPoint(ulc + 1, ulr + 1), TPoint(lrc - 2, ulr + 1)); + aGc.DrawLine ( TPoint(ulc + 1, ulr + 2), TPoint(ulc + 1, lrr - 2)); +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchQueryDialogL (const TDesC & aPrompt) +{ + CAknQueryDialog * dlg = + new (ELeave) CAknQueryDialog ( const_cast(aPrompt) ); + + return dlg->ExecuteLD (R_IMAGE_EDITOR_CONFIRMATION_QUERY); +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchQueryDialogOkOnlyL (const TDesC & aPrompt) +{ + CAknQueryDialog * dlg = + new (ELeave) CAknQueryDialog ( const_cast(aPrompt) ); + + return dlg->ExecuteLD (R_IMAGE_EDITOR_CONFIRMATION_QUERY_OK_ONLY); +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchTextQueryDialogL ( + TDes & aData, + const TDesC & aPrompt + ) +{ + // Create a query dialog + CAknTextQueryDialog * dlg = + new (ELeave) CAknTextQueryDialog (aData); + + // Enable predictive input + dlg->SetPredictiveTextInputPermitted(ETrue); + + // Execute query dialog + return dlg->ExecuteLD (R_IMAGE_EDITOR_TEXT_QUERY, aPrompt); +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchMultiLineTextQueryDialogL ( + TDes & aData, + const TDesC & aPrompt + ) +{ + // Create a query dialog + CMultiLineQueryDialog* dlg = CMultiLineQueryDialog::NewL( aData ); + + // Enable predictive input + dlg->SetPredictiveTextInputPermitted( ETrue ); + + // Execute query dialog + return dlg->ExecuteLD ( R_IMAGE_EDITOR_TEXT_QUERY, aPrompt ); +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchListQueryDialogL ( + MDesCArray * aTextItems, + const TDesC & aPrompt + ) +{ + // Selected text item index + TInt index (-1); + + // Create a new list dialog + CAknListQueryDialog * dlg = new (ELeave) CAknListQueryDialog (&index); + + // Prepare list query dialog + dlg->PrepareLC (R_IMAGE_EDITOR_LIST_QUERY); + + // Set heading + dlg->QueryHeading()->SetTextL (aPrompt); + + // Set text item array + dlg->SetItemTextArray (aTextItems); + + // Set item ownership + dlg->SetOwnershipType (ELbmDoesNotOwnItemArray); + + // Execute + if (dlg->RunLD()) + { + return index; + } + else + { + return -1; + } +} + +//============================================================================= +EXPORT_C void SDrawUtils::LaunchWaitNoteL ( + CAknWaitDialog** aSelfPtr, + TInt aResourceID, + const TDesC & aPrompt, + MProgressDialogCallback* aCallback + ) +{ + (*aSelfPtr) = new (ELeave) CAknWaitDialog ( (CEikDialog**)aSelfPtr, ETrue); + (*aSelfPtr)->SetTextL ( aPrompt ); + (*aSelfPtr)->ExecuteLD (aResourceID); + if (aCallback) + { + (*aSelfPtr)->SetCallback (aCallback); + } +} + +//============================================================================= +EXPORT_C void SDrawUtils::LaunchProgressNoteL ( + CAknProgressDialog** aSelfPtr, + TInt aResourceID, + const TDesC & aPrompt, + TInt aFinalValue, + MProgressDialogCallback* aCallback + ) +{ + (*aSelfPtr) = new (ELeave) CAknWaitDialog ( (CEikDialog**)aSelfPtr, ETrue); + (*aSelfPtr)->PrepareLC(aResourceID); + (*aSelfPtr)->GetProgressInfoL()->SetFinalValue (aFinalValue); + (*aSelfPtr)->SetTextL ( aPrompt ); + if (aCallback) + { + (*aSelfPtr)->SetCallback (aCallback); + } + (*aSelfPtr)->RunLD(); +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchColorSelectionGridL (TRgb & aColor) +{ + + CColorSelectionGrid * grid = new (ELeave) CColorSelectionGrid; + CleanupStack::PushL(grid); + + CAknPopupList * popup_list = + CAknPopupList::NewL (grid, R_AVKON_SOFTKEYS_SELECT_BACK__SELECT); + CleanupStack::PushL (popup_list); + + grid->ConstructL (popup_list, CEikListBox::ELeftDownInViewRect); + + // Create dialog prompt + HBufC * prompt = + grid->ControlEnv()->AllocReadResourceLC (R_SELECT_COLOUR); + + popup_list->SetTitleL ( prompt->Des() ); + + CleanupStack::PopAndDestroy(); // prompt + + TInt popup_ok = popup_list->ExecuteLD(); + CleanupStack::Pop(); // popupList + if (popup_ok) + { + // Get the selected item descriptor from the grid + TInt index = grid->CurrentDataIndex(); + TPtrC ptr = grid->Model()->MatchableTextArray()->MdcaPoint (index); + + // Extract the color information from the descriptor + TInt i = ptr.Locate (TChar('\t')); + if( i != KErrNotFound ) + { + TBuf<32> colordes; + colordes.Copy ( ptr.Mid ( i + 1 ) ); + TLex val (colordes); + val.SkipSpace(); + TInt color = 0; + val.Val (color); + aColor.SetRed (color & 0xFF); + aColor.SetGreen ((color >> 8) & 0xFF); + aColor.SetBlue ((color >> 16) & 0xFF); + } + } + CleanupStack::PopAndDestroy(); // grid + + return popup_ok; +} + +//============================================================================= +EXPORT_C TInt SDrawUtils::LaunchColorSelectionPopupL (const CFbsBitmap* aPreview, + TRect aRect, + TRgb & aColor) + { + TInt dialog_ok = CColorSelectionDialog::RunDlgLD( aPreview, aRect, aColor); + + return dialog_ok; + } + +//============================================================================= +EXPORT_C TInt SDrawUtils::GetIndicatorBitmapL ( + CFbsBitmap *& aChBitmap, + CFbsBitmap *& aChMask, + TInt aBmpIndex, + TInt aMaskIndex + ) +{ + + // Get the icon file name + TFileName iconFile (KImageEditorUiMifFile); + User::LeaveIfError( CompleteWithAppPath(iconFile) ); + + // Create bitmap and mask + AknIconUtils::CreateIconL ( + aChBitmap, + aChMask, + iconFile, + aBmpIndex, + aMaskIndex + ); + + // Get the screen mode from the Resolution Util + TInt screenMode = CResolutionUtil::Self()->GetScreenMode(); + TSize bitmapSize; + + switch( screenMode ) + { + // small screen sizes + case CResolutionUtil::EStandard: + case CResolutionUtil::EStandardFullScreen: + case CResolutionUtil::EStandardLandscape: + case CResolutionUtil::EStandardLandscapeFullScreen: + case CResolutionUtil::ESquare: + case CResolutionUtil::ESquareFullScreen: + case CResolutionUtil::ESquareRotated: + case CResolutionUtil::ESquareRotatedFullScreen: + { + bitmapSize = TSize (KStandardCrosshairWidth, KStandardCrosshairHeight); + break; + } + + // big screen sizes + case CResolutionUtil::EQVGA: + case CResolutionUtil::EQVGAFullScreen: + case CResolutionUtil::EQVGALandscape: + case CResolutionUtil::EQVGALandscapeFullScreen: + { + bitmapSize = TSize (KQVGACrosshairWidth, KQVGACrosshairHeight); + break; + } + + case CResolutionUtil::EDouble: + case CResolutionUtil::EDoubleFullScreen: + case CResolutionUtil::EDoubleLandscape: + case CResolutionUtil::EDoubleLandscapeFullScreen: + { + bitmapSize = TSize (KDoubleCrosshairWidth, KDoubleCrosshairHeight); + break; + } + + // HVGA + case CResolutionUtil::EHVGA: + case CResolutionUtil::EHVGAFullScreen: + case CResolutionUtil::EHVGALandscape: + case CResolutionUtil::EHVGALandscapeFullScreen: + { + bitmapSize = TSize (KHVGACrosshairWidth, KHVGACrosshairHeight); + break; + } + + // VGA + case CResolutionUtil::EVGA: + case CResolutionUtil::EVGAFullScreen: + case CResolutionUtil::EVGALandscape: + case CResolutionUtil::EVGALandscapeFullScreen: + { + bitmapSize = TSize (KVGACrosshairWidth, KVGACrosshairHeight); + break; + } + + // QHD + case CResolutionUtil::EQHD: + case CResolutionUtil::EQHDFullScreen: + case CResolutionUtil::EQHDLandscape: + case CResolutionUtil::EQHDLandscapeFullScreen: + { + bitmapSize = TSize (KVGACrosshairWidth, KVGACrosshairHeight); + break; + } + + default: + { + bitmapSize = TSize (KStandardCrosshairWidth, KStandardCrosshairHeight); + break; + } + } + + // Set size for scalable icons - MUST BE CALLED BEFORE ICON IS USABLE + AknIconUtils::SetSize( aChBitmap, bitmapSize ); + + return KErrNone; +} + +//============================================================================= +EXPORT_C void SDrawUtils::ShowToolTip ( + CAknInfoPopupNoteController* aPopupController, + CCoeControl* aCallingControl, + TRect aPositionRect, + const TDesC& aText ) + { + TPoint controlPosition( 0, 0 ); + if ( AknsUtils::GetControlPosition( aCallingControl, + controlPosition ) != KErrNone ) + { + controlPosition = aCallingControl->PositionRelativeToScreen(); + } + + // add calling control's relative position to rect coordinates + TRect positionRect( TPoint( aPositionRect.iTl.iX + controlPosition.iX, + aPositionRect.iTl.iY + controlPosition.iY ), + aPositionRect.Size() ); + if( aPopupController ) + { + aPopupController->SetTextL( aText ); + aPopupController->SetTimePopupInView( KTimeTooltipInView ); + aPopupController->SetTooltipModeL( ETrue ); + aPopupController->SetPositionByHighlight( positionRect ); + aPopupController->ShowInfoPopupNote(); + } + + } + +//============================================================================= +EXPORT_C void SDrawUtils::ShowToolTip ( + CAknInfoPopupNoteController* aPopupController, + CCoeControl* aCallingControl, + TPoint aPosition, + TGulAlignmentValue aAlignment, + const TDesC& aText ) + { + TPoint controlPosition( 0, 0 ); + if ( AknsUtils::GetControlPosition( aCallingControl, + controlPosition ) != KErrNone ) + { + controlPosition = aCallingControl->PositionRelativeToScreen(); + } + + // add calling control's relative position to coordinates + TPoint finalPosition = TPoint( aPosition.iX + controlPosition.iX, + aPosition.iY + controlPosition.iY ); + if( aPopupController ) + { + aPopupController->SetTextL( aText ); + aPopupController->SetTimePopupInView( KTimeTooltipInView ); + aPopupController->SetTooltipModeL( ETrue ); + aPopupController->SetPositionAndAlignment( finalPosition, aAlignment ); + aPopupController->ShowInfoPopupNote(); + } + } +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/HorizontalSlider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/HorizontalSlider.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,326 @@ +/* +* 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: +* +*/ + + +// INCLUDE +#include +#include +#include +#include +#include + +#include +#include +#include "ResolutionUtil.h" +#include "ImageEditorUiDefs.h" +#include "HorizontalSlider.h" +#include "CustomControlPanics.h" + +// constants +const TInt KBorderPartsNum = 9; +const TInt KSliderPartsNum = 4; + +//============================================================================= +EXPORT_C CHorizontalSlider* CHorizontalSlider::NewL(const TRect& aRect, const CCoeControl& aControl) + { + CHorizontalSlider* self = CHorizontalSlider::NewLC(aRect, aControl); + CleanupStack::Pop(self); + return self; + } + +//============================================================================= +EXPORT_C CHorizontalSlider* CHorizontalSlider::NewLC(const TRect& aRect, const CCoeControl& aControl) + { + CHorizontalSlider* self = new (ELeave) CHorizontalSlider; + CleanupStack::PushL(self); + self->ConstructL(aRect, aControl); + return self; + } + +//============================================================================= +EXPORT_C CHorizontalSlider::~CHorizontalSlider() + { + iBorders.ResetAndDestroy(); + iScrollBar.ResetAndDestroy(); + if (iIcon) + { + delete iIcon; + } + } + +//============================================================================= +void CHorizontalSlider::ConstructL(const TRect& aRect, const CCoeControl& aControl) + { + SetContainerWindowL(aControl); + SetRect(aRect); + + TInt variant = 0; + TFileName iconFile (KImageEditorUiMifFile); + + // create popup and slider graphics + for ( TInt i = 0; i < KBorderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_center + 2*i, + EMbmImageeditoruiQgn_graf_popup_trans_center_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); +// image->SetPictureOwnedExternally( ETrue ); + iBorders.AppendL( image ); + CleanupStack::Pop( image ); + } + for ( TInt i = 0; i < KSliderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_nslider_imed_end_left + 2*i, + EMbmImageeditoruiQgn_graf_nslider_imed_end_left_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); +// image->SetPictureOwnedExternally( ETrue ); + iScrollBar.AppendL( image ); + CleanupStack::Pop( image ); + } + + ActivateL(); + } + +//============================================================================= +CHorizontalSlider::CHorizontalSlider() + { + // no implementation required + } + +//============================================================================= +EXPORT_C TInt CHorizontalSlider::CountComponentControls() const + { + TInt count = iBorders.Count(); + count += iScrollBar.Count(); + if (iIcon) + { + count++; + } + + return count; + } + +//============================================================================= +void CHorizontalSlider::Draw(const TRect& /*aRect*/) const + { + // determine popup border layouts + AknLayoutUtils::LayoutControl( iBorders[0], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g1().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[1], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[2], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[3], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[4], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[5], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[6], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[7], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g8().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[8], Rect(), AknLayoutScalable_Avkon::bg_tb_trans_pane_g9().LayoutLine() ); + // Images need to be resized separately, because the standard LayoutImage + // tries to preserve the aspect ratio and we don't want that. + // + for ( TInt i = 0; i < iBorders.Count(); ++i ) + { + AknIconUtils::SetSize( + const_cast( iBorders[i]->Bitmap() ), + iBorders[i]->Size(), EAspectRatioNotPreserved ); + } + + // determine icon layout + AknLayoutUtils::LayoutControl( iIcon, Rect(), AknLayoutScalable_Apps::popup_imed_adjust2_window_g1().LayoutLine() ); + AknIconUtils::SetSize( + const_cast( iIcon->Bitmap() ), + iIcon->Size(), EAspectRatioNotPreserved ); + + // determine caption layout + TAknLayoutText layoutText; + layoutText.LayoutText( Rect(), AknLayoutScalable_Apps::popup_imed_adjust2_window_t1() ); + TRgb color = layoutText.Color(); + layoutText.DrawText( SystemGc(), iText, ETrue, color ); + + // determine scrollbar layouts + TAknWindowComponentLayout l = AknLayoutScalable_Apps::slider_imed_adjust_pane(); + TAknWindowLineLayout lineLayout = l.LayoutLine(); + TAknLayoutRect layoutRect; + layoutRect.LayoutRect(Rect(), lineLayout); + AknLayoutUtils::LayoutControl( iScrollBar[0], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g1().LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[1], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[2], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[3], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g4().LayoutLine() ); + for ( TInt i = 0; i < iScrollBar.Count(); ++i ) + { + AknIconUtils::SetSize( + const_cast( iScrollBar[i]->Bitmap() ), + iScrollBar[i]->Size(), EAspectRatioNotPreserved ); + } + + // determine scrollbar marker layout + if ( iMinimumValue <= iMaximumValue ) + { + TUint length = iMaximumValue - iMinimumValue; // length of the slider + TUint pixelsFromMin = iPosition - iMinimumValue; // tab position from the beginning + + TReal factor = 0.0; + if (iMinimumValue < iMaximumValue ) + { + factor = (TReal) pixelsFromMin / length; // tab position from the beginning in percentage + } + + TUint sliderTabWidth = iScrollBar[KSliderPartsNum - 1]->Size().iWidth; // slider tab width + + // slider bitmap is actually a bit longer but this resolves the problem + // where the tab is drawn outside of the slider when in maximum position + TUint sliderBitmapWidth = layoutRect.Rect().Width() - sliderTabWidth; + + TInt tabPositionFromMinInPixels = (TInt) ((factor * sliderBitmapWidth + 0.5) - (sliderBitmapWidth / 2)); // calculate tab position + + TRect markerRect = layoutRect.Rect(); + markerRect.iTl.iX += tabPositionFromMinInPixels; + + AknLayoutUtils::LayoutControl( iScrollBar[KSliderPartsNum - 1], markerRect, AknLayoutScalable_Apps::slider_imed_adjust_pane_g4().LayoutLine() ); + + AknIconUtils::SetSize( + const_cast( iScrollBar[KSliderPartsNum - 1]->Bitmap() ), + iScrollBar[KSliderPartsNum - 1]->Size(), EAspectRatioNotPreserved ); + } + } + +//============================================================================= +EXPORT_C CCoeControl* CHorizontalSlider::ComponentControl(TInt aIndex) const + { + if ( aIndex < iBorders.Count() ) + { + return iBorders[aIndex]; + } + + if ( aIndex < iBorders.Count() + iScrollBar.Count()) + { + return iScrollBar[aIndex - iBorders.Count()]; + } + return iIcon; + } + +// setters + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetIcon(CEikImage* aIcon) + { + iIcon = aIcon; + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetCaption(const TDesC& aText) + { + iText = aText; + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetMinimum(TInt aValue) + { + iMinimumValue = aValue; + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetMaximum(TInt aValue) + { + iMaximumValue = aValue; + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetStep(TUint aValue) + { + iStep = aValue; + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetStepAmount(TUint8 aValue) + { + iNumberOfSteps = aValue; + + if(aValue == 0) + { + iStep = 0; + } + else + { + iStep = (iMaximumValue-iMinimumValue) / aValue; + } + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::SetPosition(TInt aValue) + { + __ASSERT_ALWAYS( aValue >= iMinimumValue, Panic(EHorizontalSliderPanicIndexUnderflow) ); + __ASSERT_ALWAYS( aValue <= iMaximumValue, Panic(EHorizontalSliderPanicIndexOverflow) ); + + iPosition = aValue; + } + +// getters + +//============================================================================= +EXPORT_C TInt CHorizontalSlider::Minimum() const + { + return iMinimumValue; + } + +//============================================================================= +EXPORT_C TInt CHorizontalSlider::Maximum() const + { + return iMaximumValue; + } + +//============================================================================= +EXPORT_C TInt CHorizontalSlider::Step() const + { + return iStep; + } + +//============================================================================= +EXPORT_C TInt CHorizontalSlider::Position() const + { + return iPosition; + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::Increment() + { + iPosition += iStep; + if(iPosition > iMaximumValue) + { + iPosition = iMaximumValue; + } + } + +//============================================================================= +EXPORT_C void CHorizontalSlider::Decrement() + { + iPosition -= iStep; + if(iPosition < iMinimumValue) + { + iPosition = iMinimumValue; + } + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/ImageEditorControlBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/ImageEditorControlBase.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,168 @@ +/* +* 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: +* A base class for Image Editor controls. +* +*/ + + + +#include "ImageEditorControlBase.h" +#include "ImageEditorUiPanics.h" + +//============================================================================= +EXPORT_C CImageEditorControlBase::CImageEditorControlBase () : CCoeControl() +{ + // EMPTY +} + +//============================================================================= +EXPORT_C CImageEditorControlBase::~CImageEditorControlBase () +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/ + ) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::SetImageL (CFbsBitmap * /*aBitmap*/) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::SetImageL (const CFbsBitmap * /*aBitmap*/) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::SetView (CAknView * /*aView*/) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::SetSelectedUiItemL (CPluginInfo * /*aItem*/) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::PrepareL () +{ + // EMPTY +} + +//============================================================================= +EXPORT_C TKeyResponse CImageEditorControlBase::OfferKeyEventL ( + const TKeyEvent & /*aKeyEvent*/, + TEventCode /*aType*/ + ) +{ + return EKeyWasNotConsumed; +} + +//============================================================================= +EXPORT_C TInt CImageEditorControlBase::CountComponentControls() const +{ + return 0; +} + +//============================================================================= +EXPORT_C CCoeControl * CImageEditorControlBase::ComponentControl (TInt /*aIndex*/) const +{ + return 0; +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::SetBusy() +{ + iBusy = ETrue; +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::ResetBusy() +{ + iBusy = EFalse; +} + +//============================================================================= +EXPORT_C TBool CImageEditorControlBase::Busy() const +{ + return iBusy; +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::HandlePluginCommandL (const TInt /*aCommand*/) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C TInt CImageEditorControlBase::GetSoftkeyIndexL () +{ + return -1; +} + +//============================================================================= +EXPORT_C TInt CImageEditorControlBase::GetContextMenuResourceId() +{ + return 0; +} + +//============================================================================= +EXPORT_C TPtrC CImageEditorControlBase::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return TPtrC(); +} + +//============================================================================= +EXPORT_C TBitField CImageEditorControlBase::GetDimmedMenuItems () +{ + // return all-zero bitfield + return TBitField(); +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::SizeChanged() +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::HandlePointerEventL( const TPointerEvent& /*aPointerEvent*/ ) +{ + // EMPTY +} + +//============================================================================= +EXPORT_C void CImageEditorControlBase::Draw (const TRect & /*aRect*/) const +{ + // EMPTY +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/ImageEditorUIContainer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/ImageEditorUIContainer.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,394 @@ +/* +* 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: +* Container class that handles/forwards keyevents and pointer +* events to other controls. +* +*/ + + +// INCLUDE FILES +#include +#include +#include +#include +#include + +#include "ImageEditorUIContainer.h" +#include "ImageEditorControlBase.h" +#include "ImageEditorUI.hrh" + +#include "WaitIndicator.h" + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +const TInt KTouchPanTotalMoveThreshold = 5; + +//============================================================================= +void CImageEditorUIContainer::ConstructL(const TRect & aRect) + { + // Create window + CreateWindowL(); + + iWaitIndicator = CWaitIndicator::NewL(); + iWaitIndicator->SetParent( this); + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + // Set window rectangle + SetRect(aRect); + + // Set busy + SetBusy(); + + SetCanDrawOutsideRect(); + iBgContext = CAknsBasicBackgroundControlContext::NewL( + KAknsIIDQsnBgAreaMain, Rect(), EFalse); + + EnableDragEvents(); + + // Activate container control + ActivateL(); + } + +//============================================================================= +CImageEditorUIContainer::~CImageEditorUIContainer() + { + delete iWaitIndicator; + delete iBgContext; + iEditorView = NULL; + iPreview = NULL; + iControl = NULL; + } + +//============================================================================= +void CImageEditorUIContainer::SetImageL(CFbsBitmap * aBitmap) + { + iPreview = aBitmap; + if (iControl) + { + ((CImageEditorControlBase*)iControl)->SetImageL(iPreview); + } + DrawDeferred(); + } + +//============================================================================= +void CImageEditorUIContainer::SetControl(CCoeControl * aControl) + { + iControl = aControl; + if (iControl) + { + ((CImageEditorControlBase *)iControl)->SetView(iEditorView); + iControl->SetRect(Rect() ); + } + DrawDeferred(); + } + +//============================================================================= +void CImageEditorUIContainer::SetView(CImageEditorUIView * aView) + { + if (iControl) + { + ((CImageEditorControlBase *)iControl)->SetView(aView); + } + iEditorView = aView; + } + +//============================================================================= +TKeyResponse CImageEditorUIContainer::OfferKeyEventL( + const TKeyEvent & aKeyEvent, TEventCode aType) + { + if (Busy() ) + { + return EKeyWasConsumed; + } + else + { + TKeyResponse res = EKeyWasNotConsumed; + if (iControl) + { + res = ((CCoeControl*)iControl)->OfferKeyEventL(aKeyEvent, + aType); + } + return res; + } + } + +//============================================================================= +void CImageEditorUIContainer::SizeChanged() + { + if (iBgContext) + { + iBgContext->SetRect(Rect() ); + } + + if (iControl) + { + iControl->SetRect(Rect() ); + } + + iWaitIndicator->SetItemRect(Rect() ); + } + +//============================================================================= +void CImageEditorUIContainer::HandlePointerEventL( + const TPointerEvent &aPointerEvent) + { + if (Busy() ) + { + return; + } + else + { + if (iControl) + { + ((CCoeControl*)iControl)->HandlePointerEventL(aPointerEvent); + } + else + { + + switch (aPointerEvent.iType) + { + case TPointerEvent::EButton1Down: + { + +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorUIContainer: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + if ( !iEditorView->InZoomingState() ) + { + iEditorView->HandleCommandL(EImageEditorMenuCmdApplyEffect); + } + else + { + iTappedPosition = aPointerEvent.iPosition; + } + break; + } + case TPointerEvent::EDrag: + { + 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) + { + iTappedPosition = aPointerEvent.iPosition; + iEditorView->HandleCommandL(EImageEditorCmdTouchPan); + } + + break; + } + case TPointerEvent::EButton1Up: + { + iTappedPosition = aPointerEvent.iPosition; + break; + } + + default: + { + break; + } + } + + } + + } + + } + +//============================================================================= +TInt CImageEditorUIContainer::CountComponentControls() const + { + TInt count = 0; + if (iControl) + { + ++count; + } + return count; + } + +//============================================================================= +CCoeControl * CImageEditorUIContainer::ComponentControl(TInt aIndex) const + { + switch (aIndex) + { + case 0: + { + return iControl; + } + default: + { + return 0; + } + } + } + +//============================================================================= +void CImageEditorUIContainer::SetBusy() + { + if (iControl) + { + ((CImageEditorControlBase *)iControl)->SetBusy(); + } + iBusy = ETrue; + } + +//============================================================================= +void CImageEditorUIContainer::ResetBusy() + { + if (iControl) + { + ((CImageEditorControlBase *)iControl)->ResetBusy(); + } + iBusy = EFalse; + } + +//============================================================================= +TBool CImageEditorUIContainer::Busy() const + { + return iBusy; + } + +//============================================================================= +void CImageEditorUIContainer::SetFullScreen() + { + iFullScreen = ETrue; + } + +//============================================================================= +void CImageEditorUIContainer::ResetFullScreen() + { + iFullScreen = EFalse; + } + +//============================================================================= +void CImageEditorUIContainer::Draw(const TRect & /*aRect*/) const + { + // Get graphics context + CWindowGc & gc = SystemGc(); + + // If there is a plug-in control, it is responsible + // for drawing the preview image (to avoid flicker) + if (!iControl) + { + gc.SetBrushStyle(CGraphicsContext::ESolidBrush); + gc.SetBrushColor(KRgbWhite); + gc.SetPenStyle(CGraphicsContext::ESolidPen); + gc.SetPenColor(KRgbWhite); + + if (iPreview && iPreview->Handle() ) + { + gc.DrawBitmap(Rect(), iPreview); + } + else + { + // Draw skin background + MAknsSkinInstance* skin = AknsUtils::SkinInstance(); + 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*/ +) + { + + } + +//============================================================================= +void CImageEditorUIContainer::GetHelpContext(TCoeHelpContext& aContext) const + { + if (iControl) + { + iControl->GetHelpContext(aContext); + } + } + +//============================================================================= +void CImageEditorUIContainer::GetDragDirections(TInt& xMovement, TInt& yMovement) + { + xMovement = iXDirChange; + yMovement = iYDirChange; + } + +//============================================================================= +void CImageEditorUIContainer::HandleNaviDecoratorEventL(TInt aEventID) + { + if (aEventID == EAknNaviDecoratorEventRightTabArrow) + { + // A right arrow key event is simulated + TKeyEvent key; + key.iRepeats = 0; + key.iCode = EKeyRightArrow; + key.iModifiers = 0; + CEikonEnv::Static()->SimulateKeyEventL(key, EEventKey); + } + else + if (aEventID == EAknNaviDecoratorEventLeftTabArrow) + { + // A left arrow key event is simulated + TKeyEvent key; + key.iRepeats = 0; + key.iCode = EKeyLeftArrow; + key.iModifiers = 0; + CEikonEnv::Static()->SimulateKeyEventL(key, EEventKey); + } + } + +//============================================================================= +TTypeUid::Ptr CImageEditorUIContainer::MopSupplyObject(TTypeUid aId) + { + if (aId.iUid == MAknsControlContext::ETypeId && iBgContext) + { + return MAknsControlContext::SupplyMopObject(aId, iBgContext); + } + return CCoeControl::MopSupplyObject(aId); + } + +//============================================================================= +void CImageEditorUIContainer::HideWaitNote() + { + iWaitIndicator->Hide(); + } + +//============================================================================= +void CImageEditorUIContainer::ShowWaitNote() + { + iWaitIndicator->Show(); + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/ImageEditorUIView.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/ImageEditorUIView.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1516 @@ +/* +* 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 +#include +#include +#include +#include +#include +#include +#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" + +#ifdef AIW_PRINT_PROVIDER_USED +#include +#include +#include +#endif + +// CONSTANTS +_LIT (KResourceDir, "\\resource\\apps\\"); +_LIT (KResourceFile, "imageeditorui.rsc"); +_LIT (KComponentName, "ImageEditorUI"); + +#define KMediaGalleryUID3 0x101F8599 + +// MACRO DEFINITIONS +#ifdef LANDSCAPE_SUPPORT +#define LANDSCAPE_ARG(x) x +#else +#define LANDSCAPE_ARG(x) +#endif + + +//============================================================================= +EXPORT_C void CImageEditorUIView::ConstructL() +{ + LOG(KImageEditorLogFile, "CImageEditorUIView::ConstructL()"); + + // 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); + + // Get reference to status pane + CEikStatusPane * sp = AppUi()->StatusPane(); + + // Get reference to navi pane + iNaviPane = + (CAknNavigationControlContainer *) sp->ControlL (TUid::Uid (EEikStatusPaneUidNavi)); + + // 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(); + + // Read strings needed for zoom popup + 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) ); + + 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 + + +#ifdef AIW_PRINT_PROVIDER_USED + iServiceHandler = CAiwServiceHandler::NewL(); + // Attach menu services. + iServiceHandler->AttachMenuL(R_IMAGEEDITORUI_MENUPANE, R_IMAGE_EDITOR_INTEREST); +#endif + LOG(KImageEditorLogFile, "CImageEditorUIView: Constructred succesfully"); +} + +//============================================================================= +EXPORT_C CImageEditorUIView::CImageEditorUIView() : +CAknView (), +iResLoader ( *iEikonEnv ), +iBusy(ETrue), +iContainerInStack(EFalse) +{ + +} + +//============================================================================= +EXPORT_C CImageEditorUIView::~CImageEditorUIView() +{ + LOG(KImageEditorLogFile, "CImageEditorUIView::~CImageEditorUIView()"); + + iResLoader.Close(); + +#ifdef AIW_PRINT_PROVIDER_USED + 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; + + RemoveContainerFromStack(); + if ( iContainer ) + { + delete iContainer; + iContainer = 0; + } + + iArray.Reset(); + + iNaviPane = NULL; + iTitlePane = NULL; + iControl = NULL; + iPreview = NULL; + iSendAppUi = NULL; + + if ( iPopupController ) + { + delete iPopupController; + } + + if ( iZoomTexts ) + { + iZoomTexts->Reset(); + delete iZoomTexts; + } + + LOG(KImageEditorLogFile, "CImageEditorUIView: View deleted"); +} + +//============================================================================= +EXPORT_C TUid CImageEditorUIView::Id() const +{ + return KViewId; +} + +//============================================================================= +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); + + LOGFMT2(KImageEditorLogFile, "CImageEditorUIView: View mode: ScreenMode: %d, Rotation: %d", aScreenMode, rotation.iRotation); + + 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); +#else + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT); +#endif + break; + } + + case CFbsBitGc::EGraphicsOrientationRotated90: // camcorder mode + { + LOG(KImageEditorLogFile, "CImageEditorUIView: EGraphicsOrientationRotated90"); + +#ifndef SWAP_SOFTKEY_POSITIONS + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_LEFT); +#else + sp->SwitchLayoutL(R_AVKON_STACON_PANE_LAYOUT_USUAL_SOFTKEYS_RIGHT); +#endif + 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); + +#ifdef LANDSCAPE_SUPPORT + + // And now the CBA... + TRect rect = ClientRect(); + + CEikButtonGroupContainer* cba = Cba(); + __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) ); + + 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; + } + + +//============================================================================= +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 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); + } + } + + // If msk pressed + else if ( iInPlugin && (aCommand == iMSK) ) + { + if ( iContainer && iContainer->Busy() ) + { + return; + } + else + { + ((CImageEditorControlBase *)iControl)->HandlePluginCommandL (aCommand); + } + } + + // 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() ) + { + 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(); + + TFileName filename(iImageFileName); + TAiwVariant variant(filename); + TAiwGenericParam param(EGenericParamFile, variant); + + 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; + } + } + } +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::HandleClientRectChange() +{ + LOG(KImageEditorLogFile, "CImageEditorUIView: Client rect changed"); + + if (iContainer) + { + iContainer->SetRect ( ClientRect() ); + } +} + +//============================================================================= +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 CCoeControl * CImageEditorUIView::GetContainer () const +{ + return iContainer; +} + +//============================================================================= +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; + + + } + case 2: // EPluginUiTypeSingleParam + case 3: // EPluginUiTypeMultiParam + case 4: // EPluginUiTypeCustomized + { + iInPlugin = ETrue; + + // Set control + iControl = aControl; + if (iContainer) + { + iContainer->SetControl (iControl); + } + + // Set plug-in item + if (iControl) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling SetSelectedUiItemL"); + + ((CImageEditorControlBase *)iControl)->SetSelectedUiItemL (iArray[iIndex]); + } + + // Prepare the plug-in item + if (iControl) + { + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating plugin: calling PrepareL"); + + ((CImageEditorControlBase *)iControl)->PrepareL (); + } + + // Update soft keys + UpdateSoftkeysL(); + + // Update navigation pane + UpdateNaviPaneL(); + + break; + } + default: + { + iInPlugin = ETrue; + + // Set control + iControl = aControl; + if (iContainer) + { + iContainer->SetControl (iControl); + } + break; + } + } +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::ActivateMainViewL() +{ + + LOG(KImageEditorLogFile, "CImageEditorUIView: Activating main view"); + + iInPlugin = EFalse; + + // 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(); + + // 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()); + + 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::SetCustomButtonsL (TInt aResourceID) const +{ + LOG(KImageEditorLogFile, "CImageEditorUIView: Setting buttons"); + + CEikButtonGroupContainer* cba = Cba(); + __ASSERT_ALWAYS( cba, User::Panic(KComponentName, EImageEditorPanicCbaNotAccessible) ); + + cba->SetCommandSetL (aResourceID); + cba->DrawDeferred(); +} + +//============================================================================= +EXPORT_C TInt CImageEditorUIView::LaunchSaveChangesQueryL () const +{ + // Create dialog prompt + HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_LIST_QUERY_SAVE_CONFIRMATION); + + // Execute query dialog + TInt ret = SDrawUtils::LaunchQueryDialogL (*prompt); + + CleanupStack::PopAndDestroy(); // prompt + + return ret; +} + +//============================================================================= +EXPORT_C TInt CImageEditorUIView::LaunchExitWithoutSavingQueryL () const +{ + // Create dialog prompt + HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_LIST_QUERY_EXIT_WITHOUT_SAVING_CONFIRMATION); + + // Execute query dialog + TInt ret = SDrawUtils::LaunchQueryDialogL (*prompt); + + CleanupStack::PopAndDestroy(); // prompt + + return ret; +} + +//============================================================================= +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); + + // Execute query dialog + 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); + + 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); + + iSendAppUi->ShowQueryAndSendL (msgData, aCaps); + + CleanupStack::PopAndDestroy(msgData); + } +} + + +//============================================================================= +EXPORT_C void CImageEditorUIView::LaunchSaveWaitDialogL( + 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 ); + } + + // Launch wait dialog with Cancel softkey + 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 ); + } + +//============================================================================= +EXPORT_C void CImageEditorUIView::LaunchLoadWaitDialogL( + CAknWaitDialog** aSelfPtr, + MProgressDialogCallback* aCallback + ) const +{ + // Create dialog prompt + HBufC * prompt = iEikonEnv->AllocReadResourceLC (R_WAIT_NOTE_LOADING); + + // Launch wait dialog with empty softkeys + 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 ); + iContainer->ShowWaitNote(); +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::HideWaitDialog() const +{ + iContainer->HideWaitNote(); +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::ShowInformationNoteL (const TDesC& aNoteText) const +{ + + CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); + globalnote->ShowNoteL (EAknGlobalInformationNote, aNoteText); + + CleanupStack::PopAndDestroy(); // globalnote + +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::ShowConfirmationNoteL (const TDesC& aNoteText) const +{ + + CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); + globalnote->ShowNoteL (EAknGlobalConfirmationNote, aNoteText); + + CleanupStack::PopAndDestroy(); // globalnote + +} + +//============================================================================= +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); + + // 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 ); + + 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 + } +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::SetTitlePaneTextL (const TDesC & aText) +{ + iTitlePane->SetTextL (aText); +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::ClearTitlePaneTextL() +{ + 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::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::SetBusy() +{ + + if (iContainer) + { + iContainer->SetBusy(); + } + + iBusy = ETrue; + RemoveContainerFromStack(); + +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::ResetBusy() +{ + + AddContainerToStack(); + iBusy = EFalse; + + if (iContainer) + { + iContainer->ResetBusy(); + } +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::SetUndoFlag (const TBool aUndo) +{ + iCanUndo = aUndo; +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::SetSaveFlag (const TBool aSave) +{ + iCanSave = aSave; +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::SetFullScreen() +{ + if (iContainer) + { + iContainer->SetFullScreen(); + } + iFullScreen = ETrue; +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::ResetFullScreen() +{ + if (iContainer) + { + iContainer->ResetFullScreen(); + } + iFullScreen = EFalse; +} + +//============================================================================= +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 ); + } + + // 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 ) ); + } + + } + +//============================================================================= +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; + } +#endif + + 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 ); + +#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 ); + } + + // 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 ); +#ifdef FULLSCREEN_AVAILABLE + 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 + { + +#ifdef AIW_PRINT_PROVIDER_USED + +#else + 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) ); + } + + // Nothing to undo + if ( !iCanUndo ) + { + aMenuPane->SetItemDimmed( EImageEditorMenuCmdUndo, ETrue ); + } +#ifdef FULLSCREEN_AVAILABLE + // In full screen mode + if ( iFullScreen ) + { + aMenuPane->SetItemDimmed( EImageEditorMenuCmdFullScreen, 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 ); + } + +#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 ); + + iServiceHandler->InitializeMenuPaneL( *aMenuPane, + aResourceId, + EImageEditorMenuAiwPrintBase, + in); + } +#endif + + } + } + } + +//============================================================================= +EXPORT_C void CImageEditorUIView::SetSendAppUi(CSendUi* 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) ); + + // Get plug-in info + CPluginInfo * pgn_info = iArray[iIndex]; + + // Get soft key pair index + TInt sk_index = ((CImageEditorControlBase *)iControl)->GetSoftkeyIndexL(); + + // 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) ); + + TBool leftNaviPaneScrollButtonVisibile; + TBool rightNaviPaneScrollButtonVisible; + TPtrC naviText = ((CImageEditorControlBase *)iControl)->GetNaviPaneTextL( + leftNaviPaneScrollButtonVisibile, + rightNaviPaneScrollButtonVisible ); + + SetNaviPaneTextL ( + naviText, + leftNaviPaneScrollButtonVisibile, + rightNaviPaneScrollButtonVisible ); +} + +//============================================================================= +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 ); + } + } +} + +//============================================================================= +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::DoDeactivate() +{ + 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; + } + } +} + + + +//============================================================================= +void CImageEditorUIView::RemoveContainerFromStack() +{ + if (iContainerInStack) + { + AppUi()->RemoveFromViewStack (*this, iContainer); + iContainerInStack = EFalse; + } +} + +//============================================================================= +EXPORT_C TBool CImageEditorUIView::InZoomingState() + { + if ( iZoomMode == EZoomIn1 || + iZoomMode == EZoomIn2 || + iZoomMode == EZoomIn3 ) + { + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= +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); + + // Query dialog texts + 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); + + options->Reset(); + + CleanupStack::PopAndDestroy(4); //options, option2, option1, heading + + return ret; +} + +//============================================================================= +EXPORT_C void CImageEditorUIView::GetTouchPanDirections( TInt& xMovement, + TInt& yMovement ) + { + + xMovement = 0; + yMovement = 0; + iContainer->GetDragDirections( xMovement, yMovement ); + } + +EXPORT_C TBool CImageEditorUIView::IsMemoryInCriticalLevel() + { + TEntry 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); + } + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/PluginGrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/PluginGrid.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,962 @@ +/* +* 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: +* Effect plugin selection dialog that shows icons of available +* plugins in a grid. +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "PluginGrid.h" +#include "PluginInfo.h" +#include "ResolutionUtil.h" +#include +#include "ImageEditorUI.hrh" +#include "ImageEditorUIDefs.h" +#include "DrawUtils.h" + +// CONSTANTS +const TInt KDefaultCurrentItem = 7; +const TInt KPortraitNumberOfRows = 5; +const TInt KPortraitNumberOfColumns = 3; +const TInt KLandscapeNumberOfRows = 3; +const TInt KLandscapeNumberOfColumns = 5; +const TInt KBorderPartsNum = 9; +const TInt KTooltipDelayBeforeShow = 200; + +//============================================================================= +CPluginGrid::CPluginGrid (CFbsBitmap** aBitmap, + const RPluginArray* aItems) +: iBitmap( aBitmap ), + iPluginItems( aItems ), + iCurrentItem( KDefaultCurrentItem ), + iNumberOfRows( KPortraitNumberOfRows ), + iNumberOfColumns( KPortraitNumberOfColumns ), + iCellSize(0,0), + iTouchGridRect(0,0,0,0), + iHighlightPos(0,0), + iParentRect(0,0,0,0) + { + } + +//============================================================================= +CPluginGrid::~CPluginGrid () + { + iBorders.ResetAndDestroy(); + iHighlight.ResetAndDestroy(); + iIcons.ResetAndDestroy(); + delete iText; + + iBitmap = NULL; + iPluginItems = NULL; + } + +//============================================================================= +void CPluginGrid::ConstructL () + { + TFileName iconFile (KImageEditorUiMifFile); + + // create popup graphics + for ( TInt i = 0; i < KBorderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_center + 2*i, + EMbmImageeditoruiQgn_graf_popup_trans_center_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); + iBorders.AppendL( image ); + CleanupStack::Pop( image ); + } + + // create highlight graphics + for ( TInt i = 0; i < KBorderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_center + 2*i, + EMbmImageeditoruiQgn_graf_popup_trans_center_mask + 2*i); +// EMbmImageeditoruiQsn_fr_imed_grid_center + 2*i, +// EMbmImageeditoruiQsn_fr_imed_grid_center_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); + iHighlight.AppendL( image ); + CleanupStack::Pop( image ); + } + + // title text + iText = new (ELeave) CEikLabel; + iText->SetContainerWindowL( *this ); + HBufC* heading = CEikonEnv::Static()->AllocReadResourceLC( R_HEADING_APPLY_EFFECT ); + iText->SetTextL( heading->Des() ); + CleanupStack::PopAndDestroy( heading ); + + // plugin graphics + for (TInt i = 0; i < iPluginItems->Count(); ++i) + { + CPluginInfo * pgn_info = (*iPluginItems)[i]; + + CEikImage* image = new (ELeave) CEikImage; + + image->SetPicture(pgn_info->Icon(), pgn_info->Mask()); + image->SetPictureOwnedExternally(ETrue); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); + iIcons.AppendL( image ); + CleanupStack::Pop( image ); + } + + ActivateL(); + } + +//============================================================================= +TInt CPluginGrid::GetSelectedItemIndex() const + { + return iCurrentItem; + } + + +//============================================================================= +void CPluginGrid::SizeChanged() + { + + TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); + if( variant ) + { + iNumberOfRows = KLandscapeNumberOfRows; + iNumberOfColumns = KLandscapeNumberOfColumns; + } + else + { + iNumberOfRows = KPortraitNumberOfRows; + iNumberOfColumns = KPortraitNumberOfColumns; + } + + TAknLayoutRect layoutRect; + + if(variant) + { + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_trans_window(4) ); + } + else + { + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::bg_tb_trans_pane_cp02(1) ); + } + iParentRect = layoutRect.Rect(); + + // determine grid cell size + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::cell_imed_effect_pane(1,1,variant) ); + iCellSize = layoutRect.Rect().Size(); + + TInt delta = 0; + + // determine caption layout + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::heading_imed_pane(variant) ); + TAknLayoutText layoutText; + layoutText.LayoutText( layoutRect.Rect(), AknLayoutScalable_Apps::heading_imed_pane_t1(variant) ); + TRgb color = layoutText.Color(); + iText->SetFont(layoutText.Font()); + iText->OverrideColorL( EColorLabelText, color ); + iText->SetExtent(layoutText.TextRect().iTl, layoutText.TextRect().Size()); + if(AknLayoutUtils::LayoutMirrored()) + { + iText->SetAlignment( EHRightVCenter ); + } + else + { + iText->SetAlignment( EHLeftVCenter ); + } + + // determine popup border layouts + if( !AknLayoutUtils::LayoutMirrored() ) + { + AknLayoutUtils::LayoutControl( iBorders[1], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[2], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[3], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[4], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[5], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[6], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + } + else + { + AknLayoutUtils::LayoutControl( iBorders[1], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[2], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[3], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[4], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[5], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[6], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + } + AknLayoutUtils::LayoutControl( iBorders[0], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g1().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[7], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g8().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[8], iParentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g9().LayoutLine() ); + // Images need to be resized separately, because the standard LayoutImage + // tries to preserve the aspect ratio and we don't want that. + // + for ( TInt i = 0; i < iBorders.Count(); ++i ) + { + AknIconUtils::SetSize( + const_cast( iBorders[i]->Bitmap() ), + iBorders[i]->Size(), EAspectRatioNotPreserved ); + } + + // plugin graphics sizes + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::cell_imed_effect_pane_g1(variant) ); + TRect iconRect = layoutRect.Rect(); + TSize iconSize = iconRect.Size(); + for (TInt i = 0; i < iPluginItems->Count(); ++i) + { + CPluginInfo * pgn_info = (*iPluginItems)[i]; + + // Set size for scalable icons - MUST BE CALLED BEFORE ICON IS USABLE + if (pgn_info->Icon()) + { + AknIconUtils::SetSize(pgn_info->Icon(), iconSize); + } + if (pgn_info->Mask()) + { + AknIconUtils::SetSize(pgn_info->Mask(), iconSize); + } + } + + // touch area + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + iTouchGridRect = layoutRect.Rect(); + delta = layoutRect.Rect().Width(); + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::cell_imed_effect_pane(0,0,variant) ); + iTouchGridRect.SetWidth(layoutRect.Rect().Width() * iNumberOfColumns); + iTouchGridRect.SetHeight(layoutRect.Rect().Height() * iNumberOfRows); + delta = (delta - iTouchGridRect.Width()) / 2; + if( AknLayoutUtils::LayoutMirrored() ) + { + delta = -delta; + } + iTouchGridRect.iTl.iX += delta; + + // plugin graphics positions + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + TAknLayoutRect iconLayoutRect; + + for ( TInt i = 0; i SetSize(iconSize); + iIcons[j + iNumberOfColumns * i]->SetPosition(iconPos); + } + } + + // determine highlight layouts + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::cell_imed_effect_pane(0,0,variant) ); + iHighlightPos = layoutRect.Rect().iTl; + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::grid_highlight_pane_cp017(variant) ); + TRect highlightRect = layoutRect.Rect(); + highlightRect.iTl.iX += delta; + highlightRect.iBr.iX += delta; + if( !AknLayoutUtils::LayoutMirrored() ) + { + AknLayoutUtils::LayoutControl( iHighlight[1], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[2], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[3], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[4], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[5], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[6], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + } + else + { + AknLayoutUtils::LayoutControl( iHighlight[1], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[2], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[3], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[4], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[5], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[6], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + } + AknLayoutUtils::LayoutControl( iHighlight[0], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g1().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[7], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g8().LayoutLine() ); + AknLayoutUtils::LayoutControl( iHighlight[8], highlightRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g9().LayoutLine() ); + // Images need to be resized separately, because the standard LayoutImage + // tries to preserve the aspect ratio and we don't want that. + // + for ( TInt i = 0; i < iHighlight.Count(); ++i ) + { + AknIconUtils::SetSize( + const_cast( iHighlight[i]->Bitmap() ), + iHighlight[i]->Size(), EAspectRatioNotPreserved ); + } + + iHighlightPos = highlightRect.iTl - iHighlightPos; + } + +//============================================================================= +void CPluginGrid::Draw(const TRect& /*aRect*/) const + { + // Get graphics context + CWindowGc & gc = SystemGc(); + + // Draw preview image if found + if ( (*iBitmap)->Handle() ) + { + gc.BitBlt (Rect().iTl, *iBitmap); + } + + TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); + TAknLayoutRect layoutRect; + for ( TInt i = 0; i < iNumberOfRows; ++i ) + { + for ( TInt j = 0; j < iNumberOfColumns; ++j ) + { + if(j + iNumberOfColumns * i == iCurrentItem) + { + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::cell_imed_effect_pane(j, i,variant) ); + TPoint deltaPos = iHighlight[1]->Position() - (layoutRect.Rect().iTl + iHighlightPos); + + for ( TInt ii = 0; ii < iHighlight.Count(); ++ii ) + { + iHighlight[ii]->SetPosition(iHighlight[ii]->Position() - deltaPos); + } + } + } + } + } + +//============================================================================= +TKeyResponse CPluginGrid::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( AknLayoutUtils::LayoutMirrored() ) + { + iCurrentItem++; + if (iCurrentItem >= iPluginItems->Count()) + { + iCurrentItem = 0; + } + } + else + { + if (iCurrentItem == 0) + { + iCurrentItem = iPluginItems->Count() - 1; + } + else + { + iCurrentItem--; + } + } + + res = EKeyWasConsumed; + break; + } + + case EKeyRightArrow: + case 54: // numeric keypad '6' + { + if( AknLayoutUtils::LayoutMirrored() ) + { + if (iCurrentItem == 0) + { + iCurrentItem = iPluginItems->Count() - 1; + } + else + { + iCurrentItem--; + } + } + else + { + iCurrentItem++; + if (iCurrentItem >= iPluginItems->Count()) + { + iCurrentItem = 0; + } + } + + res = EKeyWasConsumed; + break; + } + + case EKeyDownArrow: + case 56: // numeric keypad '8' + { + iCurrentItem += iNumberOfColumns; + if (iCurrentItem >= iPluginItems->Count()) + { + iCurrentItem = iCurrentItem - iPluginItems->Count(); + } + + res = EKeyWasConsumed; + break; + } + + case EKeyUpArrow: + case 50: // numeric keypad '2' + { + iCurrentItem -= iNumberOfColumns; + if (iCurrentItem < 0) + { + iCurrentItem = iPluginItems->Count() + iCurrentItem; + } + + res = EKeyWasConsumed; + break; + } + + case 49: // numeric keypad '1' + { + // Move up and left + iCurrentItem -= iNumberOfColumns; + if( AknLayoutUtils::LayoutMirrored() ) + if( AknLayoutUtils::LayoutMirrored() ) + { + iCurrentItem ++; + } + else + { + iCurrentItem --; + } + if (iCurrentItem < 0) + { + iCurrentItem = iPluginItems->Count() + iCurrentItem; + } + res = EKeyWasConsumed; + break; + } + + case 51: // numeric keypad '3' + { + // Move up and right + iCurrentItem -= iNumberOfColumns; + if( AknLayoutUtils::LayoutMirrored() ) + { + iCurrentItem --; + } + else + { + iCurrentItem ++; + } + if (iCurrentItem < 0) + { + iCurrentItem = iPluginItems->Count() + iCurrentItem; + } + res = EKeyWasConsumed; + break; + } + + case 55: // numeric keypad '7' + { + // Move down and left + iCurrentItem += iNumberOfColumns; + if( AknLayoutUtils::LayoutMirrored() ) + { + iCurrentItem++; + } + else + { + iCurrentItem--; + } + if (iCurrentItem >= iPluginItems->Count()) + { + iCurrentItem = iCurrentItem - iPluginItems->Count(); + } + res = EKeyWasConsumed; + break; + } + + case 57: // numeric keypad '9' + { + // Move down and left + iCurrentItem += iNumberOfColumns; + if( AknLayoutUtils::LayoutMirrored() ) + { + iCurrentItem--; + } + else + { + iCurrentItem++; + } + if (iCurrentItem >= iPluginItems->Count()) + { + iCurrentItem = iCurrentItem - iPluginItems->Count(); + } + res = EKeyWasConsumed; + break; + } + + default: + { + break; + } + + } + + } + + return res; + } + +//============================================================================= +void CPluginGrid::HandlePointerEventL( const TPointerEvent &aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + case TPointerEvent::EDrag: + { + TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); + TAknLayoutRect layoutRect; + for ( TInt i = 0; i < iNumberOfRows; ++i ) + { + for ( TInt j = 0; j < iNumberOfColumns; ++j ) + { + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::cell_imed_effect_pane(j, i, variant) ); + + if( layoutRect.Rect().Contains( aPointerEvent.iPosition ) ) + { + // set new highlighted item + iCurrentItem = j + iNumberOfColumns * i; + return; + } + } + } + + break; + } + case TPointerEvent::EButton1Up: + { + break; + } + default: + { + break; + } + } + } + } + +//============================================================================= +TRect CPluginGrid::GridRect() const + { + TRect boundingRect( iTouchGridRect ); +// boundingRect.BoundingRect( iTitleboxBorderRect ); + return boundingRect; + } + +//============================================================================= +TBool CPluginGrid::HighlightedItemPressed( TPoint aPosition ) const + { + TAknLayoutRect layoutRect; + TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); + for ( TInt i = 0; i < iNumberOfRows; ++i ) + { + for ( TInt j = 0; j < iNumberOfColumns; ++j ) + { + if(j + iNumberOfColumns * i == iCurrentItem) + { + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::cell_imed_effect_pane(j, i, variant) ); + } + } + } + + if (layoutRect.Rect().Contains( aPosition )) + { + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= +void CPluginGrid::ShowTooltip ( CAknInfoPopupNoteController* aPopupController, + CCoeControl* aCallingControl ) + { + TAknLayoutRect layoutRect; + TBool variant = Layout_Meta_Data::IsLandscapeOrientation(); + + TBool layoutFound = EFalse; + for ( TInt i = 0; i < iNumberOfRows; ++i ) + { + for ( TInt j = 0; j < iNumberOfColumns; ++j ) + { + if(j + iNumberOfColumns * i == iCurrentItem) + { + layoutRect.LayoutRect( iParentRect, AknLayoutScalable_Apps::listscroll_imed_pane (variant) ); + layoutRect.LayoutRect( layoutRect.Rect(), AknLayoutScalable_Apps::cell_imed_effect_pane(j, i, variant) ); + layoutFound = ETrue; + } + } + } + + if( layoutFound ) + { + CPluginInfo * pgn_info = ( *iPluginItems )[ iCurrentItem ]; + + // change default time to shorter one + aPopupController->SetTimeDelayBeforeShow( KTooltipDelayBeforeShow ); + + SDrawUtils::ShowToolTip( aPopupController, + aCallingControl, + layoutRect.Rect(), + pgn_info->PluginName()->Des() ); + } + + } + +//============================================================================= +TInt CPluginGrid::CountComponentControls() const + { + TInt count = iBorders.Count(); + count += iHighlight.Count(); + count += iIcons.Count(); + count++; + + return count; + } + +//============================================================================= +CCoeControl* CPluginGrid::ComponentControl(TInt aIndex) const + { + if ( aIndex < iBorders.Count() ) + { + return iBorders[aIndex]; + } + if ( aIndex < iBorders.Count() + iHighlight.Count()) + { + return iHighlight[aIndex - iBorders.Count()]; + } + if ( aIndex < iBorders.Count() + iHighlight.Count() + iIcons.Count()) + { + return iIcons[aIndex - iBorders.Count() - iHighlight.Count()]; + } + + return iText; + } + +//============================================================================= +TInt CPluginSelectionDialog::RunDlgLD(CFbsBitmap** aBitmap, + TInt& aSelectedItem, + const RPluginArray* aItems, + const TRect& aRect) + { + CPluginSelectionDialog* dialog = + new (ELeave) CPluginSelectionDialog (aBitmap, aSelectedItem, aItems); + dialog->ConstructL(aRect); + return dialog->ExecuteLD(R_IMAGE_EDITOR_PLUGIN_DIALOG); + } + +//============================================================================= +CPluginSelectionDialog::CPluginSelectionDialog(CFbsBitmap** aBitmap, + TInt& aSelectedItem, + const RPluginArray* aItems) + : iBitmap(aBitmap), iItems(aItems), iSelectedItem(aSelectedItem) + { + + } +//============================================================================= +CPluginSelectionDialog::~CPluginSelectionDialog() + { + delete iGrid; + iBitmap = NULL; + iItems = NULL; + delete iPopupController; + iPopupController = NULL; + } + +//============================================================================= + +void CPluginSelectionDialog::ConstructL(const TRect& aRect) + { + SetRect(aRect); + + iGrid = new (ELeave) CPluginGrid(iBitmap, iItems); + iGrid->ConstructL(); + + iGrid->SetSize(aRect.Size()); + iGrid->SetPosition(TPoint(0,0)); + + iPopupController = CAknInfoPopupNoteController::NewL(); + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + } + +//============================================================================= +TBool CPluginSelectionDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect) + { + if (iGrid) + { + iSelectedItem = iGrid->GetSelectedItemIndex(); + } + return ETrue; + } + else + { + iSelectedItem = KErrCancel; + return EFalse; + } + } + +//============================================================================= +void CPluginSelectionDialog::Draw(const TRect& /*aRect*/) const + { + } + +//============================================================================= +void CPluginSelectionDialog::SizeChanged() + { + if (iGrid) + { + iGrid->SetRect( Rect() ); + iGrid->SizeChanged(); + + if ( iPopupController ) + { + // Shows the first tooltip when effect grid is entered + iGrid->ShowTooltip( iPopupController, this ); + } + } + } + +//============================================================================= +TInt CPluginSelectionDialog::CountComponentControls() const + { + return 1; + } + +//============================================================================= +CCoeControl* CPluginSelectionDialog::ComponentControl(TInt /*aIndex*/) const + { + return iGrid; + } + +//============================================================================= +TKeyResponse CPluginSelectionDialog::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 = iGrid->OfferKeyEventL(aKeyEvent, aType); + if (res == EKeyWasConsumed) + { + DrawDeferred(); + iGrid->ShowTooltip( iPopupController, this ); + } + + } + + return res; + } + +//============================================================================= +void CPluginSelectionDialog::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 ( iGrid->GridRect().Contains( aPointerEvent.iPosition ) ) + { + iPopupController->HideInfoPopupNote(); +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::CPluginSelectionDialog: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + iGrid->HandlePointerEventL( aPointerEvent ); + draw = ETrue; + } + else + { + // Cancel if tapped outside of the grid + TryExitL( EAknSoftkeyCancel ); + } + break; + } + case TPointerEvent::EDrag: + { + if ( iGrid->GridRect().Contains( aPointerEvent.iPosition ) ) + { + TBool highlightedBefore = + iGrid->HighlightedItemPressed( aPointerEvent.iPosition ); + + iGrid->HandlePointerEventL( aPointerEvent ); + + TBool highlightedAfter = + iGrid->HighlightedItemPressed( aPointerEvent.iPosition ); + + // if these two values differ from each other, it indicates + // that focus has changed in the grid to a new item + if ( highlightedBefore != highlightedAfter ) + { +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackSensitive ); + RDebug::Printf( "ImageEditor::CPluginSelectionDialog: ETouchFeedbackSensitive" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + draw = ETrue; + } + } + break; + } + case TPointerEvent::EButton1Up: + { + // already highlighted item is pressed + if ( iGrid->HighlightedItemPressed( aPointerEvent.iPosition ) ) + { + TryExitL (EAknSoftkeyOk); + } + break; + } + default: + { + break; + } + } + + if ( draw ) + { + DrawDeferred(); + iGrid->ShowTooltip( iPopupController, this ); + } + } + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/PreviewControlBase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/PreviewControlBase.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,99 @@ +/* +* 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: +* +*/ + + + +#include "PreviewControlBase.h" + +//============================================================================= +EXPORT_C CPreviewControlBase * CPreviewControlBase::NewL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + CPreviewControlBase * self = new (ELeave) CPreviewControlBase; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +EXPORT_C void CPreviewControlBase::ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + // Set container + SetContainerWindowL (*aParent); + + // Set extent + SetRect (aRect); + + // Activate + ActivateL(); +} + +//============================================================================= +EXPORT_C CPreviewControlBase::~CPreviewControlBase() +{ + iPreview = NULL; +} + +//============================================================================= +EXPORT_C void CPreviewControlBase::SetImageL (CFbsBitmap * aBitmap) +{ + iPreview = aBitmap; +} + +//============================================================================= +EXPORT_C void CPreviewControlBase::SetImageL (const CFbsBitmap * aBitmap) +{ + iPreview = aBitmap; +} + +//============================================================================= +EXPORT_C void CPreviewControlBase::DrawPreviewImage (const TRect & aRect) const +{ + // Get graphics context + CWindowGc & gc = SystemGc(); + + // Set graphics context parameters + gc.SetPenStyle (CGraphicsContext::ESolidPen); + gc.SetPenColor (KRgbBlack); + gc.SetBrushStyle (CGraphicsContext::ESolidBrush); + gc.SetBrushColor (KRgbBlack); + + // Draw preview image if found + if ( iPreview && iPreview->Handle() ) + { + gc.BitBlt (TPoint(0,0), iPreview); + } + else + { + gc.DrawRect (aRect); + } +} + +//============================================================================= +EXPORT_C void CPreviewControlBase::Draw (const TRect & aRect) const +{ + DrawPreviewImage(aRect); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/SingleParamControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/SingleParamControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,791 @@ +/* +* 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: + * +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "ImageEditorUI.hrh" +#include "ImageEditorUiDefs.h" +#include "SingleParamControl.h" +#include "PreviewControlBase.h" +#include "SingleParamControlObserver.h" +#include "PluginInfo.h" +#include "CustomControlPanics.h" + +// constants +const TReal KTouchSensitivity = 0.5; +const TInt KBorderPartsNum = 9; +const TInt KSliderPartsNum = 4; +const TInt KTouchSliderPartsNum = 7; +const TInt KSliderWidth = 20; +const TInt KScrollRepeatTimeout = 250000; // 0.25 seconds + +//============================================================================= +EXPORT_C CSingleParamControl * CSingleParamControl::NewL ( + const TRect & aRect, + CCoeControl * aParent, + TBool aActionOnButtonRelease +) + { + CSingleParamControl * self = new (ELeave) CSingleParamControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent, aActionOnButtonRelease); + CleanupStack::Pop (); // self + return self; + } + +//============================================================================= +EXPORT_C CSingleParamControl::CSingleParamControl() +: iDragging( EFalse ), +iActionOnButtonRelease( EFalse ), +iTouchRect(0,0,0,0), +iMinimumValue(0), +iMaximumValue(1), +iStep(0), +iStepInPixels(0), +iNumberOfSteps(0), +iPosition(0), +iMarkerPressed( EFalse ) + { + } + +//============================================================================= +EXPORT_C void CSingleParamControl::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * aParent, + TBool aActionOnButtonRelease +) + { + // Set parent + SetContainerWindowL (*aParent); + + TFileName iconFile (KImageEditorUiMifFile); + + // create popup and slider graphics + for ( TInt i = 0; i < KBorderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_popup_trans_center + 2*i, + EMbmImageeditoruiQgn_graf_popup_trans_center_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); + iBorders.AppendL( image ); + CleanupStack::Pop( image ); + } + if( AknLayoutUtils::PenEnabled() ) + { + for ( TInt i = 0; i < KTouchSliderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_nslider_end_left + 2*i, + EMbmImageeditoruiQgn_graf_nslider_end_left_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); + iScrollBar.AppendL( image ); + CleanupStack::Pop( image ); + } + } + else + { + for ( TInt i = 0; i < KSliderPartsNum; ++i ) + { + CEikImage* image = new (ELeave) CEikImage; + + image->CreatePictureFromFileL(iconFile, + EMbmImageeditoruiQgn_graf_nslider_imed_end_left + 2*i, + EMbmImageeditoruiQgn_graf_nslider_imed_end_left_mask + 2*i); + + CleanupStack::PushL( image ); + image->SetContainerWindowL( *this ); + iScrollBar.AppendL( image ); + CleanupStack::Pop( image ); + } + } + + iText = new (ELeave) CEikLabel; + iText->SetContainerWindowL( *this ); + iActionOnButtonRelease = aActionOnButtonRelease; + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + EnableDragEvents(); + + // Activate control + ActivateL(); + } + +//============================================================================= +EXPORT_C CSingleParamControl::~CSingleParamControl() + { + iBorders.ResetAndDestroy(); + iScrollBar.ResetAndDestroy(); + if (iIcon) + { + delete iIcon; + } + delete iText; + + iParObserver = NULL; + iItem = NULL; + iEditorView = NULL; + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetView (CAknView * aView) + { + iEditorView = aView; + } + +EXPORT_C void CSingleParamControl::SetIcon(CEikImage* aIcon) + { + iIcon = aIcon; + } + +EXPORT_C void CSingleParamControl::SetCaption(const TDesC& aText) + { + iText->SetTextL( aText ); + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetSelectedUiItemL (CPluginInfo * aItem) + { + iItem = aItem; + } + +//============================================================================= +EXPORT_C TKeyResponse CSingleParamControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType +) + { + if ( Busy() ) + { + return EKeyWasConsumed; + } + else + { + if (EEventKey == aType) + { + switch (aKeyEvent.iCode) + { + + case EKeyRightArrow: + { + if ( iPosition == iMaximumValue ) + { + return EKeyWasConsumed; + } + MoveSlider(1); + if( iActionOnButtonRelease ) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawDeferred(); + } + return EKeyWasConsumed; + } + case EKeyLeftArrow: + { + if ( iPosition == iMinimumValue ) + { + return EKeyWasConsumed; + } + MoveSlider(-1); + if( iActionOnButtonRelease ) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawDeferred(); + } + return EKeyWasConsumed; + } + + case EKeyOK: + case EKeyEnter: + { + // Cancel plug-in if no changes made + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + return EKeyWasConsumed; + } + + case EKeyDownArrow: + case EKeyUpArrow: + { + return EKeyWasConsumed; + } + + default: + { + break; + } + } + } + return EKeyWasNotConsumed; + } + } + +//============================================================================= +EXPORT_C void CSingleParamControl::HandlePointerEventL(const TPointerEvent &aPointerEvent) + { + if( AknLayoutUtils::PenEnabled() ) + { + if( iTouchRect.Contains( aPointerEvent.iPosition ) ) + { + TRect markerRect = iScrollBar[KSliderPartsNum - 1]->Rect(); + markerRect.iTl.iX -= KSliderWidth / 2; + markerRect.iBr.iX += KSliderWidth / 2; + // marker pressed? + if( markerRect.Contains( aPointerEvent.iPosition ) ) + { + if( aPointerEvent.iType == TPointerEvent::EButton1Down ) + { + iDragging = ETrue; + iMarkerPressed = ETrue; + +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::SingleParamControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + DrawDeferred(); + return; + } + } + + // marker dragged? + if (iDragging) + { + if( aPointerEvent.iType == TPointerEvent::EButton1Up + || aPointerEvent.iType == TPointerEvent::EDrag ) + { + TInt markerCenter = iScrollBar[KSliderPartsNum - 1]->Rect().iTl.iX + + (iScrollBar[KSliderPartsNum - 1]->Rect().iBr.iX + - iScrollBar[KSliderPartsNum - 1]->Rect().iTl.iX) / 2; + + if(aPointerEvent.iPosition.iX> iScrollBar[KSliderPartsNum - 1]->Rect().iBr.iX) + { + MoveSlider((((TReal) (aPointerEvent.iPosition.iX + - markerCenter)) + / iStepInPixels) + KTouchSensitivity); + } + else if(aPointerEvent.iPosition.iX < iScrollBar[KSliderPartsNum - 1]->Rect().iTl.iX) + { + MoveSlider((((TReal) (aPointerEvent.iPosition.iX + - markerCenter)) + / iStepInPixels) - KTouchSensitivity); + } + } + if( aPointerEvent.iType == TPointerEvent::EButton1Up ) + { + if( iActionOnButtonRelease ) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + iDragging = EFalse; + iMarkerPressed = EFalse; + DrawDeferred(); + } + if( iActionOnButtonRelease ) + { + DrawDeferred(); + } + return; + } + + // normal moving + if( aPointerEvent.iType == TPointerEvent::EButton1Down + || aPointerEvent.iType == TPointerEvent::EButtonRepeat ) + { + iMarkerPressed = ETrue; + if(aPointerEvent.iPosition.iX> iScrollBar[KSliderPartsNum - 1]->Rect().iBr.iX) + { + MoveSlider(1); + if( iActionOnButtonRelease ) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawDeferred(); + } + } + else if(aPointerEvent.iPosition.iX < iScrollBar[KSliderPartsNum - 1]->Rect().iTl.iX) + { + MoveSlider(-1); + if( iActionOnButtonRelease ) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawDeferred(); + } + } + Window().RequestPointerRepeatEvent( KScrollRepeatTimeout, iTouchRect ); + +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack && + ((aPointerEvent.iPosition.iX < markerRect.iTl.iX) || + (aPointerEvent.iPosition.iX > markerRect.iBr.iX)) ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::SingleParamControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + return; + } + } + if (iDragging && iMarkerPressed) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + + iDragging = EFalse; + iMarkerPressed = EFalse; + DrawDeferred(); + return; + } + } + +//============================================================================= +EXPORT_C void CSingleParamControl::HandlePluginCommandL (const TInt aCommand) + { + // If soft key 1 pressed + if (aCommand == EAknSoftkeyOk) + { + // Cancel plug-in if no changes made + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + } + + // If soft key 2 pressed + + else if (aCommand == EAknSoftkeyCancel) + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + + // Default functionality + + else + { + CImageEditorControlBase::HandlePluginCommandL (aCommand); + } + } + +//============================================================================= +EXPORT_C TInt CSingleParamControl::GetSoftkeyIndexL() + { + return 0; + } + +//============================================================================= +EXPORT_C TPtrC CSingleParamControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) + { + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + + // Don't show any text in navi pane + // The whole if-branch should probably be removed for good + TBool showNaviPaneText ( EFalse ); + + if ( iItem && showNaviPaneText ) + { + return iItem->PluginName()->Des(); + } + else + { + return TPtrC(); + } + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetParObserver (MSingleParControlObserver * aObserver) + { + iParObserver = aObserver; + } + +//============================================================================= +EXPORT_C void CSingleParamControl::Draw (const TRect & aRect) const + { + TInt variety = 0; + if( AknLayoutUtils::PenEnabled() ) + { + variety = 1; + } + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_adjust2_window(variety) ); + TRect parentRect = layoutRect.Rect(); + + // centralize the slider + TPoint topLeft = parentRect.iTl; + topLeft.iX = (Rect().Width() - parentRect.Width()) / 2; + parentRect.SetRect(topLeft, parentRect.Size()); + + TAknWindowComponentLayout l = AknLayoutScalable_Apps::slider_imed_adjust_pane(variety); + TAknWindowLineLayout lineLayout = l.LayoutLine(); + layoutRect.LayoutRect(parentRect, lineLayout); + + TRect markerRect = layoutRect.Rect(); + TUint sliderTabWidth = KSliderWidth; + TUint sliderBitmapWidth = layoutRect.Rect().Width() - sliderTabWidth; + if ( iMinimumValue < iMaximumValue ) + { + if(AknLayoutUtils::LayoutMirrored()) + { + markerRect.iTl.iX += (iPosition - iMinimumValue) + * sliderBitmapWidth + / (iMaximumValue - iMinimumValue); + } + else + { + markerRect.iTl.iX += (iPosition - iMinimumValue) + * sliderBitmapWidth + / (iMaximumValue - iMinimumValue); + } + iScrollBar[KSliderPartsNum - 1]->SetPosition(markerRect.iTl); + if( AknLayoutUtils::PenEnabled() ) + { + iScrollBar[KTouchSliderPartsNum - 1]->SetPosition(markerRect.iTl); + } + } + + if (iPreview) + { + CPreviewControlBase::DrawPreviewImage (aRect); + } + } + +//============================================================================= +EXPORT_C TInt CSingleParamControl::CountComponentControls() const + { + TInt count = iBorders.Count(); + count += iScrollBar.Count(); + + if( AknLayoutUtils::PenEnabled() ) + { + count--; + } + + if (iIcon) + { + count++; + } + count++; + + return count; + } + +//============================================================================= +EXPORT_C CCoeControl* CSingleParamControl::ComponentControl(TInt aIndex) const + { + if ( aIndex < iBorders.Count() ) + { + return iBorders[aIndex]; + } + + TInt touchSelected = 0; + if( AknLayoutUtils::PenEnabled() ) + { + touchSelected++; + } + + if ( aIndex < iBorders.Count() + iScrollBar.Count() - touchSelected ) + { + if ( iMarkerPressed && (aIndex - iBorders.Count() == 3) ) + { + return iScrollBar[aIndex - iBorders.Count() + 3]; + } + return iScrollBar[aIndex - iBorders.Count()]; + } + if ( aIndex == iBorders.Count() + iScrollBar.Count() - touchSelected ) + { + return iText; + } + return iIcon; + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SizeChanged() + { + CountImageSizesAndPositions(); + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetSliderMinimumAndMaximum(TInt aMin, TInt aMax) + { + iMinimumValue = aMin; + iMaximumValue = aMax; + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetSliderPosition(TInt aPosition) + { + __ASSERT_ALWAYS( aPosition >= iMinimumValue, Panic(EHorizontalSliderPanicIndexUnderflow) ); + __ASSERT_ALWAYS( aPosition <= iMaximumValue, Panic(EHorizontalSliderPanicIndexOverflow) ); + + iPosition = aPosition; + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetSliderStep(TUint aStep) + { + iStep = aStep; + + TInt variety = 0; + if( AknLayoutUtils::PenEnabled() ) + { + variety = 1; + } + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_adjust2_window(variety) ); + TRect parentRect = layoutRect.Rect(); + TAknWindowComponentLayout l = AknLayoutScalable_Apps::slider_imed_adjust_pane(variety); + TAknWindowLineLayout lineLayout = l.LayoutLine(); + layoutRect.LayoutRect(parentRect, lineLayout); + + TUint sliderTabWidth = iScrollBar[KSliderPartsNum - 1]->Size().iWidth; + TUint sliderBitmapWidth = layoutRect.Rect().Width() - sliderTabWidth; + + iStepInPixels = sliderBitmapWidth; + if ( iMinimumValue < iMaximumValue ) + { + iStepInPixels = iStep * sliderBitmapWidth + / (iMaximumValue - iMinimumValue); + } + } + +//============================================================================= +EXPORT_C void CSingleParamControl::SetSliderStepAmount(TUint8 aAmount) + { + { + iNumberOfSteps = aAmount; + + if(aAmount == 0) + { + iStep = 0; + } + else + { + iStep = (iMaximumValue - iMinimumValue) / aAmount; + } + } + } + +//============================================================================= +EXPORT_C TInt CSingleParamControl::Position() const + { + return iPosition; + } + +//============================================================================= +EXPORT_C void CSingleParamControl::CountImageSizesAndPositions() + { + TInt variety = 0; + if( AknLayoutUtils::PenEnabled() ) + { + variety = 1; + } + + TAknLayoutRect layoutRect; + layoutRect.LayoutRect( Rect(), AknLayoutScalable_Apps::popup_imed_adjust2_window(variety) ); + TRect parentRect = layoutRect.Rect(); + + // centralize the slider + TPoint topLeft = parentRect.iTl; + topLeft.iX = (Rect().Width() - parentRect.Width()) / 2; + parentRect.SetRect(topLeft, parentRect.Size()); + + // determine popup border layouts + if(AknLayoutUtils::LayoutMirrored()) + { + AknLayoutUtils::LayoutControl( iBorders[1], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[2], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[3], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[4], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[5], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[6], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + } + else + { + AknLayoutUtils::LayoutControl( iBorders[1], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g2().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[2], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g3().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[3], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g4().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[4], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g5().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[5], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g6().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[6], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g7().LayoutLine() ); + } + AknLayoutUtils::LayoutControl( iBorders[0], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g1().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[7], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g8().LayoutLine() ); + AknLayoutUtils::LayoutControl( iBorders[8], parentRect, AknLayoutScalable_Avkon::bg_tb_trans_pane_g9().LayoutLine() ); + + // Images need to be resized separately, because the standard LayoutImage + // tries to preserve the aspect ratio and we don't want that. + // + for ( TInt i = 0; i < iBorders.Count(); ++i ) + { + AknIconUtils::SetSize( + const_cast( iBorders[i]->Bitmap() ), + iBorders[i]->Size(), EAspectRatioNotPreserved ); + } + + // determine icon layout + if (iIcon) + { + AknLayoutUtils::LayoutControl( iIcon, parentRect, AknLayoutScalable_Apps::popup_imed_adjust2_window_g1(variety).LayoutLine() ); + AknIconUtils::SetSize( + const_cast( iIcon->Bitmap() ), + iIcon->Size(), EAspectRatioNotPreserved ); + } + + // determine caption layout + TAknLayoutText layoutText; + layoutText.LayoutText( parentRect, AknLayoutScalable_Apps::popup_imed_adjust2_window_t1(variety) ); + TRgb color = layoutText.Color(); + iText->SetFont(layoutText.Font()); + iText->OverrideColorL( EColorLabelText, color ); + iText->SetExtent(layoutText.TextRect().iTl, layoutText.TextRect().Size()); + if(AknLayoutUtils::LayoutMirrored()) + { + iText->SetAlignment( EHRightVTop ); + } + else + { + iText->SetAlignment( EHLeftVTop ); + } + + // determine scrollbar layouts + if( AknLayoutUtils::PenEnabled() ) + { + if(AknLayoutUtils::LayoutMirrored()) + { + AknLayoutUtils::LayoutControl( iScrollBar[4], parentRect, AknLayoutScalable_Apps::popup_imed_adjust2_window_g3(0).LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[5], parentRect, AknLayoutScalable_Apps::popup_imed_adjust2_window_g2(0).LayoutLine() ); + } + else + { + AknLayoutUtils::LayoutControl( iScrollBar[4], parentRect, AknLayoutScalable_Apps::popup_imed_adjust2_window_g2(0).LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[5], parentRect, AknLayoutScalable_Apps::popup_imed_adjust2_window_g3(0).LayoutLine() ); + } + } + TAknWindowComponentLayout l = AknLayoutScalable_Apps::slider_imed_adjust_pane(variety); + TAknWindowLineLayout lineLayout = l.LayoutLine(); + layoutRect.LayoutRect(parentRect, lineLayout); + if(AknLayoutUtils::LayoutMirrored()) + { + AknLayoutUtils::LayoutControl( iScrollBar[0], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g2(variety).LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[1], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g1(variety).LayoutLine() ); + } + else + { + AknLayoutUtils::LayoutControl( iScrollBar[0], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g1(variety).LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[1], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g2(variety).LayoutLine() ); + } + AknLayoutUtils::LayoutControl( iScrollBar[2], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g3(variety).LayoutLine() ); + AknLayoutUtils::LayoutControl( iScrollBar[3], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g4(variety).LayoutLine() ); + iScrollBar[3]->SetSize(TSize(KSliderWidth, iScrollBar[3]->Size().iHeight)); + if( AknLayoutUtils::PenEnabled() ) + { + AknLayoutUtils::LayoutControl( iScrollBar[6], layoutRect.Rect(), AknLayoutScalable_Apps::slider_imed_adjust_pane_g4(variety).LayoutLine() ); + iScrollBar[6]->SetSize(TSize(KSliderWidth, iScrollBar[6]->Size().iHeight)); + } + for ( TInt i = 0; i < iScrollBar.Count(); ++i ) + { + AknIconUtils::SetSize( + const_cast( iScrollBar[i]->Bitmap() ), + iScrollBar[i]->Size(), EAspectRatioNotPreserved ); + } + + // set touch area + if( AknLayoutUtils::PenEnabled() ) + { + iTouchRect.iTl.iX = iScrollBar[4]->Rect().iTl.iX; + iTouchRect.iTl.iY = iScrollBar[0]->Rect().iTl.iY; + iTouchRect.iBr.iX = iScrollBar[5]->Rect().iBr.iX; + iTouchRect.iBr.iY = iScrollBar[1]->Rect().iBr.iY; + } + + // slider tab width + TUint sliderTabWidth = KSliderWidth; + // slider bitmap is actually a bit longer but this resolves the problem + // where the tab is drawn outside of the slider when in maximum position + TUint sliderBitmapWidth = layoutRect.Rect().Width() - sliderTabWidth; + iStepInPixels = sliderBitmapWidth; + if ( iMinimumValue < iMaximumValue ) + { + iStepInPixels = iStep * sliderBitmapWidth + / (iMaximumValue - iMinimumValue); + } + } + +EXPORT_C void CSingleParamControl::MoveSlider(TInt aSteps) + { + iPosition += iStep * aSteps; + + if(iPosition> iMaximumValue) + { + iPosition = iMaximumValue; + } + if(iPosition < iMinimumValue) + { + iPosition = iMinimumValue; + } + + if(aSteps < 0) + { + for ( TInt i = 0; i> aSteps; i-- ) + { + iParObserver->ParamOperation(MSingleParControlObserver::EParamOperationSubtract); + } + } + else + { + for ( TInt i = 0; i < aSteps; i++ ) + { + iParObserver->ParamOperation(MSingleParControlObserver::EParamOperationAdd); + } + } + + if( !iActionOnButtonRelease ) + { + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + } + +// End of File + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/TControlItem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/TControlItem.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,61 @@ +/* +* 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: +* +*/ + + +// INCLUDE FILES +#include "TControlItem.h" +#include + +// ----------------------------------------------------------------------------- +// TControlItem:: +// ----------------------------------------------------------------------------- +// +void TControlItem::SetParent( CCoeControl* aParent ) + { + iParent = aParent; + } + +// ----------------------------------------------------------------------------- +// TControlItem:: +// ----------------------------------------------------------------------------- +// +void TControlItem::SetItemRect( const TRect& aRect ) + { + iRect = aRect; + SizeChanged(); + } + +// ----------------------------------------------------------------------------- +// TControlItem:: +// ----------------------------------------------------------------------------- +// +void TControlItem::DrawItem( CWindowGc& aGc ) const + { + Draw( aGc ); + } + +// ----------------------------------------------------------------------------- +// TControlItem:: +// ----------------------------------------------------------------------------- +// +void TControlItem::DrawNow() + { + if( iParent ) iParent->DrawNow(); + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/VerticalSlider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/VerticalSlider.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,369 @@ +/* +* 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: +* +*/ + + + +#include "VerticalSlider.h" +#include "CustomControlPanics.h" +#include +#include "ResolutionUtil.h" +#include "ImageEditorUiDefs.h" +#include +#include +#include + + +// CONSTANTS +const TInt KStandardSliderWidth = 7; +const TInt KStandardSliderHeight = 132; +const TInt KStandardSliderTabWidth = 7; +const TInt KStandardSliderTabHeight = 12; + +const TInt KDoubleSliderWidth = 13; +const TInt KDoubleSliderHeight = 244; +const TInt KDoubleSliderTabWidth = 13; +const TInt KDoubleSliderTabHeight = 24; + +const TInt KQVGASliderWidth = 10; +const TInt KQVGASliderHeight = 188; +const TInt KQVGASliderTabWidth = 10; +const TInt KQVGASliderTabHeight = 18; + +const TInt KHVGASliderWidth = 13; +const TInt KHVGASliderHeight = 244; +const TInt KHVGASliderTabWidth = 13; +const TInt KHVGASliderTabHeight = 24; + +const TInt KVGASliderWidth = 20; +const TInt KVGASliderHeight = 376; +const TInt KVGASliderTabWidth = 20; +const TInt KVGASliderTabHeight = 36; + +const TInt KQHDSliderWidth = 13; +const TInt KQHDSliderHeight = 244; +const TInt KQHDSliderTabWidth = 13; +const TInt KQHDSliderTabHeight = 24; + +//============================================================================= +EXPORT_C CVerticalSlider* CVerticalSlider::NewL(const TRect& aRect, const CCoeControl& aControl) + { + CVerticalSlider* self = CVerticalSlider::NewLC(aRect, aControl); + CleanupStack::Pop(self); + return self; + } + +//============================================================================= +EXPORT_C CVerticalSlider* CVerticalSlider::NewLC(const TRect& aRect, const CCoeControl& aControl) + { + CVerticalSlider* self = new (ELeave) CVerticalSlider; + CleanupStack::PushL(self); + self->ConstructL(aRect, aControl); + return self; + } + +//============================================================================= +EXPORT_C CVerticalSlider::~CVerticalSlider() + { + delete iSliderBg; + delete iSliderBgMask; + delete iSliderTab; + delete iSliderTabMask; + } + +//============================================================================= +void CVerticalSlider::ConstructL(const TRect& /*aRect*/, const CCoeControl& aControl) + { + SetContainerWindowL(aControl); + + // Load the bitmaps + LoadBitmapL( iSliderBg, iSliderBgMask, EMbmImageeditoruiQgn_graf_ied_vslider, EMbmImageeditoruiQgn_graf_ied_vslider_mask ); + LoadBitmapL( iSliderTab, iSliderTabMask, EMbmImageeditoruiQgn_graf_ied_vtab, EMbmImageeditoruiQgn_graf_ied_vtab_mask ); + SetBitmapSize(); + + ActivateL(); + } + +//============================================================================= +CVerticalSlider::CVerticalSlider() + { + // no implementation required + } + +//============================================================================= +EXPORT_C TInt CVerticalSlider::CountComponentControls() const + { + return 0; + } + +//============================================================================= +void CVerticalSlider::Draw(const TRect& /*aRect*/) const +{ + if ( iMinimumValue <= iMaximumValue ) + { + TUint height = iMaximumValue - iMinimumValue; // height of the slider + TUint pixelsFromMin = iPosition - iMinimumValue; // tab position from the beginning + + TReal factor = 0.0; + if (iMinimumValue < iMaximumValue ) + { + factor = (TReal) pixelsFromMin / height; // tab position from the beginning in percentage + } + TUint sliderTabHeight = iSliderTab->SizeInPixels().iHeight; // slider tab height + + // slider bitmap is actually a bit longer but this resolves the problem + // where the tab is drawn outside of the slider when in maximum position + TUint sliderBitmapHeight = iSliderBg->SizeInPixels().iHeight - sliderTabHeight; + + TUint tabPositionFromMinInPixels = (TUint) (factor * sliderBitmapHeight + 0.5); // calculate tab position + + // top left coordinate + const TPoint tl = Rect().iTl; + + CWindowGc& gc = SystemGc(); + + // draw actual slider using mask bitmap + TRect bgRect(TPoint(0,0), iSliderBg->SizeInPixels()); + gc.BitBltMasked(tl, iSliderBg, bgRect, iSliderBgMask, ETrue); + + // draw the tab using mask bitmap + TRect tabRect(TPoint(0,0),iSliderTab->SizeInPixels()); + gc.BitBltMasked(TPoint(tl.iX, tl.iY+tabPositionFromMinInPixels), iSliderTab, tabRect, iSliderTabMask, ETrue); + } +} + +//============================================================================= +EXPORT_C CCoeControl* CVerticalSlider::ComponentControl(TInt /*aIndex*/) const + { + return NULL; + } + +//============================================================================= +EXPORT_C TSize CVerticalSlider::MinimumSize() + { + TSize size = iSliderBg->SizeInPixels(); + return size; + } + +// setters + +//============================================================================= +EXPORT_C void CVerticalSlider::SetMinimum(TInt aValue) + { + iMinimumValue = aValue; + } + +//============================================================================= +EXPORT_C void CVerticalSlider::SetMaximum(TInt aValue) + { + iMaximumValue = aValue; + } + +//============================================================================= +EXPORT_C void CVerticalSlider::SetStep(TUint aValue) + { + iStep = aValue; + } + +//============================================================================= +EXPORT_C void CVerticalSlider::SetStepAmount(TUint8 aValue) + { + iNumberOfSteps = aValue; + + if(aValue == 0) + { + iStep = 0; + } + else + { + iStep = (iMaximumValue-iMinimumValue) / aValue; + } + } + +//============================================================================= +EXPORT_C void CVerticalSlider::SetPosition(TInt aValue) + { + __ASSERT_ALWAYS( aValue >= iMinimumValue, Panic(EVerticalSliderPanicIndexUnderflow) ); + __ASSERT_ALWAYS( aValue <= iMaximumValue, Panic(EVerticalSliderPanicIndexOverflow) ); + + iPosition = aValue; + } + +// getters + +//============================================================================= +EXPORT_C TInt CVerticalSlider::Minimum() const + { + return iMinimumValue; + } + +//============================================================================= +EXPORT_C TInt CVerticalSlider::Maximum() const + { + return iMaximumValue; + } + +//============================================================================= +EXPORT_C TInt CVerticalSlider::Step() const + { + return iStep; + } + +//============================================================================= +EXPORT_C TInt CVerticalSlider::Position() const + { + return iPosition; + } + +//============================================================================= +EXPORT_C void CVerticalSlider::Increment() + { + iPosition += iStep; + if(iPosition > iMaximumValue) + { + iPosition = iMaximumValue; + } + } + +//============================================================================= +EXPORT_C void CVerticalSlider::Decrement() + { + iPosition -= iStep; + if(iPosition < iMinimumValue) + { + iPosition = iMinimumValue; + } + } + + +//============================================================================= +void CVerticalSlider::LoadBitmapL( CFbsBitmap*& aBitmap, CFbsBitmap*& aMask, TInt aBitmapId, TInt aMaskId ) const +{ + + TFileName iconFile( KImageEditorUiMifFile ); + User::LeaveIfError( CompleteWithAppPath(iconFile) ); + + // Get ids for bitmap and mask + AknIconUtils::CreateIconL( + aBitmap, + aMask, + iconFile, + aBitmapId, + aMaskId + ); + + +} + +//============================================================================= +void CVerticalSlider::SetBitmapSize() const +{ + + __ASSERT_ALWAYS( iSliderBg && iSliderTab, Panic(EVerticalSliderPanicBitmapsNotLoaded) ); + + // Get the screen mode from the Resolution Util + TInt screenMode = CResolutionUtil::Self()->GetScreenMode(); + + TSize sliderSize; + TSize tabSize; + + switch( screenMode ) + { + // small screen sizes + case CResolutionUtil::EStandard: + case CResolutionUtil::EStandardFullScreen: + case CResolutionUtil::EStandardLandscape: + case CResolutionUtil::EStandardLandscapeFullScreen: + case CResolutionUtil::ESquare: + case CResolutionUtil::ESquareFullScreen: + case CResolutionUtil::ESquareRotated: + case CResolutionUtil::ESquareRotatedFullScreen: + { + sliderSize = TSize (KStandardSliderWidth, KStandardSliderHeight); + tabSize = TSize (KStandardSliderTabWidth, KStandardSliderTabHeight); + break; + } + + // QVGA + case CResolutionUtil::EQVGA: + case CResolutionUtil::EQVGAFullScreen: + case CResolutionUtil::EQVGALandscape: + case CResolutionUtil::EQVGALandscapeFullScreen: + { + sliderSize = TSize (KQVGASliderWidth, KQVGASliderHeight); + tabSize = TSize (KQVGASliderTabWidth, KQVGASliderTabHeight); + break; + } + + case CResolutionUtil::EDouble: + case CResolutionUtil::EDoubleFullScreen: + case CResolutionUtil::EDoubleLandscape: + case CResolutionUtil::EDoubleLandscapeFullScreen: + { + sliderSize = TSize (KDoubleSliderWidth, KDoubleSliderHeight); + tabSize = TSize (KDoubleSliderTabWidth, KDoubleSliderTabHeight); + break; + } + + // HVGA + case CResolutionUtil::EHVGA: + case CResolutionUtil::EHVGAFullScreen: + case CResolutionUtil::EHVGALandscape: + case CResolutionUtil::EHVGALandscapeFullScreen: + { + sliderSize = TSize (KHVGASliderWidth, KHVGASliderHeight); + tabSize = TSize (KHVGASliderTabWidth, KHVGASliderTabHeight); + break; + } + + // VGA + case CResolutionUtil::EVGA: + case CResolutionUtil::EVGAFullScreen: + case CResolutionUtil::EVGALandscape: + case CResolutionUtil::EVGALandscapeFullScreen: + { + sliderSize = TSize (KVGASliderWidth, KVGASliderHeight); + tabSize = TSize (KVGASliderTabWidth, KVGASliderTabHeight); + break; + } + + // QHD + case CResolutionUtil::EQHD: + case CResolutionUtil::EQHDFullScreen: + case CResolutionUtil::EQHDLandscape: + case CResolutionUtil::EQHDLandscapeFullScreen: + { + sliderSize = TSize (KQHDSliderWidth, KQHDSliderHeight); + tabSize = TSize (KQHDSliderTabWidth, KQHDSliderTabHeight); + break; + } + + default: + { + sliderSize = TSize (KStandardSliderWidth, KStandardSliderHeight); + tabSize = TSize (KStandardSliderTabWidth, KStandardSliderTabHeight); + break; + } + } + + // Set size for scalable icons - MUST BE CALLED BEFORE ICON IS USABLE + AknIconUtils::SetSize( iSliderBg, sliderSize ); + AknIconUtils::SetSize( iSliderTab, tabSize ); + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/ImageEditorUI/src/WaitIndicator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/ImageEditorUI/src/WaitIndicator.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,227 @@ +/* +* 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: +* +*/ + +// INCLUDE FILES +#include "WaitIndicator.h" +#include + +#include +#include + +#include +#include +#include + +// ----------------------------------------------------------------------------- +// CWaitIndicator::CWaitIndicator() +// C++ constructor can NOT contain any code, that might leave. +// ----------------------------------------------------------------------------- +// +CWaitIndicator::CWaitIndicator() +:CTimer( EPriorityStandard ) + { + CActiveScheduler::Add( this ); + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CWaitIndicator* CWaitIndicator::NewL() + { + CWaitIndicator* self = new( ELeave ) CWaitIndicator(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator::ConstructL +// Symbian two phased constructor may leave +// ----------------------------------------------------------------------------- +// +void CWaitIndicator::ConstructL() + { + CTimer::ConstructL(); + + // Bitmap file name and drive letter. + // Path is generated using PathInfo. + _LIT( KMbmDrive, "z:" ); + _LIT( KMbmFileName, "ImageEditorUI.mbm" ); + + // Waitnote bitmap count + const TInt KWaitnoteBitmapCount = 10; + + TFileName mbmPath; + mbmPath.Copy( KMbmDrive ); + mbmPath.Append( KDC_APP_BITMAP_DIR ); + mbmPath.Append( KMbmFileName ); + + for ( TInt i = 0; i < KWaitnoteBitmapCount; ++i ) + { + CFbsBitmap* bitmap; + CFbsBitmap* mask; + + // *2 for bitmap and mask + AknIconUtils::CreateIconL( bitmap, mask, mbmPath, + EMbmImageeditoruiQgn_graf_ring_wait_01 + i * 2, + EMbmImageeditoruiQgn_graf_ring_wait_01_mask + i * 2 ); + + TInt err = iBitmaps.Append( bitmap ); + if( err ) + { + delete bitmap; + delete mask; + } + else + { + err = iBitmaps.Append( mask ); + if( err ) + { + delete mask; + } + } + User::LeaveIfError( err ); + } + } + +// ----------------------------------------------------------------------------- +// Destructor +// ----------------------------------------------------------------------------- +// +CWaitIndicator::~CWaitIndicator() + { + Cancel(); + iBitmaps.ResetAndDestroy(); + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator:: +// ----------------------------------------------------------------------------- +// +TBool CWaitIndicator::IsVisible() + { + return IsActive(); + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator:: +// ----------------------------------------------------------------------------- +// +void CWaitIndicator::Show() + { + // From LAF + TTimeIntervalMicroSeconds32 KWaitNoteDelay = TTimeIntervalMicroSeconds32( 1000*100 ); + + if( !IsActive() ) + { + // Start timer if not already + After( KWaitNoteDelay ); + } + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator:: +// ----------------------------------------------------------------------------- +// +void CWaitIndicator::Hide() + { + // Stop waitnote + Cancel(); + + // Request draw event + DrawNow(); + } + +// ---------------------------------------------------------------------------- +// CWaitIndicator::RunL +// ---------------------------------------------------------------------------- +// +void CWaitIndicator::RunL() + { + // From LAF + TTimeIntervalMicroSeconds32 KWaitNoteInterval = TTimeIntervalMicroSeconds32( 1000*100 ); + + // Waitnote bitmap count + const TInt KWaitnoteBitmapCount = 10; + + // Start timer again + After( KWaitNoteInterval ); + + // Draw next frame + ++iIndex; + if ( iIndex >= KWaitnoteBitmapCount ) + { + iIndex = 0; + } + DrawNow(); + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator::Draw +// ----------------------------------------------------------------------------- +// +void CWaitIndicator::Draw( CWindowGc& aGc ) const + { + if( IsActive() ) + { + // *2 because masks are in same array + CFbsBitmap* bitmap = iBitmaps[iIndex * 2]; + CFbsBitmap* mask = iBitmaps[iIndex * 2 + 1]; + + TSize bitmapSize( bitmap->SizeInPixels() ); + TSize rectSize( iRect.Size() ); + TPoint topLeft( iRect.iTl ); + + // Center the image + if( bitmapSize.iWidth < rectSize.iWidth ) + { + topLeft.iX = ( rectSize.iWidth - bitmapSize.iWidth ) / 2; + } + if( bitmapSize.iHeight < rectSize.iHeight ) + { + topLeft.iY = ( rectSize.iHeight - bitmapSize.iHeight ) / 2; + } + + // Draw wait indicator + aGc.BitBltMasked( topLeft, bitmap, TRect( bitmapSize ), mask, EFalse ); + } + } + +// ----------------------------------------------------------------------------- +// CWaitIndicator:: +// ----------------------------------------------------------------------------- +// +void CWaitIndicator::SizeChanged() + { + // Waitnote bitmap count + const TInt KWaitnoteBitmapCount = 10; + + // From LAF + // Variety 0 + TAknWindowLineLayout layout = AknLayoutScalable_Apps::main_image2_pane_g1( 0 ); + TSize waitNoteSize( layout.iW, layout.iH ); + for ( TInt i = 0; i < KWaitnoteBitmapCount; ++i ) + { + AknIconUtils::SetSize( iBitmaps[i * 2], waitNoteSize ); + } + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/PB/EABI/pb.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/PB/EABI/pb.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _ZN11CPluginBase10ConstructLEv @ 1 NONAME + _ZN11CPluginBase11GetPropertyEiR6TDes16 @ 2 NONAME + _ZN11CPluginBase11SetPropertyEiR7TDesC16 @ 3 NONAME + _ZN11CPluginBase19ReservedBaseMethod1Ev @ 4 NONAME + _ZN11CPluginBase19ReservedBaseMethod2Ev @ 5 NONAME + _ZN11CPluginBase4NewLEv @ 6 NONAME + _ZN11CPluginBaseC1Ev @ 7 NONAME + _ZN11CPluginBaseC2Ev @ 8 NONAME + _ZN11CPluginBaseD0Ev @ 9 NONAME + _ZN11CPluginBaseD1Ev @ 10 NONAME + _ZN11CPluginBaseD2Ev @ 11 NONAME + _ZTI11CPluginBase @ 12 NONAME ; ## + _ZTV11CPluginBase @ 13 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/PB/bwins/pb.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/PB/bwins/pb.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,10 @@ +EXPORTS + ??0CPluginBase@@QAE@XZ @ 1 NONAME ; CPluginBase::CPluginBase(void) + ??1CPluginBase@@UAE@XZ @ 2 NONAME ; CPluginBase::~CPluginBase(void) + ?ConstructL@CPluginBase@@QAEXXZ @ 3 NONAME ; void CPluginBase::ConstructL(void) + ?GetProperty@CPluginBase@@UAEHHAAVTDes16@@@Z @ 4 NONAME ; int CPluginBase::GetProperty(int, class TDes16 &) + ?NewL@CPluginBase@@SAPAV1@XZ @ 5 NONAME ; class CPluginBase * CPluginBase::NewL(void) + ?ReservedBaseMethod1@CPluginBase@@UAEXXZ @ 6 NONAME ; void CPluginBase::ReservedBaseMethod1(void) + ?ReservedBaseMethod2@CPluginBase@@UAEXXZ @ 7 NONAME ; void CPluginBase::ReservedBaseMethod2(void) + ?SetProperty@CPluginBase@@UAEHHAAVTDesC16@@@Z @ 8 NONAME ; int CPluginBase::SetProperty(int, class TDesC16 &) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/PB/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/PB/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,39 @@ +/* +* 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: +* PluginBase bld.inf file. +* +*/ + + +#include +#include + +#include "../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorPB.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorPB.iby) + +// mmp files +PRJ_MMPFILES +pluginbase.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/PB/group/pluginbase.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/PB/group/pluginbase.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../inc/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET pb.dll +TARGETTYPE dll +UID 0x1000008d + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE pluginbase.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +LANG SC + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +LIBRARY euser.lib + +//#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/PB/rom/ImageEditorPB.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/PB/rom/ImageEditorPB.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __PB_IBY__ +#define __PB_IBY__ + +file=ABI_DIR\BUILD_DIR\pb.dll SHARED_LIB_DIR\pb.dll + +#endif // __PB_IBY__ + +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/PB/src/pluginbase.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/PB/src/pluginbase.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,84 @@ +/* +* 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: +* +*/ + + + +#include "pluginbasedefs.h" +#include "pluginbase.h" + + +//============================================================================= +EXPORT_C CPluginBase * CPluginBase::NewL () +{ + CPluginBase * self = new (ELeave) CPluginBase; + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +//============================================================================= +EXPORT_C CPluginBase::~CPluginBase () +{ + iPluginBaseInternalRepresentation = NULL; +} + +//============================================================================= +EXPORT_C TInt CPluginBase::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return TPropRetErrNotSupported; +} + +//============================================================================= +EXPORT_C TInt CPluginBase::GetProperty ( + TInt /*aPropertyId*/, + TDes & /*aPropertyValue*/ + ) + +{ + return TPropRetErrNotSupported; +} + +//============================================================================= +EXPORT_C CPluginBase::CPluginBase () +{ + +} + +//============================================================================= +EXPORT_C void CPluginBase::ConstructL () +{ + +} + +//============================================================================= +EXPORT_C void CPluginBase::ReservedBaseMethod1 () +{ + +} + +//============================================================================= +EXPORT_C void CPluginBase::ReservedBaseMethod2 () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/data/ImageEditor.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/data/ImageEditor.pkg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,191 @@ +; +; 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: +; +; Languages: +&EN + +; Header +#{"Image Editor"}, (0x101FFA91), 1, 0, 0, TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files + +;;============================================================================= +;; APPLICATION +;;============================================================================= +""-"z:\sys\bin\ImageEditor.exe" +""-"z:\resource\apps\imageeditor.rsc" +""-"z:\private\10003A3F\import\apps\ImageEditor_reg.rsc" + +;;============================================================================= +;; UI +;;============================================================================= +""-"z:\sys\bin\ImageEditorUi.dll" +""-"z:\resource\apps\ImageEditorUi.rsc" +""-"z:\resource\apps\ImageEditorUi.mif" + +;;============================================================================= +;; MANAGER +;;============================================================================= +""-"z:\sys\bin\ImageEditorManager.dll" + +;;============================================================================= +;; PLUG-IN FRAMEWORK +;;============================================================================= +""-"z:\sys\bin\pb.dll" +""-"z:\sys\bin\iepb.dll" +""-"z:\resource\apps\ImageEditorPluginBase.rsc" + +;;============================================================================= +;; AIW SERVICE PROVIDER +;;============================================================================= +""-"z:\sys\bin\ImageEditorProvider.dll" +""-"z:\resource\plugins\ImageEditorProvider.rsc" +""-"z:\resource\ImageEditorProviderInternal.rsc" + +;;============================================================================= +;; BLACK & WHITE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Blackwhite.pgn" +""-"z:\private\101ffa91\plugins\Blackwhite.rsc" +""-"z:\resource\apps\Blackwhite.mif" + +;;============================================================================= +;; BRIGHTNESS PLUGIN +;;============================================================================= +""-"z:\sys\bin\Brightness.pgn" +""-"z:\private\101ffa91\plugins\brightness.rsc" +""-"z:\resource\apps\brightness.mif" + +;;============================================================================= +;; CARTOONIZE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Cartoonize.pgn" +""-"z:\private\101ffa91\plugins\Cartoonize.rsc" +""-"z:\resource\apps\Cartoonize.mif" + +;;============================================================================= +;; CLIPART PLUGIN +;;============================================================================= +""-"z:\sys\bin\Clipart.pgn" +""-"z:\private\101ffa91\plugins\Clipart.rsc" +""-"z:\resource\apps\Clipart.mif" + +""-"z:\private\101ffa91\cliparts\Cliparts01.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts02.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts03.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts04.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts05.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts06.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts07.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts08.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts09.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts10.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts11.mbm" + +;;============================================================================= +;; BUBBLE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Bubble.pgn" +""-"z:\private\101ffa91\plugins\Bubble.rsc" +""-"z:\resource\apps\Bubble.mif" + +""-"z:\private\101ffa91\bubbles\Bubbles01.mbm" +""-"z:\private\101ffa91\bubbles\Bubbles02.mbm" +""-"z:\private\101ffa91\bubbles\Bubbles03.mbm" + +;;============================================================================= +;; CONTRAST PLUGIN +;;============================================================================= +""-"z:\sys\bin\Contrast.pgn" +""-"z:\private\101ffa91\plugins\Contrast.rsc" +""-"z:\resource\apps\contrast.mif" + +;;============================================================================= +;; CROP PLUGIN +;;============================================================================= +""-"z:\sys\bin\Crop.pgn" +""-"z:\private\101ffa91\plugins\crop.rsc" +""-"z:\resource\apps\crop.mif" + +;;============================================================================= +;; FRAME PLUGIN +;;============================================================================= +""-"z:\sys\bin\Frame.pgn" +""-"z:\private\101ffa91\plugins\Frame.rsc" +""-"z:\resource\apps\Frame.mif" +""-"z:\private\101ffa91\frames\frames01.mbm" + +;;============================================================================= +;; NEGATIVE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Negative.pgn" +""-"z:\private\101ffa91\plugins\Negative.rsc" +""-"z:\resource\apps\Negative.mif" + +;;============================================================================= +;; RED-EYE REDUCTION PLUGIN +;;============================================================================= +""-"z:\sys\bin\RedEyeReduction.pgn" +""-"z:\private\101ffa91\plugins\RedEyeReduction.rsc" +""-"z:\resource\apps\RedEyeReduction.mif" + +;;============================================================================= +;; RESIZE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Resize.pgn" +""-"z:\private\101ffa91\plugins\Resize.rsc" +""-"z:\resource\apps\Resize.mif" + +;;============================================================================= +;; ROTATE LEFT PLUGIN +;;============================================================================= +""-"z:\sys\bin\RotateLeft.pgn" +""-"z:\private\101ffa91\plugins\RotateLeft.rsc" +""-"z:\resource\apps\RotateLeft.mif" + +;;============================================================================= +;; ROTATE RIGHT PLUGIN +;;============================================================================= +""-"z:\sys\bin\RotateRight.pgn" +""-"z:\private\101ffa91\plugins\RotateRight.rsc" +""-"z:\resource\apps\RotateRight.mif" + +;;============================================================================= +;; SEPIA PLUGIN +;;============================================================================= +""-"z:\sys\bin\Sepia.pgn" +""-"z:\private\101ffa91\plugins\Sepia.rsc" +""-"z:\resource\apps\Sepia.mif" + +;;============================================================================= +;; SHARPNESS PLUGIN +;;============================================================================= +""-"z:\sys\bin\Sharpness.pgn" +""-"z:\private\101ffa91\plugins\Sharpness.rsc" +""-"z:\resource\apps\Sharpness.mif" + +;;============================================================================= +;; TEXT PLUGIN +;;============================================================================= +""-"z:\sys\bin\Text.pgn" +""-"z:\private\101ffa91\plugins\Text.rsc" +""-"z:\resource\apps\Text.mif" diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/data/ImageEditorStub.sis Binary file imageeditor/data/ImageEditorStub.sis has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/data/ImageEditor_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/data/ImageEditor_stub.pkg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,197 @@ +; +; 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: +; +; Languages: +&EN + +; Header +#{"Image Editor"}, (0x101FFA91), 1, 0, 0, TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Files + +;;============================================================================= +;; APPLICATION +;;============================================================================= +""-"z:\sys\bin\ImageEditor.exe" +""-"z:\resource\apps\imageeditor.rsc" +""-"z:\private\10003A3F\import\apps\ImageEditor_reg.rsc" + +;;============================================================================= +;; UI +;;============================================================================= +""-"z:\sys\bin\ImageEditorUi.dll" +""-"z:\resource\apps\ImageEditorUi.rsc" +""-"z:\resource\apps\ImageEditorUi.mif" + +;;============================================================================= +;; MANAGER +;;============================================================================= +""-"z:\sys\bin\ImageEditorManager.dll" + +;;============================================================================= +;; PLUG-IN FRAMEWORK +;;============================================================================= +""-"z:\sys\bin\pb.dll" +""-"z:\sys\bin\iepb.dll" +""-"z:\resource\apps\ImageEditorPluginBase.rsc" + +;;============================================================================= +;; AIW SERVICE PROVIDER +;;============================================================================= +""-"z:\sys\bin\ImageEditorProvider.dll" +""-"z:\resource\plugins\ImageEditorProvider.rsc" +""-"z:\resource\ImageEditorProviderInternal.rsc" + +;;============================================================================= +;; BLACK & WHITE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Blackwhite.pgn" +""-"z:\private\101ffa91\plugins\Blackwhite.rsc" +""-"z:\resource\apps\Blackwhite.mif" + +;;============================================================================= +;; BRIGHTNESS PLUGIN +;;============================================================================= +""-"z:\sys\bin\Brightness.pgn" +""-"z:\private\101ffa91\plugins\brightness.rsc" +""-"z:\resource\apps\brightness.mif" + +;;============================================================================= +;; CARTOONIZE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Cartoonize.pgn" +""-"z:\private\101ffa91\plugins\Cartoonize.rsc" +""-"z:\resource\apps\Cartoonize.mif" + +;;============================================================================= +;; CLIPART PLUGIN +;;============================================================================= +""-"z:\sys\bin\Clipart.pgn" +""-"z:\private\101ffa91\plugins\Clipart.rsc" +""-"z:\resource\apps\Clipart.mif" + +""-"z:\private\101ffa91\cliparts\Cliparts01.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts02.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts03.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts04.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts05.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts06.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts07.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts08.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts09.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts10.mbm" +""-"z:\private\101ffa91\cliparts\Cliparts11.mbm" + +;;============================================================================= +;; BUBBLE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Bubble.pgn" +""-"z:\private\101ffa91\plugins\Bubble.rsc" +""-"z:\resource\apps\Bubble.mif" + +""-"z:\private\101ffa91\bubbles\Bubbles01.mbm" +""-"z:\private\101ffa91\bubbles\Bubbles02.mbm" +""-"z:\private\101ffa91\bubbles\Bubbles03.mbm" + + +;;============================================================================= +;; CONTRAST PLUGIN +;;============================================================================= +""-"z:\sys\bin\Contrast.pgn" +""-"z:\private\101ffa91\plugins\Clipart.rsc" +""-"z:\resource\apps\contrast.mif" + +;;============================================================================= +;; CROP PLUGIN +;;============================================================================= +""-"z:\sys\bin\Crop.pgn" +""-"z:\private\101ffa91\plugins\crop.rsc" +""-"z:\resource\apps\crop.mif" + +;;============================================================================= +;; FRAME PLUGIN +;;============================================================================= +""-"z:\sys\bin\Frame.pgn" +""-"z:\private\101ffa91\plugins\Frame.rsc" +""-"z:\resource\apps\Frame.mif" + +""-"z:\private\101ffa91\frames\frames01.mbm" + +;;============================================================================= +;; NEGATIVE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Negative.pgn" +""-"z:\private\101ffa91\plugins\Negative.rsc" +""-"z:\resource\apps\Negative.mif" + +;;============================================================================= +;; RED-EYE REDUCTION PLUGIN +;;============================================================================= +""-"z:\sys\bin\RedEyeReduction.pgn" +""-"z:\private\101ffa91\plugins\RedEyeReduction.rsc" +""-"z:\resource\apps\RedEyeReduction.mif" + +;;============================================================================= +;; RESIZE PLUGIN +;;============================================================================= +""-"z:\sys\bin\Resize.pgn" +""-"z:\private\101ffa91\plugins\Resize.rsc" +""-"z:\resource\apps\Resize.mif" + +;;============================================================================= +;; ROTATE LEFT PLUGIN +;;============================================================================= +""-"z:\sys\bin\RotateLeft.pgn" +""-"z:\private\101ffa91\plugins\RotateLeft.rsc" +""-"z:\resource\apps\RotateLeft.mif" + +;;============================================================================= +;; ROTATE RIGHT PLUGIN +;;============================================================================= +""-"z:\sys\bin\RotateRight.pgn" +""-"z:\private\101ffa91\plugins\RotateRight.rsc" +""-"z:\resource\apps\RotateRight.mif" + +;;============================================================================= +;; SEPIA PLUGIN +;;============================================================================= +""-"z:\sys\bin\Sepia.pgn" +""-"z:\private\101ffa91\plugins\Sepia.rsc" +""-"z:\resource\apps\Sepia.mif" + +;;============================================================================= +;; SHARPNESS PLUGIN +;;============================================================================= +""-"z:\sys\bin\Sharpness.pgn" +""-"z:\private\101ffa91\plugins\Sharpness.rsc" +""-"z:\resource\apps\Sharpness.mif" + +;;============================================================================= +;; TEXT PLUGIN +;;============================================================================= +""-"z:\sys\bin\Text.pgn" +""-"z:\private\101ffa91\plugins\Text.rsc" +""-"z:\resource\apps\Text.mif" + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/data/ImageEditor_stub.sis Binary file imageeditor/data/ImageEditor_stub.sis has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/data/buildsis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/data/buildsis.bat Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2010 Ixonos Plc. +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of the "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - Initial contribution +rem +rem Contributors: +rem Ixonos Plc +rem +rem Description: +rem + +makesis -s ImageEditor.pkg ImageEditorStub.sis \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,79 @@ +/* +* 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: +* ImageEditor bld.inf file. +* +*/ + + +#include +#include "../inc/definitions.def" +#include + +// Erase temp files in WINS env +PRJ_MMPFILES +//gnumakefile erasetempfiles.mk + +/// Plugin framework +#include "../PB/group/bld.inf" +#include "../IEPB/group/bld.inf" + +/// Image Editor components +#include "../ImageEditorUI/group/bld.inf" +#include "../ImageEditorManager/group/bld.inf" + +/// Image editor application +#include "../ImageEditorApp/group/bld.inf" + +/// Plugins +#include "../plugins/BlackWhitePlugin/group/bld.inf" +#include "../plugins/NegativePlugin/group/bld.inf" +#include "../plugins/SepiaPlugin/group/bld.inf" +#include "../plugins/BrightnessPlugin/group/bld.inf" +#include "../plugins/BubblePlugin/group/bld.inf" +#include "../plugins/ContrastPlugin/group/bld.inf" +#include "../plugins/SharpnessPlugin/group/bld.inf" +#include "../plugins/RedEyePlugin/group/bld.inf" +#include "../plugins/CartoonizePlugin/group/bld.inf" +#include "../plugins/FramePlugin/group/bld.inf" +#include "../plugins/ClipartPlugin/group/bld.inf" +#include "../plugins/CropPlugin/group/bld.inf" +#include "../plugins/RotateLPlugin/group/bld.inf" +#include "../plugins/RotateRPlugin/group/bld.inf" +#include "../plugins/ResizePlugin/group/bld.inf" +#include "../plugins/TextPlugin/group/bld.inf" +#ifdef RD_IE_DRAW_PLUGIN +#include "../plugins/DrawPlugin/group/bld.inf" +#endif // RD_IE_DRAW_PLUGIN +// Editor AIW Provider +#include "../EditorProvider/group/bld.inf" + +// makefiles +PRJ_MMPFILES +//gnumakefile bldsis.mk + +// Exported files +PRJ_EXPORTS +../loc/ImageEditor.loc APP_LAYER_LOC_EXPORT_PATH(ImageEditor.loc) + +../data/ImageEditorStub.sis /epoc32/data/z/system/install/ImageEditorStub.sis +//../inc/imageeditordebugutils.h /epoc32/include/imageeditordebugutils.h + +// ROM description +../rom/ImageEditor_Resource.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(ImageEditor_Resource.iby) +// +//../inc/ImageEditorUids.hrh /epoc32/include/ImageEditorUids.hrh + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/aif/ImageEditor_reg.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/aif/ImageEditor_reg.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,39 @@ +/* +* 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: +* Resource definitions for ImageEditorApp. +* +*/ + + +#include +#include +#include + +#include "../../inc/imageeditoruids.hrh" + +UID2 KUidAppRegistrationResourceFile +UID3 UID_IMAGE_EDITOR + +RESOURCE APP_REGISTRATION_INFO +{ + app_file = "ImageEditor"; + localisable_resource_file = APP_RESOURCE_DIR"\\ImageEditor"; + localisable_resource_id = R_IMAGE_EDITOR_APP_INFO; + hidden = KAppIsHidden; + embeddability = KAppEmbeddable; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/aif/Thumbs.db Binary file imageeditor/imageeditorApp/aif/Thumbs.db has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/aif/context_pane_icon.bmp Binary file imageeditor/imageeditorApp/aif/context_pane_icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/aif/context_pane_icon_mask.bmp Binary file imageeditor/imageeditorApp/aif/context_pane_icon_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/aif/list_icon.bmp Binary file imageeditor/imageeditorApp/aif/list_icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/aif/list_icon_mask.bmp Binary file imageeditor/imageeditorApp/aif/list_icon_mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/data/01020304.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/data/01020304.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* +*/ + + +#include +#include "ImageEditorUids.hrh" + + +RESOURCE REGISTRY_INFO the_info + { + dll_uid = 0x01010101; + interfaces = + { + INTERFACE_INFO + { + interface_uid=0x101f8c96; // const TUid KUidFileEmbeddedApplicationInterfaceUid={0x101f8c96}; + implementations= + { + IMPLEMENTATION_INFO + { + implementation_uid=UID_IMAGE_EDITOR; + version_no=1; + display_name="ImageEditor"; + default_data=""; + opaque_data=""; + } + }; + } + }; + } + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/data/ImageEditor.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/data/ImageEditor.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,134 @@ +/* +* 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: +* Resource definitions for ImageEditorApp. +* +*/ + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME IEDT + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include +#include +#include +#include +#include + +#include "imageeditor.hrh" +#include "imageeditor_gen.loc" + +#include + +//============================================================================= +// CONSTANTS +//============================================================================= + + + +//============================================================================= +// MACROS +//============================================================================= + + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE TBUF { buf="imageeditor"; } + + +//============================================================================= +// APPLICATION INFO +//============================================================================= +RESOURCE EIK_APP_INFO +{ +// cba = R_AVKON_SOFTKEYS_EMPTY; +} + +//============================================================================= +// LOCALISABLE APPLICATION INFO +//============================================================================= +RESOURCE LOCALISABLE_APP_INFO r_image_editor_app_info +{ + caption_and_icon = + CAPTION_AND_ICON_INFO + { + }; +} + + +//============================================================================= +// +// ERROR NOTES +// +//============================================================================= + +RESOURCE TBUF128 r_error_not_enough_disk_space +{ + buf = qtn_memlo_memory_running_out; +} + +RESOURCE TBUF128 r_error_not_enough_memory +{ + buf = qtn_memlo_ram_out_of_mem; +} + +RESOURCE TBUF128 r_error_saving +{ + buf = qtn_sie_error_saving; +} + +RESOURCE TBUF128 r_error_loading +{ + buf = qtn_sie_error_loading; +} + +RESOURCE TBUF128 r_error_processing +{ + buf = qtn_sie_error_processing; +} + +RESOURCE TBUF128 r_error_engine +{ + buf = qtn_sie_error_engine; +} + +RESOURCE TBUF128 r_error_internal +{ + buf = qtn_sie_error_internal; +} + +RESOURCE TBUF128 r_error_internal_non_recoverable +{ + buf = qtn_sie_error_internal_non_recoverable; +} + +// qtn_sie_error_protected_file not defined anywhere +// is this even needed or can it be taken away? +RESOURCE TBUF128 r_error_protected_file +{ + buf = qtn_sie_error_protected_file; +} diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/data/ImageEditor_caption.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/data/ImageEditor_caption.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,39 @@ +/* +* 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: +* ImageEditor caption resource definitions. +* +*/ + + + +//============================================================================= +// INCLUDES +//============================================================================= +#include + +//============================================================================= +// CAPTION +// +// Because the editor is used only as an embedded application, these +// captions are never shown to the user. The application status pane text +// is replaced with the name of the edited image. +// +//============================================================================= +RESOURCE CAPTION_DATA +{ + caption = " "; + shortcaption = " "; +} diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/group/ImageEditor.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/group/ImageEditor.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,162 @@ +/* +* 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: +* +*/ + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../inc/imageeditoruids.hrh" +#include "../../inc/definitions.def" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + + +MACRO EXIF_SUPPORT + + + +MACRO AIW_SUPPORT + + +#if defined( __LANDSCAPE_SUPPORT__ ) +MACRO LANDSCAPE_SUPPORT +#endif + +#if defined( __FILE_TIME_STAMP_UPDATE__ ) +MACRO FILE_TIME_STAMP_UPDATE +#endif + +#if defined( __LANDSCAPE_ONLY__ ) +MACRO LANDSCAPE_ONLY +#endif + +#if defined(__LANDSCAPE_ROTATE_HOTKEYS__) +MACRO LANDSCAPE_ROTATE_HOTKEYS +#endif + +#if defined(__LANDSCAPE_PAN_HOTKEYS__) +MACRO LANDSCAPE_PAN_HOTKEYS +#endif + +#if defined(__S60_31_VOLUME_KEYS__) +MACRO S60_31_VOLUME_KEYS +LIBRARY remconcoreapi.lib +LIBRARY remconinterfacebase.lib +#endif + +#if defined( __FULLSCREEN_AVAILABLE__ ) +MACRO FULLSCREEN_AVAILABLE +#endif + +TARGET ImageEditor.exe +TARGETTYPE exe +EPOCSTACKSIZE 0x5000 +EPOCHEAPSIZE 0x400 0x800000 +UID 0x100039CE UID_IMAGE_EDITOR + +VENDORID VID_DEFAULT +CAPABILITY CAP_APPLICATION AllFiles + +SOURCEPATH ../src +SOURCE ImageEditorApp.cpp +SOURCE ImageEditorAppUi.cpp +SOURCE ImageEditorDocument.cpp +SOURCE ImageEditorImageController.cpp +SOURCE CImageEditorVolumeKeyObserver.cpp +#if defined(__S60_31_VOLUME_KEYS__) +SOURCE CMGXRemConTarget.cpp +#endif + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../group +USERINCLUDE ../../ImageEditorUI/inc +USERINCLUDE ../../ImageEditorManager/inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/ImageEditor.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + +START RESOURCE ../data/ImageEditor_caption.rss +HEADER +TARGETPATH APP_RESOURCE_DIR +LANGUAGE_IDS +END + + +LIBRARY euser.lib + +LIBRARY apparc.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY eikctl.lib +LIBRARY eikcoctl.lib +LIBRARY eikcdlg.lib +LIBRARY avkon.lib +LIBRARY fbscli.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY sendui.lib +LIBRARY hlplch.lib +LIBRARY ws32.lib +LIBRARY systemparameters.lib +LIBRARY aknnotify.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditormanager.lib +LIBRARY imageeditorutils.lib +LIBRARY CommonDialogs.lib +LIBRARY PlatformEnv.lib +LIBRARY featmgr.lib +LIBRARY eiksrv.lib + +LIBRARY RemConCoreApi.lib +LIBRARY RemConInterfaceBase.lib + +START RESOURCE ../aif/ImageEditor_reg.rss +DEPENDS imageeditor.rsg +// Do not change the UID below. +TARGETPATH /private/10003a3f/apps +END + +START BITMAP ImageEditor_aif.mbm +TARGETPATH APP_RESOURCE_DIR +SOURCEPATH ../aif +SOURCE c8 context_pane_icon.bmp +SOURCE c8 context_pane_icon_mask.bmp +SOURCE c8 list_icon.bmp +SOURCE c8 list_icon_mask.bmp +END + +// End of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,44 @@ +/* +* 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: +* ImageEditorApp bld.inf file. +* +*/ + + +#include +#include + +#include "../../inc/definitions.def" + + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// Help exports +#include "../help/group/bld.inf" + +// project exports +PRJ_EXPORTS +../rom/ImageEditor.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditor.iby) + +// mmp files +PRJ_MMPFILES +ImageEditor.mmp + +// test project mmp files +PRJ_TESTMMPFILES +//../tsrc/MemTestProg/group/MemTestProg.mmp diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/help/data/xhtml.zip Binary file imageeditor/imageeditorApp/help/data/xhtml.zip has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/help/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/help/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* Export help related files. +* +*/ + +#include +PRJ_EXPORTS +:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite +:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite + +../inc/sie.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/sie.hlp.hrh) +../rom/imageeditorapphelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(imageeditorapphelps_variant.iby) diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/help/inc/sie.hlp.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/help/inc/sie.hlp.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,18 @@ +// +// sie.hlp.hrh +// + +// +// File generated by CSXHelp Utilities on 2008-08-12 +// + +#ifndef __SIE_HLP_HRH__ +#define __SIE_HLP_HRH__ + +_LIT(KSIE_HLP_EDIT_TEXT, "SIE_HLP_EDIT_TEXT"); // +_LIT(KSIE_HLP_EDIT_CLIPART, "SIE_HLP_EDIT_CLIPART"); // +_LIT(KSIE_HLP_REDEYE, "SIE_HLP_REDEYE"); // +_LIT(KSIE_HLP_ZOOMING, "SIE_HLP_ZOOMING"); // +_LIT(KSIE_HLP_MAIN, "SIE_HLP_MAIN"); // + +#endif \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/help/rom/imageeditorapphelps_variant.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/help/rom/imageeditorapphelps_variant.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + +#ifndef __IMAGEEDITORAPPHELPS_VARIANT_IBY__ +#define __IMAGEEDITORAPPHELPS_VARIANT_IBY__ + +#if defined(FF_S60_HELPS_IN_USE) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FFA91\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x101FFA91\contents.zip) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FFA91\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101FFA91\index.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FFA91\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101FFA91\keywords.xml) + data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FFA91\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101FFA91\meta.xml) +#endif + +#endif \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/CImageEditorVolumeKeyObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/CImageEditorVolumeKeyObserver.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,156 @@ +/* +* 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: +* Observes Remote Controller Framework for volume key presses. +* +*/ + + +#ifndef IMAGEEDITORVOLKEYOBSERVER_H +#define IMAGEEDITORVOLKEYOBSERVER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CRemConInterfaceSelector; +class CRemConCoreApiTarget; +class CImageEditorRemConKeyResponse; + +/** +* Observer interface for volume key events +* +* since @3.1 +* +*/ +class MImageEditorVolumeKeyObserver + { +public: + /** + * Report volume keys events to observer + * @since 3.1 + * @param aOperationId Volume key up Volume key down event + * @param aButtonAct button action (press, release, click) + */ + virtual void HandleVolumeKeyEvent( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) = 0; + }; + +// CLASS DECLARATION + +/** +* Observes Remote Controller Framework +* +* @since 3.1 +*/ +class CImageEditorRemConObserver + : public CBase, public MRemConCoreApiTargetObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * @param aZoomPane zoom pane instance + * @return new instance. + */ + static CImageEditorRemConObserver* NewL( MImageEditorVolumeKeyObserver& aObserver ); + + /** + * Destructor. + */ + ~CImageEditorRemConObserver(); + + public: // New functions + + protected: + + /** + * from MRemConCoreApiTargetObserver interface class. + * A command has been received. + * @param aOperationId The operation ID of the command. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoCommand( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); + + /** + * from MRemConCoreApiTargetObserver interface class. + * not used + */ + void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, + TRemConCoreApiButtonAction aButtonAct); + + /** + * from MRemConCoreApiTargetObserver interface class. + * not used + */ + void MrccatoTuneFunction(TBool aTwoPart, + TUint aMajorChannel, + TUint aMinorChannel, + TRemConCoreApiButtonAction aButtonAct); + + /** + * from MRemConCoreApiTargetObserver interface class. + * not used + */ + void MrccatoSelectDiskFunction(TUint aDisk, + TRemConCoreApiButtonAction aButtonAct); + + /** + * from MRemConCoreApiTargetObserver interface class. + * not used + */ + void MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct); + + /** + * from MRemConCoreApiTargetObserver interface class. + * not used + */ + void MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber, + TRemConCoreApiButtonAction aButtonAct); + + private: + + /** + * C++ default constructor. + * @since 3.1 + * @param aZoomPane instance of zoom pane + */ + CImageEditorRemConObserver( MImageEditorVolumeKeyObserver& aObserver ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + private: // Data + + // Remote Controller + CRemConInterfaceSelector* iInterfaceSelector; + + // Remote Controller + CRemConCoreApiTarget* iCoreTarget; + + // Key response + CImageEditorRemConKeyResponse* iActiveRemCon; + + // zoom pane + MImageEditorVolumeKeyObserver& iObserver; + }; + +#endif // IMAGEEDITORVOLKEYOBSERVER_H + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/CMGXRemConTarget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/CMGXRemConTarget.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,141 @@ +/* +* 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: +* +*/ + + + + +#ifndef DMHREMCONTARGET_H +#define DMHREMCONTARGET_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS +class CRemConCoreApiTarget; +class CRemConInterfaceSelector; + +// CLASS DECLARATION + +class MMGXMediakeyObserver + { + public: + + virtual void HandleVolumeUpL() = 0; + virtual void HandleVolumeDownL() = 0; + + }; + +/** +* mgx listener for RemCon commands. +*/ +class CMGXRemConTarget : public CBase, public MRemConCoreApiTargetObserver + { + public: // Methods + + // Constructors and destructor + + /** + * Static constructor. + */ + static CMGXRemConTarget* NewL(MMGXMediakeyObserver* aObserver); + + /** + * Destructor. + */ + virtual ~CMGXRemConTarget(); + + // Methods from base classes + + /** + * From MRemConCoreApiTargetObserver MrccatoCommand. + * A command has been received. + * @param aOperationId The operation ID of the command. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct); + + /** + * From MRemConCoreApiTargetObserver MrccatoPlay. + * A 'play' command has been received. + * @param aSpeed The playback speed. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoPlay(TRemConCoreApiPlaybackSpeed aSpeed, TRemConCoreApiButtonAction aButtonAct); + + /** + * From MRemConCoreApiTargetObserver MrccatoTuneFunction. + * A 'tune function' command has been received. + * @param aTwoPart If EFalse, only aMajorChannel is to be used. Otherwise, + * both aMajorChannel and aMinorChannel are to be used. + * @param aMajorChannel The major channel number. + * @param aMinorChannel The minor channel number. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoTuneFunction(TBool aTwoPart, TUint aMajorChannel, TUint aMinorChannel, TRemConCoreApiButtonAction aButtonAct); + + /** + * From MRemConCoreApiTargetObserver MrccatoSelectDiskFunction. + * A 'select disk function' has been received. + * @param aDisk The disk. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoSelectDiskFunction(TUint aDisk, TRemConCoreApiButtonAction aButtonAct); + + /** + * From MRemConCoreApiTargetObserver MrccatoSelectAvInputFunction. + * A 'select AV input function' has been received. + * @param aAvInputSignalNumber The AV input. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoSelectAvInputFunction(TUint8 aAvInputSignalNumber, TRemConCoreApiButtonAction aButtonAct); + + /** + * From MRemConCoreApiTargetObserver MrccatoSelectAudioInputFunction. + * A 'select audio input function' has been received. + * @param aAudioInputSignalNumber The audio input. + * @param aButtonAct The button action associated with the command. + */ + void MrccatoSelectAudioInputFunction(TUint8 aAudioInputSignalNumber, TRemConCoreApiButtonAction aButtonAct); + + protected: // Methods + + private: //Methods + + /** + * C++ default constructor. + */ + CMGXRemConTarget(MMGXMediakeyObserver* aObserver); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + + private: // Data + + MMGXMediakeyObserver* iObserver; + /** RemCon interface selector. */ + CRemConInterfaceSelector* iInterfaceSelector; + /** RemCon Core API target class. */ + CRemConCoreApiTarget* iCoreTarget; + }; + +#endif //MMENUREMCONTARGET_H + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageControllerObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageControllerObserver.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,120 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGECONTROLLEROBSERVER_H +#define IMAGECONTROLLEROBSERVER_H + +// INCLUDES + +// FORWARD DECLARATIONS + + +/* CLASS: MImageControllerObserver +* +* MImageControllerObserver is an mixing class providing a callback API +* for the observer of CImageController class. +* +*/ +class MImageControllerObserver +{ + +public: + +/** @name Methods:*/ +//@{ + enum TOperationCode + { + /// Invalid + EOperationCodeMin = 0, + /// Loading images + EOperationCodeLoad, + /// Block loading images + EOperationCodeBlockLoad, + /// Saving images + EOperationCodeSave, + /// Block saving images + EOperationCodeBlockSave, + /// Deleting images + EOperationCodeDelete, + /// Renaming images + EOperationCodeRename, + /// Searching images + EOperationCodeSearch, + /// Invalid + EOperationCodeMax + }; +//@} + +/** @name Methods:*/ +//@{ + + /* OperationReadyL + * + * This method is called when asynchronous loading or saving operation + * is completed or when an error has occurred. + * + * @param aOpId - operation ID + * @param aError - error code + * @return - + */ + virtual void OperationReadyL ( + TOperationCode aOpId, + TInt aError + ) = 0; + + /* IncrementProgressBarL + * + * This method is called to increment the progress bar when + * one step is completed. + * + * @param - + * @return - + */ + virtual void IncrementProgressBarL (const TInt aIncrement) = 0; +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageEditor.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageEditor.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,37 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITOR_HRH +#define IMAGEEDITOR_HRH + +/// Image Editor command IDs +enum TImageEditorCommandIds +{ + EImageEditorCmdAppNop = 1 +}; + +enum TImageEditorControlIds // Progress note id + { + EWaitNote = 0x300 + }; + + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageEditorApp.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageEditorApp.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,119 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORAPP_H +#define IMAGEEDITORAPP_H + + +// INCLUDES +#include + +// debug log writer +#include "imageeditordebugutils.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + + +/* CLASS: CImageEditorApp +* +* CImageEditorApp application class. Provides factory to create concrete +* document object. +* +*/ +class CImageEditorApp : public CAknApplication +{ + +public: + +/** @name Methods:*/ +//@{ + + /* OpenIniFileLC + * + * Opens .ini file associated with the application. Constructs + * dictionary store object, puts the pointer to it to CleanupStack + * and returns it. + * + * The .ini file is created, if it does not exist. + * + * Implementation of this method is provided by UI framework. + * + * @param aFs - file server session + * @return pointer to the created dictionary store + * @see CApaApplication + */ + virtual CDictionaryStore * OpenIniFileLC (RFs & aFs) const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ +//@} + +/** @name Members:*/ +//@{ +//@} + +private: + +/** @name Methods:*/ +//@{ + + /* CreateDocumentL + * + * Creates a document object. Called by the application process when + * a new document is required. Application process adds the document + * its list of documents. + * + * Implementation of this method is provided by UI framework. + * + * @param - + * @return pointer to the created CApaDocument + * @see CApaApplication + */ + virtual CApaDocument * CreateDocumentL(); + + /* AppDllUid + * + * Gets application specific UID. The UID is used to differentiate + * between UI applications. + * + * Implementation of this method must be provided by UI application. + * + * @param - + * @return TUid - application's UID + * @see CApaApplication + */ + virtual TUid AppDllUid() const; + +//@} + +/** @name Members:*/ +//@{ +//@} + +}; + +#endif + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageEditorAppUi.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageEditorAppUi.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,752 @@ +/* +* 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 header. +* +*/ + + + +#ifndef IMAGEEDITORAPPUI_H +#define IMAGEEDITORAPPUI_H + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ImageControllerObserver.h" +#include "CallbackMethod.h" +#include "commondefs.h" +#include "CImageEditorVolumeKeyObserver.h" + +#ifdef S60_31_VOLUME_KEYS +#include "CMGXRemConTarget.h" +#endif + +// debug log writer +#include "imageeditordebugutils.h" + +// FORWARD DECLARATIONS +class CPluginLocator; +class CImageController; +class CImageEditorPluginManager; +class CAknView; +class CPluginLocator; +class CImageEditorPluginManager; +class CImageController; +class CSendUi; +class CObCallback; +class CResolutionUtil; + + +// CONSTANTS + + +/** CLASS: CImageEditorAppUi +* +* Image Editor application UI class. Encapsulates and provides support +* for EIKON control architecture, view architecture and status pane. +* +*/ +class CImageEditorAppUi : public CAknViewAppUi, + public MImageControllerObserver, + public MObCallbackMethod, + public MProgressDialogCallback, + public MImageEditorVolumeKeyObserver + + #ifdef S60_31_VOLUME_KEYS + , public MMGXMediakeyObserver + #endif +{ + +public: + +/** @name Methods:*/ +//@{ + + /** ConstructL, second phase constructor + * + * @param - + * @return - + */ + void ConstructL(); + + /** C++ constructor + * + * @param - + * @return - + */ + CImageEditorAppUi(); + + /** Destructor + * + * @param - + * @return - + */ + ~CImageEditorAppUi(); + + /** ProcessCommandParametersL + * + * Processes shell commands sent to the application. + * + * @param aCommand - sent shell command + * @param aDocumentName - document name + * @param aTail - command line tail + * @return ETrue if aDocumentName exists, EFalse otherwise + * @see CEikAppUi + */ + virtual TBool ProcessCommandParametersL ( + TApaCommand aCommand, + TFileName & aDocumentName, + const TDesC8 & aTail + ); + + /** OperationReadyL + * + * @see MImageControllerObserver + */ + virtual void OperationReadyL ( + TOperationCode aOpId, + TInt aError + ); + + /** IncrementProgressBarL + * + * @from MImageControllerObserver + * Increments the iProgressNote one step + * + * @param aIncrement - increment + * @return - + */ + void IncrementProgressBarL(const TInt aIncrement); + + /** SendImageL + * + * Sends image by using CSendAppUi class. + * + * @param - + * @return - + */ + void SendImageL (); + + /** RenderL + * + * Calls manager to render image + * + * @param - + * @return - + */ + void RenderL (); + + /** OpenFileL + * + * Set document filename. Called when started as an embedded + * + * @param aFile - image file + * @return - + */ + void OpenFileL (RFile& aFile); + + /** CallbackMethodL + * + * @see MObCallbackMethod + */ + virtual TBool CallbackMethodL (TInt aParam); + + /** DialogDismissedL + * + * @see MProgressDialogCallback + */ + void DialogDismissedL( TInt aButtonId ); + + /** HandleVolumeKeyEvent + * + * @From MIVVolumeKeyObserver + */ + void HandleVolumeKeyEvent( TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ); +//@} + +protected: + +/** @name Methods:*/ +//@{ +//@} + +/** @name Members:*/ +//@{ +//@} + +private: + +/** @name Typedefs:*/ +//@{ + enum TConstructionState + { + // Invalid + EConstructionStateMin = 0, + // Allocate new locator, manager and controller objects + EConstructionStateAlloc, + // Scan plug-ins + EConstructionStateScanPlugins, + // Load image plug-ins + EConstructionStateLoadImage, + // Wait for the application framework to provide parameters (calling OpenFileL) + EConstructionStateWaitForStartupParameters, + // Initialize UI + EConstructionStateInitUi, + // Invalid + EConstructionStateReady + } iConstructionState; +//@} + +/** @name Methods:*/ +//@{ + + /** HandleCommandL + * + * Handles user commands. This implementation overwrites the dummy + * implementation in CEikAppUi to provide application specific response + * to CEikAppUi::ProcessCommandL() called by application framework. + * + * @param aCommand - + * @return - + * @see CEikAppUi + */ + virtual void HandleCommandL (TInt aCommand); + + /** HandleKeyEventL + * + * This function is called whenever the window server sends an event + * aEvent (standard or special) to the application. It calls one of a + * number of functions, according to the type of the event receivedHandles + * key events generated when keys are pressed. + * + * @param aEvent - generated window server event + * @param aDestination - target control (pointer events) + * @return - + * @see CCoeAppUi + */ + void HandleWsEventL ( + const TWsEvent & aEvent, + CCoeControl * aDestination + ); + + /** HandleForegroundEventL + * + * Handles application transfer to foreground and background. + * + * @param aForeground - foreground flag + * @return - + * @see CCoeAppUi + */ + void HandleForegroundEventL (TBool aForeground); + + /** HandleKeyEventL + * + * Handles key events generated when keys are pressed. This method is + * called by HandleWsEventL() if the whole control stack returns + * EKeyWasNotConsumed from OfferKeyEventL(). + * + * @param aKeyEvent - key event that occurred + * @param aType - window server event type that is being handled + * @return TKeyResponse - response enum incicating whether or not + * the event has been handled, defaults to EKeyWasNotConsumed + * @see CCoeAppUi + */ + virtual TKeyResponse HandleKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /** HandleScreenDeviceChangedL + * + * Handles screen device changes like orientation + * + * @param - + * @return - + * + * @see CEikAppUi + */ + virtual void HandleScreenDeviceChangedL(); + + /** LandscapeScreenOrientation + * + * Check the screen orientation. ote that is not necessarily the same as + * the current device orientation. + * + * @param - + * @return TBool - Returns true if the screen device is + * rotated by 90 degrees (landscape display) + * + * @see CEikAppUi + */ + virtual TBool LandscapeScreenOrientation(); + + /* HelpContextL + * + * Return the help context for this application + * + * @PARAM A pointer to the help context + * @see CAknAppUi + */ + CArrayFix* HelpContextL() const; + + /** CreatePluginLocatorL + * + * Creates plug-in locator. + * + * @param - + * @return - + */ + void CreatePluginLocatorL(); + + /** CreateEditorManagerL + * + * Creates editor manager. + * + * @param - + * @return - + */ + void CreateEditorManagerL(); + + /** CreateImageControllerL + * + * Creates image controller. + * + * @param - + * @return - + */ + void CreateImageControllerL(); + + /** LoadPluginsL + * + * Loads Image Editor plug-ins. + * + * @param - + * @return - + */ + void LoadPluginsL(); + + /** InitializeUiItemsL + * + * Initializes UI: sets preview image and UI items for plug-ins. + * Activates main view. + * + * @param - + * @return - + */ + void InitializeUiItemsL (); + + /** LoadImageL + * + * Loads the editor image + * + * @param - + * @return - + */ + void LoadImageL(); + + /** SaveImageL + * + * Saves the edited image with name orig-012.ext + * + * @param - + * @return - + */ + void SaveImageL (); + + /** SaveChangesAndSendL + * + * Shows a list dialog with two options: + * Save as new image + * Replace original + * + * Called before sending image. + * + * @param - + * @return - + */ + void SaveChangesAndSendL(); + + /** InitializePluginL + * + * Loads plug-in and initializes it, activates plug-in control. + * + * @param - + * @return - + */ + void InitializePluginL (); + + /** SetBusy + * + * Sets system busy. + * + * @param - + * @return - + */ + void SetBusy(); + + /** ResetBusy + * + * Resets system busy. + * + * @param - + * @return - + */ + void ResetBusy(); + + /** SetFullScreenL + * + * Sets full screen. + * + * @param - + * @return - + */ + void SetFullScreenL (); + + /** ResetFullScreenL + * + * Resets full screen. + * + * @param - + * @return - + */ + void ResetFullScreenL (); + + /** SetUndoFlag + * + * Sets the CanUndo flag to editor view. + * + * @param - + * @return - + */ + void SetUndoFlag(); + + /** SetTitlePaneTextL + * + * Sets title pane text. + * + * @param aText - title pane text + * @return - + */ + void SetTitlePaneTextL (const TDesC & aText); + + /** ClearTitlePaneTextL + * + * Clears title pane text. + * + * @param - + * @return - + */ + void ClearTitlePaneTextL(); + + + /** ClearNaviPaneTextL + * + * Clears navigation pane text. + * + * @param - + * @return - + */ + void ClearNaviPaneTextL(); + + /** SetFileNameTitlePaneL + * + * Sets current file name to title pane. + * + * @param aFullFileName - Full file name + * @return - + */ + void SetFileNameTitlePaneL (const TDesC& aFullFileName); + + /** HandleError + * + * @CAknAppUi + */ + virtual TErrorHandlerResponse HandleError ( + TInt aError, + const SExtendedError & aExtErr, + TDes & aErrorText, + TDes & aContextText + ); + + /** HandleErrorL + * + * Handles errors. + * + * @param - + * @return - + */ + void HandleErrorL (const TInt aError); + + /** ShowErrorNoteL + * + * Shows error note based on error. + * + * @param - + * @return - + */ + void ShowErrorNoteL (const TInt aError) const; + + /** CheckFileL + * + * Checks the file whether saving is OK to do. + * + * @param aFileName - file name + * @return - + */ + void CheckFileL (const TDesC & aFileName) const; + + /** UpdateScreenRectL + * + * Updates screen rect e.g. after switching full screen or landscape mode. + * + * @param - + * @return - + */ + void UpdateScreenRectL(); + + /** ZoomL + * + * Zoom in or out by one step + * + * @param aZoom - zoom direction + * @return - + */ + void ZoomL (const TZoom aZoom); + + /** PanL + * + * Pan image. + * + * @param aDirection - pan direction + * @return - + */ + void PanL (TDirection aDirection); + + /** TouchPanL + * + * Pan image. Panning has been done with touch. No parameters are + * delivered but function fetches direction information from view + * before forwarding pan command to engine. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void TouchPanL(); + + /** RotateL + * + * Rotate image (add rotate filter to engine). + * + * @param aRot - rotate direction + * @return - + */ + void RotateL (const TRotation aRot); + + /** SetImageNameL + * + * Create new document name + * + * @param - + * @return - + */ + void SetImageNameL (); + + /** LaunchLoadWaitNoteL + * + * Launches load wait note. + * + * @param - + * @return - + */ + void LaunchLoadWaitNoteL(); + + /** LaunchSaveWaitNoteL + * + * Launches load wait note. + * + * @param - + * @param aNumberOfSteps - Number of blocks to save + * @return - + */ + void LaunchSaveWaitNoteL (); + + /** KillWaitNote + * + * Kills wait note. + * + * @param - + * @return - + */ + void KillWaitNote(); + + /** DeleteTempFiles + * + * Deletes all temp files. + * + * @param - + * @return - + */ + void DeleteTempFiles() const; + + /** ApplicationReadyL + * + * Resets busy flag when application is ready. For synchronization. + * + * @param - + * @return - + */ + void ApplicationReadyL(); + + /** FinalizeSaveL + * + * + * @param - + * @return - + */ + void FinalizeSaveL(); + + /** HandleVolumeUpL + * + * @see MMGXMediakeyObserver + */ + virtual void HandleVolumeUpL(); + + /** HandleVolumeDownL + * + * @see MMGXMediakeyObserver + */ + virtual void HandleVolumeDownL(); + + /** SaveImageOverWriteL + * + * Saves the changed image + * + * + * + * @param aOverWrite if ETrue, overwrites the edited image + if EFalse, the image is saved to a given file name + * @return - + */ + void SaveImageOverWriteL(TBool aOverWrite); + + /** QueryAndSaveL + * + * Displays Avkon file handling queries and calls + * SaveImageOverWriteL() + * + * + * @param - + * @return TInt 1 if the image has been saved, otherwise 0 + */ + TInt QueryAndSaveL(); + + +//@} + +/** @name Members:*/ +//@{ + /// Main view + CAknView * iEditorView; + /// Wait dialog reference + CAknWaitDialog * iWaitNote; + /// Progress dialog reference + CAknProgressDialog * iProgressNote; + /// File handle + RFile iFile; + /// Command line file name + TFileName iDocumentName; + /// Source file name + TFileName iSourceFileName; + /// Temporary saved file name + TFileName iTempSaveFileName; + /// Active factory instance + CObCallback * iCallback; + /// Plug-in locator instance + CPluginLocator * iLocator; + /// Editor manager instance + CImageEditorPluginManager * iEditorManager; + /// Image operation controller + CImageController * iImageController; + /// CSendUi instance + CSendUi * iSendAppUi; + /// Has the image been saved at least once + TBool iImageSaved; + /// Application focus indicator + TBool iForeground; + /// Are we exiting from UI + TBool iExitFromApp; + /// Do we need to save changes + TBool iSaveOnExit; + /// System exit + TBool iSysExit; + /// Are we busy + TBool iBusy; + /// Orientation changed during loading + TBool iOrientationChanged; + /// Are we saving + TBool iSaving; + /// Are we going to send + TBool iSending; + /// Are we going to print + TBool iPrinting; + /// Are we going to cancel a plugin + TBool iCancelling; + /// Are we in full screen + TBool iFullScreen; + /// Plug-ins are scanned + TBool iPluginsScanned; + /// Image is loaded + TBool iImageLoaded; + /// Main view is ready + TBool iEditorReady; + /// Cancel text input query dialog shown + TBool iCancelTextInputActive; + /// Resolution util + CResolutionUtil* iResolutionUtil; + /// Media Gallery Albums support. + /// List of albums where the source image belongs to. + RArray iSourceImageMgAlbumIdList; + /// Screen rectangle + TRect iOldScreenRect; + + TProcessPriority iOriginalProcessPriority; + TBool iProcessPriorityAltered; + CImageEditorRemConObserver* iVolumeKeyObserver; + + TBool iSavingQuery; + +#ifdef S60_31_VOLUME_KEYS + /// Remote connection API used to handle the volume keys + /// (implementation borrowed from Media gallery) + CMGXRemConTarget* iMGXRemConTarget; +#endif + +//@} + +}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageEditorDocument.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageEditorDocument.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,132 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORDOCUMENT_H +#define IMAGEEDITORDOCUMENT_H + + +// INCLUDES +#include + +// debug log writer +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CEikAppUi; + + +// CLASS DECLARATION + +/** +* CIMAGEEDITORDocument application class. +*/ + +class CImageEditorDocument : public CAknDocument +{ + + +public: + +/** @name Methods:*/ +//@{ + + /* CImageEditorDocument factory method + * + * Creates new instance of CImageEditorDocument class. + * + * @param aApp - reference to CEikApplication + * @return - pointer to the created instance of CImageEditorDocument + * @see CAknDocument + * @see CEikDocument + */ + static CImageEditorDocument * NewL (CEikApplication & aApp); + + /* Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorDocument(); + + /* OpenFileL + * + * This method is called by UIKON framework to open a file. + * + * @see CAknDocument + */ + void OpenFileL(CFileStore*& aFileStore, RFile& aFile); + +//@} + +protected: + +/** @name Methods:*/ +//@{ +//@} + +/** @name Members:*/ +//@{ +//@} + +private: + +/** @name Methods:*/ +//@{ + + /* Default constructor + * + * Calls CEikDocument::CEikDocument(aApp), allocates new document, + * initializes its references to its associated application and managing + * process. + * + * @param aApp - reference to the application + * @return - + */ + CImageEditorDocument (CEikApplication & aApp); + + /* Second phase constructor + * + * @param - + * @return - + */ + void ConstructL(); + + /* CreateAppUiL + * + * Allocates application UI. Application framework calls this to create + * an instance of application UI for the document instance in question. + * Ownership of the returned CEikAppUi is transferred to UIKON. + * + * @param - + * @return pointer to created application UI instance + * @see CEikDocument + */ + CEikAppUi * CreateAppUiL(); + +//@} + +/** @name Members:*/ +//@{ +//@} +}; + +#endif + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageEditorImageController.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageEditorImageController.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,263 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORIMAGECONTROLLER_H +#define IMAGEEDITORIMAGECONTROLLER_H + +// INCLUDES +#include +#include + +#include "ImageControllerObserver.h" + + +// FORWARD DECLARATIONS +class CImageEditorPluginManager; +class CImageEditorImageHandler; + +/* CLASS: CImageController +* +* CImageController is an active object controlling asynchronous saving +* and loading of images. Also, synchronous methods for renaming and deleting +* images can be found. +*/ +class CImageController : public CActive +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aObserver - CImageController observer instance, ownership not changed + * @param aManager - CImageEditorPluginManager instance + * @return pointer to created CImageController object + */ + static CImageController * NewL ( + MImageControllerObserver * aObserver, + CImageEditorPluginManager * aManager + ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageController (); + + /** LoadImage + * + * Loads image. + * + * @param aFileName - name of the image file to be loaded + * @return - + */ + void LoadImageL (const TDesC & aFileName); + + /** SaveImage + * + * Saves image + * + * @param aFileName - saved image name + * @param aProgressCount - On return, contains the number of blocks to progress + * @return - + */ + void SaveImageL (const TDesC & aFileName); + + /** RenameImage + * + * Renames image. + * + * @param aFileNameSrc - source image name + * @param aFileNameDst - destination image name + * @return KErrNone if no errors, system wide error otherwise + */ + TInt RenameImage ( + const TDesC & aFileNameSrc, + const TDesC & aFileNameDst + ) const; + + /** DeleteImage + * + * Deletes image. + * + * @param aFileName - image name to be deleted + * @return KErrNone if no errors, system wide error otherwise + */ + TInt DeleteImage (const TDesC & aFileName) const; + + /** CreatePreviewBitmapL + * + * Creates the preview bitmap. + * + * @param - + * @return - + */ + void CreatePreviewBitmapL (); + + /** DeletePreviewBitmap + * + * Deletes the preview bitmap. + * + * @param - + * @return - + */ + void DeletePreviewBitmap (); + + /** CancelOperation + * + * Cancels loading, saving or processing operation. + * This does not call the AO's Cancel(), but rather waits for the nexts RunL() + * to finish, and finishes after that. + * + * @param aOperation - the on-going operation + * @return - + */ + void CancelOperation(TBool aForce = EFalse); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /** DoCancel + * + * Implements cancellation of outstanding request. This method is + * called from Cancel() of active object. Cancels asynchronous request + * and returns. DOES NOT WAIT THE REQUEST TO COMPLETE. + * + * @param - + * @return - + * @see CActive + */ + virtual void DoCancel(); + + /** RunL + * + * Active object's request completion handler. + * + * Active scheduler selects this class based on class priority and + * marks the status completed before calling this method. This method + * should handle the completion as fast as possible and return or issue + * another request. + * + * @param - + * @return - + * @see CActive + */ + virtual void RunL (); + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageController (); + + /** Second phase constructor, may leave + * + * @param aObserver - CImageController observer instance, ownership not changed + * @param aManager - CImageEditorPluginManager instance + * @return - + */ + void ConstructL ( + MImageControllerObserver * aObserver, + CImageEditorPluginManager * aManager + ); + + /** CompleteRequest + * + * Force RunL + * + * @param - + * @return - + */ + void CompleteRequest(); + + /** CalculateProgressInterval + * + * The saving operation typically consists of thousands of blocks. + * It makes no sense to update the progress bar that often. + * + * @param - + * @return - + */ + void CalculateProgressInterval (TInt aBlockCount); +//@} + +/** @name Members:*/ +//@{ + /// Image Handler + CImageEditorImageHandler * iImageHandler; + + /// Plug-in Manager + CImageEditorPluginManager * iManager; + + /// CImageController observer instance + MImageControllerObserver * iObserver; + + /// Preview bitmap + CFbsBitmap * iPreview; + + /// Jpeg Image + TBool iJpegImage; + + /// JPEG quality + TInt iQuality; + + /// Last operation + MImageControllerObserver::TOperationCode iOperation; + + /// Progress bar update interval (number of blocks) + TInt iProgressBarInterval; + + // Current save progress in percentage + TInt iSavedPercentage; + + // Previous save progress in percentage + TInt iSavedPercentageOld; + + /// Is operation cancelled + TBool iIsCancelled; + +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/inc/ImageEditor_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/inc/ImageEditor_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#include + +// ERROR NOTE TEXTS + +#define qtn_sie_error_not_enough_disk_space qtn_memlo_memory_running_out +#define qtn_sie_error_not_enough_memory qtn_memlo_ram_out_of_mem + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/rom/ImageEditor.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/rom/ImageEditor.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IMAGEEDITOR_IBY__ +#define __IMAGEEDITOR_IBY__ + +file=ABI_DIR\BUILD_DIR\ImageEditor.exe PROGRAMS_DIR\ImageEditor.exe + +data=DATAZ_\PRIVATE\10003A3F\APPS\ImageEditor_reg.rsc Private\10003a3f\apps\ImageEditor_reg.rsc + +#endif // __IMAGEEDITOR_IBY__ + +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/src/CImageEditorVolumeKeyObserver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/src/CImageEditorVolumeKeyObserver.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,342 @@ +/* +* 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: +* Receives buton presses from volume keys. +* +*/ + + +// INCLUDE FILES + +#include "CImageEditorVolumeKeyObserver.h" +#include +#include +#include +#include + +/** +* Helper class for sending response back to +* Remote Controller Framework +* +* @since 3.1 +*/ +class CImageEditorRemConKeyResponse : public CActive + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + * aparam Remote Controller instance + * @return new instance. + */ + static CImageEditorRemConKeyResponse* NewL( CRemConCoreApiTarget& + aRemConCoreApiTarget ); + + /** + * Destructor. + */ + virtual ~CImageEditorRemConKeyResponse(); + + public: // new function + + /** + * Send the any key response back to Remcon server + * @since 3.1 + * @param aOperationId Remcon operation + */ + void CompleteAnyKeyL( TRemConCoreApiOperationId aOperationId ); + + private: //from base class + + /** + * From CActive + * Called on completion of a request + * @since 3.1 + */ + void RunL(); + + /** + * From CActive + * Cancels an outstanding request + * @since 3.1 + */ + void DoCancel(); + + private: + + /** + * C++ default constructor. + * @since 3.1 + * aparam Remote Controller instance + */ + CImageEditorRemConKeyResponse( CRemConCoreApiTarget& aRemConCoreApiTarget ); + + private: + + // Response array + RArray iResponseArray; + + // Remote controller + CRemConCoreApiTarget& iRemConCoreApiTarget; + }; + + +// ----------------------------------------------------------------------------- +// CImageEditorRemConKeyResponse::CImageEditorRemConKeyResponse +// default C++ constructor +// ----------------------------------------------------------------------------- +// +CImageEditorRemConKeyResponse::CImageEditorRemConKeyResponse( CRemConCoreApiTarget& + aRemConCoreApiTarget ) + : CActive ( EPriorityNormal ), + iRemConCoreApiTarget ( aRemConCoreApiTarget ) + + { + CActiveScheduler::Add( this ); + } + + +// ----------------------------------------------------------------------------- +// CImageEditorRemConKeyResponse::NewL +// ----------------------------------------------------------------------------- +// +CImageEditorRemConKeyResponse* CImageEditorRemConKeyResponse::NewL(CRemConCoreApiTarget& + aRemConCoreApiTarget) + { + CImageEditorRemConKeyResponse* self = + new (ELeave) CImageEditorRemConKeyResponse( aRemConCoreApiTarget ); + + return self; + } + +// ----------------------------------------------------------------------------- +// CImageEditorRemConKeyResponse::~CImageEditorRemConKeyResponse +// ----------------------------------------------------------------------------- +// +CImageEditorRemConKeyResponse::~CImageEditorRemConKeyResponse() + { + Cancel(); + iResponseArray.Reset(); + iResponseArray.Close(); + } + +// ----------------------------------------------------------------------------- +// CImageEditorRemConKeyResponse::DoCancel +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConKeyResponse::DoCancel() + { + } + +// ----------------------------------------------------------------------------- +// CImageEditorRemConKeyResponse::RunL +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConKeyResponse::RunL() + { + // if any existing -> Send response + if ( iResponseArray.Count() ) + { + CompleteAnyKeyL( iResponseArray[0] ); + // Remove already completed key + iResponseArray.Remove(0); + iResponseArray.Compress(); + } + } + +// ----------------------------------------------------------------------------- +// CCamConKeyResponse::CompleteAnyKeyL +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConKeyResponse::CompleteAnyKeyL( TRemConCoreApiOperationId + aOperationId ) + { + if ( !IsActive() ) + { + switch ( aOperationId ) + { + case ERemConCoreApiVolumeUp: + { + iRemConCoreApiTarget.VolumeUpResponse( iStatus, KErrNone ); + SetActive(); + } + break; + case ERemConCoreApiVolumeDown: + { + iRemConCoreApiTarget.VolumeDownResponse( iStatus, KErrNone ); + SetActive(); + } + break; + default: + { + // Send general response for 'other' keys + iRemConCoreApiTarget.SendResponse( iStatus, aOperationId, KErrNone ); + SetActive(); + } + break; + } + } + // already active. Append to array and complete later. + else + { + User::LeaveIfError( iResponseArray.Append( aOperationId ) ); + } + } + + +// ----------------------------------------------------------------------------- +// ImageEditorRemConObserver::NewL +// ----------------------------------------------------------------------------- +// +CImageEditorRemConObserver* CImageEditorRemConObserver::NewL( MImageEditorVolumeKeyObserver &aObserver ) + { + CImageEditorRemConObserver* self = new ( ELeave ) CImageEditorRemConObserver( aObserver ); + CleanupStack::PushL( self ); + self->ConstructL( ); + CleanupStack::Pop(); + + return self; + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::~CPhoneRemConObserver +// destructor +// ----------------------------------------------------------------------------- +// +CImageEditorRemConObserver::~CImageEditorRemConObserver() + { + delete iActiveRemCon; + delete iInterfaceSelector; + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::CPhoneRemConObserver +// C++ default constructor +// ----------------------------------------------------------------------------- +// +CImageEditorRemConObserver::CImageEditorRemConObserver( MImageEditorVolumeKeyObserver& aObserver ): + iObserver ( aObserver ) + { + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::ConstructL +// Symbian 2nd phase constructor +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::ConstructL() + { + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + + // owned by CRemConInterfaceSelector instance + iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this ); + iActiveRemCon = CImageEditorRemConKeyResponse::NewL( *iCoreTarget ); + + iInterfaceSelector->OpenTargetL(); + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::MrccatoCommand +// A command has been received. +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::MrccatoCommand( + TRemConCoreApiOperationId aOperationId, + TRemConCoreApiButtonAction aButtonAct ) + { + switch ( aOperationId ) + { + case ERemConCoreApiVolumeUp: + { + // send the response back to Remcon server + TRAP_IGNORE( iActiveRemCon->CompleteAnyKeyL( aOperationId ) ); + + // send button press to zoom pane + iObserver.HandleVolumeKeyEvent( aOperationId, aButtonAct ); + } + break; + case ERemConCoreApiVolumeDown: + { + TRAP_IGNORE( iActiveRemCon->CompleteAnyKeyL( aOperationId ) ); + iObserver.HandleVolumeKeyEvent( aOperationId, aButtonAct ); + } + break; + default: + { + // Complete any other operation id + TRAP_IGNORE( iActiveRemCon->CompleteAnyKeyL( aOperationId ) ); + } + break; + } + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::MrccatoPlay +// not used +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/, + TRemConCoreApiButtonAction /*aButtonAct*/ ) + { + // not used + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::MrccatoTuneFunction +// not used +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::MrccatoTuneFunction( TBool /*aTwoPart*/, + TUint /*aMajorChannel*/, + TUint /*aMinorChannel*/, + TRemConCoreApiButtonAction /*aButtonAct*/ ) + { + // not used + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::MrccatoSelectDiskFunction +// not used +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::MrccatoSelectDiskFunction( TUint /*aDisk*/, + TRemConCoreApiButtonAction /*aButtonAct*/ ) + { + // not used + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::MrccatoSelectAvInputFunction +// not used +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::MrccatoSelectAvInputFunction( TUint8 /*aAvInputSignalNumber*/, + TRemConCoreApiButtonAction /*aButtonAct*/ ) + { + // not used + } + +// ----------------------------------------------------------------------------- +// CPhoneRemConObserver::MrccatoSelectAudioInputFunction +// not used +// ----------------------------------------------------------------------------- +// +void CImageEditorRemConObserver::MrccatoSelectAudioInputFunction( TUint8 /*aAudioInputSignalNumber*/, + TRemConCoreApiButtonAction /*aButtonAct*/ ) + { + // not used + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/src/CMGXRemConTarget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/src/CMGXRemConTarget.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,149 @@ +/* +* 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: +* +*/ + + +/* +*/ + +// INCLUDE FILES +#include +#include +#include + +#include + + +#include "cmgxremcontarget.h" + +//MACROS + +#ifdef _DEBUG +#define TRACES(x) x +#else +#define TRACES(x) +#endif + + +// CONSTANTS + +// ================= MEMBER FUNCTIONS ======================= + +// C++ default constructor can NOT contain any code, that +// might leave. +// +CMGXRemConTarget::CMGXRemConTarget(MMGXMediakeyObserver* aObserver) : iObserver(aObserver) + { + } + +// EPOC default constructor can leave. +void CMGXRemConTarget::ConstructL() + { + // Create interface selector. + iInterfaceSelector = CRemConInterfaceSelector::NewL(); + // Create a new CRemConCoreApiTarget, owned by the interface selector. + iCoreTarget = CRemConCoreApiTarget::NewL(*iInterfaceSelector, *this); + // Start being a target. + iInterfaceSelector->OpenTargetL(); + } + +// Two-phased constructor. +CMGXRemConTarget* CMGXRemConTarget::NewL(MMGXMediakeyObserver* aObserver) + { + CMGXRemConTarget* self = new (ELeave) CMGXRemConTarget(aObserver); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + +// Destructor +CMGXRemConTarget::~CMGXRemConTarget() + { + delete iInterfaceSelector; + // iCoreTarget was owned by iInterfaceSelector. + iCoreTarget = NULL; + } + +// --------------------------------------------------------- +// CMGXRemConTarget::MrccatoCommand +// --------------------------------------------------------- +// +void CMGXRemConTarget::MrccatoCommand(TRemConCoreApiOperationId aOperationId, TRemConCoreApiButtonAction aButtonAct) + { + TRACES( RDebug::Print( _L( "CMGXRemConTarget::MrccatoCommand: buttonact:%d >>"), aButtonAct ) ); + switch (aOperationId) + { + case ERemConCoreApiVolumeUp: + iObserver->HandleVolumeUpL(); + break; + case ERemConCoreApiVolumeDown: + iObserver->HandleVolumeDownL(); + break; + + default: + break; + } + TRACES( RDebug::Print( _L( "CMGXRemConTarget::MrccatoCommand << ") )); + } + +// --------------------------------------------------------- +// CDmhRemConTarget::MrccatoPlay +// --------------------------------------------------------- +// +void CMGXRemConTarget::MrccatoPlay(TRemConCoreApiPlaybackSpeed /*aSpeed*/, TRemConCoreApiButtonAction /*aButtonAct*/) + { + TRACES( RDebug::Print( _L( "CMGXRemConTarget::MrccatoPlay <<") )); + } + +// --------------------------------------------------------- +// CDmhRemConTarget::MrccatoTuneFunction +// --------------------------------------------------------- +// +void CMGXRemConTarget::MrccatoTuneFunction(TBool /*aTwoPart*/, TUint /*aMajorChannel*/, TUint /*aMinorChannel*/, TRemConCoreApiButtonAction /*aButtonAct*/) + { + + } + +// --------------------------------------------------------- +// CDmhRemConTarget::MrccatoSelectDiskFunction +// --------------------------------------------------------- +// +void CMGXRemConTarget::MrccatoSelectDiskFunction(TUint /*aDisk*/, TRemConCoreApiButtonAction /*aButtonAct*/) + { + + } + +// --------------------------------------------------------- +// CMGXRemConTarget::MrccatoSelectAvInputFunction +// --------------------------------------------------------- +// +void CMGXRemConTarget::MrccatoSelectAvInputFunction(TUint8 /*aAvInputSignalNumber*/, TRemConCoreApiButtonAction /*aButtonAct*/) + { + + } + +// --------------------------------------------------------- +// CMGXRemConTarget::MrccatoSelectAudioInputFunction +// --------------------------------------------------------- +// +void CMGXRemConTarget::MrccatoSelectAudioInputFunction(TUint8 /*aAudioInputSignalNumber*/, TRemConCoreApiButtonAction /*aButtonAct*/) + { + + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/src/ImageEditorApp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/src/ImageEditorApp.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,67 @@ +/* +* 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: +* +*/ + + + +// INCLUDE FILES +#include "ImageEditorApp.h" +#include "ImageEditorDocument.h" +#include "ImageEditorUids.hrh" + +#ifdef ENABLE_DEBUGLOG +#include "editorversion.h" +#endif + +#include + + +//============================================================================= +LOCAL_C CApaApplication* NewApplication() +{ + return new CImageEditorApp; +} + +//============================================================================= +GLDEF_C TInt E32Main() +{ + return EikStart::RunApplication(NewApplication); +} + +//============================================================================= +TUid CImageEditorApp::AppDllUid() const +{ + return TUid::Uid(UID_IMAGE_EDITOR); +} + +//============================================================================= +CDictionaryStore * CImageEditorApp::OpenIniFileLC (RFs & aFs) const +{ + return CEikApplication::OpenIniFileLC (aFs); +} + +//============================================================================= +CApaDocument * CImageEditorApp::CreateDocumentL() +{ + // create log file if the logging is enabled + LOG_INIT(KImageEditorLogFile); + LOGFMT3(KImageEditorLogFile, "Image Editor version: MAJOR=%d, MINOR=%d, BUILD=%d", my_version_major, my_version_minor, my_version_build); + + return CImageEditorDocument::NewL (*this); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/src/ImageEditorAppUi.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/src/ImageEditorAppUi.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,2917 @@ +/* +* 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 +#include +#include +#include +#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 "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; + +//============================================================================= +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) +{ + +} + +//============================================================================= +void 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 ); +#else +#ifdef LANDSCAPE_SUPPORT + BaseConstructL( EAppOrientationAutomatic|EAknEnableSkin | EAknEnableMSK ); +#else + 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(); + 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 + iConstructionState = EConstructionStateAlloc; + iCallback = CObCallback::NewL ( (MObCallbackMethod *)this ); + iCallback->DoCallback (KObConstructCallBackID); + + // Volume key observer instance + iVolumeKeyObserver = CImageEditorRemConObserver::NewL( *this ); + +#ifdef S60_31_VOLUME_KEYS + iMGXRemConTarget = CMGXRemConTarget::NewL( this ); +#endif +} + +//============================================================================= +CImageEditorAppUi::~CImageEditorAppUi() +{ + LOG(KImageEditorLogFile, "CImageEditorAppUi::~CImageEditorAppUi() starting..."); + + //KillWaitNote(); + if (iWaitNote != NULL) + { + delete iWaitNote; + iWaitNote = NULL; + } + + delete iLocator; + delete iImageController; + delete iEditorManager; + delete iSendAppUi; + delete iCallback; + iSourceImageMgAlbumIdList.Close(); + + iEditorView = NULL; + + iFile.Close(); + +#ifdef S60_31_VOLUME_KEYS + delete iMGXRemConTarget; +#endif + + // deleted by CCoeEnv + iResolutionUtil = NULL; + delete iVolumeKeyObserver; + + 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 ) + { + 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"); +#ifdef VERBOSE + 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; + } + } + } + else + { + 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 ); + + // 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(); + + // Do not have to keep file open anymore. + // Fixes problem with Online Printing + iFile.Close(); + + break; + } + + case EOperationCodeSave: + case EOperationCodeBlockSave: + { + LOG(KImageEditorLogFile, "CImageEditorAppUi: Image saved"); +#ifdef VERBOSE + 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; + } + } + } +} + +//============================================================================= +void CImageEditorAppUi::RenderL () +{ + LOG(KImageEditorLogFile, "CImageEditorAppUi: Rendering..."); + SetBusy(); + iEditorManager->ProcessImageL(); + ((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 + // then we consume the key + 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; + } + + // 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 + { + if (!rotated) + { + PanL (EDirectionUp); + response = EKeyWasConsumed; + } + else + { + 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 (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 + { + // 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); + 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; + } + } + } + return response; +} + +//============================================================================= +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 + case EImageEditorMenuCmdUndo: + { + SetBusy(); + iCallback->DoCallback (KObUndoDCallbackID); + break; + } + + // Switch to full screen + case EImageEditorMenuCmdFullScreen: + { +#ifdef FULLSCREEN_AVAILABLE + SetFullScreenL(); +#endif // FULLSCREEN_AVAILABLE + break; + } + + // Switch to normal screen + case EImageEditorMenuCmdNormalScreen: + { +#ifdef FULLSCREEN_AVAILABLE + 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 + 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"); + DeleteTempFiles(); + Exit(); + break; + } + + /** + * + * MISC COMMANDS + * + */ + + // Render image + case EImageEditorCmdRender: + { + RenderL(); + break; + } + + case EImageEditorCmdViewReady: + { + + LOG(KImageEditorLogFile, "CImageEditorAppUi: View ready"); + iEditorReady = ETrue; + + // Initialize UI items + InitializeUiItemsL(); + ApplicationReadyL(); + break; + } + + case EImageEditorApplyPlugin: + { + // Return from plug-in + 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 + 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(); + 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; + } + } + } +} + +//============================================================================= +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); +#endif + + 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 ); + } + iForeground = ETrue; + break; + } + + default: + { + break; + } + + } + + if ( ( aEvent.Type() == KAknUidValueEndKeyCloseEvent) && iEditorManager->IsImageChanged() ) + { + if (iCancelling) + { + return; + } + iExitFromApp = ETrue; + if (iSaving) + { + iImageController->CancelOperation(ETrue); + iSaveOnExit = EFalse; + + return; + } + + TInt err = ImageEditorUtils::GenerateNewDocumentNameL ( + iEikonEnv->FsSession(), + iSourceFileName, + iDocumentName, + &iSourceImageMgAlbumIdList + ); + SaveImageOverWriteL( EFalse ); + } + else + { + 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(); + control->SetRect(rect); + } + + // 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; + +#ifdef LANDSCAPE_SUPPORT + + TRect rect; + + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, rect); + + if ( rect.iBr.iX > rect.iBr.iY ) + { + orientation = ETrue; + } + else + { + orientation = EFalse; + } + +#endif + + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi: Orientation (%d)", (TInt)orientation); + + return orientation; +} + +//============================================================================= +void CImageEditorAppUi::HandleForegroundEventL (TBool aForeground) +{ + LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleForegroundEventL()"); + + if (aForeground) + { + if ( !BaflUtils::FileExists( iEikonEnv->Static()->FsSession() , iSourceFileName ) ) + { + DeleteTempFiles(); + RunAppShutter(); + } + + if ( iProcessPriorityAltered ) + { + // Return to normal priority. + RProcess myProcess; + TProcessPriority priority = myProcess.Priority(); + if ( priority < iOriginalProcessPriority ) + { + myProcess.SetPriority( iOriginalProcessPriority ); + } + 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); + } + else + { + 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 ); + iProcessPriorityAltered = ETrue; + + + } + 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 + { + aDocumentName = _L("C:\\Data\\Images\\test.jpg"); + }; + // ---------------- test only ------------- */ + + // 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); + } + +//============================================================================= +void CImageEditorAppUi::OpenFileL(RFile &aFile) + { + 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); + + // 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(); + TInt err = iFile.Open(fs, iDocumentName, EFileRead | EFileShareReadersOnly); + if (KErrNone != err) + { + User::LeaveIfError(iFile.Open(fs, iDocumentName, EFileRead | EFileShareAny)); + } + + // 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 + // suspended to wait for this. + if (EConstructionStateWaitForStartupParameters == iConstructionState) + { + // Resume construction + iConstructionState = EConstructionStateLoadImage; + 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; +} + +//============================================================================= +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() ); + + 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::CreateImageControllerL () +{ + iImageController = CImageController::NewL (this, iEditorManager); +} + +//============================================================================= +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)); + } + + // Set the last opened image to editor view + ((CImageEditorUIView *)iEditorView)->SetImageL ( + iEditorManager->GetPreviewImage() + ); + + 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(); + } + + 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); + + // Load the image to be edited + 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(); + } + + // Set temp save image name to engine + 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); + + // 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); + + } + + +//============================================================================= +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 (); + } + +} + +//============================================================================= +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); +} + +//============================================================================= +void CImageEditorAppUi::CheckFileL (const TDesC & aFileName) const +{ + RFs & fs = iEikonEnv->FsSession(); + + // Is file name valid + if ( !fs.IsValidName (aFileName) ) + { + User::Leave ( KSIEESaveFile ); + } + +} + +//============================================================================= +TBool CImageEditorAppUi::CallbackMethodL (TInt aParam) +{ + LOGFMT(KImageEditorLogFile, "CImageEditorAppUi::CallbackMethodL (%d)", aParam); + + TBool ret = EFalse; + + switch (aParam) + { + + 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); + } +#else +#ifdef LANDSCAPE_ONLY + iResolutionUtil->SetLandscape(ETrue); +#else + 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(); + LOG(KImageEditorLogFile, "Locator created"); + // Create plug-in manager + CreateEditorManagerL(); + LOG(KImageEditorLogFile, "Manager created"); + // Create image controller + CreateImageControllerL(); + LOG(KImageEditorLogFile, "Image Controller created"); + 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; + } + break; + } + + case EConstructionStateScanPlugins: + { + LOG(KImageEditorLogFile, "Scanning plugins"); + LoadPluginsL(); + iConstructionState = EConstructionStateInitUi; + ret = ETrue; + break; + } + + case EConstructionStateInitUi: + { + LOG(KImageEditorLogFile, "Init UI"); + // Initialize UI items + iPluginsScanned = ETrue; + InitializeUiItemsL(); + iConstructionState = EConstructionStateReady; + ret = ETrue; + break; + } + + default: + { + LOG(KImageEditorLogFile, "Ready"); + KillWaitNote(); + ApplicationReadyL(); + break; + } + } + break; + } + + case KObReturnFromPluginID: + { + SetUndoFlag(); + iEditorManager->ShowPluginPopup(); + iEditorManager->ClosePlugin(); + + __ASSERT_ALWAYS( iEditorView, User::Panic(KComponentName, EImageEditorPanicNoView) ); + ((CImageEditorUIView *)iEditorView)->ActivateMainViewL(); + + ((CImageEditorUIView *)iEditorView)->SetImageL ( + iEditorManager->GetPreviewImage()); + + ResetBusy(); + break; + } + + case KObInitPluginID: + { + InitializePluginL (); + SetUndoFlag(); + break; + } + + case KObCancelCallbackID: + { + iEditorManager->ClosePlugin(); + 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(); + ResetBusy(); + break; + } + + case KObSendCallbackID: + { + 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; + } + } + + 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::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::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::SetFileNameTitlePaneL (const TDesC& aFullFileName) +{ + TParsePtrC parser (aFullFileName); + SetTitlePaneTextL ( parser.Name() ); +} + +//============================================================================= +void CImageEditorAppUi::ClearNaviPaneTextL() +{ + if (iEditorView) + { + ((CImageEditorUIView *)iEditorView)->ClearNaviPaneTextL(); + } +} + + +//============================================================================= +void CImageEditorAppUi::UpdateScreenRectL() + { + LOG(KImageEditorLogFile, "CImageEditorAppUi::UpdateScreenRectL()"); + + if (iEditorView == NULL || + iEditorManager == NULL || + iImageController == NULL) + { + return; + } + + 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); + } +#else +#ifdef LANDSCAPE_ONLY + iResolutionUtil->SetLandscape(ETrue); +#else + iResolutionUtil->SetLandscape(EFalse); +#endif +#endif + + // 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(); + + // Check if screen size has changed + TRect newScreenRect; + CResolutionUtil::Self()->GetClientRect(newScreenRect); + if (iOldScreenRect == newScreenRect && !iOrientationChanged) + { + 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(); + } + + // Set the new image pointer to editor view + if (!iSaving) + { + ((CImageEditorUIView *)iEditorView)->SetImageL ( + iEditorManager->GetPreviewImage() + ); + } + else // if saving cannot update new image until saving is completed. + { + iOrientationChanged = ETrue; + ((CImageEditorUIView *)iEditorView)->SetImageL ( NULL ); + } + + // Set container extent to whole screen + CCoeControl * control = ((CImageEditorUIView *)iEditorView)->GetContainer(); + if (control) + { + if (iFullScreen) + { + control->SetExtentToWholeScreen(); + } + else + { + TRect rect; + iResolutionUtil->GetClientRect(rect); + control->SetRect(rect); + } + + 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(); + iEditorManager->GetSystemParameters(); + + // 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(); + + // Pan + 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 ); + + // Pan + iEditorManager->PanL( xMovement, yMovement ); + + RenderL(); + iEditorManager->GetSystemParameters(); + + ResetBusy(); + + iEditorView->HandleCommandL (EImageEditorGlobalPanChanged); +} + +//============================================================================= +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); + RenderL(); + SetUndoFlag(); + 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::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::IncrementProgressBarL(const TInt 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 ) + { + iCallback->Cancel(); + 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); + + // Reset busy flag + 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 ) + { + Exit(); + } + } + + // 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 ) + { + Exit(); + } + } + return ret; +} + +//============================================================================= +void CImageEditorAppUi::HandleErrorL (const TInt aError) +{ + + // Show error note + ShowErrorNoteL (aError); + + // Handle error + 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()); + } + + break; + } + } +} + +//============================================================================= +void CImageEditorAppUi::ShowErrorNoteL (const TInt aError) const +{ + TInt res_id = -1; + + switch (aError) + { + case KErrNotFound: + case KSIEEOpenFile: + case KSIEEExifRead: + case KSIEEIncompatibleImage: + { + res_id = R_ERROR_LOADING; + break; + } + case KSIEESaveFile: + 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; + } + + 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); + } + +} + +//============================================================================= +void 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); + } +#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"); +} + +//============================================================================= +void CImageEditorAppUi::HandleVolumeUpL() +{ + LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeUpL: in"); + + TKeyEvent key; + key.iScanCode = EStdKeyIncVolume; + key.iCode = EKeyIncVolume; + + if( LandscapeScreenOrientation() ) + { + key.iScanCode = EStdKeyDecVolume; + key.iCode = EKeyDecVolume; + } + + key.iRepeats = 0; + 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() ) + { + key.iScanCode = EStdKeyIncVolume; + key.iCode = EKeyIncVolume; + } + + key.iRepeats = 0; + iEikonEnv->SimulateKeyEventL( key, EEventKey ); + + LOG(KImageEditorLogFile, "CImageEditorAppUi::HandleVolumeDownL: out"); +} + +//============================================================================= +void CImageEditorAppUi::SaveImageOverWriteL(TBool aOverWrite) +{ + 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); + } + } + + // overwrite the existing file + if (aOverWrite) + { + 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); + } + } + + // 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 ); + _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 +#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 ); + +#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; + } +#endif + } + // 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 ) ); + } + } + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/src/ImageEditorDocument.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/src/ImageEditorDocument.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,74 @@ +/* +* 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: +* +*/ + + + +// INCLUDE FILES +#include "ImageEditorDocument.h" +#include "ImageEditorAppUi.h" + + +//============================================================================= +CImageEditorDocument::CImageEditorDocument (CEikApplication & aApp) : +CAknDocument (aApp) +{ + +} + +//============================================================================= +CImageEditorDocument::~CImageEditorDocument() +{ + LOG(KImageEditorLogFile, "CImageEditorDocument::~CImageEditorDocument()"); +} + +//============================================================================= +void CImageEditorDocument::ConstructL() +{ + LOG(KImageEditorLogFile, "CImageEditorDocument: Document created"); +} + +//============================================================================= +CImageEditorDocument * CImageEditorDocument::NewL (CEikApplication & aApp) +{ + CImageEditorDocument * self = new (ELeave) CImageEditorDocument (aApp); + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +//============================================================================= +CEikAppUi * CImageEditorDocument::CreateAppUiL() +{ + return new (ELeave) CImageEditorAppUi; +} + + +//============================================================================= +void CImageEditorDocument::OpenFileL(CFileStore*& /*aFileStore*/, RFile& aFile) +{ + LOG(KImageEditorLogFile, "CImageEditorDocument::OpenFileL()"); + + CleanupClosePushL(aFile); + + // File handle must be closed. Open File Service won't do it. + // Using cleanup stack, because iAppUi->OpenFileL() may leave. + ((CImageEditorAppUi*)iAppUi)->OpenFileL(aFile); + + CleanupStack::PopAndDestroy(); +} diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/imageeditorApp/src/ImageEditorImageController.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/imageeditorApp/src/ImageEditorImageController.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,381 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include + +#include "ImageEditorError.h" +#include "ImageEditorImageController.h" +#include "ImageEditorPluginManager.h" +#include "ImageEditorImageHandler.h" +#include "ResolutionUtil.h" +#include "ImageEditorPanics.h" +#include "SystemParameters.h" +#include "imageeditordebugutils.h" +#include "editorversion.h" +#include "commondefs.h" + + +// CONSTANTS + +// Panic category +_LIT(KComponentName, "CImageController"); + +//============================================================================= +CImageController * CImageController::NewL ( + MImageControllerObserver * aObserver, + CImageEditorPluginManager * aManager + ) +{ + CImageController * self = new (ELeave) CImageController; + CleanupStack::PushL (self); + self->ConstructL (aObserver, aManager); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +CImageController::~CImageController () +{ + LOG(KImageEditorLogFile, "CImageController::~CImageController() starting..."); + + Cancel(); + DeletePreviewBitmap(); + delete iImageHandler; + iManager = NULL; + iObserver = NULL; + + LOG(KImageEditorLogFile, "CImageController::~CImageController() finished."); +} + +//============================================================================= +void CImageController::ConstructL ( + MImageControllerObserver * aObserver, + CImageEditorPluginManager * aManager + ) + { + CActiveScheduler::Add (this); + iObserver = aObserver; + iManager = aManager; + iImageHandler = CImageEditorImageHandler::NewL (); + iQuality = KDefaultSavedJpegQuality; + iJpegImage = EFalse; + iIsCancelled = EFalse; + LOG(KImageEditorLogFile, "CImageController: Image controller created"); + } + + +//============================================================================= +void CImageController::LoadImageL (const TDesC & aFileName) + { + LOGFMT(KImageEditorLogFile, "CImageController: Loading image %S", &aFileName); + + iOperation = MImageControllerObserver::EOperationCodeLoad; + iIsCancelled = EFalse; + + // If active, cancel + if ( IsActive() ) + { + Cancel(); + } + + // Create new CFbsBitmap + DeletePreviewBitmap(); + CreatePreviewBitmapL(); + + TBool useIPECodec = EFalse; + // try open first with IPE ICL codec + LOG (KImageEditorLogFile, "CImageController::LoadImageL() -- try open image with ICL"); + + // Create new TFileName and store it + iManager->SetImageName (aFileName); + + // Load RAJPEG image + TRAPD ( err, iManager->LoadImageL( useIPECodec ) ); + if ( KErrNone == err ) + { + LOG (KImageEditorLogFile, "CImageController::LoadImageL() -- image opened with ICL"); + // Force RunL() + CompleteRequest(); + } + else + { + LOG (KImageEditorLogFile, "CImageController::LoadImageL() -- failed open image with ICL"); + // Try with IPE codec + useIPECodec = ETrue; + } + + if ( useIPECodec ) + { + // If JPEG source image, try opening with IPE JPEG filter + iJpegImage = iImageHandler->IsRajpegImageL (aFileName); + + if ( !iJpegImage ) + { + iObserver->OperationReadyL ( iOperation, KSIEEIncompatibleImage ); + } + else + { + LOG(KImageEditorLogFile, "CImageController::LoadImageL() -- open JPEG image with IPE"); + + // Create new TFileName and store it + iManager->SetImageName (aFileName); + + // Load RAJPEG image + TRAPD (err, iManager->LoadImageL( useIPECodec )); + if (KErrNone == err) + { + // Force RunL() + CompleteRequest(); + } + else if ((KSIEEIncompatibleImage == err) || (KErrNotSupported == err)) + { + LOG (KImageEditorLogFile, "CImageController::LoadImageL() -- JPEG not supported"); + iObserver->OperationReadyL ( iOperation, err ); + } + // Added because system runs out of memory if jpeg size is too big + // (around 5 Mb) + else if ( KErrNoMemory == err ) + { + LOG (KImageEditorLogFile, "CImageController::LoadImageL() -- Not enough memory to use IPE"); + iObserver->OperationReadyL ( iOperation, err ); + } + else + { + User::Leave (err); + } + } + } + +} + +//============================================================================= +void CImageController::SaveImageL (const TDesC & /*aFileName*/) +{ + + LOG(KImageEditorLogFile, "CImageController: Saving image"); + + // Start saving operation + iOperation = MImageControllerObserver::EOperationCodeBlockSave; + iSavedPercentage = 1; + iSavedPercentageOld = 1; + iIsCancelled = EFalse; + iManager->PrepareAsyncSaveL (iQuality); + + // Force RunL() + CompleteRequest(); +} + +//============================================================================= +TInt CImageController::RenameImage ( + const TDesC & aFileNameSrc, + const TDesC & aFileNameDst + ) const +{ + return iImageHandler->RenameImage (aFileNameSrc, aFileNameDst); +} + +//============================================================================= +TInt CImageController::DeleteImage (const TDesC & aFileName) const +{ + return iImageHandler->DeleteImage (aFileName); +} + +//============================================================================= +void CImageController::DoCancel() +{ + LOG(KImageEditorLogFile, "CImageController::DoCancel"); + + if( IsActive() ) + { + iImageHandler->CleanupConverters(); + } +} + +//============================================================================= +void CImageController::CancelOperation (TBool aForce) +{ + LOGFMT(KImageEditorLogFile, "CImageController::CancelImageController: iOperation == %d", iOperation); + + iIsCancelled = ETrue; + + // Handle cancelling block save + if (aForce) + { + CompleteRequest(); + } +} + +//============================================================================= +void CImageController::RunL () +{ + + switch (iOperation) + { + /// Loading images + case MImageControllerObserver::EOperationCodeLoad: + { + LOG(KImageEditorLogFile, "CImageController: Loading completed"); + iObserver->OperationReadyL ( iOperation, iStatus.Int() ); + break; + } + + case MImageControllerObserver::EOperationCodeBlockLoad: + { + LOG(KImageEditorLogFile, "CImageController: Loading completed"); + iObserver->OperationReadyL ( iOperation, iStatus.Int() ); + break; + } + + /// Block saving images + case MImageControllerObserver::EOperationCodeBlockSave: + { + // Handle cancelling block save + if (iIsCancelled) + { + LOG(KImageEditorLogFile, "CImageController: Saving cancelled"); + iManager->SaveAbortL(); + iObserver->OperationReadyL ( iOperation, KErrCancel ); + } + + else + { + // Increment progress bar + if ( iSavedPercentage > iSavedPercentageOld ) + { + iObserver->IncrementProgressBarL (iSavedPercentage - iSavedPercentageOld); + iSavedPercentageOld = iSavedPercentage; + } + + // Save next block + iSavedPercentage = iManager->SaveBlockL(); + + // Complete? + if (iSavedPercentage == 100) + { + // Save completed + LOG(KImageEditorLogFile, "CImageController: Saving completed"); + iManager->FinishAsyncSaveL(); + iObserver->OperationReadyL ( iOperation, iStatus.Int() ); + } + + // Save next block + else + { + CompleteRequest(); + + } + } + break; + } + + /// Saving images + case MImageControllerObserver::EOperationCodeSave: + { + iObserver->OperationReadyL ( iOperation, iStatus.Int() ); + break; + } + /// Deleting images + case MImageControllerObserver::EOperationCodeDelete: + /// Renaming images + case MImageControllerObserver::EOperationCodeRename: + /// Searching images + case MImageControllerObserver::EOperationCodeSearch: + default: + { + User::Panic(KComponentName, EImageEditorPanicUnexpectedCommand); + break; + } + } +} + +//============================================================================= +CImageController::CImageController () : +CActive (CActive::EPriorityStandard) +{ + +} + + +//============================================================================= +void CImageController::CreatePreviewBitmapL () +{ + LOG(KImageEditorLogFile, "CImageController: Creating preview bitmap"); + // Get current screen rect + TRect rect; + CResolutionUtil::Self()->GetClientRect(rect); + TSize size = rect.Size(); + + LOG(KImageEditorLogFile, "CImageController: Resolution read"); + LOGFMT(KImageEditorLogFile, " Width: %d", size.iWidth); + LOGFMT(KImageEditorLogFile, " Height: %d", size.iHeight); + + // Create bitmap + if (iPreview) + { + delete iPreview; + iPreview = NULL; + } + + iPreview = new (ELeave) CFbsBitmap; + User::LeaveIfError ( iPreview->Create ( size, EColor16M) ); + + // Set bitmap + iManager->SetPreviewImage (iPreview); +} + +//============================================================================= +void CImageController::DeletePreviewBitmap() +{ + LOG(KImageEditorLogFile, "CImageController: Deleting preview bitmap"); + delete iPreview; + iPreview = NULL; + iManager->SetPreviewImage (NULL); +} + +//============================================================================= +void CImageController::CompleteRequest() +{ + if ( IsActive() ) + { + Cancel(); + } + TRequestStatus * p = &iStatus; + SetActive(); + User::RequestComplete (p, KErrNone); +} + +//============================================================================= +void CImageController::CalculateProgressInterval (TInt aBlockCount) +{ + const TInt KMaxProgressSteps = 25; + + iProgressBarInterval = 1; + while( (aBlockCount / iProgressBarInterval) > KMaxProgressSteps ) + { + iProgressBarInterval++; + } + + LOGFMT(KImageEditorLogFile, "CImageController: Progress bar interval: %d", iProgressBarInterval); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/DrawUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/DrawUtils.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,344 @@ +/* +* 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 utility class header file. +* +*/ + + +#ifndef DRAWUTILS_H +#define DRAWUTILS_H + +// INCLUDES +#include +#include +#include + +// FORWARD DECLARATIONS +class CAknWaitDialog; +class CAknProgressDialog; +class MProgressDialogCallback; +class CAknInfoPopupNoteController; + +/* CLASS: SDrawUtils +* +* SDrawUtils wraps often used UI drawing utilities into single class +*/ +class SDrawUtils +{ + +public: + +/** @name TypeDefs:*/ +//@{ + enum TGuideType + { + // Invalid + EGuideTypeMin, + // Guide arrow up + EGuideTypeUp, + // Guide arrow down + EGuideTypeDown, + // Guide arrow left + EGuideTypeLeft, + // Guide arrow right + EGuideTypeRight, + // Invalid + EGuideTypeMax + }; + +//@} + +/** @name Methods:*/ +//@{ + + /** DrawGuide + * + * Draws arrow guide to CWindowGc. + * + * @param aGc - grapics context + * @param aRect - surrouding rectangle + * @param aType - guide type + * @param aColor - guide color + * @return - + */ + IMPORT_C static void DrawGuide ( + CGraphicsContext & aGc, + const TRect & aRect, + const TGuideType aType, + const TRgb & aColor + ); + + /** DrawBeveledRect + * + * Draws a 3D beveled rectangle. + * + * @param aGc - grapics context + * @param aRect - surrouding rectangle (includes the borders) + * @param aColor - rectangle color + * @param aLight - light color + * @param aShadow - shadow color + * @return - + */ + IMPORT_C static void DrawBeveledRect ( + CGraphicsContext & aGc, + const TRect & aRect, + const TRgb & aColor, + const TRgb & aLight, + const TRgb & aShadow + ); + + /** DrawFlatRect + * + * Draws a 3D flat rectangle. + * + * @param aGc - grapics context + * @param aRect - surrouding rectangle (includes the borders) + * @param aColor - rectangle color + * @param aLight - light color + * @param aShadow - shadow color + * @return - + */ + IMPORT_C static void DrawFlatRect ( + CGraphicsContext & aGc, + const TRect & aRect, + const TRgb & aColor, + const TRgb & aLight, + const TRgb & aShadow + ); + + /** LaunchQueryDialogL + * + * Launches a confirmation query dialog. + * + * @param aPrompt - dialog prompt descriptor + * @return - + */ + IMPORT_C static TInt LaunchQueryDialogL (const TDesC & aPrompt); + + /** LaunchQueryDialogOkOnlyL + * + * Launches a confirmation query dialog with only OK softkey + * available. + * + * @param aPrompt - dialog prompt descriptor + * @return - + */ + IMPORT_C static TInt LaunchQueryDialogOkOnlyL (const TDesC & aPrompt); + + /** LaunchTextQueryDialogL + * + * Launches a text query dialog and returns the queried descriptor. + * aData includes the data shown in the edit window and on return, + * includes the edited text data. + * + * @param aData - data descriptor + * @param aPrompt - dialog prompt descriptor + * @return - + */ + IMPORT_C static TInt LaunchTextQueryDialogL ( + TDes & aData, + const TDesC & aPrompt + ); + + /** LaunchMultiLineTextQueryDialogL + * + * Launches a multiline text query dialog and returns the queried descriptor. + * aData includes the data shown in the edit window and on return, + * includes the edited text data. + * + * @param aData - data descriptor + * @param aPrompt - dialog prompt descriptor + * @return - + */ + IMPORT_C static TInt LaunchMultiLineTextQueryDialogL ( + TDes & aData, + const TDesC & aPrompt + ); + + /** LaunchListQueryDialogL + * + * Launches a list query dialog and returns the selected index. + * aData includes the descriptor array of selection items. + * + * @param aTextItems - text item descriptor array + * @param aPrompt - dialog prompt descriptor + * @return - + */ + IMPORT_C static TInt LaunchListQueryDialogL ( + MDesCArray * aTextItems, + const TDesC & aPrompt + ); + + /** LaunchWaitNoteL + * + * Creates and launches a wait note dialog and returns a pointer to + * it. + * @param - aSelfPtr + * The wait dialog is allocated at this pointer. + * The pointer needs to be valid when the dialog + * is dismissed and must be a class member. + * @param aResourceID - resource ID for prompt + * @param aPrompt - wait dialog prompt + * @param aCallback + * The wait dialog callback. + * Pass NULL if no callback is needed. + * @return - pointer to wait dialog + */ + IMPORT_C static void LaunchWaitNoteL ( + CAknWaitDialog** aSelfPtr, + TInt aResourceID, + const TDesC & aPrompt, + MProgressDialogCallback* aCallback = NULL + ); + + /** LaunchProgressNoteL + * + * Creates and launches a wait note dialog and returns a pointer to + * it. + * @param - aSelfPtr + * The wait dialog is allocated at this pointer. + * The pointer needs to be valid when the dialog + * is dismissed and must be a class member. + * @param aResourceID - resource ID for prompt + * @param aPrompt - wait dialog prompt + * @param aFinalValue Final value for the process + * @param aCallback + * The wait dialog callback. + * Pass NULL if no callback is needed. + * @return - pointer to wait dialog + */ + IMPORT_C static void LaunchProgressNoteL ( + CAknProgressDialog** aSelfPtr, + TInt aResourceID, + const TDesC & aPrompt, + TInt aFinalValue = 0, + MProgressDialogCallback* aCallback = NULL + ); + + /** LaunchColorSelectionGridL + * + * Launches a color selection grid inside a pop-up list. Returns + * KErrNone if color was selected. + * + * @param aColor - includes the selected color on return + * @return - KErrNone if color selected + */ + IMPORT_C static TInt LaunchColorSelectionGridL (TRgb & aColor); + + /** LaunchColorSelectionPopupL + * + * Launches a semi-transparent 35 color selection popup component. + * Color grid is launched via a dialog. + * + * @param aPreview - a constant pointer to a bitmap image that should be + * drawn to background + * @param aRect - rectangle of calling control (use main pane rect) + * @param aColor - includes the selected color on return + * @return - KErrNone if color selected + */ + IMPORT_C static TInt LaunchColorSelectionPopupL (const CFbsBitmap* aPreview, + TRect aRect, + TRgb & aColor); + + + /** GetIndicatorBitmapL + * + * Load the indicator cursor bitmap and mask. + * + * @param aChBitmap - reference to cursor bitmap pointer + * @param aChMask - reference to cursor mask pointer + * @param aBmpIndex - bitmap MBM index + * @param aMaskIndex - mask MBM index + * @return - KErrNone if successful + */ + IMPORT_C static TInt GetIndicatorBitmapL ( + CFbsBitmap *& aChBitmap, + CFbsBitmap *& aChMask, + TInt aBmpIndex, + TInt aMaskIndex + ); + + /** ShowToolTip + * + * Show a tooltip note on the screen. This function calculates the + * relative position on the screen for the tooltip. + * + * @param aPopupController - pointer to popup note controller + * @param aCallingControl - pointer to a calling control + * @param aPositionRect - position rect where the tooltip should be shown + * @param aText - text to be shown + * @return - + */ + IMPORT_C static void ShowToolTip ( + CAknInfoPopupNoteController* aPopupController, + CCoeControl* aCallingControl, + TRect aPositionRect, + const TDesC& aText + ); + + /** ShowToolTip + * + * Show a tooltip note on the screen. This function calculates the + * relative position on the screen for the tooltip. + * + * @param aPopupController - pointer to popup note controller + * @param aCallingControl - pointer to a calling control + * @param aPosition - position where the tooltip should be shown + * @param aAlignment - GUI alignment to use + * @param aText - text to be shown + * @return - + */ + IMPORT_C static void ShowToolTip ( + CAknInfoPopupNoteController* aPopupController, + CCoeControl* aCallingControl, + TPoint aPosition, + TGulAlignmentValue aAlignment, + const TDesC& aText + ); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + /// +//@} + +private: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/HorizontalSlider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/HorizontalSlider.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,224 @@ +/* +* 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: +* +*/ + + +#ifndef __HORIZONTALSLIDER_H__ +#define __HORIZONTALSLIDER_H__ + +#include +#include +#include + +class CFbsBitmap; + +/*! + @class CHorizontalSlider + @discussion Simple control which draws a vertical slider + */ + +class CHorizontalSlider : public CCoeControl + { + public: + + /*! + @function NewL + @discussion Create a CHorizontalSlider object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @return a pointer to the created instance of CHorizontalSlider + */ + IMPORT_C static CHorizontalSlider* NewL(const TRect& aRect, const CCoeControl& aControl); + + /*! + @function NewLC + @discussion Create a CHorizontalSlider object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @return a pointer to the created instance of CHorizontalSlider + */ + IMPORT_C static CHorizontalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl); + + /*! + @function ~CHorizontalSlider + @discussion Destroy the object and release all memory objects + */ + IMPORT_C ~CHorizontalSlider(); + + + public: + // new functions + + /*! + @function SetIcon + @param aIcon the new icon + @discussion Sets the icon of the slider + */ + IMPORT_C void SetIcon(CEikImage* aIcon); + + /*! + @function SetCaption + @param aText the new caption text + @discussion Sets the caption text of the slider + */ + IMPORT_C void SetCaption(const TDesC& aText); + + /*! + @function SetMinimum + @param aValue the new minimum value + @discussion Sets the minimum value of the slider + */ + IMPORT_C void SetMinimum(TInt aValue); + + /*! + @function SetMaximum + @param aValue the new maximum value + @discussion Sets the maximum value of the slider + */ + IMPORT_C void SetMaximum(TInt aValue); + + /*! + @function SetStepL + @param aValue the new step value + @discussion Sets the step of the slider + */ + IMPORT_C void SetStep(TUint aValue); + + /*! + @function SetStepAmount + @param aValue the new step amount + @discussion Sets the number of steps in the slider + */ + IMPORT_C void SetStepAmount(TUint8 aValue); + + /*! + @function SetPosition + @discussion Sets the position of the slider. Panics if the position is out of bounds. + */ + IMPORT_C void SetPosition(TInt aValue); + + /*! + @function Minimum + @discussion Gets the minimum value of the slider + @return minimum value + */ + IMPORT_C TInt Minimum() const; + + /*! + @function Maximum + @discussion Gets the maximum value of the slider + @return maximum value + */ + IMPORT_C TInt Maximum() const; + + /*! + @function Step + @discussion Gets the step of the slider + @return current step + */ + IMPORT_C TInt Step() const; + + /*! + @function Position + @discussion Gets the position of the slider + @return current position + */ + IMPORT_C TInt Position() const; + + /*! + @function Increment + @discussion Increments the slider + */ + IMPORT_C void Increment(); + + /*! + @function Decrement + @discussion Decrements the slider + */ + IMPORT_C void Decrement(); + + private: + + /*! + @fuction ConstructL + @discussion Perform the second phase construction of a CHorizontalSlider object + @param aRect Frame rectangle for container. + */ + void ConstructL(const TRect& aRect, const CCoeControl& aControl); + + /*! + @function CHorizontalSlider + @discussion Constructs this object + */ + CHorizontalSlider(); + + public: // from CoeControl + /*! + @function CountComponentControls + @return Number of component controls + */ + IMPORT_C TInt CountComponentControls() const; + + /*! + @function ComponentControl. + @param aIndex index of the component control + @return Pointer to component control + */ + IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; + + /*! + @function Draw + @discussion Draw this CHorizontalSlider to the screen + @param aRect the rectangle of this view that needs updating + */ + IMPORT_C void Draw(const TRect& aRect) const; + + private: + + + /// minimum value of the slider + TInt iMinimumValue; + + /// maximum value of the slider + TInt iMaximumValue; + + /// step value + TUint iStep; + + /// number of steps + TUint8 iNumberOfSteps; + + /// current position + TInt iPosition; + + /// popup graphics + RPointerArray iBorders; + + /// scrollbar graphics + RPointerArray iScrollBar; + + /// caption text + TBuf<20> iText; + + /// icon graphic, owned + CEikImage* iIcon; + + }; + +#endif // __HORIZONTALSLIDER_H__ + +// End of File + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/IEPB_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/IEPB_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + + +#include + +// SOFTKEY TEXTS + +#define qtn_sie_iepb_softkey_ok text_softkey_ok +#define qtn_sie_iepb_softkey_cancel text_softkey_cancel +#define qtn_sie_iepb_softkey_options text_softkey_option +#define qtn_sie_iepb_softkey_done text_softkey_done +#define qtn_sie_iepb_softkey_back text_softkey_back + +// MENU OPTIONS + +#define qtn_sie_iepb_menu_undo text_pup_option_undo + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorControlBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorControlBase.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,298 @@ +/* +* 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: +* A base class for image editor controls. +* +*/ + + +#ifndef IMAGEEDITORCONTROLBASE_H +#define IMAGEEDITORCONTROLBASE_H + +// INCLUDES +#include +#include "bitfield.h" + +// FORWARD DECLARATIONS +class CImageEditorUIView; +class CUiItem; +class CAknView; +class CPluginInfo; +class CEikButtonGroupContainer; + +/* CLASS: CImageEditorControlBase +* +* CImageEditorControlBase represents a base class for all Image Editor +* controls: main UI controls and plug-in controls. +*/ +class CImageEditorControlBase : public CCoeControl +{ + +public: + +/** @name Methods:*/ +//@{ + + /* Default constructor + * + * @param - + * @return - + */ + IMPORT_C CImageEditorControlBase (); + + /* Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CImageEditorControlBase (); + + /** Second phase constructor + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return - + */ + IMPORT_C virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* SetImageL + * + * Setter for bitmap pointer + * + * @param aBitmap - pointer to bitmap image + * @return - + */ + IMPORT_C virtual void SetImageL (CFbsBitmap * aBitmap); + + /* SetImageL + * + * Setter for constant bitmap pointer + * + * @param aBitmap - const pointer to bitmap image + * @return - + */ + IMPORT_C virtual void SetImageL (const CFbsBitmap * aBitmap); + + /* SetView + * + * Sets reference to the parent view + * + * @param aView - pointer to view + * @return - + */ + IMPORT_C virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * Sets selected UI item + * + * @param aItem - pointer to selected UI Item + * @return - + */ + IMPORT_C virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /* PrepareL + * + * This function is called to finalize the plugin control construction. + * It is called after ConstructL, SetView and SetSelectedUiItemL + * have been done. + * + * @param - + * @return - + */ + IMPORT_C virtual void PrepareL (); + + /* OfferKeyEventL + * + * Handles key events. When a key event occurs, the control framework + * calls this function for each control on the control stack, until one + * of them can process the key event (and returns EKeyWasConsumed). + * + * @param aKeyEvent - the key event + * @param aType - type of key event + * @return indicator for event to be handled + * @see CCoeControl + */ + IMPORT_C virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* CountComponentControls + * + * Gets the number of controls in compound control. + * + * @param - + * @return number of controls + * @see CoeControl + */ + IMPORT_C virtual TInt CountComponentControls() const; + + /* ComponentControl + * + * Gets special component control indexed with aIndex. + * + * @param aIndex - component control index + * @return pointer to component control + * @see CoeControl + */ + IMPORT_C virtual CCoeControl * ComponentControl (TInt aIndex) const; + + /* SetBusy + * + * Sets busy, when busy UI does not handle key events. + * + * @param - + * @return - + */ + IMPORT_C virtual void SetBusy(); + + /* ResetBusy + * + * Resets busy, when busy UI does not handle key events. + * + * @param - + * @return - + */ + IMPORT_C virtual void ResetBusy(); + + /* Busy + * + * Returns the busy value, when busy UI does not handle key events + * + * @param - + * @return - + */ + IMPORT_C virtual TBool Busy() const; + + /* HandlePluginCommandL + * + * Handles plug-in command for a plug-in. + * + * @param aCommand - command id + * @return UI step index >= 0, -1 if no UI update needed + */ + IMPORT_C virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * Gets soft key index of a plug-in. + * + * @param - + * @return -1 if no change, index otherwise + */ + IMPORT_C virtual TInt GetSoftkeyIndexL (); + + /* GetContextMenuResourceId + * + * Gets context specific menu resource id of a plug-in. + * + * @param - + * @return 0 if no id, resource id otherwise + */ + IMPORT_C virtual TInt GetContextMenuResourceId (); + + /* GetNaviPaneTextL + * + * Gets navi pane text. + * + * By default a plain navi pane label is created. Scroll + * indicators can be enabled by setting the boolean parateters. + * + * @param - aLeftNaviPaneScrollButtonVisibile + * @param - aRightNaviPaneScrollButtonVisible + * @return - + */ + IMPORT_C virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetDimmedMenuItems + * + * Get the plugin menu item visibility information to dynamically + * initialise the menu pane. + * + * @param - + * @return - the visibility information bitfield + */ + IMPORT_C virtual TBitField GetDimmedMenuItems (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /* SizeChanged + * + * Responds to size and position changes of the control. Called every + * time if one of the control size-changing methods is called. + * + * @param - + * @return - + * @see CoeControl + */ + IMPORT_C virtual void SizeChanged(); + + /* HandlePointerEventL + * + * @param aPointerEvent event to handle in the function + * @return - + * @see CoeControl + */ + IMPORT_C virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + /* Draw + * + * Draw controls, called by window server. + * + * @param aRect - region of control in need of redrawing + * @return - + * @see CoeControl + */ + IMPORT_C virtual void Draw (const TRect & aRect) const; + +//@} + +/** @name Members:*/ +//@{ + /// Busy flag + TBool iBusy; +//@} + +}; + + +#endif + +// End of File + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorPanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorPanics.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,42 @@ +/* +* 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: +* +*/ + + + +#include + +#ifndef __IMAGEEDITOR_PAN__ +#define __IMAGEEDITOR_PAN__ + +/// Image Editor panics +enum TImageEditorPanicIds +{ + /// Editor view is not constructed + EImageEditorPanicNoView = 0, + + /// Editor manager is needed but not constructed + EImageEditorPanicNoEditorManager, + + /// Attemp to access iProgressDialog when it is not constructed + EImageEditorPanicNoProgressDialog, + + /// When everything goes Beverly Hills... + EImageEditorPanicUnexpectedCommand = 90210 +}; + +#endif __IMAGEEDITOR_PAN__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorPluginBase.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorPluginBase.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,107 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORPLUGINBASE_HRH +#define IMAGEEDITORPLUGINBASE_HRH + +#include "avkon.hrh" + +enum TPluginUiType +{ + // Invalid + EPluginUiTypeMin = 0, + + // No UI, only image processing functionality + EPluginUiTypeNone, + + // Single parameter UI + EPluginUiTypeSingleParam, + + // Triple parameter UI + EPluginUiTypeMultiParam, + + // Customized UI + EPluginUiTypeCustomized, + + // Invalid + EPluginUiTypeMax +}; + +enum TPluginFilterType +{ + // Invalid + EPluginFilterTypeMin = 0, + + // ABITO filter + EPluginFilterTypeABITO, + + // Customized filter + EPluginFilterTypeCustomized, + + // System plugin + EPluginFilterTypeSystem, + + // Invalid + EPluginFilterTypeMax +}; + +enum TPluginScope +{ + // Invalid + EPluginScopeMin = 0, + + // Filter inserted to main engine + EPluginScopeMainEngine, + + // Filter first inserted to adjustment engine + EPluginScopeAdjustmentEngine, + + // Plugin is a singleton, only top element survives + EPluginScopeSingletonTop, + + // Invalid + EPluginScopeMax +}; + +enum TPgnCommandId +{ + // Use AVKON softkey commands where possible + EPgnSoftkeyIdOptions = EAknSoftkeyOptions, + EPgnSoftkeyIdExit = EAknSoftkeyExit, + EPgnSoftkeyIdOk = EAknSoftkeyOk, + EPgnSoftkeyIdCancel = EAknSoftkeyCancel, + EPgnSoftkeyIdBack = EAknSoftkeyBack, + EPgnSoftkeyIdSelect = EAknSoftkeySelect, + EPgnSoftkeyIdInsert = EAknSoftkeyInsert, + EPgnSoftkeyIdYes = EAknSoftkeyYes, + EPgnSoftkeyIdNo = EAknSoftkeyNo, + EPgnSoftkeyIdDone = EAknSoftkeyDone, + EPgnSoftkeyIdClose = EAknSoftkeyClose, + EPgnSoftkeyIdClear = EAknSoftkeyClear, + EPgnSoftkeyIdSave = EAknSoftkeySave, + EPgnSoftkeyIdEmpty = EAknSoftkeyEmpty, + + EPgnSoftkeyIdBase = 100000, + EPgnSoftkeyIdSet = 100001, + EPgnSoftkeyIdReduceRed = 100002, // + + EPgnMenuCmdIdBase = 200000 +}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorPluginBase.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorPluginBase.rh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINBASE_RH +#define IMAGEEDITORPLUGINBASE_RH + +STRUCT PGNINFO +{ + LONG pluginuid=0; + LONG uitype=0; + LONG plugintype=0; + LONG pluginscope=0; + LONG plugindisplayorder=0; + LTEXT pluginname=""; + LTEXT iconfile=""; + LTEXT filterfile=""; +} + +STRUCT PARAMNAMES +{ + LTEXT parameters[]; +} + +STRUCT PGNUIITEM +{ + LONG id=0; + LTEXT text=""; +} + +STRUCT PGNUIITEMS +{ + STRUCT items[]; +} + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorUI.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorUI.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,102 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORUI_HRH +#define IMAGEEDITORUI_HRH + +enum TImageEditorUICommandIds +{ + // MENU COMMANDS + EImageEditorCmdBase = 10000, + EImageEditorMenuCmdApplyEffect, + EImageEditorMenuCmdUndo, + EImageEditorMenuCmdFullScreen, + EImageEditorMenuCmdNormalScreen, + EImageEditorMenuCmdSave, + EImageEditorMenuCmdHelp, + EImageEditorMenuCmdExit, + EImageEditorMenuCmdZoomIn, + EImageEditorMenuCmdZoomOut, + EImageEditorMenuCmdFitToScreen, + // CSendAppUi commands are here + EImageEditorMenuCmdSend = 10020, + EImageEditorMenuCmdSendLast = 10029, + // AIW Print commands are here + EImageEditorMenuAiwPrintBase = 10030, + EImageEditorMenuAiwPrintLast = 10033, + // AIW MENU COMMANDS WILL BE BETWEEN THESE IDs + EImageEditorMenuAiwLast = 10999, + + // SOFTKEYS + EImageEditorSoftkeyCmdOptions = 11000, + EImageEditorSoftkeyCmdBack, + EImageEditorSoftkeyCmdOk, + EImageEditorSoftkeyCmdDone, + EImageEditorSoftkeyCmdYes, + EImageEditorSoftkeyCmdNo, + + // MISC COMMANDS + EImageEditorCmdSelectPlugin = 15000, + EImageEditorCmdRender, + EImageEditorCmdViewReady, + EImageEditorApplyPlugin, + EImageEditorApplyPluginNoStorage, + EImageEditorCancelPlugin, + EImageEditorUpdateSoftkeys, + EImageEditorUpdateNavipane, + EImageEditorAddFilterToEngine, + EImageEditorFocusGained, + EImageEditorFocusLost, + EImageEditorUndoFilter, + EImageEditorTryDisplayMenuBar, + EImageEditorStoreParameters, + EImageEditorSaveAndPrint, + EImageEditorDoPrint, + EImageEditorResetZoom, + EImageEditorPreGlobalZoomChange, + EImageEditorGlobalZoomChanged, + EImageEditorGlobalCropChanged, + EImageEditorPreGlobalPanChange, + EImageEditorGlobalPanChanged, + EImageEditorGlobalRotationChanged, + EImageEditorPreScreenModeChange, + EImageEditorPostScreenModeChange, + EImageEditorCmdSaveReplace, + EImageEditorCmdSaveNew, + EImageEditorCmdTouchPan, + EImageEditorOpenContextMenu, + + + // PLUG-IN COMMAND BASE + EImageEditorPgnCmdBase = 100000, + + // AIW CRITERIAS + EImageEditorAiwCriteriaPrint = 110000 + +}; + +// Location of the "Send" menu item in the menu +#define SIE_SENDUI_MENU_ITEM_INDEX 2 + + +#endif + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorUI.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorUI.rh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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: +* Resource header file for ImageEditorUI component. +* +*/ + + +#ifndef IMAGEEDITORUI_RH +#define IMAGEEDITORUI_RH + + +STRUCT TEXT_ARRAY + { + LTEXT parameters[]; + } + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorUIDefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorUIDefs.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,72 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORUIDEFS_H +#define IMAGEEDITORUIDEFS_H + +/// CONSTANTS + +/// The image editor UI icons +_LIT(KImageEditorUiMifFile, "\\resource\\apps\\ImageEditorUi.mif"); + +const TInt KStandardCrosshairWidth = 15; +const TInt KStandardCrosshairHeight = 15; +const TInt KQVGACrosshairWidth = 20; +const TInt KQVGACrosshairHeight = 20; +const TInt KDoubleCrosshairWidth = 25; +const TInt KDoubleCrosshairHeight = 25; +const TInt KHVGACrosshairWidth = 24; +const TInt KHVGACrosshairHeight = 24; +const TInt KVGACrosshairWidth = 32; +const TInt KVGACrosshairHeight = 32; + +/// some common scan codes +const TInt KScanCode_Edit = EStdKeyRightShift; +const TInt KScanCode_Clear = EStdKeyBackspace; +const TInt KScanCode_Apps = EStdKeyApplication0; +const TInt KScanCode_Soft_Left = EStdKeyDevice0; +const TInt KScanCode_Soft_Right = EStdKeyDevice1; + +/// Time that the tooltip is shown in the view +const TInt KTimeTooltipInView = 1500; // 1.5s + +/// INLINE FUNCTIONS + +/* min_2 +* +* Utility function for getting minimum of two numbers. +*/ +inline TInt min_2 (TInt aX, TInt aY) +{ + return (aX < aY) ? (aX) : (aY); +} + +/* max_2 +* +* Utility function for getting maximum of two numbers. +*/ +inline TInt max_2 (TInt aX, TInt aY) +{ + return (aX > aY) ? (aX) : (aY); +} + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorUIView.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorUIView.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,732 @@ +/* +* 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 View class. +* +*/ + + + +#ifndef IMAGEEDITORUIVIEW_H +#define IMAGEEDITORUIVIEW_H + + +// INCLUDES +#include + +#include +#include + +#include "bitfield.h" +#include "commondefs.h" + +// CONSTANTS + +// UID of view +const TUid KViewId = {0x00000001}; + +// FORWARD DECLARATIONS +class CImageEditorUIContainer; +class CPluginInfo; +class CAknWaitDialog; +class CAknNavigationControlContainer; +class CAknNavigationDecorator; +class CAknTitlePane; +class CSendUi; +class TSendingCapabilities; +class CAknInfoPopupNoteController; + +#ifdef AIW_SUPPORT +class CAiwServiceHandler; +#endif + + + +/* CLASS: CImageEditorUIView +* +* View part of Image Editor UI. +* +*/ +class CImageEditorUIView : public CAknView +{ + +public: + +/** @name Methods:*/ +//@{ + + /* Default constructor + * + * @param + * @return + */ + IMPORT_C CImageEditorUIView(); + + /* Second phase constructor + * + * @param + * @return + */ + IMPORT_C void ConstructL(); + + /* Destructor + * + * @param + * @return + */ + IMPORT_C ~CImageEditorUIView(); + + /* Id + * + * Returns UID of the view. + * + * @param + * @return + * @see CAknView + */ + IMPORT_C TUid Id() const; + + /* HandleCommandL + * + * Handle view commands. + * + * @param aCommand - command ID + * @return - + * @see CAknView + */ + IMPORT_C void HandleCommandL (TInt aCommand); + + /* HandleClientRectChange + * + * Handles client rectangle changes. + * + * @param - + * @return - + */ + IMPORT_C void HandleClientRectChange(); + + /* SetImage + * + * Set bitmap for preview pane. + * + * @param aBitmap - preview bitmap + * @return - + */ + IMPORT_C void SetImageL (CFbsBitmap * aBitmap); + + /* SetImageFileName + * + * Set image file name + * + * @param aFileName - image filename + * @return - + */ + IMPORT_C void SetImageFileName (const TDesC& aFileName); + + /* GetContainer + * + * Set plug-in control to UI. + * + * @param - + * @return - pointer to container control + */ + IMPORT_C CCoeControl * GetContainer () const; + + /* ActivatePluginL + * + * Activates plug-in UI. + * + * @param aControl - plug-in control + * @return - + */ + IMPORT_C void ActivatePluginL (CCoeControl * aControl); + + /* ActivateMainViewL + * + * Activates main view. + * + * @param - + * @return - + */ + IMPORT_C void ActivateMainViewL(); + + /* GetSelectedPluginInfoL + * + * Gets plug-in information of the selected plug-in. + * + * @param - + * @return plug-in info + */ + IMPORT_C CPluginInfo * GetSelectedPluginInfoL (); + + /* AddPluginUiItemL + * + * Adds a new plug-in UI item. + * + * @param aPluginInfo - plug-in info class + * @return - + */ + IMPORT_C void AddPluginUiItemL (const CPluginInfo * aPluginInfo); + + /* SetCustomButtonsL + * + * Sets custom buttons for the view. + * + * @param aResourceID - resource ID for CBA + * @return - + */ + IMPORT_C void SetCustomButtonsL (TInt aResourceID) const; + + /* LaunchSaveChangesQueryL + * + * Launches a query dialog "Save changes?" query. + * + * @param - + * @return - !0 if exit, 0 if not exit + */ + IMPORT_C TInt LaunchSaveChangesQueryL () const; + + /* LaunchExitWithoutSavingQueryL + * + * Launches a query dialog "Exit anyway" if disk is full + * when trying to exit and save - confirmation query. + * + * @param - + * @return - !0 if exit, 0 if not exit + */ + IMPORT_C TInt LaunchExitWithoutSavingQueryL () const; + + /* LaunchCancelTextInputQueryL + * + * Launches a query dialog "Cancel text input" if screen + * is turned to landscape mode and text input is not available + * + * @param - + * @return - !0 if cancel, 0 otherwise + */ + IMPORT_C TInt LaunchCancelTextInputQueryL () const; + + /* LaunchSendQueryL + * + * Launches a send list query. + * + * @param aCaps - sending capabilities + * @param aFileName - aAttachment + * @return - + */ + IMPORT_C void LaunchSendQueryL ( + const TSendingCapabilities& aCaps, + TFileName& aFileName + ) const; + + /* LaunchSendQueryL + * + * Launches a send list query. + * + * @param aCaps - sending capabilities + * @param aFileHandle - aAttachment + * @return - + */ + IMPORT_C void LaunchSendQueryL ( + const TSendingCapabilities& aCaps, + RFile& aFileHandle + ) const; + + /* LaunchSaveWaitDialogL + * + * Launches a save wait dialog. + * + * @param - aSelfPtr + * The wait dialog is allocated at this pointer. + * The pointer needs to be valid when the dialog + * is dismissed and must be a class member. + * @param aFinalValue Final value for the process + * @param - aCallback The wait dialog callback. + * Pass NULL if no callback is needed. + * @return - + */ + IMPORT_C void LaunchSaveWaitDialogL( + CAknProgressDialog** aSelfPtr, + TInt aFinalValue, + MProgressDialogCallback* aCallback + ) const; + + /* LaunchLoadWaitDialogL + * + * Launches a load wait dialog. + * + * @param - aSelfPtr + * The wait dialog is allocated at this pointer. + * The pointer needs to be valid when the dialog + * is dismissed and must be a class member. + * @param - aCallback + * The wait dialog callback. + * Pass NULL if no callback is needed. + * @return - + */ + IMPORT_C void LaunchLoadWaitDialogL( + CAknWaitDialog** aSelfPtr, + MProgressDialogCallback* aCallback + ) const; + + IMPORT_C void LaunchWaitDialog() const; + + IMPORT_C void HideWaitDialog() const; + + /* ShowInformationNoteL + * + * Launches a information note. + * + * @param aNoteText - text to be shown + * @return - + */ + IMPORT_C void ShowInformationNoteL (const TDesC& aNoteText) const; + + /* ShowConfirmationNoteL + * + * Launches a confirmation note. + * + * @param aNoteText - text to be shown + * @return - + */ + IMPORT_C void ShowConfirmationNoteL (const TDesC& aNoteText) const; + + /* SetNaviPaneTextL + * + * Sets navigation pane text. + * + * @param aText - navigation pane text + * @param aLeftNaviPaneScrollButtonVisibile + * @param aRightNaviPaneScrollButtonVisible + * @return - + */ + IMPORT_C void SetNaviPaneTextL ( + const TDesC & aText, + TBool aLeftNaviPaneScrollButtonVisibile, + TBool aRightNaviPaneScrollButtonVisible ); + + /* ClearNaviPaneTextL + * + * Clears navigation pane text. + * + * @param - + * @return - + */ + IMPORT_C void ClearNaviPaneTextL(); + + /* SetTitlePaneTextL + * + * Sets title pane text. + * + * @param aText - title pane text + * @return - + */ + IMPORT_C void SetTitlePaneTextL (const TDesC & aText); + + /* ClearTitlePaneTextL + * + * Clears title pane text. + * + * @param - + * @return - + */ + IMPORT_C void ClearTitlePaneTextL (); + + /* SetSoftKey1L + * + * Sets soft key 1 command id and text. + * + * @param aText - soft key text + * @param aCommand - command id + * @return - + */ + IMPORT_C void SetSoftKey1L ( + const TDesC & aText, + const TInt aCommand + ); + + /* SetSoftKey2L + * + * Sets soft key 2 command id and text. + * + * @param aText - soft key text + * @param aCommand - command id + * @return - + */ + IMPORT_C void SetSoftKey2L ( + const TDesC & aText, + const TInt aCommand + ); + + /* SetMiddleSoftKeyL + * + * Sets Middle soft key command id and text. + * + * @param aText - soft key text + * @param aCommand - command id + * @return - + */ + IMPORT_C void SetMiddleSoftKeyL ( + const TDesC & aText, + const TInt aCommand + ); + + /* SetBusy + * + * Sets busy flag. When busy flag is set, no key events are handled. + * + * @param - + * @return - + */ + IMPORT_C void SetBusy(); + + /* ResetBusy + * + * Resets busy flag. When busy flag is reset, key events are handled. + * + * @param - + * @return - + */ + IMPORT_C void ResetBusy(); + + /* SetUndoFlag + * + * Sets undo flag. When undo flag is set to ETrue, Undo item is shown + * in menu. + * + * @param - + * @return - + */ + IMPORT_C void SetUndoFlag (const TBool aUndo); + + /* SetCanSave + * + * Sets save flag. When save flag is set, Save item is shown in menu. + * + * @param aSave - flag indicating, wheather saving is possible or not. + * @return - + */ + IMPORT_C void SetSaveFlag (const TBool aSave); + + /* SetFullScreen + * + * Sets full screen flag. When full screen flag is set, the view is in + * full screen mode. Normal screen item is shown in menu. + * + * @param - + * @return - + */ + IMPORT_C void SetFullScreen(); + + /* ResetFullScreen + * + * Resets full screen flag. When full screen flag is reset, the view is + * in normal screen mode. Full screen item is shown in menu. + * + * @param - + * @return - + */ + IMPORT_C void ResetFullScreen(); + + /* SetZoomModeL + * + * Sets zoom mode. + * + * @param aMode - zoom mode + * @return - + */ + IMPORT_C void SetZoomModeL( const TZoomMode& aMode ); + + /* DynInitMenuPaneL + * + * Initialize menu items dynamically + * + * @param aResourceId - resource ID of menu to be initialized + * @param aMenuPane - run-time presentation of the menu pane + * @return - + * @see MEikMenuObserver + */ + IMPORT_C virtual void DynInitMenuPaneL ( + TInt aResourceId, + CEikMenuPane * aMenuPane + ); + + /* HandleStatusPaneSizeChange + * + * Main pane and status pane are partly overlapping. This method + * handles the status pane changes + * + * @param - + * @return - + * @see CAknView + */ + IMPORT_C void HandleStatusPaneSizeChange(); + + /* UpdateLayoutL + * + * Update layout of the view according to screenmode + * + * @param aScreenMode - screen mode + * @return - + */ + IMPORT_C void UpdateLayoutL(TInt aScreenMode) const; + + /* SetSendAppUi + * + * Sets CSendUi pointer + * + * @param aSendAppUi - pointer to CSendUi instance + * @return - + */ + IMPORT_C void SetSendAppUi(CSendUi* aSendAppUi); + + /* LaunchSaveImageQueryL + * + * Launches a query dialog "Save image:". + * + * @param - + * @return - list query id or -1 if the user selects No + */ + IMPORT_C TInt LaunchSaveImageQueryL () const; + + /* GetTouchPanDirections + * + * Can be used to get the x- and y-directional movement changes + * when image is panned with touch. + * + * @since S60 v5.0 + * @param - xMovement x-directional change + * @param - yMovement y-directional change + * @return - + */ + IMPORT_C void GetTouchPanDirections( TInt& xMovement, TInt& yMovement ); + + /* InZoomingState() + * + * Checks whether an image has been zoomed or not. + * + * @param - + * @return ETrue if in zooming state, EFalse otherwise + */ + IMPORT_C TBool InZoomingState(); + IMPORT_C TBool IsMemoryInCriticalLevel(); +//@} + +protected: + +/** @name Methods:*/ +//@{ +//@} + + /* ViewScreenModeCompatible + * + * @see CAknView + * + */ + IMPORT_C TBool ViewScreenModeCompatible(TInt aScreenMode); + + +/** @name Members:*/ +//@{ +//@} + +private: + +/** @name Methods:*/ +//@{ + + /* DoActivateL + * + * Called when view is activated. + * + * @param aPrevViewId - + * @param aCustomMessageId - + * @param aCustomMessage - + * @return - + * @see CAknView + */ + IMPORT_C void DoActivateL ( + const TVwsViewId & aPrevViewId, + TUid aCustomMessageId, + const TDesC8 & aCustomMessage + ); + + /* DoDeactivate + * + * Called when view is deactivated. + * + * @param - + * @return - + * @see CAknView + */ + IMPORT_C void DoDeactivate(); + + /* DimAllL + * + * Dims all menu items + * + * @param aResourceId - resource ID of menu to be initialized + * @param aMenuPane - run-time presentation of the menu pane + * @return - + */ + void DimAllL ( + TInt aResourceId, + CEikMenuPane & aMenuPane + ) const; + + /* UpdateSoftkeysL + * + * Updates softkeys. + * + * @param - + * @return - + */ + void UpdateSoftkeysL(); + + /* UpdateNaviPaneL + * + * Updates navi pane text. + * + * @param - + * @return - + */ + void UpdateNaviPaneL(); + + /* InsertPluginItemsL + * + * Inserts plug-in menu items to menu pane. + * + * @param aMenuPane - run-time presentation of the menu pane + * @return - + */ + void InsertPluginItemsL (CEikMenuPane & aMenuPane); + + /* MenuItemPressedL + * + * Checks if a plug-in menu item has been pressed. + * + * @param aCommand - command id + * @return ETrue if menu item pressed, EFalse otherwise + */ + TBool MenuItemPressedL (TInt aCommand); + + /* AddContainerToStack() + * + * Add container to control stack and ensure it is not added twice + * + * @param - + * @return - + */ + void AddContainerToStack(); + + /* RemoveContainerFromStack() + * + * Remove container from control stack and ensure it is not removed twice + * + * @param - + * @return - + */ + void RemoveContainerFromStack(); + + /* HandleZoomModeChangeL() + * + * Handle needed operations (CBA buttons, tooltip) + * after zoom mode change. + * + * @param - + * @return - + */ + void HandleZoomModeChangeL(); + + /* ResolveCaptionNameL + * + * Resolves the caption (Media gallery) that should be added to + * saving note. Leaves if something goes wrong and caption can't be + * resolved. + * + * @param aCaption - Caption to be added + * @return - + */ + void ResolveCaptionNameL( TApaAppCaption& aCaption ) const; + +//@} + +/** @name Members:*/ +//@{ + /// UI container control + CImageEditorUIContainer * iContainer; + // Navigation pane + CAknNavigationControlContainer * iNaviPane; + /// Navigation decorator + CAknNavigationDecorator * iNaviDecorator; + /// Previous navigation decorator + CAknNavigationDecorator * iPreviousNaviDecorator; + /// Title pane + CAknTitlePane * iTitlePane; + /// SendAppUi + CSendUi* iSendAppUi; + /// Resource reader + RConeResourceLoader iResLoader; + /// Resource ID + TInt iResID; + /// Can undo + TBool iCanUndo; + /// Can save + TBool iCanSave; + /// In plug-in + TBool iInPlugin; + /// Are we in full screen mode + TBool iFullScreen; + /// Busy + TBool iBusy; + /// Zoom mode + TZoomMode iZoomMode; + /// Left soft key ID + TInt iSoftkey1; + /// Right soft key ID + TInt iSoftkey2; + /// Middle soft key ID + TInt iMSK; + /// Array of UI items + RPointerArray iArray; + /// Selected plug-in UI item index + TInt iIndex; + /// Currently loaded image name + TFileName iImageFileName; + /// Pointer to plug-in control + CCoeControl * iControl; + /// Preview bitmap + CFbsBitmap* iPreview; + /// Selected print menu command + TInt iSelectedPrintMenuCmd; + /// Is container added to stack + TBool iContainerInStack; + // Array for zoom popup note texts + CDesCArray* iZoomTexts; + // Popup controller + CAknInfoPopupNoteController* iPopupController; + +#ifdef AIW_SUPPORT + /// AIW Service Handler + CAiwServiceHandler* iServiceHandler; +#endif + +//@} + +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/ImageEditorUids.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/ImageEditorUids.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,75 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORUIDS_HRH +#define IMAGEEDITORUIDS_HRH + +// IImage Editor app UID +#define UID_IMAGE_EDITOR 0x101FFA91 + +// Image Editor ECOM plugin UID (for platform security) +#define UID_IMAGE_EDITOR_PLUGIN 0x01020304 + +// Plug-In Interface +#define UID_PLUGIN_INTERFACE 0x101FFAA0 + +// Plugins +#define UID_BRIGHTNESS_PLUGIN 0x00000001 +#define UID_CONTRAST_PLUGIN 0x00000002 +#define UID_CROP_PLUGIN 0x00000003 +#define UID_ROTATEL_PLUGIN 0x00000004 +#define UID_ROTATER_PLUGIN 0x00000005 +#define UID_RESIZE_PLUGIN 0x00000006 +#define UID_CARTOONIZE_PLUGIN 0x00000008 +#define UID_BLACKWHITE_PLUGIN 0x00000009 +#define UID_SEPIA_PLUGIN 0x0000000A +#define UID_NEGATIVE_PLUGIN 0x0000000B +#define UID_CLIPART_PLUGIN 0x0000000C +#define UID_TEXT_PLUGIN 0x0000000D +#define UID_FRAME_PLUGIN 0x0000000E +#define UID_SHARPNESS_PLUGIN 0x0000000F +#define UID_REDEYEREDUCTION_PLUGIN 0x00000010 +#define UID_OILIFY_PLUGIN 0x00000011 +#define UID_BUBBLE_PLUGIN 0x00000012 +#define UID_DRAW_PLUGIN 0x00000013 + + +// Image Editor Provider AIW ECom DLL UID +#define UID_AIW_ECOM_DLL 0x101FFA9E + +// Image Editor Provider AIW interface UID (is this used?) +#define UID_AIW_SERV_PROVIDER 0x101FFA9F + +// Image Editor Provider ECom implementation UID +#define UID_AIW_ECOM_IMPL 0x0000002A + +// UID for CResolutionUtil (CCoeStatic) +#define UID_RESOLUTION_UTIL UID_IMAGE_EDITOR + + +// UID for the JPEG rotator DLL +#define UID_JPEG_ROTATOR 0xA00002F8 + +// UID for the JPEG scaler DLL +#define UID_JPEG_SCALER 0xA00002F9 + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/JpTimer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/JpTimer.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,53 @@ +/* +* 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: +* +*/ + + +#ifndef __CJPTIMER_H__ +#define __CJPTIMER_H__ + +#include + +class MTimerCallBack; + +class CJPTimer : public CTimer +{ + + public: + + static CJPTimer* NewL( MTimerCallBack* aCallBack ); + ~CJPTimer(); + + private: + + void ConstructL(); + CJPTimer( MTimerCallBack* aCallBack ); + + public: + + void Call( TInt aWait ); + + private: // CActive + + void RunL(); + + private: + + MTimerCallBack * iCallBack; + bool iCalling; + }; +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/MTimerCallBack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/MTimerCallBack.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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: +* +*/ + + +#ifndef __MTIMERCALLBACK_H__ +#define __MTIMERCALLBACK_H__ + +class MTimerCallBack + { + public: + virtual ~MTimerCallBack() {} + + virtual void TimerCallBack() = 0; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/PluginTypeDef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/PluginTypeDef.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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: +* +*/ + + + +#ifndef PLUGINTYPEDEF_H +#define PLUGINTYPEDEF_H + +#include "iepb.h" +#include "ImageEditorUids.hrh" + +typedef CImageEditorPluginBase CPluginType; + +const TUid TUid2 = {UID_PLUGIN_INTERFACE}; + +#endif // plugintypedef.h diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/PreviewControlBase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/PreviewControlBase.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,144 @@ +/* +* 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: +* +*/ + + + +#ifndef PREVIEWCONTROLBASE_H +#define PREVIEWCONTROLBASE_H + +// INCLUDES +#include "ImageEditorControlBase.h" +#include "DrawUtils.h" + +// FORWARD DECLARATIONS +class CFbsBitmap; +class CPluginInfo; + +// CONSTANTS +const TInt KDancingAntzTimerDelayInMicroseconds = 100000; +const TInt KDancingAntzTimerIntervalInMicroseconds = 250000; + +// These can be replaced in the plug-ins to adjust the movement +const TInt KDefaultFastKeyTimerDelayInMicroseconds = 200000; +const TInt KDefaultFastKeyTimerIntervalInMicroseconds = 50000; +const TInt KDefaultFastKeyTimerMultiplyThresholdInTicks = 3; +const TInt KDefaultSmallNavigationStepMultiplier = 1; +const TInt KDefaultBigNavigationStepMultiplier = 6; + + +/* CLASS: CPreviewControlBase +* +* CPreviewControlBase acts as a base class for preview pane Image Editor UI. +* +*/ +class CPreviewControlBase : public CImageEditorControlBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /* NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return - pointer to newly created CPreviewControlBase + */ + IMPORT_C static CPreviewControlBase * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Second phase constructor + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CPreviewControlBase(); + + /* SetImage + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void SetImageL (CFbsBitmap * aBitmap); + + /* SetImageL + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void SetImageL (const CFbsBitmap * aBitmap); + + /* DrawPreviewImage + * + * Draws preview image + * + * @param aRect - region of control in need of redrawing + * @return - + */ + IMPORT_C virtual void DrawPreviewImage (const TRect & aRect) const; + + +//@} + +protected: + +/** @name Methods:*/ +//@{ +//@} + +/** @name Members:*/ +//@{ + /// Preview image + const CFbsBitmap * iPreview; +//@} + +private: + +/** @name Methods:*/ +//@{ + + /* Draw + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void Draw (const TRect & aRect) const; + +//@} + +/** @name Members:*/ +//@{ + +//@} + + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/SingleParamControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/SingleParamControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,238 @@ +/* +* 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: +* +*/ + + +#ifndef SINGLEPARAMCONTROL_H +#define SINGLEPARAMCONTROL_H + +// INCLUDES +#include +#include "PreviewControlBase.h" + +// FORWARD DECLARATIONS +class CCoeControl; +class CAknView; +class MSingleParControlObserver; +class CPluginInfo; +class CHorizontalSlider; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +/* CLASS: CSingleParamControl + * + * CSingleParamControl represents a single parameter adjustment UI control, + * that can be used by any of the plug-ins just by defining a UI type to + * resource file. + */ +class CSingleParamControl : public CPreviewControlBase + { +public: + + /** @name Methods:*/ + //@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @param aActionOnButtonRelease - To indicate if rendering should happen only when + * the button1 is released, i.e. when dragging has stopped. Default value is false. + * @return - pointer to the newly created CSingleParamControl instance + */ + IMPORT_C static CSingleParamControl * NewL ( + const TRect & aRect, + CCoeControl * aParent, + TBool aActionOnButtonRelease = EFalse + ); + + /** Default constructor + * + * @param - + * @return - + */ + IMPORT_C CSingleParamControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent, + TBool aActionOnButtonRelease + ); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CSingleParamControl (); + + /* SetView + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + IMPORT_C virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + /* SetParObserver + * + * Sets the MSingleParControlObserver for the control. + * + * @param aObserver - parameter observer + * @return - + */ + IMPORT_C void SetParObserver (MSingleParControlObserver * aObserver); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual TInt GetSoftkeyIndexL(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + // these functions are for adjusting the slider + IMPORT_C void SetSliderMinimumAndMaximum(TInt aMin, TInt aMax); + IMPORT_C void SetSliderPosition(TInt aPosition); + IMPORT_C void SetSliderStep(TUint aStep); + IMPORT_C void SetSliderStepAmount(TUint8 aAmount); + IMPORT_C void SetIcon(CEikImage* aIcon); + IMPORT_C void SetCaption(const TDesC& aText); + IMPORT_C TInt Position() const; + + // from CCoeControl + IMPORT_C TInt CountComponentControls() const; + IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; + IMPORT_C void SizeChanged(); + + //@} + +protected: + +private: + + /** @name Methods:*/ + //@{ + + /* Draw + * + * @see CImageEditorControlBase + */ + IMPORT_C virtual void Draw (const TRect & aRect) const; + + //@} + /// Parameter adjustment observer + MSingleParControlObserver * iParObserver; + + IMPORT_C void CountImageSizesAndPositions(); + IMPORT_C void MoveSlider(TInt aSteps); + +protected: + + /// Plug-in info + CPluginInfo* iItem; + + /// View reference + CAknView* iEditorView; + + /// drag flag + TBool iDragging; + + /// should rendering happen only when the button is released + TBool iActionOnButtonRelease; + + /// touch area + TRect iTouchRect; + + /// minimum value of the slider + TInt iMinimumValue; + + /// maximum value of the slider + TInt iMaximumValue; + + /// step value + TUint iStep; + TUint iStepInPixels; + + /// number of steps + TUint8 iNumberOfSteps; + + /// current position + TInt iPosition; + + /// popup graphics + RPointerArray iBorders; + + /// scrollbar graphics + RPointerArray iScrollBar; + + /// caption text + CEikLabel* iText; + + /// icon graphic, owned + CEikImage* iIcon; + + /// use selection graphic + TBool iMarkerPressed; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ + + }; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/SingleParamControlObserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/SingleParamControlObserver.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,104 @@ +/* +* 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: +* +*/ + + + +#ifndef SINGLEPARAMCONTROLOBSERVER_H +#define SINGLEPARAMCONTROLOBSERVER_H + +// INCLUDES + +// FORWARD DECLARATIONS + + +/* CLASS: MSingleParControlObserver +* +* MSingleParControlObserver is a mixin class for updating the parameter +* +*/ +class MSingleParControlObserver +{ +public: +/** @name Methods:*/ +//@{ + enum TParamOperation + { + // Invalid + EParamOperationMin, + // Set default parameter + EParamOperationDefault, + // Add step to parameter + EParamOperationAdd, + // Subtract step from parameter + EParamOperationSubtract, + // Invalid + EParamOperationMax, + }; +//@} + +/** @name Methods:*/ +//@{ + /** ParamOperation + * + * Performs an operation to the filter parameter. + * + * @param aOperation - filter parameter operation + * @return - + */ + virtual void ParamOperation (const TParamOperation aOperation) = 0; + + /** GetParam + * + * Gets filter parameter. + * + * @param - + * @return TReal - filter parameter value + */ + virtual TReal GetParam () const = 0; +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/VerticalSlider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/VerticalSlider.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,232 @@ +/* +* 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: +* +*/ + + + +#ifndef __VERTICALSLIDER_H__ +#define __VERTICALSLIDER_H__ + +#include + +class CFbsBitmap; + +/*! + @class CVerticalSlider + @discussion Simple control which draws a vertical slider + */ + +class CVerticalSlider : public CCoeControl + { + public: + + /*! + @function NewL + @discussion Create a CVerticalSlider object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @return a pointer to the created instance of CVerticalSlider + */ + IMPORT_C static CVerticalSlider* NewL(const TRect& aRect, const CCoeControl& aControl); + + /*! + @function NewLC + @discussion Create a CVerticalSlider object, which will draw itself to aRect + @param aRect the rectangle this view will be drawn to + @return a pointer to the created instance of CVerticalSlider + */ + IMPORT_C static CVerticalSlider* NewLC(const TRect& aRect, const CCoeControl& aControl); + + /*! + @function ~CVerticalSlider + @discussion Destroy the object and release all memory objects + */ + IMPORT_C ~CVerticalSlider(); + + + public: + // new functions + + /*! + @function SetMinimum + @param aValue the new minimum value + @discussion Sets the minimum value of the slider + */ + IMPORT_C void SetMinimum(TInt aValue); + + /*! + @function SetMaximum + @param aValue the new maximum value + @discussion Sets the maximum value of the slider + */ + IMPORT_C void SetMaximum(TInt aValue); + + /*! + @function SetStepL + @param aValue the new step value + @discussion Sets the step of the slider + */ + IMPORT_C void SetStep(TUint aValue); + + /*! + @function SetStepAmount + @param aValue the new step amount + @discussion Sets the number of steps in the slider + */ + IMPORT_C void SetStepAmount(TUint8 aValue); + + /*! + @function SetPosition + @discussion Sets the position of the slider. Panics if the position is out of bounds. + */ + IMPORT_C void SetPosition(TInt aValue); + + /*! + @function Minimum + @discussion Gets the minimum value of the slider + @return minimum value + */ + IMPORT_C TInt Minimum() const; + + /*! + @function Maximum + @discussion Gets the maximum value of the slider + @return maximum value + */ + IMPORT_C TInt Maximum() const; + + /*! + @function Step + @discussion Gets the step of the slider + @return current step + */ + IMPORT_C TInt Step() const; + + /*! + @function Position + @discussion Gets the position of the slider + @return current position + */ + IMPORT_C TInt Position() const; + + /*! + @function Increment + @discussion Increments the slider + */ + IMPORT_C void Increment(); + + /*! + @function Decrement + @discussion Decrements the slider + */ + IMPORT_C void Decrement(); + + private: + + /*! + @fuction ConstructL + @discussion Perform the second phase construction of a CVerticalSlider object + @param aRect Frame rectangle for container. + */ + void ConstructL(const TRect& aRect, const CCoeControl& aControl); + + /*! + @function CVerticalSlider + @discussion Constructs this object + */ + CVerticalSlider(); + + /*! + @function LoadBitmapL + @discussion Loads one bitmap and its mask + */ + void LoadBitmapL( + CFbsBitmap*& aBitmap, + CFbsBitmap*& aMask, + TInt aBitmapIndex, + TInt aMaskIndex + ) const; + + /*! + @function SetBitmapSize + @discussion Set size of the bitmaps to reflect the current screen resolution + */ + void SetBitmapSize() const; + + + public: // from CoeControl + /*! + @function CountComponentControls + @return Number of component controls + */ + IMPORT_C TInt CountComponentControls() const; + + /*! + @function ComponentControl. + @param aIndex index of the component control + @return Pointer to component control + */ + IMPORT_C CCoeControl* ComponentControl(TInt aIndex) const; + + /*! + @function Draw + @discussion Draw this CVerticalSlider to the screen + @param aRect the rectangle of this view that needs updating + */ + IMPORT_C void Draw(const TRect& aRect) const; + + /*! + @function MinimumSize + @discussion Gets the minimum size of this component + @return a minimum size of the control + */ + IMPORT_C TSize MinimumSize(); + + private: + + /// minimum value of the slider + TInt iMinimumValue; + + /// maximum value of the slider + TInt iMaximumValue; + + /// step value + TUint iStep; + + /// number of steps + TUint8 iNumberOfSteps; + + /// current position + TInt iPosition; + + /// bitmap holding the slider background + CFbsBitmap* iSliderBg; + + /// mask for the slider background + CFbsBitmap* iSliderBgMask; + + /// bitmap holding the slider tab that moves + CFbsBitmap* iSliderTab; + + /// mask for the slider tab + CFbsBitmap* iSliderTabMask; + }; + +#endif // __VERTICALSLIDER_H__ + +// End of File + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/definitions.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/definitions.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,51 @@ +// +// After modifying this file, reallyclean and build the whole project! +// + +// Do not require frozen DEF files for framework modules +// (i.e. all modules except plugins). +// Instead specify 'exportunfrozen' in MMP files +#define __EXPORT_UNFROZEN_FRAMEWORK__ + +// Same as above, but for the plugin modules. +#define __EXPORT_UNFROZEN_PLUGINS__ + + +// Enable logging facility in all modules. +// Enabling logs will do the both of the following: +// +// 1) Write the the logging information to RDebug::Print() +// (in UDEB builds only) +// 2) Write the log to file using RFileLogger (both in UDEB and UREL) +// Create the folder C:\Logs\ImageEditor to enable the file logging. +#define __IE_GLOBAL_DEBUGLOG__ + +// Verbosity level of the debuglog output +//#define __VERBOSE__ +//#define __VERBOSE_2__ + +// Export the ROM description (.iby) files to epoc32\rom\include. +// Not needed if we are not creating rom image. +//#define __EXPORT_ROM_DESCRIPTION_FILES__ + +// Use print provider +#define __AIW_PRINT_PROVIDER_USED__ + +// Enable fullscreen feature +#undef __FULLSCREEN_AVAILABLE__ + +// Cropping aspect ratio options +// Enable showing both portrait and landscape in cropping aspect ratio +// selection list. If disabled, only one wallpaper option is shown (always +// portrait) +#undef __SHOW_TWO_WALLPAPER_ASPECT_RATIOS__ + +// Enable showing optional aspect ratios in selection list +#undef __SHOW_OPTIONAL_ASPECT_RATIOS__ + +// Enable landscape feature +#define __LANDSCAPE_SUPPORT__ + +// Enable touch-only device Red Eye Reduction plugin action +// If enabled, the set state is skipped and plugin loops only in resize state +#undef __TOUCH_ONLY_DEVICE_RER_PLUGIN_ACTION__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/iepb.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/iepb.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,196 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINBASE_H +#define IMAGEEDITORPLUGINBASE_H + +/// INCLUDES +#include +#include +#include "pluginbase.h" + +/// FORWARD DECLARATIONS +class CCoeControl; +class CEditorImage; + + +/// CONSTANTS +_LIT (KPgnResourcePath, "\\private\\101ffa91\\plugins\\"); + + +/* CLASS: CImageEditorPluginBase +* +* CImageEditorPluginBase is a plugin base class for all Image Editor +* plug-ins. +*/ +class CImageEditorPluginBase : public CPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aResourcePath - plug-in resource path + * @param aResourceFile - plug-in resource file + * @return CImageEditorPluginBase *, pointer to created CImageEditorPluginBase object + */ + IMPORT_C static CImageEditorPluginBase * NewL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ); + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + IMPORT_C CImageEditorPluginBase (); + + /** Second phase constructor, may leave + * + * @param aResourcePath - plug-in resource path + * @param aResourceFile - plug-in resource file + * @return - + */ + IMPORT_C void ConstructL ( + const TDesC & aResourcePath, + const TDesC & aResourceFile + ); + + /** Destructor + * @param - + * @return - + */ + IMPORT_C virtual ~CImageEditorPluginBase (); + + /* GetProperty + * + * @see CPluginBase + */ + IMPORT_C virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + IMPORT_C virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /* ShowPopupNote + * + * Shows plug-in related popup note. + * + * @param - + * @return - + */ + IMPORT_C virtual void ShowPopupNote (); + + /** InitPluginL + * + * Initializes image processing plug-in and returns CCoeControl. + * + * @param aRect - control rectangle + * @param aParent - parent control + * @param aPluginControl - reference to the plug-in control + * @return CCoeControl - plugin drawing area + */ + IMPORT_C virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * Sets the image to be processed. + * + * @param CFbsBitmap - pointer to CMiaImage instance + * @return - + */ + IMPORT_C virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * Releases plugin. + * + * @param - + * @return - + */ + IMPORT_C virtual void ReleasePlugin (); + + /* ReservedImageEditorBaseMethod1 + * + * @see CPluginBase + */ + IMPORT_C virtual void ReservedImageEditorBaseMethod1 (); + + /* ReservedImageEditorBaseMethod2 + * + * @see CPluginBase + */ + IMPORT_C virtual void ReservedImageEditorBaseMethod2 (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + /* + * Internal representation pointer. + * + * DO NOT add any other private members here, so that the size + * of the class stays constant. + */ + void * iEditorPluginBaseInternalRepresentation; + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/imageeditorpluginbasedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/imageeditorpluginbasedefs.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,110 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORPLUGINBASEDEFS_H +#define IMAGEEDITORPLUGINBASEDEFS_H + +#include "pluginbasedefs.h" + +/* +* IMAGE PROCESSING PLUG-IN CAPABILITY ID'S. +*/ + +/// UI type +const TInt KCapPluginUiType= KPluginCapabilityCustomOffset; + +/// Filter type +const TInt KCapPluginFilterType= KPluginCapabilityCustomOffset + 1; + +/// Filter scope +const TInt KCapPluginScope = KPluginCapabilityCustomOffset + 2; + +/// Filter scope +const TInt KCapPluginDisplayOrder = KPluginCapabilityCustomOffset + 3; + +/// Plug-in name +const TInt KCapPluginName = KPluginCapabilityCustomOffset + 4; + +/// Icon file name +const TInt KCapIconName = KPluginCapabilityCustomOffset + 5; + +/// Filter file name +const TInt KCapFilterName = KPluginCapabilityCustomOffset + 6; + +/// Plug-in miscellaneous parameter name array +const TInt KCapPluginParamNames = KPluginCapabilityCustomOffset + 7; + +/// Soft key 1 command ID +const TInt KCapPluginSk1Cmd = KPluginCapabilityCustomOffset + 8; + +/// Soft key 1 text +const TInt KCapPluginSk1Text = KPluginCapabilityCustomOffset + 9; + +/// Soft key 2 command ID +const TInt KCapPluginSk2Cmd = KPluginCapabilityCustomOffset + 10; + +/// Soft key 2 text +const TInt KCapPluginSk2Text = KPluginCapabilityCustomOffset + 11; + +/// Middle softkey command ID +const TInt KCapPluginMSKCmd = KPluginCapabilityCustomOffset + 12; + +/// Middle softkey text +const TInt KCapPluginMSKText = KPluginCapabilityCustomOffset + 13; + +/// Menu items +const TInt KCapPluginMenuItems = KPluginCapabilityCustomOffset + 14; + + +/// Pointer to the parameter struct +const TInt KCapParamStruct = KPluginCapabilityCustomOffset + 100; + +/// System parameter class +const TInt KCapSystemParameters = KPluginCapabilityCustomOffset + 101; + +/// System parameter class +const TInt KCapGlobalZoomDisabled = KPluginCapabilityCustomOffset + 102; + +/// Ready to render +const TInt KCapReadyToRender = KPluginCapabilityCustomOffset + 103; + +/// Is landscape enabled plugin +const TInt KCapIsLandscapeEnabled = KPluginCapabilityCustomOffset + 104; + +/// Is slow plugin +const TInt KCapIsSlowPlugin = KPluginCapabilityCustomOffset + 105; + +/* +* +* API VERSION +* +*/ +const TInt KImageEditorPluginAPIMajor = 0; +const TInt KImageEditorPluginAPIMinor = 8; +const TInt KImageEditorPluginAPIBuild = 0; + +///* +//* +//* TYPE DEFINITIONS +//* +//*/ +typedef TInt TPluginInt; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/pluginbase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/pluginbase.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,154 @@ +/* +* 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: +* +*/ + + + +#ifndef PLUGINBASE_H +#define PLUGINBASE_H + +#include +#include + + +/* CLASS: CPluginBase +* +* +*/ +class CPluginBase : public CBase +{ + +public: + + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param - + * @return CPluginBase *, pointer to created CPluginBase object + */ + IMPORT_C static CPluginBase * NewL (); + + /** Default constructor + * + * @param - + * @return - + */ + IMPORT_C CPluginBase (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + IMPORT_C void ConstructL (); + + /* Destructor + * + * @param - + * @return - + */ + IMPORT_C virtual ~CPluginBase (); + + /* SetProperty + * + * Sets plug-in property. + * + * @param aPropertyId - ID number of the property + * @param aPropertyValue - new property value as descriptor + * @return TInt - KErrNone if everything ok, one of the system wide + * error codes otherwise + */ + IMPORT_C virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * Gets plug-in property. + * + * @param aPropertyId - ID number of the queried property + * @param aPropertyValue - queried property value as descriptor + * @return TInt - KErrNone if everything ok, one of the system wide + * error codes otherwise + */ + IMPORT_C virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /* ReservedBaseMethod1 + * + * Reserved method to export table for future extensions. + * + * @param - + * @return - + */ + IMPORT_C virtual void ReservedBaseMethod1 (); + + /* ReservedBaseMethod2 + * + * Reserved method to export table for future extensions. + * + * @param - + * @return - + */ + IMPORT_C virtual void ReservedBaseMethod2 (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + + /* + * Internal representation pointer. + * + * DO NOT add any other private members here, so that the size + * of the class stays constant. + */ + void * iPluginBaseInternalRepresentation; + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/inc/pluginbasedefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/inc/pluginbasedefs.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,81 @@ +/* +* 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: +* +*/ + + + +#ifndef PLUGINBASEDEFS_H +#define PLUGINBASEDEFS_H + +#include + +/* +* TYPEDEFS +*/ + +/* TPluginType +* +* Plugin type for plug-in framework. +* +*/ +enum TPluginType +{ + // Invalid + KPluginTypeInvalid, + // Image Editor: image editing plug-in + KPluginTypeImageEditor, + // Maximum value, invalid + KPluginTypeMax +}; + +/* +* PLUG-IN CAPABILITY ID'S. +*/ + +/// Base offset for general capabilities +const TInt KPluginCapabilityBase = 0; + +/// Base offset for plugin-specific capabilities +const TInt KPluginCapabilityCustomOffset = 3000; + +/// Plugin type +const TInt KPluginCapabilityPluginType = KPluginCapabilityBase; + +/// Plugin API major version +const TInt KPluginCapabilityAPIMajorVersion = KPluginCapabilityBase + 1; + +/// Plugin API minor version +const TInt KPluginCapabilityAPIMinorVersion = KPluginCapabilityBase + 2; + +/// Plugin API build version +const TInt KPluginCapabilityAPIBuildVersion = KPluginCapabilityBase + 3; + +/// Plugin UID +const TInt KPluginCapabilityUID = KPluginCapabilityBase + 4; + +/* +* QUERY RETURN VALUES +*/ + +/// No errors +const TInt TPropRetErrNone = 0; + +/// Queried property not supprted +const TInt TPropRetErrNotSupported = -1; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/loc/ImageEditor.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/loc/ImageEditor.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,772 @@ +/* +* 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: +* This is a localisation file for Image Editor. +* +*/ + + + +//============================================================================= +// ERROR NOTES +//============================================================================= + +// d:Processing image has been failed (apply effect) +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_error_processing "Error in processing image." + +// d:Loading image has been failed +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_error_loading "Error in loading image." + +// d:Saving image has been failed +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_error_saving "Error in saving image." + +// d:Saving is failed on exit. User confirmation is needed to exit +// d:without saving. +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_exit_without_saving_confirmation "Save failed. Exit without saving?" + +// d:Internal engine error has been occured +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_error_engine "Internal engine error." + +// d:Internal error has been occured +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_error_internal "Internal error." + +// d:Internal error that requires application to exit has been occured +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_error_internal_non_recoverable "Internal error. Exiting Image Editor." + +// d:Note is shown if user has selected resize plugin from effect grid and image to be +// d:resized has too small resolution (under the limits). +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_too_small_to_resize "Image is too small to be resized" + +//============================================================================= +// OPTIONS MENU ITEMS +//============================================================================= + +// d:Command in options menu +// d:Command name for opening a color grid and choosing a new color +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_change_color "Change color" + +// d:Command in options menu +// d:Command name for resizing text function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_resize "Resize text" + +// d:Command in options menu +// d:Selects moving mode in text editing view +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_move "Move text" + +// d:Command in options menu +// d:Selects rotate mode in text editing view +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_rotate "Rotate text" + +// d:Command in options menu +// d:Command name for resizing clipart function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_resize_clipart "Resize clip-art" + +// d:Command in options menu +// d:Command name for rotating clipart function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_rotate_clipart "Rotate clip-art" + +// d:Command in options menu +// d:Command name for moving clipart function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_move_clipart "Move clip-art" + +// d:Command in options menu +// d:Command name for resizing bubble function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_resize_bubble "Resize talk bubble" + +// d:Command in options menu +// d:Command name for rotating bubble function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_rotate_bubble "Rotate talk bubble" + +// d:Command in options menu +// d:Command name for moving bubble function. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_move_bubble "Move talk bubble" + +// d:Command in options menu +// d:It used in a way similar to right softkey Cancel; +// d:going back to the previous state without saving changes. +// d:'effect' in this context means the image processing +// d:effect, i.e. Crop, Rotate left, Adjust brightness etc. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_cancel_effect "Cancel effect" + +// d:Command in options menu +// d:Command to complete the red-dye reduction effect for an eye. +// d:When the user has adjusted the selection box to cover the area +// d:containing the red eye, selecting this menu item completes the +// d:action, i.e. the image will be processed according to the currently +// d:adjusted parameters. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_reduce_red "Reduce red" + +// d:Command in options menu +// d:It is used to fix the location of the cursor on the screen +// d:to start some action related to that point. For example, +// d:the user moves the cursor to a point which user wants to be +// d:the top-left corner of a selection rectangle and selects "Set". +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_set "Set" + +// d:Command in options menu +// d:Undo operation +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_undo "Undo" + +// d:Command in options menu +// d:Opens plug-in selection grid +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_apply_effect "Apply effect" + +// d:Command in options menu +// d:Saves the edited image +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_save "Save" + +// d:Command in options menu +// d:Command name for "full screen mode" +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_full_screen "Full screen" + +// d:Command in options menu +// d:Command name for "normal screen mode" +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_normal_screen "Normal screen" + +// d:Command in options menu +// d:returns from zooming state to normal "Fit to screen" state +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_fit_to_screen "Fit to screen" + +// d:Command in options menu +// d:Available in menu if image has already zoomed in. Re-scales image display +// d:to half of the current resolution on the screen. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_zoom_out "Zoom out" + +// d:Command in options menu +// d:Re-scales image display +// d:to double of the current resolution on the screen. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_zoom_in "Zoom in" + +// d:Command in the AIW provider's Options menu +// d:Launches Image editor for editing image +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_options_edit "Edit" + +// d:Command in the AIW provider's Options submenu +// d:Launches Image editor for editing image +// l:list_single_popup_submenu_pane_t1 +// r:5.0 +// +#define qtn_sie_options_sub_edit "Edit" + +//============================================================================= +// TOOL TIPS +//============================================================================= + +// d:A tooltip text +// d:Text is shown on the screen next to the rotate icon when rotate function +// d:has been selected. Text disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_rotate "Rotate" + +// d:A tooltip text +// d:Text is shown on the screen next to the resize icon when resize function +// d:has been selected. Text disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_resize "Resize" + +// d:A tooltip text +// d:Text is shown on the screen next to the move icon when move function +// d:has been selected in clip art, talk bubble or text editing view. +// d:Text disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_move "Move" + +// d:A tooltip text +// d:Text is shown on the screen next to the outlined area when redeye +// d:reduction function has been selected and cursor is located. Text +// d:disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_redeye_outline "Outline eye" + +// d:A tooltip text shown on the screen next to the icon +// d:Text is shown on the screen next to the locate eye cursor when redeye +// d:reduction function has been selected. +// d:Text disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_redeye_locate "Locate eye" + +// d:A tooltip text +// d:Text is shown on the screen next to the crop icon when cropping mode has +// d:been selected and top left corner of the cropping box has already been set. +// d:Text disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_crop_resize_area "Resize crop area" + +// d:A tooltip text +// d:Text is shown on the screen next to the crop icon when cropping mode has +// d:been selected and top left corner of the cropping box hasn't been set. +// d:Text disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_tooltip_crop_move_area "Move crop area" + + +//============================================================================= +// PLUGIN NAMES (Shown as tooltips in application) +//============================================================================= + +// d:Name of the "Insert picture frame" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_frame "Insert frame" + +// d:Name of the "Insert talk bubble" effect. +// d:With this tool, the user can place talk bubble images on top +// d:of the edited image. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_bubble "Insert talk bubble" + +// d:Name of the "Insert clipart" effect. +// d:With this tool, the user can place clipart images on top +// d:of the edited image. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_clipart "Insert clip art" + +// d:Name of the "Negative" color transformation effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_negative "Negative" + +// d:Name of the "Insert text" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_text "Insert text" + +// d:Name of the "Resize" effect. +// d:Resize decreases the image resolution, but doesn't affect on content +// d:of the image. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_resize "Resize" + +// d:Name of the "Cropping" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_crop "Crop" + +// d:Name of the "Posterize" transformation effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_posterize "Posterize" + +// d:Name of the "Black and White" color transformation effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_bw "Black and white" + +// d:Name of the "Red Eye reduction" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_redeye "Red eye reduction" + +// d:Name of the "Adjust image contrast" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_contrast "Contrast" + +// d:Name of the "Adjust sharpness" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_sharpness "Sharpness" + +// d:Name of the "Adjust image brightness" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_brightness "Brightness" + +// d:Name of the "Sepia" color transformation effect. +// d:The sepia is dark brown color, with a little red in its composition. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_sepia "Sepia" + +// d:Name of the "Rotate left" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_rotate_left "Rotate left" + +// d:Name of the "Rotate right" effect. +// d:Text is shown as a tooltip and it disappears after default timeout. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_plugin_name_rotate_right "Rotate right" + +//============================================================================= +// GRID HEADINGS +//============================================================================= + +// d:Heading text for a popup grid where the user selects +// d:the talk bubble to be inserted into the edited image. +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_heading_select_bubble "Select talk bubble:" + +// d:Heading text for a popup grid where the user selects +// d:the clipart image to be inserted into the edited image. +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_heading_select_clipart "Select clip art:" + +// d:Heading text for a popup grid where the user selects +// d:desired color to inserted text +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_sie_select_color_promt "Select color:" + + + +//============================================================================= +// IMAGE EDITOR SPECIFIC SOFTKEYS +//============================================================================= + +// d:Softkey command +// d:It is used to fix the location of the cursor on the screen +// d:to start some action related to that point. +// l:control_pane_t1/opt7 +// r:5.0 +// +#define qtn_sie_softkey_set "Set" + +// d:Softkey command +// d:Completes the crop operation with the currently selected rectangle. +// l:control_pane_t1/opt7 +// r:5.0 +// +#define qtn_sie_softkey_crop "Crop" + +// d:Middle Softkey command +// d:Command to complete the red-dye reduction effect for an eye. +// l:control_pane_t3/opt7 +// r:5.0 +// +#define qtn_sie_msk_reduce_red "Reduce red" + +// d:Middle Softkey command +// d:It is used to fix the location of the cursor on the screen +// d:to start some action related to that point. +// l:control_pane_t3/opt7 +// r:5.0 +// +#define qtn_sie_msk_set "Set" + +// d:Middle Softkey command +// d:It is used to fix the location of the cursor on the screen +// d:to start some action related to that point. +// l:control_pane_t3/opt7 +// r:5.0 +// +#define qtn_sie_msk_zoom_in "Zoom in" + +// d:Middle Softkey command +// d:Opens plug-in selection grid +// l:control_pane_t3/opt7 +// r:5.0 +// +#define qtn_sie_msk_apply_effect "Apply effect" + + +//============================================================================= +// CROPPING +//============================================================================= + +// d:Indicator of the current crop area +// d:Where %U is the size of the selected cropping region (e.g. 800x600), if +// d:manual aspect ratio was selected in the aspect ration selection list +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_crop_area "Crop %U" + +// d:Name for the 8 by 10 portrait image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_10x8 "8:10 portrait" + +// d:Name for the 8 by 10 image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_8x10 "8:10 landscape" + +// d:Name for the 5 by 7 portrait image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_7x5 "5:7 portrait" + +// d:Name for the 5 by 7 image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_5x7 "5:7 landscape" + +// d:Name for the 4 by 6 portrait image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_6x4 "4:6 portrait" + +// d:Name for the 4 by 6 image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_4x6 "4:6 landscape" + +// d:Menu item for the manual image aspect ratio. +// d:i.e. not one of the fixed ration listed above. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_aspect_ratio_manual "Manual" + +// d:Name for the wallpaper image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_wallpaper "Wallpaper" + +// d:Name for the portrait wallpaper image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_wallpaper_prt "Wallpaper portrait" + +// d:Name for the landscape wallpaper image aspect ratio. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_crop_wallpaper_lnds "Wallpaper landscape" + +// d:Prompt text for crop aspect ratio selection +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_sie_heading_aspect_ratio "Select aspect ratio:" + + +//============================================================================= +// ZOOMING +//============================================================================= + +// d:Zooming ratio when image has been zoomed in 3 times +// d:Text is shown displayed on the screen 1.5 seconds. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_zoom_in8 "Zooming 400%" + +// d:Zooming ratio when image has been zoomed in twice +// d:Text is shown displayed on the screen 1.5 seconds. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_zoom_in4 "Zooming 200%" + +// d:Zooming ratio when image has been zoomed in once +// d:Text is shown displayed on the screen 1.5 seconds. +// l:popup_preview_text_window_t1 +// r:5.0 +// +#define qtn_sie_zoom_in2 "Zooming 100%" + + +//============================================================================= +// NOTES +//============================================================================= + +// d:Waiting note that is shown if loading a clipart grid takes +// d:more than 1 second +// l:popup_note_wait_window +// r:5.0 +// +#define qtn_sie_pgn_searching_cliparts "Searching for Clip-art" + +// d:Waiting note that is shown if loading a bubble grid takes +// d:more than 1 second +// l:popup_note_wait_window +// r:5.0 +// +#define qtn_sie_pgn_searching_bubbles "Searching for Bubble" + +// d:Note that is shown when user has changed the image resolution with +// d:resize plugin +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_resize_resolution_changed "Image resolution has been changed" + + +//============================================================================= +// SAVING QUERY +//============================================================================= + +// d:List query heading text. +// d:This list query is used when option "Save" has been selected. +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_sie_heading_save "Save image:" + +// d:List query item in saving query. +// d:Overwrites existing file. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_query_save_replace "Replace original" + +// d:List query item in saving query. +// d:Creates a new file. +// l:list_single_pane_t1_cp2 +// r:5.0 +// +#define qtn_sie_query_save_new "Save with a new name" + + +//============================================================================= +// HORINZONTAL SLIDER TITLE TEXTS +//============================================================================= + +// d:Text that is shown on resize ratio selection slider. +// d:"Resize: " text is followed by selected resolution value +// d:e.g "1600x1200". +// l:popup_imed_adjust2_window_t1/opt1 +// r:5.0 +// +#define qtn_sie_slider_title_resize "Resize: %0Nx%1N" + +// d:Text that is shown on contrast adjustment slider title. +// l:popup_imed_adjust2_window_t1/opt1 +// r:5.0 +// +#define qtn_sie_slider_title_contrast "Contrast" + +// d:Text that is shown on brightness adjustment slider title. +// l:popup_imed_adjust2_window_t1/opt1 +// r:5.0 +// +#define qtn_sie_slider_title_brightness "Brightness" + +// d:Text that is shown on sharpness adjustment slider title. +// l:popup_imed_adjust2_window_t1/opt1 +// r:5.0 +// +#define qtn_sie_slider_title_sharpness "Sharpness" + + +//============================================================================= +// MISCANCELLOUS +//============================================================================= + +// d:Navi pane text when "Frame" effect has been chosen. +// d:%0N is the number of current frame. +// d:%1N is the total number of available frames. +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_current_frame "Frame %0N/%1N" + +// d:Prompt text of a data query used to input the text, +// d:which will be added to the image. +// d:Query is launched when "Insert text" effect has been chosen. +// l:popup_query_data_window +// r:5.0 +// +#define qtn_sie_heading_insert_text "Insert text:" + +// d:Heading text of the plugin selector popup grid. +// l:heading_pane_t1 +// r:5.0 +// +#define qtn_sie_heading_apply_effect "Apply effect:" + +// d:Confirmation query +// d:When user selects "Exit" and image is modified +// d:user is prompted about saving the changes. +// l:popup_note_window +// r:5.0 +// +#define qtn_sie_query_conf_save_changes "Save changes?" + +// d:Navi pane text in Image Editor main view +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_edit "Edit image" + +// d:Navi pane text in Red Eye Reduction plugin +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_edit_redeye "Red eye reduction" + +// d:Navi pane text in clip art plugin editing view +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_edit_clipart "Edit clip-art" + +// d:Navi pane text in clip art plugin editing view +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_edit_bubble "Edit talk bubble" + +// d:Navi pane text in text plugin editing view +// l:navi_text_pane_t1 +// r:5.0 +// +#define qtn_sie_navi_edit_text "Edit text" +// End of file + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/EABI/BlackWhite.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/EABI/BlackWhite.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI28CImageEditorBlackWhitePlugin @ 2 NONAME ; ## + _ZTV28CImageEditorBlackWhitePlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/bwins/BlackWhite.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/bwins/BlackWhite.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/data/blackwhite.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/data/blackwhite.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,103 @@ +/* +* 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: +* Resource definitions for BlackAndWhite Plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include + +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "blackwhite_gen.loc" +#include + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_BLACKWHITE_PLUGIN; + uitype = EPluginUiTypeNone; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 13; + pluginname = qtn_sie_plugin_name_bw; + iconfile = "blackwhite.mif"; + filterfile = "FilterGrayScale.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // NO PARAMETERS + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + }; +} + +RESOURCE PGNUIITEMS r_msk_items +{ + items= + { + }; +} + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/data/icon.bmp Binary file imageeditor/plugins/BlackWhitePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/data/mask.bmp Binary file imageeditor/plugins/BlackWhitePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/data/qgn_plugin_bw.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/data/qgn_plugin_bw.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,22 @@ + + + + +]> + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/group/BlackWhitePlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/group/BlackWhitePlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET BlackWhite.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_BLACKWHITE_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorBlackWhitePlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/blackwhite.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib +LIBRARY iepb.lib +LIBRARY pb.lib + + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,46 @@ +/* +* 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: +* BlackWhite plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorBlackWhitePlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorBlackWhitePlugin.iby) + +// mmp files +PRJ_MMPFILES +BlackWhitePlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE blackwhite.mif +OPTION HEADERFILE blackwhite.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_bw +END + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/inc/BlackWhite_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/inc/BlackWhite_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,20 @@ +/* +* 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: +* +*/ + + +#include diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/inc/ImageEditorBlackWhitePlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/inc/ImageEditorBlackWhitePlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,146 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORBLACKWHITEPLUGIN_H +#define IMAGEEDITORBLACKWHITEPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CPluginParameters; + +/* CLASS: CImageEditorBlackWhitePlugin +* +* CImageEditorBlackWhitePlugin represents Black & White color conversion plug-in +* for Image Editor application. +*/ +class CImageEditorBlackWhitePlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorBlackWhitePlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorBlackWhitePlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorBlackWhitePlugin (const CImageEditorBlackWhitePlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorBlackWhitePlugin & operator= (const CImageEditorBlackWhitePlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/rom/ImageEditorBlackWhitePlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/rom/ImageEditorBlackWhitePlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __BLACKWHITEPLUGIN_IBY__ +#define __BLACKWHITEPLUGIN_IBY__ + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\BlackWhite.pgn SHARED_LIB_DIR\BlackWhite.pgn + +// Resources +data=DATAZ_\resource\apps\BlackWhite.mif \resource\apps\BlackWhite.mif + +#endif // __BLACKWHITEPLUGIN_IBY__ + +#endif +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BlackWhitePlugin/src/ImageEditorBlackWhitePlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BlackWhitePlugin/src/ImageEditorBlackWhitePlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,111 @@ +/* +* 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: +* +*/ + + + +#include "ImageEditorBlackWhitePlugin.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "blackwhite.rsc"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorBlackWhitePlugin * plugin = new (ELeave) CImageEditorBlackWhitePlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorBlackWhitePlugin::CImageEditorBlackWhitePlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorBlackWhitePlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorBlackWhitePlugin::~CImageEditorBlackWhitePlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorBlackWhitePlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorBlackWhitePlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorBlackWhitePlugin::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +void CImageEditorBlackWhitePlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here + +} + +//============================================================================= +void CImageEditorBlackWhitePlugin::ReleasePlugin () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/EABI/Brightness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/EABI/Brightness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI28CImageEditorBrightnessPlugin @ 2 NONAME ; ## + _ZTV28CImageEditorBrightnessPlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/bwins/Brightness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/bwins/Brightness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/data/brightness.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/data/brightness.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,123 @@ +/* +* 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: +* Resource definitions for Brightness plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "brightness_gen.loc" +#include + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_BRIGHTNESS_PLUGIN; + uitype = EPluginUiTypeSingleParam; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 1; + pluginname = qtn_sie_plugin_name_brightness; + iconfile = "brightness.mif"; + filterfile = "FilterBrightness.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // Horizontal slider title + qtn_sie_slider_title_brightness + + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_msk; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/data/icon.bmp Binary file imageeditor/plugins/BrightnessPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/data/mask.bmp Binary file imageeditor/plugins/BrightnessPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/data/qgn_plugin_brightness.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/data/qgn_plugin_brightness.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,19 @@ + + + + +]> + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/group/BrightnessPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/group/BrightnessPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,71 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET Brightness.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_BRIGHTNESS_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorBrightnessPlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/brightness.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib + +LIBRARY imageeditorui.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY eikcoctl.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Brightness plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorBrightnessPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorBrightnessPlugin.iby) + +// mmp files +PRJ_MMPFILES +BrightnessPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE brightness.mif +OPTION HEADERFILE brightness.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_bright -c8,1 qgn_indi_imed_bright_super +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/inc/Brightness_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/inc/Brightness_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,28 @@ +/* +* 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: +* String generalisations for brightness plugin. +* +*/ + + +#include +#include "iepb_gen.loc" + +// SOFTKEYS + +#define qtn_sie_pgn_sk1 qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2 qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_msk qtn_sie_iepb_softkey_ok diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/inc/ImageEditorBrightnessPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/inc/ImageEditorBrightnessPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,164 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORBRIGHTNESSPLUGIN_H +#define IMAGEEDITORBRIGHTNESSPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" +#include "SingleParamControlObserver.h" + + +// FORWARD DECLARATIONS +class CEditorImage; +class CPluginParameters; + + +/* CLASS: CImageEditorBrightnessPlugin +* +* CImageEditorBrightnessPlugin represents brightness adjustment plug-in for +* Image Editor application. +* +*/ +class CImageEditorBrightnessPlugin : public CImageEditorPluginBase, + public MSingleParControlObserver +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorBrightnessPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorBrightnessPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + /** ParamOperation + * + * @see MSingleParControlObserver + */ + virtual void ParamOperation (const TParamOperation aOperation); + + /** GetParam + * + * @see MSingleParControlObserver + */ + virtual TReal GetParam() const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorBrightnessPlugin (const CImageEditorBrightnessPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorBrightnessPlugin & operator= (const CImageEditorBrightnessPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// Brightness parameter + TInt iBrightness; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/rom/ImageEditorBrightnessPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/rom/ImageEditorBrightnessPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __BRIGHTNESSPLUGIN_IBY__ +#define __BRIGHTNESSPLUGIN_IBY__ + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Brightness.pgn SHARED_LIB_DIR\Brightness.pgn + +// Resources +data=DATAZ_\resource\apps\Brightness.mif \resource\apps\Brightness.mif + +#endif // __BRIGHTNESSPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BrightnessPlugin/src/ImageEditorBrightnessPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BrightnessPlugin/src/ImageEditorBrightnessPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,195 @@ +/* +* 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: +* Brightness plugin plugin base class. +* +*/ + + +/// INCLUDES +#include "ImageEditorBrightnessPlugin.h" +#include "SingleParamControl.h" +#include + +/// CONSTANTS +_LIT (KPgnResourceFile, "brightness.rsc"); + +const long KParamMin = -100; +const long KParamMax = 100; +const long KParamStep = 10; +const long KParamDef = 0; +const TInt KBrightnessHSTitleIndex = 0; + +// brightness tag +_LIT (KBrightnessTag, "brightness "); +_LIT (KResourceDir, "\\resource\\apps\\"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorBrightnessPlugin * plugin = new (ELeave) CImageEditorBrightnessPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorBrightnessPlugin::CImageEditorBrightnessPlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorBrightnessPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorBrightnessPlugin::~CImageEditorBrightnessPlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorBrightnessPlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorBrightnessPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + aPropertyValue.Copy (KBrightnessTag); + aPropertyValue.AppendNum (iBrightness); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorBrightnessPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + ReleasePlugin(); + iControl = CSingleParamControl::NewL (aRect, aParent); + ((CSingleParamControl *)iControl)->SetParObserver ( (MSingleParControlObserver*)this ); + aPluginControl = iControl; + + // initialize vertical slider + ((CSingleParamControl *)iControl)->SetSliderMinimumAndMaximum(KParamMin, KParamMax); + ((CSingleParamControl *)iControl)->SetSliderStep(KParamStep); + ((CSingleParamControl *)iControl)->SetSliderPosition(KParamDef); + TFileName iconFile (KResourceDir); + TBuf<256> readbuf; + User::LeaveIfError ( GetProperty (KCapIconName, readbuf) ); + iconFile.Append(readbuf); + CEikImage* icon = new (ELeave) CEikImage; + icon->CreatePictureFromFileL(iconFile, + EMbmBrightnessQgn_indi_imed_bright_super, + EMbmBrightnessQgn_indi_imed_bright_super_mask); + ((CSingleParamControl *)iControl)->SetIcon(icon); + + // Get caption from plugin properties + User::LeaveIfError ( GetProperty (KCapPluginParamNames, readbuf) ); + TLex parser; + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + CDesCArray * parameters = (CDesCArray *)tempval; + ((CSingleParamControl *)iControl)->SetCaption( (*parameters)[KBrightnessHSTitleIndex] ); + + return KErrNone; +} + +//============================================================================= +void CImageEditorBrightnessPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorBrightnessPlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + +//============================================================================= +void CImageEditorBrightnessPlugin::ParamOperation (const TParamOperation aOperation) +{ + switch (aOperation) + { + case EParamOperationSubtract: + { + + iBrightness -= KParamStep; + if ( iBrightness < KParamMin ) + { + iBrightness = KParamMin; + } + break; + } + case EParamOperationAdd: + { + iBrightness += KParamStep; + if ( iBrightness > KParamMax ) + { + iBrightness = KParamMax; + } + break; + } + case EParamOperationDefault: + { + iBrightness = KParamDef; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +TReal CImageEditorBrightnessPlugin::GetParam () const +{ + return (TReal)( (TReal)iBrightness / (KParamMax - KParamMin) ); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/EABI/Bubble.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/EABI/Bubble.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI13CBubbleScaler @ 2 NONAME ; ## + _ZTI20CBubbleSelectionGrid @ 3 NONAME ; ## + _ZTI22CBubbleSelectionDialog @ 4 NONAME ; ## + _ZTI24CImageEditorBubblePlugin @ 5 NONAME ; ## + _ZTI25CImageEditorBubbleControl @ 6 NONAME ; ## + _ZTI8CJPTimer @ 7 NONAME ; ## + _ZTV13CBubbleScaler @ 8 NONAME ; ## + _ZTV20CBubbleSelectionGrid @ 9 NONAME ; ## + _ZTV22CBubbleSelectionDialog @ 10 NONAME ; ## + _ZTV24CImageEditorBubblePlugin @ 11 NONAME ; ## + _ZTV25CImageEditorBubbleControl @ 12 NONAME ; ## + _ZTV8CJPTimer @ 13 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/bwins/Bubble.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/bwins/Bubble.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/Bubble.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/data/Bubble.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,315 @@ +/* +* 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: +* Resource definitions for Bubble plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include +#include +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "bubble.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "bubble_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info + { + pluginuid = UID_BUBBLE_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeAdjustmentEngine; + plugindisplayorder = 7; + pluginname = qtn_sie_plugin_name_bubble; + iconfile = "bubble.mif"; + filterfile = "FilterBubble.dll"; + } + +RESOURCE PARAMNAMES r_plugin_pars + { + parameters= + { + // Select bubble + qtn_sie_heading_select_bubble, + + // Plugin main + qtn_sie_navi_edit_bubble, + + // Move bubble + qtn_sie_navi_edit_bubble, + + // Resize bubble + qtn_sie_navi_edit_bubble, + + // Rotate bubble + qtn_sie_navi_edit_bubble + }; + } + +RESOURCE PGNUIITEMS r_sk1_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_sk2_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_pgn_sk2_done; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items + { + items= + { + // Move + PGNUIITEM + { + id=EBubblePgnMenuCmdMove; + text=qtn_sie_options_move_bubble; + }, + // Resize + PGNUIITEM + { + id=EBubblePgnMenuCmdResize; + text=qtn_sie_options_resize_bubble; + }, + // Rotate + PGNUIITEM + { + id=EBubblePgnMenuCmdRotate; + text=qtn_sie_options_rotate_bubble; + }, + // Cancel + PGNUIITEM + { + id=EBubblePgnMenuCmdCancel; + text=qtn_sie_options_cancel_effect; + } + }; + } + +//============================================================================= +// +// r_bubble_progress_note +// For progress note. +// +//============================================================================= +// +RESOURCE DIALOG r_bubble_progress_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = 11; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_sie_pgn_searching_bubbles; + }; + } + }; + } + +//============================================================================= +// +// r_bubble_selection_dialog +// +// +//============================================================================= +// +RESOURCE DIALOG r_bubble_selection_dialog + { + flags = EEikDialogFlagCbaButtons | EEikDialogFlagWait| EEikDialogFlagFillAppClientRect; + buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + DLG_LINE + { + type = EBubbleCustomControlType ; + id = EBubbleSelectionGrid; + control = GRID + { + flags = EAknGridHorizontalOrientation|EAknGridFollowsItemsAndLoops; + width = 0; + height = 0; + style = 0; + }; + } + }; + } + + +// PATHS CANNOT EXCEED 256 CHARACTERS TOGETHER +RESOURCE ARRAY r_bubble_dirs + { + items= + { + LBUF { txt = "c:\\private\101ffa91\\bubbles\\"; }, + LBUF { txt = ""text_memory_card_root_path"private\101ffa91\\bubbles\\"; }, + LBUF { txt = "z:\\private\101ffa91\\bubbles\\"; }, + LBUF { txt = "c:\\data\\images\\bubbles\\"; }, + LBUF { txt = ""text_memory_card_root_path"images\\bubbles\\"; } + }; + } + +// Context specific MSK menu +RESOURCE MENU_BAR r_bubble_context_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_bubble_context_menupane; + txt = " "; + } + }; + } + +RESOURCE MENU_PANE r_bubble_context_menupane + { + items = + { + MENU_ITEM + { + command = EBubblePgnMenuCmdMove; + txt = qtn_sie_options_move_bubble; + }, + MENU_ITEM + { + command = EBubblePgnMenuCmdResize; + txt = qtn_sie_options_resize_bubble; + }, + MENU_ITEM + { + command = EBubblePgnMenuCmdRotate; + txt = qtn_sie_options_rotate_bubble; + } + }; + } + +RESOURCE TBUF r_tooltip_bubble_resize { buf = qtn_sie_tooltip_resize; } +RESOURCE TBUF r_tooltip_bubble_move { buf = qtn_sie_tooltip_move; } +RESOURCE TBUF r_tooltip_bubble_rotate { buf = qtn_sie_tooltip_rotate; } + + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ants.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ants.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ants_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ants_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_balloon_bunch.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_balloon_bunch.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_balloon_bunch_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_balloon_bunch_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_baseball.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_baseball.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_baseball_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_baseball_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_basketball.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_basketball.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_basketball_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_basketball_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_beanie.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_beanie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_beanie_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_beanie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blocks.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blocks.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blocks_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blocks_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blue_tie.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blue_tie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blue_tie_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_blue_tie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bow.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bow.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bow_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bow_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowling.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowling.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowling_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowling_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowtie.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowtie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowtie_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bowtie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_01.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_01.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_01_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_01_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_02.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_02.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_02_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubble_02_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubbles.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubbles.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubbles_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_bubbles_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_butterflies.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_butterflies.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_butterflies_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_butterflies_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cake.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cake.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cake_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cake_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cloud.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cloud.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cloud_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_cloud_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_confetti.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_confetti.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_confetti_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_confetti_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_crown.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_crown.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_crown_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_crown_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_disguise.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_disguise.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_disguise_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_disguise_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_duh.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_duh.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_duh_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_duh_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_exclamation.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_exclamation.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_exclamation_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_exclamation_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_fire.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_fire.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_fire_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_fire_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_flowers.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_flowers.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_flowers_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_flowers_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_graduation.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_graduation.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_graduation_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_graduation_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_happy.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_happy.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_happy_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_happy_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_headphones.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_headphones.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_headphones_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_headphones_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hearts.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hearts.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hearts_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hearts_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hmmm.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hmmm.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hmmm_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_hmmm_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_jacks.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_jacks.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_jacks_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_jacks_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_leaf.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_leaf.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_leaf_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_leaf_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_lightning.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_lightning.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_lightning_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_lightning_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_love.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_love.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_love_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_love_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_medal.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_medal.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_medal_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_medal_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_mustache.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_mustache.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_mustache_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_mustache_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_notes.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_notes.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_notes_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_notes_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_party_hat.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_party_hat.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_party_hat_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_party_hat_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_paws.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_paws.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_paws_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_paws_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_question.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_question.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_question_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_question_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_rattle.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_rattle.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_rattle_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_rattle_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_red_tie.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_red_tie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_red_tie_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_red_tie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ribbon.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ribbon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ribbon_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_ribbon_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sad.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sad.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sad_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sad_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_school.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_school.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_school_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_school_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_shooting_star.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_shooting_star.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_shooting_star_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_shooting_star_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_snowflakes.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_snowflakes.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_snowflakes_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_snowflakes_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_soccer.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_soccer.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_soccer_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_soccer_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_stars.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_stars.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_stars_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_stars_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sunflowers.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sunflowers.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sunflowers_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_sunflowers_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tattoo.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tattoo.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tattoo_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tattoo_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tiara.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tiara.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tiara_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_tiara_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_wink.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_wink.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_wink_mask_soft.bmp Binary file imageeditor/plugins/BubblePlugin/data/bubbles/qgn_graf_ied_Bubble_wink_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/icon.bmp Binary file imageeditor/plugins/BubblePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/mask.bmp Binary file imageeditor/plugins/BubblePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/data/qgn_plugin_Bubble.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/data/qgn_plugin_Bubble.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/group/BubblePlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/group/BubblePlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,167 @@ +/* +* 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: +* Bubble plugin mmp file. +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +// to get icon & bmp locations +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + +TARGET Bubble.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_BUBBLE_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../../../src +SOURCE JpTimer.cpp + +SOURCEPATH ../src +SOURCE ImageEditorBubblePlugin.cpp +SOURCE ImageEditorBubbleControl.cpp +SOURCE BubbleSelectionGrid.cpp +SOURCE BubbleScaler.cpp +SOURCE BubbleSelectionDialog.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/Bubble.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY eikcore.lib +LIBRARY egul.lib +LIBRARY eikctl.lib +LIBRARY CommonEngine.lib +LIBRARY BitmapTransforms.lib +LIBRARY estor.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib +LIBRARY platformenv.lib +LIBRARY AknLayout2Scalable.lib +LIBRARY aknlayout2.lib +LIBRARY cdlengine.lib + +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + + +// Initial Bubble package +START BITMAP Bubbles01.mbm +TARGETPATH /private/101ffa91/Bubbles + +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_indi_imed_talkbb_01.bmp +SOURCE 8 qgn_indi_imed_talkbb_01_mask_soft.bmp +SOURCE c24 qgn_indi_imed_talkbb_02.bmp +SOURCE 8 qgn_indi_imed_talkbb_02_mask_soft.bmp +SOURCE c24 qgn_indi_imed_talkbb_03.bmp +SOURCE 8 qgn_indi_imed_talkbb_03_mask_soft.bmp +SOURCE c24 qgn_indi_imed_talkbb_04.bmp +SOURCE 8 qgn_indi_imed_talkbb_04_mask_soft.bmp + +END +// Initial Bubble package +START BITMAP Bubbles02.mbm +TARGETPATH /private/101ffa91/Bubbles +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_indi_imed_talkbb_05.bmp +SOURCE 8 qgn_indi_imed_talkbb_05_mask_soft.bmp +SOURCE c24 qgn_indi_imed_talkbb_06.bmp +SOURCE 8 qgn_indi_imed_talkbb_06_mask_soft.bmp +SOURCE c24 qgn_indi_imed_thinkbb_01.bmp +SOURCE 8 qgn_indi_imed_thinkbb_01_mask_soft.bmp +SOURCE c24 qgn_indi_imed_thinkbb_02.bmp +SOURCE 8 qgn_indi_imed_thinkbb_02_mask_soft.bmp +SOURCE c24 qgn_indi_imed_thinkbb_03.bmp +SOURCE 8 qgn_indi_imed_thinkbb_03_mask_soft.bmp + +END + +// Initial Bubble package +START BITMAP Bubbles03.mbm +TARGETPATH /private/101ffa91/Bubbles +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_indi_imed_thinkbb_04.bmp +SOURCE 8 qgn_indi_imed_thinkbb_04_mask_soft.bmp +SOURCE c24 qgn_indi_imed_thinkbb_05.bmp +SOURCE 8 qgn_indi_imed_thinkbb_05_mask_soft.bmp +SOURCE c24 qgn_indi_imed_thinkbb_06.bmp +SOURCE 8 qgn_indi_imed_thinkbb_06_mask_soft.bmp + +END + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: +* Talk bubble plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// ROM description file +../rom/ImageEditorBubblePlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorBubblePlugin.iby) +../rom/ImageEditorBubblePluginSettings.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorBubblePluginSettings.iby) + +// mmp files +PRJ_MMPFILES +BubblePlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE bubble.mif +OPTION HEADERFILE bubble.mbg +OPTION SOURCES -c8 qgn_indi_imed_talkbb +END + +// test project mmp files +PRJ_TESTMMPFILES + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/Bubble.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/Bubble.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,47 @@ +/* +* 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: +* +*/ + + +#ifndef BUBBLE_HRH +#define BUBBLE_HRH + +#include "ImageEditorPluginBase.hrh" +#include "avkon.hrh" + +enum TBubblePgnCommandId +{ + EBubblePgnMenuCmdMin = EPgnMenuCmdIdBase, + EBubblePgnMenuCmdDone, + EBubblePgnMenuCmdMove, + EBubblePgnMenuCmdResize, + EBubblePgnMenuCmdRotate, + EBubblePgnMenuCmdCancel, + EBubblePgnMenuCmdMax +}; + +enum +{ + EBubbleSelectionGrid = 5000 +}; + +enum +{ + EBubbleCustomControlType = 10000 +}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/BubbleScaler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/BubbleScaler.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,103 @@ +/* +* 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: +* +*/ + + +#ifndef BUBBLESCALER_H +#define BUBBLESCALER_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +class CBitmapScaler; +class CFbsBitmap; + +/* CLASS: MBubbleScalerNotifier +* +* Notifier class for CBubbleScaler +* +*/ +class MBubbleScalerNotifier + { + public: + virtual void BubbleScalerOperationReadyL(TInt aError) = 0; + }; + +/* CLASS: CBubbleScaler +* +* Class is used for scaling bitmaps +* +*/ +class CBubbleScaler : public CActive + { + +public: + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CBubbleScaler (MBubbleScalerNotifier* aNotifier); + + /** Destructor + * + * @param - + * @return - + */ + ~CBubbleScaler (); + + /* Second phase constructor + * + * @param - + * @return - + */ + void ConstructL (); + + /* Second phase constructor + * + * @param aBitmap - bitmap to be scaled + * @return - + */ + void ScaleBitmapL(CFbsBitmap* aBitmap, TSize aNewSize); + +protected: + + /* DoCancel + * + * @see CActive + */ + void DoCancel(); + + /* RunL + * + * @see CActive + */ + void RunL(); + +private: + + CBitmapScaler* iBitmapScaler; + MBubbleScalerNotifier* iNotifier; + +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/BubbleSelectionDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/BubbleSelectionDialog.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,259 @@ +/* +* 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: +* Dialog for Bubble plugin. +* +*/ + + +#ifndef BUBBLESELECTIONDIALOG_H +#define BUBBLESELECTIONDIALOG_H + +#include +#include + +#include "Bubblescaler.h" +#include "CallbackMethod.h" + +// FORWARD DECLARATION +class CBubbleSelectionGrid; +class CGulIcon; +class CDir; +class CAknIconArray; +class CBubbleScaler; +class CObCallback; + + +class CBubbleSelectionDialog : public CEikDialog, + public MBubbleScalerNotifier, + public MProgressDialogCallback, + public MEikListBoxObserver, + public MObCallbackMethod + { + + class TBubbleListItem + { + public: + TFileName iFilename; + TInt iIndex; + }; + + typedef RArray RBubbleList; + + enum TState + { + EIdle, + EScalingBitmap, + EScalingMask + }; + +public: + + /** Constructor + * + * @param aBubbleFileName - Bubble filename + * @param aBubbleFileNameIndex - Bubble filename index + * @return - + */ + CBubbleSelectionDialog(TFileName& aBubbleFileName, TInt& aBubbleFileNameIndex); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CBubbleSelectionDialog(); + + /** ConstructL + * + * Second phase constructor + * + * @param aParent - Parent control + * + */ + void ConstructL(MCoeControlObserver* aParent); + + /** 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 ); + + /** SetBusy + * + * @param aBusy - Set control busy + * + */ + void SetBusy(TBool aBusy); + + /** SetSizeAndPosition + * + * @see CEikDialog + * + */ + void SetSizeAndPosition( const TSize& /*aSize*/ ); + + /** BubbleFilenameL + * + * Get select Bubble filename and index + * + * @param aFilename - Bubble filename with full path + * @param aIndex - Bubble index in the MBM file + * @return - + */ + void BubbleFilenameL(TDes& aFilename, TInt& aIndex); + + /** BubbleScalerOperationReadyL + * + * Called by the Bubble scaler when operation is ready + * + * @see MBubbleScalerNotifier + * + */ + void BubbleScalerOperationReadyL(TInt aError) ; + + /** DialogDismissedL + * + * @see MProgressDialogCallback + * + */ + void DialogDismissedL( TInt aButtonId ); + + /** + * + * @see MObCallbackMethod + * + */ + TBool CallbackMethodL( TInt aParam ); + + /** PreLayoutDynInitL + * + * @see CEikDialog + * + */ + void PreLayoutDynInitL(); + + /** CreateCustomControlL + * + * @see CEikDialog + * + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + + /** OfferKeyEventL + * + * @see CEikDialog + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + virtual void HandleDialogPageEventL(TInt /*aEventId*/); + + virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + void HandleResourceChange(TInt aType); +private: + + /* SetupGrid + * + * Sets up grid every time the grid size changes. + * + * @param - + * @return - + */ + void SetupGrid(); + + /** FindBubblesL + * + * Find all Bubbles in directories specified in the + * resource file + * + * @param - + * @return - + */ + void FindBubblesL(); + + /** LoadBitmapsL + * + * Loads Bubble bitmap and mask + * + * @param - + * @return - + */ + void LoadBitmapsL(); + + /** AddIconL + * + * Adds icon to grid + * + * @param - + * @return - + */ + void AddIconL(); + + /** ExternalizeIconArrayL + * + * Externalize icon array + * + * @param - + * @return - + */ + void ExternalizeIconArrayL(); + + /** InternalizeIconArrayL + * + * Internalize icon array + * + * @param - + * @return - + */ + void InternalizeIconArrayL(); + +private: + + /// Selection grid + CBubbleSelectionGrid* iGrid; + TFileName& iBubbleFileName; + TInt& iBubbleFileNameIndex; + + CAknIconArray* iIconArray; + CDesC16Array* iTextArray; + + CAknProgressDialog* iProgressDialog; + CBubbleScaler* iBubbleScaler; + RBubbleList iBubbleList; + CObCallback* iCallback; + CFbsBitmap* iCurrentBitmap; + CFbsBitmap* iCurrentMask; + TInt iBubbleGridCellWidth; + TInt iBubbleGridCellHeight; + TInt iCurrentIcon; + TInt iState; + TBool iBusy; + TBool iDoubleClick; + TBool iClick; + + }; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/BubbleSelectionGrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/BubbleSelectionGrid.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,103 @@ +/* +* 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: +* Header file for bubble grid. +* +*/ + + + +#ifndef BUBBLEINSELECTIONGRID_H +#define BUBBLEINSELECTIONGRID_H + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +/* CLASS: CBubbleSelectionGrid +* +* CBubbleSelectionGrid represents a Bubble selection grid control in +* Nokia Still Image Editor. +*/ +class CBubbleSelectionGrid : public CAknGrid +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CBubbleSelectionGrid (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CBubbleSelectionGrid (); + + /** Second phase constructor + * + * @param aParent - parent control + * @param aFlags - grid flags + * @param aItems - icon item array + * @return - + */ + virtual void ConstructL ( + const CCoeControl * aParent, + TInt aFlags); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /* MinimumSize + * + * @see CCoeControl + */ + virtual TSize MinimumSize(); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif // EOF BubbleSelectionGrid.h diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/Bubble_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/Bubble_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: +* +*/ + + +#include +#include "iepb_gen.loc" +#include + +// SOFTKEYS + +#define qtn_sie_pgn_sk1_options qtn_sie_iepb_softkey_options +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel + +#define qtn_sie_pgn_sk1_ok qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2_done qtn_sie_iepb_softkey_done + +// MENU ITEMS + +#define qtn_sie_pgn_menu_cancel qtn_sie_options_cancel_effect + + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/ImageEditorBubbleControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/ImageEditorBubbleControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,622 @@ +/* +* 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: +* Header file for bubble control class. +* +*/ + + +#ifndef IMAGEEDITORBUBBLECONTROL_H +#define IMAGEEDITORBUBBLECONTROL_H + +// INCLUDES +#include +#include +#include +#include + +#include "PreviewControlBase.h" +#include "MTimerCallBack.h" +#include "BubbleSelectionDialog.h" + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; +class CSystemParameters; +class CBubbleSelectionGrid; +class CJPTimer; +class CAknInfoPopupNoteController; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + + +/* CLASS: CImageEditorBubbleControl +* +* CImageEditorBubbleControl is a control for Bubble insertion plug-in. +* +*/ +class CImageEditorBubbleControl : public CPreviewControlBase, + public MCoeControlObserver, + public MEikListBoxObserver, + public MTimerCallBack + +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorBubbleControl object + */ + static CImageEditorBubbleControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorBubbleControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + * + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Setter for view reference + * + * @see CImageEditorControlBase + * + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItem + * + * @see CImageEditorControlBase + * + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /** PrepareL + * + * @see CImageEditorControlBase + * + */ + virtual void PrepareL (); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL(); + + /* GetContextMenuResourceId + * + * @see CImageEditorControlBase + */ + virtual TInt GetContextMenuResourceId(); + + /* GetDimmedMenuItems + * + * @see CImageEditorControlBase + */ + virtual TBitField GetDimmedMenuItems(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetParam + * + * Gets pointer to the parameter struct. + * + * @param - + * @return - pointer to MIA parameter struct + */ + TDesC & GetParam (); + + /* SetSysteParameters + * + * Sets reference to system parameters to plug-in. + * + * @param aSysPars - System parameters instance + * @return - + */ + void SetSystemParameters (const CSystemParameters * aSysPars); + + /** IsReadyToRender + * + * Return ETrue if all parameters have valid value and filter + * can be rendered. + * + * @param - + * @return - ETrue if ready to render, otherwise EFalse + */ + TBool IsReadyToRender() const; + + /* GetHelpContext + * + * @see CCoeControl + * + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + /* TimerCallBack + * + * @see MTimerCallBack + * + */ + virtual void TimerCallBack(); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /* HandleListBoxEventL + * + * @see CImageEditorControlBase + * + */ + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + /* HandleControlEventL + * + * @see CImageEditorControlBase + * + */ + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + + /* SetBitmapL + * + * Sets bubble bitmap to filter paramerters object + * + */ + void SetBitmapL(); + + /* SetBusy + * + * @see CImageEditorControlBase + * + */ + void SetBusy(); + + /* ResetBusy + * + * @see CImageEditorControlBase + * + */ + void ResetBusy(); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorBubbleControl (); + + /** Draw + * + * @see CImageEditorControlBase + * + */ + virtual void Draw (const TRect & aRect) const; + + /** NaviDown + * + * Handles navi key down event. + * + * @param - + * @return - + */ + void NaviDown(); + + /** NaviUp + * + * Handles nave key up event. + * + * @param - + * @return - + */ + void NaviUp(); + + /** NaviRight + * + * Handles nave key right event. + * + * @param - + * @return - + */ + void NaviRight(); + + /** NaviLeft + * + * Handles nave key left event. + * + * @param - + * @return - + */ + void NaviLeft(); + + /** ToMoveState + * + * Handles transition to Move state. + * + * @param - + * @return - + */ + void ToMoveStateL(); + + /** ToResizeState + * + * Handles transition to Resize state. + * + * @param - + * @return - + */ + void ToResizeStateL(); + + /** ToRotateState + * + * Handles transition to Rotate state. + * + * @param - + * @return - + */ + void ToRotateStateL(); + + /** ToMainStateL + * + * Handles transition to Main state. + * + * @param - + * @return - + */ + void ToMainStateL(); + + /** StoreTempParams + * + * Store all parameters to temp variables. + * + * @param - + * @return - + */ + void StoreTempParams(); + + /** RestoreTempParams + * + * Restore parameters from temp variables. + * + * @param - + * @return - + */ + void RestoreTempParams(); + + /** SelectBubbleL + * + * Select Bubble and set to the parameter object + * + * @param - + * @return - + */ + void SelectBubbleL(); + + /** LoadIndicatorL + * + * Loads indicator. + * + * @param aBitmapInd - indicator bitmap MBM index + * @param aMaskInd - indicator mask MBM index + * @return - + */ + void LoadIndicatorL ( + TInt aBitmapInd, + TInt aMaskInd + ); + + /** ComputeIndicatorPosition + * + * Computes indicator position. + * + * @param - + * @return - + */ + TPoint ComputeIndicatorPosition() const; + + /** StoreParameters + * + * Stores parameters to command line. + * + * @param - + * @return - + */ + void StoreParameters(); + + + /** StorePosAndScaleRelScreen + * + * Stores Bubble position and scale relative to + * screen. + * + * @param - + * @return - + */ + void StorePosAndScaleRelScreen(); + + /** RestorePosAndScaleRelScreen + * + * Restores Bubble position and scale relative to + * screen. + * + * @param - + * @return - + */ + void RestorePosAndScaleRelScreen(); + + /** StorePosAndScaleRelImage + * + * Stores scale and pan + * + * @param - + * @return - + */ + void StorePosAndScaleRelImage(); + + /** RestorePosAndScaleRelImage + * + * Stores scale and pan + * + * @param - + * @return - + */ + void RestorePosAndScaleRelImage(); + + /** ClipPosition + * + * Clips Bubble position after screen mode change. + * + * @param - + * @return - + */ + void ClipPosition(); + + /** SetBubblePosition + * + * Sets current bubble to a new position + * + * @param - aPointedPosition Middle point position on the screen where + * talk bubble should should be moved + * @return - + */ + void SetBubblePosition( TPoint aPointedPosition ); + + /** ShowTooltip + * + * Show tooltip text on the screen. Tooltip text is set based + * on the current state. + * + * @param - + * @return - + */ + void ShowTooltip(); + + /** CalculateResize + * + * Function is used to calculate a new scale value when bubble is resized + * with touch. The value is calculated based on dragging start + * and end points. This function also changes scale variable member after + * calculation. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - TBool - ETrue if scale value is changed in the function + */ + TBool CalculateResize( TPoint aStartPoint, TPoint aEndPoint ); + + /** CalculateRotation + * + * Function is used to calculate rotation when bubble is rotated + * with touch. Needed rotation is calculated based on dragging start + * and end points. This function also changes rotation variables after + * calculation. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - TBool - ETrue if rotate value is changed in the function + */ + TBool CalculateRotation( TPoint aStartPoint, TPoint aEndPoint ); + +//@} + +/** @name Typedefs:*/ +//@{ + enum TInsertBubbleState + { + // Invalid + EInsertBubbleStateMin = 0, + // Select Bubble + EInsertBubbleStateSelect = 1<<1, + // Convert + EInsertBubbleStateConvert = 1<<2, + // First time in main + EInsertBubbleStateFirst = 1<<3, + // Main view + EInsertBubbleStateMain = 1<<4, + // Move + EInsertBubbleStateMove = 1<<5, + // Rotate + EInsertBubbleStateRotate = 1<<6, + // Resize + EInsertBubbleStateResize = 1<<7, + // Invalid + EInsertBubbleStateMax = 1<<8 + } iState; + +//@} + + +/** @name Members:*/ +//@{ + + /// Editor view + CAknView * iEditorView; + + /// System parameters + const CSystemParameters* iSysPars; + + /// Plug-in info + CPluginInfo * iItem; + + /// Navigation pane text + TBuf<64> iNaviPaneText; + + /// Bubble x position + TInt iX; + /// Bubble y position + TInt iY; + /// Bubble scale + TInt iScale; + /// Bubble scale minimum + TInt iScaleMin; + /// Bubble scale maximum + TInt iScaleMax; + /// Bubble angle + TInt iAngle; + /// Do we scale Bubble to maximum height + TBool iScaleToHeight; + + TInt iScaleOld; + TInt iPosXOld; + TInt iPosYOld; + + /// Temp params + TInt iTempX; + TInt iTempY; + TInt iTempScale; + TInt iTempAngle; + + /// Popup list + CBubbleSelectionDialog* iPopupList; + + /// Bubble filename + TFileName iBubbleFileName; + + /// Bubble filename index + TInt iBubbleFileNameIndex; + + /// Resource reader + RConeResourceLoader iResLoader; + + /// Timer for fast key events + CJPTimer * iTimer; + TUint32 iKeyCode; + + /// Number of ticks since timer start + TInt iTickCount; + + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; + + /// Showing Ok options menu, where some items are dimmed + TBool iDisplayingOkOptionsMenu; + + /// Plug-in is ready to render the image + TBool iReadyToRender; + + /// State indicator glyph + CFbsBitmap * iIndicator; + CFbsBitmap * iIndicatorMask; + + /// Bubble parameter + TBuf<256> iParam; + + // Popup controller + CAknInfoPopupNoteController* iPopupController; + // Tooltip texts + HBufC * iTooltipResize; + HBufC * iTooltipMove; + HBufC * iTooltipRotate; + + // Previous pen position. Make touch rotating and resizing possible + TPoint iPointerPosition; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/inc/ImageEditorBubblePlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/inc/ImageEditorBubblePlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,151 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORBUBBLEPLUGIN_H +#define IMAGEEDITORBUBBLEPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; +class CSystemParameters; + + +/* CLASS: CImageEditorBubblePlugin +* +* CImageEditorBubblePlugin represents Bubble insertion plug-in for Image Editor +* application. +* +*/ +class CImageEditorBubblePlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorBubblePlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorBubblePlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorBubblePlugin (const CImageEditorBubblePlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorBubblePlugin & operator= (const CImageEditorBubblePlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// System Parameters + const CSystemParameters * iSysPars; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/rom/ImageEditorBubblePlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/rom/ImageEditorBubblePlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __BubblePLUGIN_IBY__ +#define __BubblePLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Bubble.pgn SHARED_LIB_DIR\Bubble.pgn + +// Resources +data=DATAZ_\resource\apps\Bubble.mif \resource\apps\Bubble.mif + +#endif // __BubblePLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/rom/ImageEditorBubblePluginSettings.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/rom/ImageEditorBubblePluginSettings.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __BUBBLEPLUGINSETTINGS_IBY__ +#define __BUBBLEPLUGINSETTINGS_IBY__ + +// Bubble data +data=DATAZ_\private\101ffa91\Bubbles\Bubbles01.mbm \private\101ffa91\Bubbles\Bubbles01.mbm +data=DATAZ_\private\101ffa91\Bubbles\Bubbles02.mbm \private\101ffa91\Bubbles\Bubbles02.mbm +data=DATAZ_\private\101ffa91\Bubbles\Bubbles03.mbm \private\101ffa91\Bubbles\Bubbles03.mbm + +#endif // __BUBBLEPLUGINSETTINGS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/src/BubbleScaler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/src/BubbleScaler.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,77 @@ +/* +* 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: +* +*/ + + +// INCLUDES +#include + +#include "BubbleScaler.h" +#include "ImageEditorError.h" + + +//============================================================================= +CBubbleScaler::CBubbleScaler (MBubbleScalerNotifier* aNotifier) +: CActive(0), iNotifier(aNotifier) + { + } + +//============================================================================= +CBubbleScaler::~CBubbleScaler () + { + Cancel(); + delete iBitmapScaler; + iBitmapScaler = 0; + } + +//============================================================================= +void CBubbleScaler::ConstructL () + { + CActiveScheduler::Add(this); + iBitmapScaler = CBitmapScaler::NewL(); + } + +//============================================================================= +void CBubbleScaler::ScaleBitmapL(CFbsBitmap* aBitmap, TSize aNewSize) + { + iBitmapScaler->Scale(&iStatus, *aBitmap, aNewSize); + SetActive(); + } + +//============================================================================= +void CBubbleScaler::DoCancel() + { + if(IsActive()) + { + iBitmapScaler->Cancel(); + } + } + +//============================================================================= +void CBubbleScaler::RunL() + { + if (iStatus == KErrNone) + { + iNotifier->BubbleScalerOperationReadyL(KErrNone); + } + else + { + iNotifier->BubbleScalerOperationReadyL(KSIEEInternal); + } + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/src/BubbleSelectionDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/src/BubbleSelectionDialog.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,923 @@ +/* +* 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: +* Dialog for Bubble plugin. +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "BubbleSelectionGrid.h" +#include "BubbleScaler.h" +#include "Callback.h" +#include "Bubble.hrh" +#include "BubbleSelectionDialog.h" +#include "ResolutionUtil.h" +#include "ImageEditorUI.hrh" +#include "iepb.h" +#include "ImageEditorError.h" +#include + +// debug log +#include "imageeditordebugutils.h" + +_LIT(KBubblePluginLogFile,"BubblePlugin.log"); + +// Constants +const TInt KDefaultNumberOfBubbles = 51; + +const TInt KStandardBubbleGridCellWidth = 40; +const TInt KStandardBubbleGridCellHeight = 30; + +const TInt KQVGABubbleGridCellWidth = 56; +const TInt KQVGABubbleGridCellHeight = 46; + +const TInt KDoubleBubbleGridCellWidth = 80; +const TInt KDoubleBubbleGridCellHeight = 60; + +const TInt KVGABubbleGridCellWidth = 95; +const TInt KVGABubbleGridCellHeight = 60; + +const TInt KQHDBubbleGridCellWidth = 80; +const TInt KQHDBubbleGridCellHeight = 60; + +const TInt KBubbleGridCellGap = 0; + +const TInt KScrollBarWidth = 3; + +const TInt KProgressInterval = 5; + +_LIT (KBubbleResourceFile, "Bubble.rsc"); +_LIT (KBubbleFileWild, "*.mbm"); +_LIT( KBubbleExternalizeFile, "c:\\private\\101FFA91\\BubbleStorage.ini"); + + +//============================================================================= +CBubbleSelectionDialog::CBubbleSelectionDialog(TFileName& aBubbleFileName, TInt& aBubbleFileNameIndex) + : CEikDialog() + , iGrid(NULL) + , iBubbleFileName(aBubbleFileName) + , iBubbleFileNameIndex(aBubbleFileNameIndex) + , iIconArray(NULL) + , iTextArray(NULL) + , iProgressDialog(NULL) + , iBubbleScaler(NULL) + , iCallback(NULL) + , iCurrentBitmap(NULL) + , iCurrentMask(NULL) + , iCurrentIcon(0) + , iState(EIdle) + , iBusy(ETrue) + , iDoubleClick(EFalse) + , iClick(EFalse) + { + + } +//============================================================================= +CBubbleSelectionDialog::~CBubbleSelectionDialog() + { + if (iCallback) + { + iCallback->Cancel(); + } + delete iCallback; + + if (iBubbleScaler) + { + iBubbleScaler->Cancel(); + } + delete iBubbleScaler; + + if (iIconArray) + { + delete iIconArray; + iIconArray = NULL; + } + if (iTextArray) + { + delete iTextArray; + iTextArray = NULL; + } + + iBubbleList.Close(); + delete iCurrentBitmap; + delete iCurrentMask; + delete iProgressDialog; + + delete iGrid; + } + + +//============================================================================= +void CBubbleSelectionDialog::ConstructL(MCoeControlObserver* aParent) +{ + + SetObserver(aParent); + + iBubbleScaler = new (ELeave) CBubbleScaler(this); + iBubbleScaler->ConstructL(); + + // Callback + iCallback = CObCallback::NewL(this); + + // Create icon and text arrays + iIconArray = new(ELeave) CAknIconArray(KDefaultNumberOfBubbles); + iTextArray = new(ELeave) CDesC16ArrayFlat(KDefaultNumberOfBubbles); + + TInt screenMode = CResolutionUtil::Self()->GetScreenMode(); + + switch (screenMode) + { + + case CResolutionUtil::EDouble: + case CResolutionUtil::EDoubleFullScreen: + case CResolutionUtil::EDoubleLandscape: + case CResolutionUtil::EDoubleLandscapeFullScreen: + { + iBubbleGridCellWidth = KDoubleBubbleGridCellWidth; + iBubbleGridCellHeight = KDoubleBubbleGridCellHeight; + break; + } + + case CResolutionUtil::EQVGA: + case CResolutionUtil::EQVGAFullScreen: + case CResolutionUtil::EQVGALandscape: + case CResolutionUtil::EQVGALandscapeFullScreen: + { + iBubbleGridCellWidth = KQVGABubbleGridCellWidth; + iBubbleGridCellHeight = KQVGABubbleGridCellHeight; + break; + } + + case CResolutionUtil::EVGA: + case CResolutionUtil::EVGAFullScreen: + case CResolutionUtil::EVGALandscape: + case CResolutionUtil::EVGALandscapeFullScreen: + { + iBubbleGridCellWidth = KVGABubbleGridCellWidth; + iBubbleGridCellHeight = KVGABubbleGridCellHeight; + break; + } + + case CResolutionUtil::EQHD: + case CResolutionUtil::EQHDFullScreen: + case CResolutionUtil::EQHDLandscape: + case CResolutionUtil::EQHDLandscapeFullScreen: + { + iBubbleGridCellWidth = KQHDBubbleGridCellWidth; + iBubbleGridCellHeight = KQHDBubbleGridCellHeight; + break; + } + default: + { + iBubbleGridCellWidth = KStandardBubbleGridCellWidth; + iBubbleGridCellHeight = KStandardBubbleGridCellHeight; + break; + } + } + + // Check that if externalize file exists + RFs& fs = ControlEnv()->FsSession(); + BaflUtils::EnsurePathExistsL( fs, KBubbleExternalizeFile() ); + + if( BaflUtils::FileExists(fs, KBubbleExternalizeFile()) ) + { + FindBubblesL(); + + // Internalize icons if externalize file exists + TRAPD(err, + InternalizeIconArrayL(); + ); + + if (err) + { + // if error delete externalization file + BaflUtils::DeleteFile( + ControlEnv()->FsSession(), + KBubbleExternalizeFile() + ); + + User::Leave(err); + } + + iCallback->DoCallback(0); + } + else + { + + // Find Bubbles + FindBubblesL(); + + // Create progress note dialog + iProgressDialog = new ( ELeave ) CAknProgressDialog( reinterpret_cast(&iProgressDialog) ); + iProgressDialog->PrepareLC(R_BUBBLE_PROGRESS_NOTE); + iProgressDialog->GetProgressInfoL()->SetFinalValue( iBubbleList.Count() ); + iProgressDialog->SetCallback ( (MProgressDialogCallback *) this); + iProgressDialog->RunLD(); + + // Load Bubble bitmaps for the grid - asynchronous method + LoadBitmapsL(); + + } + + +} + +//============================================================================= +void CBubbleSelectionDialog::PreLayoutDynInitL () +{ + + CAknGrid* grid = (CAknGrid*)ControlOrNull(EBubbleSelectionGrid); + + // Set icon array to grid + grid->ItemDrawer()->FormattedCellData()->SetIconArray(iIconArray); + iIconArray = NULL; // ownership moved + + grid->Model()->SetItemTextArray(iTextArray); + iTextArray = NULL; // ownership moved + + TRect clientRect; + CResolutionUtil::Self()->GetClientRect(clientRect); + + TInt rows = clientRect.Height() / iBubbleGridCellHeight; + TInt columns = (clientRect.Width() - KScrollBarWidth) / iBubbleGridCellWidth; + + grid->SetRect(clientRect); + + // Set grid layout + grid->SetLayoutL ( + EFalse, + ETrue, + ETrue, + columns, + rows, + TSize(iBubbleGridCellWidth, iBubbleGridCellHeight) + ); + + grid->SetPrimaryScrollingType (CAknGridView::EScrollIncrementLineAndLoops); + grid->SetSecondaryScrollingType (CAknGridView::EScrollIncrementLineAndLoops); + + // Set gaps between items + ((CAknGridView*)grid->View())-> + SetSpacesBetweenItems(TSize(KBubbleGridCellGap,KBubbleGridCellGap)); + + grid->SetCurrentDataIndex (0); + + SetupGrid(); + + // Set scroll bar + grid->CreateScrollBarFrameL(ETrue, EFalse); + // Hide scroll bar as there are only so few bubbles at the moment available + grid->ScrollBarFrame()-> + SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); + + // Inform list box about new icons + grid->HandleItemAdditionL(); + + grid->SetListBoxObserver(this); + + TBool iLandscape = CResolutionUtil::Self()->GetLandscape(); + if (iLandscape) + { + grid->ItemDrawer()->ColumnData()->SetSkinEnabledL(ETrue); + CAknsListBoxBackgroundControlContext* context = static_cast(grid->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + TRect bgRect = clientRect; + + TRect spRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EBatteryPane, spRect); + + + bgRect.iTl.iY-=spRect.Height(); + context->SetRect(bgRect); + context->SetBitmap( KAknsIIDQsnBgAreaMainFlat ); + } + // Reset busy flag + SetBusy(EFalse); + +} + +//============================================================================= +void CBubbleSelectionDialog::SetSizeAndPosition( const TSize& aSize) +{ + CEikDialog::SetSizeAndPosition(aSize); + +} + +//============================================================================= +TBool CBubbleSelectionDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect) + { + BubbleFilenameL(iBubbleFileName, iBubbleFileNameIndex); + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= + +TBool CBubbleSelectionDialog::CallbackMethodL ( TInt /*aParam*/ ) +{ + LOG(KBubblePluginLogFile, "CBubbleSelectionDialog::CallbackMethodL()"); + + // Report that the grid is ready + ReportEventL(MCoeControlObserver::EEventStateChanged); + + return EFalse; +} + +//============================================================================= +TKeyResponse CBubbleSelectionDialog::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + TKeyResponse result = EKeyWasNotConsumed; + if ( + ( aKeyEvent.iCode == EKeyEnter ) + ) + { + TryExitL( EAknSoftkeyOk ); + result = EKeyWasConsumed; + } + else + { + result = CEikDialog::OfferKeyEventL( aKeyEvent, aType ); + } + return result; + +} + +//============================================================================= +void CBubbleSelectionDialog::FindBubblesL() +{ + LOG(KBubblePluginLogFile, "CBubbleSelectionGrid::FindBubblesL()"); + + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KBubbleResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Get reference to application file session + RFs & fs = ControlEnv()->FsSession(); + + // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile + // to search for a localised resource in proper search order + RConeResourceLoader resLoader( *ControlEnv() ); + resLoader.OpenL ( resourcefile ); + CleanupClosePushL(resLoader); + + CDesCArrayFlat* array = + ControlEnv()->ReadDesCArrayResourceL(R_BUBBLE_DIRS); + CleanupStack::PushL(array); + + TBuf<256> pathList; + _LIT(KPathSeparator, ";"); + + for (TInt i = 0; i < array->Count(); ++i) + { + pathList.Append((*array)[i]); + pathList.Append(KPathSeparator); + } + CleanupStack::PopAndDestroy(2); // resLoader, array + + // Create a file finder + TFindFile fileFinder (fs); + CDir * fileList = NULL; + + // Find files by wild card and directory + TInt err = fileFinder.FindWildByPath ( + KBubbleFileWild, + &pathList, + fileList + ); + + LOGFMT(KBubblePluginLogFile, "CBubbleSelectionGrid::FindBubblesL: found %d Bubbles", fileList->Count()); + + // Trace leave + if (err) + { + LOGFMT(KBubblePluginLogFile, "CBubbleSelectionGrid::FindBubblesL: FindWildByPath returned %d. Leaving...", err); + User::LeaveIfError(KSIEEInternal); + } + + // Go through files + while (err == KErrNone) + { + CleanupStack::PushL (fileList); + + // Check all plug-in candidates + for (TInt i = 0; i < fileList->Count(); ++i) + { + + // Create a full file name for a MBM file + TParse fullentry; + fullentry.Set ( + (*fileList)[i].iName,& + fileFinder.File(), + 0 + ); + TPtrC fullname (fullentry.FullName()); + + // Check the amount of frames + TInt err_bmp = KErrNone; + TInt j = 0; + + while (err_bmp == KErrNone) + { + // Try to load next bitmap. + // KErrNotFound if no more bitmaps + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL (bitmap); + err_bmp = bitmap->Load (fullname, j); + + CFbsBitmap* bitmapMask = new (ELeave) CFbsBitmap; + CleanupStack::PushL (bitmapMask); + TInt err_mask = bitmapMask->Load (fullname, j + 1); + + if (err_bmp == KErrNone && err_mask != KErrNone) + { + User::Leave(KSIEEInternal); + } + + if (err_bmp == KErrNone) + { + + // Add filename-index pair to the Bubble list + TBubbleListItem item; + item.iFilename = fullname; + item.iIndex = j; + iBubbleList.Append(item); + + } + CleanupStack::PopAndDestroy(2); // bitmap, mask + + j += 2; + } + } + + CleanupStack::PopAndDestroy(); /// fileList + + // Try once again + err = fileFinder.FindWild (fileList); + + } + +} + + +//============================================================================= +void CBubbleSelectionDialog::LoadBitmapsL() + { + LOG(KBubblePluginLogFile, "CBubbleSelectionGrid::LoadBitmapsL()"); + + // Create and load new one + iCurrentBitmap = new (ELeave) CFbsBitmap; + User::LeaveIfError(iCurrentBitmap->Load( + iBubbleList[iCurrentIcon].iFilename, + iBubbleList[iCurrentIcon].iIndex)); + + // Create and load new one + iCurrentMask = new (ELeave) CFbsBitmap; + User::LeaveIfError(iCurrentMask->Load( + iBubbleList[iCurrentIcon].iFilename, + iBubbleList[iCurrentIcon].iIndex + 1)); + + // Scale bitmap to grid size + iState = EScalingBitmap; + iBubbleScaler->ScaleBitmapL( + iCurrentBitmap, + TSize(iBubbleGridCellWidth, iBubbleGridCellHeight)); + } + +//============================================================================= +void CBubbleSelectionDialog::AddIconL() + { + LOG(KBubblePluginLogFile, "CBubbleSelectionGrid::AddIconL()"); + // Create icon + CGulIcon* icon = NULL; + icon = CGulIcon::NewLC(); + icon->SetBitmapsOwnedExternally (EFalse); + + // Set bitmap to icon and append icon to icon array + icon->SetBitmap (iCurrentBitmap); + iCurrentBitmap = NULL; + icon->SetMask(iCurrentMask); + iCurrentMask = NULL; + iIconArray->AppendL(icon); + + CleanupStack::Pop(); // icon + + // Create grid item text + TBuf<8> buf; + buf.AppendNum (iCurrentIcon); + buf.Append(_L("\t1")); + iTextArray->AppendL (buf); + + // Increase current icon index + iCurrentIcon++; + + // Load next icon + // one step begins. + if (iProgressDialog && (iCurrentIcon % KProgressInterval) == 0) + { + iProgressDialog->GetProgressInfoL()->IncrementAndDraw (KProgressInterval); + } + if (iCurrentIcon < iBubbleList.Count()) + { + + LoadBitmapsL(); + } + else + { + + // Externalize loaded icons + TRAPD(err, + ExternalizeIconArrayL(); + ); + if (err) + { + // if error delete externalization file + BaflUtils::DeleteFile( + ControlEnv()->FsSession(), + KBubbleExternalizeFile() + ); + } + // dismiss progress dialog + if (iProgressDialog) + { + iProgressDialog->ProcessFinishedL(); + } + + SetBusy(EFalse); + + // Report that the grid is ready + ReportEventL(MCoeControlObserver::EEventStateChanged); + } + } + + +//============================================================================= +void CBubbleSelectionDialog::BubbleScalerOperationReadyL(TInt aError) + { + if (aError == KErrNone) + { + + switch (iState) + { + case EScalingBitmap: + { + // Scale the mask bitmap + iState = EScalingMask; + iBubbleScaler->ScaleBitmapL( + iCurrentMask, + TSize(iBubbleGridCellWidth, iBubbleGridCellHeight)); + break; + } + case EScalingMask: + { + iState = EIdle; + // Add icon to grid + AddIconL(); + break; + } + default: + { + break; + } + } + } + else + { + User::Leave(KSIEEInternal); + } + } + +//============================================================================= +void CBubbleSelectionDialog::DialogDismissedL( TInt aButtonId ) +{ + LOGFMT(KBubblePluginLogFile, "CBubbleSelectionGrid::DialogDismissedL(%d)", aButtonId); + + CAknGrid* grid = (CAknGrid*)ControlOrNull(EBubbleSelectionGrid); + + if( aButtonId == EAknSoftkeyCancel ) + { + // Cancel the on-going image decoding + iBubbleScaler->Cancel(); + +// grid->HandleItemAdditionL(); + + // Report cancel request + ReportEventL(MCoeControlObserver::EEventRequestCancel); + } + +} + +//============================================================================= +void CBubbleSelectionDialog::BubbleFilenameL(TDes& aFilename, TInt& aIndex) + { + CAknGrid* grid = (CAknGrid*)ControlOrNull(EBubbleSelectionGrid); + + // Get MBM file and icon index of the selected clip-art + aFilename = iBubbleList[grid->CurrentItemIndex()].iFilename; + aIndex = iBubbleList[grid->CurrentItemIndex()].iIndex; + } + +//============================================================================= +void CBubbleSelectionDialog::SetupGrid () +{ + + CAknGrid* grid = (CAknGrid*)ControlOrNull(EBubbleSelectionGrid); + + LOG(KBubblePluginLogFile, "CBubbleSelectionGrid::SetupGrid()"); + + // Setup text foreground and background colors to default + AknListBoxLayouts::SetupStandardGrid (*grid); + + // Get local copies of data we will need + CFormattedCellListBoxItemDrawer * itemDrawer = grid->ItemDrawer(); + + TInt cell_w = grid->ColumnWidth(); + TInt cell_h = grid->ItemHeight(); + + // Set up graphics sub-cells + AknListBoxLayouts::SetupGridFormGfxCell ( + *grid, // the grid + itemDrawer, // the grid's drawer + 0, // index of the graphic within item strings + 0, // left position + 0, // top position + 0, // right - unused + 0, // bottom - unused + cell_w, // width of graphic + cell_h, // height of graphic + TPoint (0, 0), // start position + TPoint (cell_w, cell_h) // end position + ); + +} + +//============================================================================= +void CBubbleSelectionDialog::InternalizeIconArrayL() +{ + LOG(KBubblePluginLogFile, "CBubbleSelectionGrid::InternalizeIconArrayL()"); + + // Internalize Bubble icons + RFileReadStream stream; + + User::LeaveIfError ( + stream.Open ( + ControlEnv()->FsSession(), + KBubbleExternalizeFile(), + EFileRead | EFileShareReadersOnly + )); + stream.PushL(); + + CGulIcon* icon = NULL; + CFbsBitmap* bitmap = NULL; + + TInt count = stream.ReadInt32L(); + for ( TInt i=0; i < count; i++ ) + { + icon = CGulIcon::NewLC(); + icon->SetBitmapsOwnedExternally (EFalse); + + // Text index + TInt len = stream.ReadInt32L(); + HBufC* iconText = HBufC::NewLC(len); + TPtr iconTextPtr = iconText->Des(); + stream >> iconTextPtr; + + iTextArray->AppendL(iconTextPtr); + + CleanupStack::PopAndDestroy(); // iconText + + // Bitmap Data + + bitmap = new(ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + + stream >> *bitmap; + + // Save data + //TBuf<20> name; + //name.Format(_L("bitmap%d.mbm"), i); + //bitmap->Save(name); + + // Set bitmap to icon - Ownership is transfered + icon->SetBitmap (bitmap); + + CleanupStack::Pop(); + + bitmap = new(ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + + stream >> *bitmap; + + //TBuf<20> name2; + //name2.Format(_L("mask%d.mbm"), i); + //bitmap->Save(name2); + + // Set bitmap to icon - Ownership transfers + icon->SetMask(bitmap); + + CleanupStack::Pop(); + bitmap = NULL; + + // Set icon to icon array + iIconArray->AppendL(icon); + + CleanupStack::Pop(); // icon + icon = NULL; + + } + + CleanupStack::PopAndDestroy(); // stream + +} + + +//============================================================================= +void CBubbleSelectionDialog::ExternalizeIconArrayL() +{ + LOG(KBubblePluginLogFile, "CBubbleSelectionGrid::ExternalizeIconArrayL()"); + + RFileWriteStream stream; + + User::LeaveIfError ( + stream.Replace ( + ControlEnv()->FsSession(), + KBubbleExternalizeFile(), + EFileWrite + )); + stream.PushL(); + + // Externalize the contents of Bubble + stream.WriteInt32L( iTextArray->Count() ); + + for ( TInt i=0; i< iTextArray->Count(); i++ ) + { + // Text index + TPtrC text = (*iTextArray)[i]; + stream.WriteInt32L(text.Length()); + stream << text; + + // Bitmap + CFbsBitmap* bitmap = (*iIconArray)[i]->Bitmap(); + stream << *bitmap; + bitmap = NULL; + + // Mask + bitmap = (*iIconArray)[i]->Mask(); + stream << *bitmap; + bitmap = NULL; + + } + + // Write extra before commiting + stream.WriteInt32L( 0 ); + + stream.CommitL(); + + CleanupStack::PopAndDestroy(); // stream + +} + +//============================================================================= +void CBubbleSelectionDialog::SetBusy(TBool aBusy) +{ + iBusy = aBusy; +} + +//============================================================================= +SEikControlInfo CBubbleSelectionDialog::CreateCustomControlL(TInt aControlType) +{ + + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + + switch (aControlType) + { + + case EBubbleCustomControlType: + { + controlInfo.iControl = new(ELeave) CBubbleSelectionGrid; + break; + } + + default: + { + break; + } + + } + + return controlInfo; +} + +void CBubbleSelectionDialog::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) +{ + if ( aEventType == EEventItemDoubleClicked ) + { + iDoubleClick = ETrue; + } + // also single click is enough for selecting item + else if ( aEventType == EEventItemClicked ) + { + iClick = ETrue; + } +} + +void CBubbleSelectionDialog::HandleDialogPageEventL(TInt /*aEventId*/) +{ + if( iDoubleClick || iClick ) + { + TryExitL( EAknSoftkeyOk ); + } +} + +//-------------------------- Handle resource change +void CBubbleSelectionDialog::HandleResourceChange(TInt aType) +{ + CEikDialog::HandleResourceChange(aType); + if( aType == KEikDynamicLayoutVariantSwitch ) + { + CAknGrid* grid = (CAknGrid*)ControlOrNull(EBubbleSelectionGrid); + if ( grid ) + { + TRect clientRect = Rect(); + grid->SetRect(clientRect); + TInt xOffset( 0 ); + TAknWindowLineLayout lineLayout; + TAknLayoutRect layoutRect; + TInt variety( 0 ); + TRect scrollPaneRect; + if( Layout_Meta_Data::IsLandscapeOrientation() ) + { + variety = 1; + } + + if( AknLayoutUtils::LayoutMirrored() ) + { + // scroll_pane_cp029 + lineLayout = AknLayoutScalable_Apps::scroll_pane_cp029( variety ).LayoutLine(); + layoutRect.LayoutRect( Rect(), lineLayout ); + scrollPaneRect = layoutRect.Rect(); + xOffset = scrollPaneRect.Width() + 5; + } + TInt rows = clientRect.Height() / iBubbleGridCellHeight; + TInt columns = (clientRect.Width() - scrollPaneRect.Width()) / iBubbleGridCellWidth; + + // Set grid layout + + grid->SetLayoutL ( + EFalse, + ETrue, + ETrue, + columns, + rows, + TSize(iBubbleGridCellWidth, iBubbleGridCellHeight) + ); + + } + } +} + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/src/BubbleSelectionGrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/src/BubbleSelectionGrid.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,53 @@ +/* +* 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: +* Talk bubble grid implementation. +* +*/ + + +// INCLUDE +#include "BubbleSelectionGrid.h" +//============================================================================= +CBubbleSelectionGrid::CBubbleSelectionGrid () : +CAknGrid() +{ + +} + +//============================================================================= +CBubbleSelectionGrid::~CBubbleSelectionGrid () +{ +} + +//============================================================================= +void CBubbleSelectionGrid::ConstructL ( + const CCoeControl * aParent, + TInt aFlags) +{ + + SetContainerWindowL(*aParent); + CAknGrid::ConstructL(aParent, aFlags); + ActivateL(); +} + +//============================================================================= +TSize CBubbleSelectionGrid::MinimumSize() + { + return Rect().Size(); +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/src/ImageEditorBubbleControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/src/ImageEditorBubbleControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1750 @@ +/* +* 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: +* Talk bubble plugin control implementation. +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ImageEditorUI.hrh" +#include "ImageEditorPluginBase.hrh" +#include "Bubble.hrh" +#include "JpTimer.h" +#include "PluginInfo.h" +#include "ImageEditorUids.hrh" +#include "ImageEditorUiDefs.h" +#include "iepb.h" +#include "SystemParameters.h" +#include "ResolutionUtil.h" + +#include "ImageEditorBubbleControl.h" +#include "BubbleSelectionGrid.h" + +//#include "platform_security_literals.hrh" + +// debug log +#include "imageeditordebugutils.h" +_LIT(KBubblePluginLogFile,"BubblePlugin.log"); + +// CONSTANTS + +// TIMER WAIT +const TInt KWait = 100; + +// Bubble POSITION +const TInt KPosParamStep = 8; + +// Bubble SCALE +const TInt KScaleParamStep = 50; +const TInt KTouchScaleMaxStepCount = 20; + +// Bubble ANGLE +const TInt KDegreeMultiplier = 1000; +const TInt KAngleParamMax = 359000; +const TInt KAngleParam90Deg = 90000; +const TInt KAngleParamDef = 0; +const TInt KAngleParamStep = 2000; + +// RESOURCE INDICES +const TInt KSelectBubbleIndex = 0; +const TInt KMainBubbleIndex = 1; +const TInt KMoveBubbleIndex = 2; +const TInt KResizeBubbleIndex = 3; +const TInt KRotateBubbleIndex = 4; + +_LIT (KPgnResourceFile, "Bubble.rsc"); +_LIT(KComponentName, "ImageEditorBubblePlugin"); + +//============================================================================= +CImageEditorBubbleControl * CImageEditorBubbleControl::NewL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + CImageEditorBubbleControl * self = new (ELeave) CImageEditorBubbleControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CImageEditorBubbleControl::CImageEditorBubbleControl () : +iState (EInsertBubbleStateMin), +iResLoader ( * ControlEnv() ), +iTickCount (0), +iNaviStepMultiplier (KDefaultSmallNavigationStepMultiplier), +iDisplayingOkOptionsMenu(EFalse), +iReadyToRender(EFalse) +{ + +} + +//============================================================================= +CImageEditorBubbleControl::~CImageEditorBubbleControl () +{ + delete iIndicator; + delete iIndicatorMask; + delete iTimer; + iResLoader.Close(); + iSysPars = NULL; + iEditorView = NULL; + iItem = NULL; + if (iPopupList) + { + delete iPopupList; + iPopupList = NULL; + } + delete iPopupController; + delete iTooltipResize; + delete iTooltipMove; + delete iTooltipRotate; +} + +//============================================================================= +void CImageEditorBubbleControl::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * aParent + ) +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::ConstructL()"); + + // Set parent window + SetContainerWindowL (*aParent); + + // Create resource utility + TFileName resFile; + resFile.Append(KPgnResourcePath); + resFile.Append(KPgnResourceFile); + + 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 ); + + iPopupController = CAknInfoPopupNoteController::NewL(); + + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read tooltip resources + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + RConeResourceLoader resLoader ( *CEikonEnv::Static() ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + iTooltipResize = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_BUBBLE_RESIZE); + iTooltipMove = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_BUBBLE_MOVE); + iTooltipRotate = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_BUBBLE_ROTATE); + CleanupStack::PopAndDestroy(); // resLoader + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + // Activate control + ActivateL(); + + EnableDragEvents(); + +} + +//============================================================================= +void CImageEditorBubbleControl::PrepareL () +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::PrepareL()"); + + // Set busy flag untill the bitmap has been decoded + SetBusy(); + + // Main view navi pane text + iNaviPaneText.Copy ( iItem->Parameters()[KSelectBubbleIndex] ); + + // Popup list to contain the grid + iPopupList = new (ELeave) CBubbleSelectionDialog(iBubbleFileName, iBubbleFileNameIndex); + iPopupList->ConstructL(this); + +} + +//============================================================================= +TBool CImageEditorBubbleControl::IsReadyToRender() const +{ + return iReadyToRender; +} + + +//============================================================================= +void CImageEditorBubbleControl::HandleControlEventL(CCoeControl* /*aControl*/ ,TCoeEvent aEventType) +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::HandleControlEventL()"); + + // When the icons have been decoded, launch the grid. + if (aEventType == EEventStateChanged) + { + __ASSERT_ALWAYS( iPopupList, User::Panic( KComponentName, KErrNotReady)); + + TBool fullscreen = CResolutionUtil::Self()->GetFullScreen(); + if (fullscreen) + { + iEditorView->HandleCommandL (EImageEditorMenuCmdNormalScreen); + } + TInt popupOk = iPopupList->ExecuteLD(R_BUBBLE_SELECTION_DIALOG); + iPopupList = NULL; + + if (fullscreen) + { + iEditorView->HandleCommandL (EImageEditorMenuCmdFullScreen); + } + + if (popupOk) + { + ToMoveStateL(); + SelectBubbleL(); + StoreTempParams(); + ResetBusy(); + } + else + { + LOG(KBubblePluginLogFile, "HandleControlEventL: Plugin cancelled from popup."); + iState = EInsertBubbleStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + } + + // Cancelled the grid + else if (aEventType == EEventRequestCancel) + { + LOG(KBubblePluginLogFile, "HandleControlEventL: Grid cancelled."); + iState = EInsertBubbleStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } +} + +//============================================================================= +void CImageEditorBubbleControl::HandleListBoxEventL(CEikListBox* /*aListBox*/, + TListBoxEvent /*aEventType*/) + { + } + + + +//============================================================================= +void CImageEditorBubbleControl::SelectBubbleL() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::SelectBubbleL()"); + + TRect rect = iSysPars->VisibleImageRect(); + + // Set default position + iX = (rect.iTl.iX + rect.iBr.iX) / 2; + iY = (rect.iTl.iY + rect.iBr.iY) / 2; + + // Set default angle + iAngle = KAngleParamDef; + + // Set default scale + if ( rect.Width() > rect.Height() ) + { + iScale = rect.Height() / 2; + iScaleMin = rect.Height() / 10; + iScaleMax = rect.Height(); + iScaleToHeight = ETrue; + } + else + { + iScale = rect.Width() / 2; + iScaleMin = rect.Width() / 10; + iScaleMax = rect.Width(); + iScaleToHeight = EFalse; + } + + iParam.Copy (_L("file \"")); + iParam.Append (iBubbleFileName); + iParam.Append (_L("\"")); + + iParam.Append (_L(" bubble ")); + iParam.AppendNum (iBubbleFileNameIndex); + iParam.Append (_L(" mask ")); + iParam.AppendNum (iBubbleFileNameIndex + 1); + iParam.Append (_L(" load")); + + iParam.Append (_L(" x ")); + iParam.AppendNum (iX); + + iParam.Append (_L(" y ")); + iParam.AppendNum (iY); + + iParam.Append (_L(" angle ")); + iParam.AppendNum (iAngle); + + if ( iScaleToHeight ) + { + iParam.Append (_L(" height ")); + iParam.AppendNum (iScale); + } + else + { + iParam.Append (_L(" width ")); + iParam.AppendNum (iScale); + } + + ToMoveStateL(); + + LOGDES(KBubblePluginLogFile, iParam); + + LOG(KBubblePluginLogFile, "SelectBubbleL: Ready to render"); + + iReadyToRender = ETrue; + + iEditorView->HandleCommandL (EImageEditorCmdRender); + + LOG(KBubblePluginLogFile, "SelectBubbleL: Rendered"); + +} + +//============================================================================= +void CImageEditorBubbleControl::SetView (CAknView * aView) +{ + iEditorView = aView; +} + +//============================================================================= +void CImageEditorBubbleControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + iItem = aItem; +} + +//============================================================================= +void CImageEditorBubbleControl::SetBusy () +{ + CImageEditorControlBase::SetBusy(); + if ( iPopupList ) + { + iPopupList->SetBusy(ETrue); + } +} + +//============================================================================= +void CImageEditorBubbleControl::ResetBusy () +{ + // Reset busy flag only if selection grid is constructed + if (iState != EInsertBubbleStateMin) + { + CImageEditorControlBase::ResetBusy(); + + if (iPopupList) + { + iPopupList->SetBusy(EFalse); + } + + } +} + +//============================================================================= +TKeyResponse CImageEditorBubbleControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::OfferKeyEventL()"); +#ifdef VERBOSE + LOGFMT(KBubblePluginLogFile, "\taType: %d", aType); + LOGFMT(KBubblePluginLogFile, "\tiTickCount: %d", iTickCount); +#endif + + TKeyResponse response = EKeyWasNotConsumed; + + // If busy, do not handle anything + if ( Busy() ) + { + response = EKeyWasConsumed; + } + + // In main state handle the OK Options menu + else if ( aKeyEvent.iCode == EKeyOK && + (iState == EInsertBubbleStateMain || iState == EInsertBubbleStateFirst ) ) + { + iDisplayingOkOptionsMenu = ETrue; + iEditorView->HandleCommandL (EImageEditorTryDisplayMenuBar); + response = EKeyWasConsumed; + } + + // We handle only event keys + else if (EEventKey == aType) + { + + switch (aKeyEvent.iCode) + { + // Just consume keys + case EKeyDownArrow: + case EKeyUpArrow: + case EKeyRightArrow: + case EKeyLeftArrow: + { + response = EKeyWasConsumed; + break; + } + + case EKeyOK: + { + if (iState == EInsertBubbleStateMove || + iState == EInsertBubbleStateRotate || + iState == EInsertBubbleStateResize) + { + ToMainStateL(); + DrawNow(); + response = EKeyWasConsumed; + } + break; + } + + case EKeyEnter: + { + if (iState == EInsertBubbleStateMove || + iState == EInsertBubbleStateRotate || + iState == EInsertBubbleStateResize) + { + ToMainStateL(); + DrawNow(); + } + else if ( iState == EInsertBubbleStateMain ) + { + // Show context sensitive menu + iEditorView->HandleCommandL( EImageEditorOpenContextMenu ); + } + response = EKeyWasConsumed; + break; + + } + + case 0x31: // 1 + { + // Rotate only in rotate state + if ( iState == EInsertBubbleStateRotate ) + { + iAngle -= KAngleParam90Deg; + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + break; + } + + case 0x33: // 3 + { + // Rotate only in rotate state + if ( iState == EInsertBubbleStateRotate ) + { + iAngle += KAngleParam90Deg; + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + break; + } + + case 0x30: // 0 + case 0x32: // 2 + case 0x34: // 4 + case 0x36: // 6 + case 0x38: // 8 + case EStdKeyDecVolume: // zoom out key + case 0x23: // # + { + StorePosAndScaleRelScreen(); + break; + } + + case 0x35: // 5 + case 0x2a: // * + case EStdKeyIncVolume: // zoom in key + { + StorePosAndScaleRelScreen(); + break; + } + + default: + { + break; + } + } + } + + // Key pressed down, mark pressed key + else if (aType == EEventKeyDown) + { + switch (aKeyEvent.iScanCode) + { + case EStdKeyUpArrow: + { + iKeyCode = 1; + response = EKeyWasConsumed; + break; + } + case EStdKeyDownArrow: + { + iKeyCode = 2; + response = EKeyWasConsumed; + break; + } + case EStdKeyLeftArrow: + { + iKeyCode = 3; + response = EKeyWasConsumed; + break; + } + case EStdKeyRightArrow: + { + iKeyCode = 4; + response = EKeyWasConsumed; + break; + } + default: + { + iKeyCode = 0; + break; + } + } + + 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(); + + break; + } + default: + { + iKeyCode = 0; + break; + } + } + } + + return response; +} + +//============================================================================= +TDesC & CImageEditorBubbleControl::GetParam () +{ + return iParam; +} + +//============================================================================= +void CImageEditorBubbleControl::SetSystemParameters (const CSystemParameters * aPars) +{ + iSysPars = aPars; +} + +//============================================================================= +void CImageEditorBubbleControl::HandlePluginCommandL (const TInt aCommand) +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::HandlePluginCommandL()"); + + switch (aCommand) + { + case EPgnSoftkeyIdCancel: + { + iPopupController->HideInfoPopupNote(); + if (iState == EInsertBubbleStateMin) + { + // ignore if the plugin is not ready yet + } + else if (iState == EInsertBubbleStateMain || + iState == EInsertBubbleStateFirst) + { + if ( !CImageEditorControlBase::Busy() ) + + { + LOG(KBubblePluginLogFile, "HandleControlEventL: Plug-in cancelled."); + + // Cancel plugin + iState = EInsertBubbleStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + + } + } + else + { + // Return to plugin main view + RestoreTempParams(); + StoreParameters(); + ToMainStateL(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + break; + } + case EPgnSoftkeyIdOk: + { + iPopupController->HideInfoPopupNote(); + if (iState != EInsertBubbleStateMin) + { + ToMainStateL(); + DrawNow(); + } + break; + } + case EPgnSoftkeyIdDone: + case EBubblePgnMenuCmdDone: + { + if (iState != EInsertBubbleStateMin) + { + iState = EInsertBubbleStateMin; + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + } + break; + } + case EBubblePgnMenuCmdMove: + { + ToMoveStateL(); + DrawDeferred(); + break; + } + case EBubblePgnMenuCmdResize: + { + ToResizeStateL(); + DrawDeferred(); + break; + } + case EBubblePgnMenuCmdRotate: + { + ToRotateStateL(); + DrawDeferred(); + break; + } + case EBubblePgnMenuCmdCancel: + { + LOG(KBubblePluginLogFile, "HandleControlEventL: Plug-in cancelled from menu."); + iState = EInsertBubbleStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + break; + } + + case EImageEditorPreGlobalZoomChange: + case EImageEditorPreGlobalPanChange: + { + StorePosAndScaleRelScreen(); + break; + } + + case EImageEditorGlobalZoomChanged: + case EImageEditorGlobalPanChanged: + { + + RestorePosAndScaleRelScreen(); + ClipPosition(); + LOGFMT(KBubblePluginLogFile, "\tiX = %d", iX); + LOGFMT(KBubblePluginLogFile, "\tiY = %d", iY); + + StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + + DrawNow(); + break; + } + + case EImageEditorPreScreenModeChange: + { + if (iState != EInsertBubbleStateMin) + { + StorePosAndScaleRelImage(); + } + break; + } + case EImageEditorPostScreenModeChange: + { + if (iState != EInsertBubbleStateMin) + { + RestorePosAndScaleRelImage(); + ClipPosition(); + StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawNow(); + } + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +TInt CImageEditorBubbleControl::GetSoftkeyIndexL() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::GetSoftkeyIndexL()"); + + TInt state = 0; + + switch (iState) + { + case EInsertBubbleStateFirst: + { + state = 0; // Options - Cancel + break; + } + case EInsertBubbleStateMove: + case EInsertBubbleStateRotate: + case EInsertBubbleStateResize: + { + state = 1; // Ok - Cancel + break; + } + case EInsertBubbleStateMain: + { + state = 2; // Options - Done + break; + } + case EInsertBubbleStateMin: + default: + { + state = 3; // Empty + break; + } + + } + + + return state; +} + +//============================================================================= +TInt CImageEditorBubbleControl::GetContextMenuResourceId() +{ +return R_BUBBLE_CONTEXT_MENUBAR; +} + +//============================================================================= +TBitField CImageEditorBubbleControl::GetDimmedMenuItems() +{ + + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::GetDimmedMenuItems()"); + + TBitField dimmedMenuItems; + TInt count = iItem->MenuItems().Count(); + + if ( iDisplayingOkOptionsMenu ) + { + // Dim the command EBubblePgnMenuCmdCancel + for ( TInt i = 0; i < count; i++) + { + // get the menu item id + TInt menuItem = iItem->MenuItems().At(i).iCommandId; + if ( menuItem == EBubblePgnMenuCmdCancel ) + { + dimmedMenuItems.SetBit( i ); + } + } + iDisplayingOkOptionsMenu = EFalse; + } + + return dimmedMenuItems; +} + +//============================================================================= +TPtrC CImageEditorBubbleControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::GetNaviPaneTextL()"); + + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return iNaviPaneText; +} + +//============================================================================= +void CImageEditorBubbleControl::Draw (const TRect & aRect) const +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::Draw()"); + + CPreviewControlBase::DrawPreviewImage (aRect); + + if ( iIndicator && iIndicator->Handle() && + iIndicatorMask && iIndicatorMask->Handle() ) + { + CWindowGc & gc = SystemGc(); + + gc.SetPenStyle (CGraphicsContext::ENullPen); + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + + gc.BitBltMasked ( + ComputeIndicatorPosition(), + iIndicator, + TRect (iIndicator->SizeInPixels()), + iIndicatorMask, + EFalse + ); + } +} + +//============================================================================= +void CImageEditorBubbleControl::NaviDown() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::NaviDown()"); + + switch (iState) + { + + case EInsertBubbleStateMove: + { + iY += (KPosParamStep * iNaviStepMultiplier); + if ( iY > iSysPars->VisibleImageRect().iBr.iY ) + { + iY = iSysPars->VisibleImageRect().iBr.iY - 1; + } + break; + } + + case EInsertBubbleStateResize: + { + iScale -= KScaleParamStep; + if (iScale < iScaleMin) + { + iScale = iScaleMin; + } + break; + } + + case EInsertBubbleStateRotate: + { + iAngle -= (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorBubbleControl::NaviUp() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::NaviUp()"); + + switch (iState) + { + + case EInsertBubbleStateMove: + { + iY -= (KPosParamStep * iNaviStepMultiplier); + if ( iY < iSysPars->VisibleImageRect().iTl.iY ) + { + iY = iSysPars->VisibleImageRect().iTl.iY; + } + break; + } + + case EInsertBubbleStateResize: + { + iScale += KScaleParamStep; + if (iScale > iScaleMax) + { + iScale = iScaleMax; + } + break; + } + + case EInsertBubbleStateRotate: + { + iAngle += (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorBubbleControl::NaviRight() +{ + + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::NaviRight()"); + + switch (iState) + { + + case EInsertBubbleStateMove: + { + iX += (KPosParamStep * iNaviStepMultiplier); + if ( iX >= iSysPars->VisibleImageRect().iBr.iX ) + { + iX = iSysPars->VisibleImageRect().iBr.iX - 1; + } + break; + } + + case EInsertBubbleStateResize: + { + iScale += KScaleParamStep; + if (iScale > iScaleMax) + { + iScale = iScaleMax; + } + break; + } + + case EInsertBubbleStateRotate: + { + iAngle += (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorBubbleControl::NaviLeft() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::NaviLeft()"); + + switch (iState) + { + + case EInsertBubbleStateMove: + { + iX -= (KPosParamStep * iNaviStepMultiplier); + if ( iX < iSysPars->VisibleImageRect().iTl.iX ) + { + iX = iSysPars->VisibleImageRect().iTl.iX; + } + break; + } + + case EInsertBubbleStateResize: + { + iScale -= KScaleParamStep; + if (iScale < iScaleMin) + { + iScale = iScaleMin; + } + break; + } + + case EInsertBubbleStateRotate: + { + iAngle -= (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorBubbleControl::ToMoveStateL() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::ToMoveStateL()"); + + iState = EInsertBubbleStateMove; + iNaviPaneText.Copy ( iItem->Parameters()[KMoveBubbleIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_move_super, + EMbmImageeditoruiQgn_indi_imed_move_super_mask + ); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorBubbleControl::ToResizeStateL() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::ToResizeStateL()"); + + iState = EInsertBubbleStateResize; + iNaviPaneText.Copy ( iItem->Parameters()[KResizeBubbleIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_resize_super, + EMbmImageeditoruiQgn_indi_imed_resize_super_mask + ); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorBubbleControl::ToRotateStateL() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::ToRotateStateL()"); + + iState = EInsertBubbleStateRotate; + iNaviPaneText.Copy ( iItem->Parameters()[KRotateBubbleIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_rotate_left_super, + EMbmImageeditoruiQgn_indi_imed_rotate_left_super_mask + ); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorBubbleControl::ToMainStateL() +{ + + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::ToMainStateL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + iState = EInsertBubbleStateMain; + iPopupController->HideInfoPopupNote(); + iNaviPaneText.Copy ( iItem->Parameters()[KMainBubbleIndex] ); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); +} + +//============================================================================= +void CImageEditorBubbleControl::StoreTempParams() + { + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::StoreTempParams()"); + iTempX = iX; + iTempY = iY; + iTempScale = iScale; + iTempAngle = iAngle; + } + +//============================================================================= +void CImageEditorBubbleControl::RestoreTempParams() + { + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::RestoreTempParams()"); + iX = iTempX; + iY = iTempY; + iScale = iTempScale; + iAngle = iTempAngle; + } + +//============================================================================= +void CImageEditorBubbleControl::GetHelpContext(TCoeHelpContext& aContext) const +{ + aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); + aContext.iContext = KSIE_HLP_EDIT_CLIPART; +} + +//============================================================================= +void CImageEditorBubbleControl::LoadIndicatorL ( + TInt aBitmapInd, + TInt aMaskInd + ) +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::LoadIndicatorL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + SDrawUtils::GetIndicatorBitmapL ( + iIndicator, + iIndicatorMask, + aBitmapInd, + aMaskInd + ); +} + +//============================================================================= +TPoint CImageEditorBubbleControl::ComputeIndicatorPosition() const +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::ComputeIndicatorPosition()"); + + TInt x( 0 ); + TInt y( 0 ); + // check if there is no indicator + if ( !iIndicator ) + { + return TPoint ( x, y ); + } + + TRect vprect = iSysPars->VisibleImageRect(); + TRect vpprect = iSysPars->VisibleImageRectPrev(); + + TInt s = 0; + if (iScaleToHeight) + { + s = (iScale * vpprect.Height()) / vprect.Height(); + + } + else + { + s = (iScale * vpprect.Width()) / vprect.Width(); + } + + x = ((iX - vprect.iTl.iX)* vpprect.Width()) / vprect.Width(); + x += vpprect.iTl.iX; + x -= iIndicator->SizeInPixels().iWidth / 2; + x -= s / 2; + + y = ((iY - vprect.iTl.iY) * vpprect.Height()) / vprect.Height(); + y += vpprect.iTl.iY; + y -= iIndicator->SizeInPixels().iHeight / 2; + y += s / 2; + + LOGFMT (KBubblePluginLogFile, "ComputeIndicatorPosition --- (iX == %d)", iX); + LOGFMT (KBubblePluginLogFile, "ComputeIndicatorPosition --- (iY == %d)", iY); + LOGFMT (KBubblePluginLogFile, "ComputeIndicatorPosition --- (x == %d)", x); + LOGFMT (KBubblePluginLogFile, "ComputeIndicatorPosition --- (y == %d)", y); + + return TPoint (x,y); +} + +//============================================================================= +void CImageEditorBubbleControl::StoreParameters() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::StoreParameters()"); + iParam.Copy (_L("x ")); + iParam.AppendNum (iX); + iParam.Append (_L(" y ")); + iParam.AppendNum (iY); + iParam.Append (_L(" angle ")); + iParam.AppendNum (iAngle); + + if ( iScaleToHeight ) + { + iParam.Append (_L(" height ")); + iParam.AppendNum (iScale); + } + else + { + iParam.Append (_L(" width ")); + iParam.AppendNum (iScale); + } + LOGDES(KBubblePluginLogFile, iParam); +} + +//============================================================================= +void CImageEditorBubbleControl::TimerCallBack() +{ + LOGFMT(KBubblePluginLogFile, "CImageEditorBubbleControl::TimerCallBack() (iTickCount == %d)", iTickCount); + + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::TimerCallBack: switching to big steps"); + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } + + if (iKeyCode) + { + + switch (iKeyCode) + { + case 1: + { + NaviUp(); + break; + } + case 2: + { + NaviDown(); + break; + } + case 3: + { + NaviLeft(); + break; + } + case 4: + { + NaviRight(); + break; + } + default: + break; + } + LOG(KBubblePluginLogFile, "\tTimerCallBack: Render..."); + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + + iTimer->Call (KWait); + } +} + +//============================================================================= +void CImageEditorBubbleControl::StorePosAndScaleRelScreen() +{ + + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::StorePosAndScaleRelScreen()"); + + TReal relscale = iSysPars->Scale(); + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = virect.iBr.iX - virect.iTl.iX; + TInt viheight = virect.iBr.iY - virect.iTl.iY; + + TRect viprect = iSysPars->VisibleImageRectPrev(); + + TInt vipwidth = viprect.iBr.iX - viprect.iTl.iX; + TInt vipheight = viprect.iBr.iY - viprect.iTl.iY; + + // Scale + TInt dimold_pix = (TInt)((iScale / relscale) + 0.5); + if ( iScaleToHeight ) + { + iScaleOld = (TReal)(dimold_pix * vipheight) / viheight; + } + else + { + iScaleOld = (TReal)(dimold_pix * vipwidth) / viwidth; + } + + // Position + TInt xCurrent = (TInt)((iX / relscale) + 0.5); + TInt yCurrent = (TInt)((iY / relscale) + 0.5); + iPosXOld = viprect.iTl.iX + (TReal)((xCurrent - virect.iTl.iX) * vipwidth) / viwidth; + iPosYOld = viprect.iTl.iY + (TReal)((yCurrent - virect.iTl.iY) * vipheight) / viheight; + + LOGFMT(KBubblePluginLogFile, "\tiPosXOld = %d", iPosXOld); + LOGFMT(KBubblePluginLogFile, "\tiPosYOld = %d", iPosYOld); + + iParam.Copy(_L("nop")); + +} + +//============================================================================= +void CImageEditorBubbleControl::RestorePosAndScaleRelScreen() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::RestorePosAndScaleRelScreen()"); + + TReal relscale = iSysPars->Scale(); + + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = virect.iBr.iX - virect.iTl.iX; + TInt viheight = virect.iBr.iY - virect.iTl.iY; + + TRect viprect = iSysPars->VisibleImageRectPrev(); + TInt vipwidth = viprect.iBr.iX - viprect.iTl.iX; + TInt vipheight = viprect.iBr.iY - viprect.iTl.iY; + + // Scale + if (iScaleToHeight) + { + iScale = (TInt)((iScaleOld * viheight) / vipheight + 0.5); + } + else + { + iScale = (TInt)((iScaleOld * viwidth) / vipwidth + 0.5); + } + iScale = (TInt)(iScale * relscale + 0.5); + + // Position + iX = (TInt)(virect.iTl.iX + (TReal)((iPosXOld - viprect.iTl.iX) * viwidth) / vipwidth + 0.5); + iY = (TInt)(virect.iTl.iY + (TReal)((iPosYOld - viprect.iTl.iY) * viheight) / vipheight + 0.5); + +} + +//============================================================================= +void CImageEditorBubbleControl::StorePosAndScaleRelImage() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::StorePosAndScaleRelImage()"); + + TReal relscale = iSysPars->RelScale(); + + iPosXOld = (TInt)((iX / relscale) + 0.5); + iPosYOld = (TInt)((iY / relscale) + 0.5); + iScaleOld = (TInt)(iScale / relscale + 0.5); + + iParam.Copy(_L("nop")); +} + +//============================================================================= +void CImageEditorBubbleControl::RestorePosAndScaleRelImage() +{ + LOG(KBubblePluginLogFile, "CImageEditorBubbleControl::RestorePosAndScaleRelImage()"); + + TReal relscale = iSysPars->RelScale(); + + iX = (TInt)(iPosXOld * relscale + 0.5); + iY = (TInt)(iPosYOld * relscale + 0.5); + iScale = TInt(iScaleOld * relscale + 0.5); +} + +//============================================================================= +void CImageEditorBubbleControl::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; + } +} + +//============================================================================= +void CImageEditorBubbleControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent) + { + if( AknLayoutUtils::PenEnabled() ) + { + // If busy, do not handle anything + if ( Busy() ) + { + return; + } + + TBool render = ETrue; + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + if ( iState == EInsertBubbleStateMove ) + { + iPopupController->HideInfoPopupNote(); + SetBubblePosition( aPointerEvent.iPosition ); + } + else if ( iState == EInsertBubbleStateRotate ) + { + iPopupController->HideInfoPopupNote(); + // Store current position. Rotating is handled in drag-event + // is pen position has changed + iPointerPosition = aPointerEvent.iPosition; + } + else if ( iState == EInsertBubbleStateResize ) + { + iPopupController->HideInfoPopupNote(); + iPointerPosition = aPointerEvent.iPosition; + } +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorBubbleControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + break; + } + case TPointerEvent::EDrag: + { + if ( iState == EInsertBubbleStateMove ) + { + SetBubblePosition( aPointerEvent.iPosition ); + iPointerPosition = aPointerEvent.iPosition; + TRect clientRect; + CResolutionUtil::Self()->GetClientRect( clientRect ); + TPoint tempPoint = iPointerPosition; + tempPoint.iY += iY; + if ( !clientRect.Contains( tempPoint ) ) + { + ShowTooltip(); + } + } + else if ( iState == EInsertBubbleStateRotate ) + { + if ( CalculateRotation( iPointerPosition, + aPointerEvent.iPosition ) ) + { + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else + { + render = EFalse; + } + } + else if ( iState == EInsertBubbleStateResize ) + { + if ( CalculateResize( iPointerPosition, + aPointerEvent.iPosition ) ) + { + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else + { + render = EFalse; + } + } + + break; + } + case TPointerEvent::EButton1Up: + { + if ( iState == EInsertBubbleStateMain ) + { + // Show context sensitive menu + iEditorView->HandleCommandL( EImageEditorOpenContextMenu ); + } + else + { + ShowTooltip(); + } + break; + } + + default: + { + break; + } + } + + StoreParameters(); + + if ( render ) + { + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + + CCoeControl::HandlePointerEventL( aPointerEvent ); + + } + } + +//============================================================================= +void CImageEditorBubbleControl::SetBubblePosition( TPoint aPointedPosition ) + { + + // Get system parameters + TRect visibleImageRect( iSysPars->VisibleImageRect() ); + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + TInt xPosFactorDivider + ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX ); + TInt yPosFactorDivider + ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY ); + + // 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 ); + + // Calculate position on visible image + iX = visibleImageRect.iTl.iX + + ( visibleImageRect.iBr.iX - visibleImageRect.iTl.iX ) * + xPositionFactor; + + iY = visibleImageRect.iTl.iY + + ( visibleImageRect.iBr.iY - visibleImageRect.iTl.iY ) * + yPositionFactor; + } + + // Check that not out of bounds + ClipPosition(); + + } + +//============================================================================= +void CImageEditorBubbleControl::ShowTooltip() + { + iPopupController->HideInfoPopupNote(); + + if ( iState != EInsertBubbleStateMove && + iState != EInsertBubbleStateResize && + iState != EInsertBubbleStateRotate ) + { + return; + } + + TPoint iconPosition = ComputeIndicatorPosition(); + + if ( iState == EInsertBubbleStateMove ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVBottom, + *iTooltipMove ); + } + // resize + else if ( iState == EInsertBubbleStateResize ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVBottom, + *iTooltipResize ); + } + // rotate + else if ( iState == EInsertBubbleStateRotate ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVBottom, + *iTooltipRotate ); + } + + } + +//============================================================================= +TBool CImageEditorBubbleControl::CalculateResize( TPoint aStartPoint, + TPoint aEndPoint ) + { + // Whether bubble is resized in this function or not + TBool bubbleResized( EFalse ); + // Store old scale value + TInt oldScale = iScale; + + // Get system parameters + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Compute change on the screen + TInt deltaX = aEndPoint.iX - aStartPoint.iX; + TInt deltaY = aEndPoint.iY - aStartPoint.iY; + + // Use bigger dimension + TInt maxChangeInPixels; + if ( visibleImageRectPrev.Height() > visibleImageRectPrev.Width() ) + { + maxChangeInPixels = visibleImageRectPrev.Height(); + } + else + { + maxChangeInPixels = visibleImageRectPrev.Width(); + } + + TInt oneStepInPixels = maxChangeInPixels / KTouchScaleMaxStepCount; + TInt scaleStep = ( iScaleMax - iScaleMin ) / KTouchScaleMaxStepCount + 1; + + // Relates to second and fourth corners. Defines how steep/gentle the + // moving angle has to be in order to scale. + TInt slopeAngleFactor = 3; + + // The first quarter (movement towards upper-right corner) + if( ( deltaX > 0 && deltaY <= 0 ) || ( deltaX >= 0 && deltaY < 0 ) ) + { + // use bigger value + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iScale += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iScale += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The second (movement towards lower-right corner) + else if( ( deltaX > 0 && deltaY >= 0 ) || ( deltaX >= 0 && deltaY > 0 ) ) + { + if( deltaX > slopeAngleFactor * deltaY ) + { + iScale += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + + else if ( slopeAngleFactor * deltaX < deltaY ) + { + iScale -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The third (movement towards lower-left corner) + else if( ( deltaX < 0 && deltaY >= 0 ) || ( deltaX <= 0 && deltaY > 0 ) ) + { + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iScale -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iScale -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The fourth (movement towards upper-left corner) + else if( ( deltaX < 0 && deltaY <= 0 ) || ( deltaX <= 0 && deltaY < 0 ) ) + { + if( slopeAngleFactor * Abs( deltaX ) < Abs( deltaY ) ) + { + iScale += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + else if ( Abs( deltaX ) > slopeAngleFactor * Abs( deltaY ) ) + { + iScale -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + } + + // Check the limits + if (iScale > iScaleMax) + { + iScale = iScaleMax; + bubbleResized = ETrue; + } + if (iScale < iScaleMin) + { + iScale = iScaleMin; + bubbleResized = ETrue; + } + + if ( oldScale != iScale ) + { + bubbleResized = ETrue; + } + + return bubbleResized; + + } + +//============================================================================= +TBool CImageEditorBubbleControl::CalculateRotation( TPoint aStartPoint, + TPoint aEndPoint ) + { + TBool angleChanged( EFalse ); + TInt oldAngle = iAngle; + + // Get system parameters + TRect visibleImageRect( iSysPars->VisibleImageRect() ); + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Calculate TalkBubble real center point on the screen + // (physical coordinates) + TReal posFactorX( TReal( iX - visibleImageRect.iTl.iX ) / + visibleImageRect.Width() ); + TInt bubbleCenterX = posFactorX * visibleImageRectPrev.Width() + + visibleImageRectPrev.iTl.iX; + + TReal posFactorY( TReal( iY - visibleImageRect.iTl.iY ) / + visibleImageRect.Height() ); + TInt bubbleCenterY = posFactorY * visibleImageRectPrev.Height() + + visibleImageRectPrev.iTl.iY; + + // Calculate start and end positions of the movement assuming that + // clipart centre is in origo. + // Note! y-axis is mirrored on screen coordinates compared to standard 2-d + // co-ordinates->mirror y-axis to ease the calculation + TPoint startPos( ( aStartPoint.iX - bubbleCenterX ), + ( bubbleCenterY - aStartPoint.iY ) ); + TPoint endPos( ( aEndPoint.iX - bubbleCenterX ), + ( bubbleCenterY - aEndPoint.iY ) ); + + TReal angleInRadStart; + TReal angleInRadEnd; + + // Calculate start and end angles in radians + TInt err1 = Math::ATan( angleInRadStart, startPos.iY, startPos.iX ); + TInt err2 = Math::ATan( angleInRadEnd, endPos.iY, endPos.iX ); + + if( !err1 && !err2 ) + { + // Calculate change in angle and convert it to degrees + TReal changeInDegrees = + ( angleInRadEnd - angleInRadStart ) * KRadToDeg; + + iAngle -= ( KDegreeMultiplier * TInt( changeInDegrees ) ) + % KAngleParamMax; + } + + if ( iAngle != oldAngle ) + { + angleChanged = ETrue; + } + + return angleChanged; + } + +// End of file + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/BubblePlugin/src/ImageEditorBubblePlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/BubblePlugin/src/ImageEditorBubblePlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,169 @@ +/* +* 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: +* Bubble plugin. +* +*/ + + +#include "ImageEditorBubblePlugin.h" +#include "ImageEditorBubbleControl.h" +#include "ImageEditorPluginBaseDefs.h" +#include "DrawUtils.h" +#include "SystemParameters.h" + +// CONSTANTS +_LIT (KPgnResourceFile, "Bubble.rsc"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorBubblePlugin * plugin = new (ELeave) CImageEditorBubblePlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorBubblePlugin::CImageEditorBubblePlugin () +{ + +} + +//============================================================================= +void CImageEditorBubblePlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorBubblePlugin::~CImageEditorBubblePlugin () +{ + iSysPars = NULL; + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorBubblePlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (const CSystemParameters *)tempval; + return KErrNone; + } + default: + { + return CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorBubblePlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + // Control found + if (iControl) + { + aPropertyValue.Copy ( ((CImageEditorBubbleControl *)iControl)->GetParam() ); + return KErrNone; + } + + // Control not found, return KErrNotReady + else + { + return KErrNotReady; + } + } + case KCapReadyToRender: + { + TBool readyToRender = EFalse; + if ( iControl ) + { + readyToRender = ((CImageEditorBubbleControl *)iControl)->IsReadyToRender(); + } + aPropertyValue.AppendNum ((TInt)readyToRender); + return KErrNone; + } + case KCapIsSlowPlugin: + { + aPropertyValue.AppendNum ((TInt)ETrue); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorBubblePlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + // Delete previous control + ReleasePlugin(); + + // Create the control + iControl = CImageEditorBubbleControl::NewL (aRect, aParent); + aPluginControl = iControl; + + // Set system parameters + ((CImageEditorBubbleControl*)iControl)->SetSystemParameters (iSysPars); + + return KErrNone; +} + +//============================================================================= +void CImageEditorBubblePlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + +} + +//============================================================================= +void CImageEditorBubblePlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/EABI/Cartoonize.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/EABI/Cartoonize.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI28CImageEditorCartoonizePlugin @ 2 NONAME ; ## + _ZTV28CImageEditorCartoonizePlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/bwins/Cartoonize.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/bwins/Cartoonize.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/data/cartoonize.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/data/cartoonize.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,106 @@ +/* +* 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: +* Resource definitions for Cartoonize plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "cartoonize_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info + { + pluginuid = UID_CARTOONIZE_PLUGIN; + uitype = EPluginUiTypeNone; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeSingletonTop; + plugindisplayorder = 10; + pluginname = qtn_sie_plugin_name_posterize; + iconfile = "cartoonize.mif"; + filterfile = "FilterCartoon.dll"; + } + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // NO PARAMETERS + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + }; +} + +RESOURCE PGNUIITEMS r_msk_items +{ + items= + { + }; +} + +RESOURCE PGNUIITEMS r_pgnmenuitems +{ + items= + { + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/data/icon.bmp Binary file imageeditor/plugins/CartoonizePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/data/mask.bmp Binary file imageeditor/plugins/CartoonizePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/data/qgn_plugin_cartoon.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/data/qgn_plugin_cartoon.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,30 @@ + + + + +]> + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/group/CartoonizePlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/group/CartoonizePlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET Cartoonize.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_CARTOONIZE_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorCartoonizePlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/cartoonize.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib +LIBRARY iepb.lib +LIBRARY pb.lib + + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Cartoonize plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorCartoonizePlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorCartoonizePlugin.iby) + +// mmp files +PRJ_MMPFILES +CartoonizePlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE cartoonize.mif +OPTION HEADERFILE cartoonize.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_posterize +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/inc/Cartoonize_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/inc/Cartoonize_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,23 @@ +/* +* 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: +* +*/ + + +#include + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/inc/ImageEditorCartoonizePlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/inc/ImageEditorCartoonizePlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,147 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORCARTOONIZEPLUGIN_H +#define IMAGEEDITORCARTOONIZEPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CPluginParameters; + + +/* CLASS: CImageEditorCartoonizePlugin +* +* CImageEditorCartoonizePlugin represents cartoonize plug-in +* for Image Editor application. +*/ +class CImageEditorCartoonizePlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorCartoonizePlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorCartoonizePlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorCartoonizePlugin (const CImageEditorCartoonizePlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorCartoonizePlugin & operator= (const CImageEditorCartoonizePlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/rom/ImageEditorCartoonizePlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/rom/ImageEditorCartoonizePlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __CARTOONIZEPLUGIN_IBY__ +#define __CARTOONIZEPLUGIN_IBY__ + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Cartoonize.pgn SHARED_LIB_DIR\Cartoonize.pgn + +// Resources +data=DATAZ_\resource\apps\Cartoonize.mif \resource\apps\Cartoonize.mif + +#endif // __CARTOONIZEPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CartoonizePlugin/src/ImageEditorCartoonizePlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CartoonizePlugin/src/ImageEditorCartoonizePlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,112 @@ +/* +* 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: +* +*/ + + + +#include "ImageEditorCartoonizePlugin.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "cartoonize.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorCartoonizePlugin * plugin = new (ELeave) CImageEditorCartoonizePlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorCartoonizePlugin::CImageEditorCartoonizePlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorCartoonizePlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorCartoonizePlugin::~CImageEditorCartoonizePlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorCartoonizePlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorCartoonizePlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + aPropertyValue.Append (_L("quantcolors")); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorCartoonizePlugin::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +void CImageEditorCartoonizePlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorCartoonizePlugin::ReleasePlugin () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/EABI/Clipart.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/EABI/Clipart.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,15 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI14CClipartScaler @ 2 NONAME ; ## + _ZTI21CClipartSelectionGrid @ 3 NONAME ; ## + _ZTI23CClipartSelectionDialog @ 4 NONAME ; ## + _ZTI25CImageEditorClipartPlugin @ 5 NONAME ; ## + _ZTI26CImageEditorClipartControl @ 6 NONAME ; ## + _ZTI8CJPTimer @ 7 NONAME ; ## + _ZTV14CClipartScaler @ 8 NONAME ; ## + _ZTV21CClipartSelectionGrid @ 9 NONAME ; ## + _ZTV23CClipartSelectionDialog @ 10 NONAME ; ## + _ZTV25CImageEditorClipartPlugin @ 11 NONAME ; ## + _ZTV26CImageEditorClipartControl @ 12 NONAME ; ## + _ZTV8CJPTimer @ 13 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/bwins/Clipart.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/bwins/Clipart.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/clipart.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/data/clipart.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,316 @@ +/* +* 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: +* Resource definitions for Clipart plugin. +* +*/ + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include +#include +#include +#include +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "clipart.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "clipart_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info + { + pluginuid = UID_CLIPART_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeAdjustmentEngine; + plugindisplayorder = 8; + pluginname = qtn_sie_plugin_name_clipart; + iconfile = "clipart.mif"; + filterfile = "FilterClipart.dll"; + } + +RESOURCE PARAMNAMES r_plugin_pars + { + parameters= + { + // Select clipart + qtn_sie_heading_select_clipart, + + // Plugin main + qtn_sie_navi_edit_clipart, + + // Move clipart + qtn_sie_navi_edit_clipart, + + // Resize clipart + qtn_sie_navi_edit_clipart, + + // Rotate clipart + qtn_sie_navi_edit_clipart + + }; + } + +RESOURCE PGNUIITEMS r_sk1_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_sk2_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_pgn_sk2_done; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items + { + items= + { + // Move + PGNUIITEM + { + id=EClipartPgnMenuCmdMove; + text=qtn_sie_options_move_clipart; + }, + // Resize + PGNUIITEM + { + id=EClipartPgnMenuCmdResize; + text=qtn_sie_options_resize_clipart; + }, + // Rotate + PGNUIITEM + { + id=EClipartPgnMenuCmdRotate; + text=qtn_sie_options_rotate_clipart; + }, + // Cancel + PGNUIITEM + { + id=EClipartPgnMenuCmdCancel; + text=qtn_sie_options_cancel_effect; + } + }; + } + +//============================================================================= +// +// r_clipart_progress_note +// For progress note. +// +//============================================================================= +// +RESOURCE DIALOG r_clipart_progress_note + { + flags = EAknProgressNoteFlags; + buttons = R_AVKON_SOFTKEYS_CANCEL; + items = + { + DLG_LINE + { + type = EAknCtNote; + id = 11; + control = AVKON_NOTE + { + layout = EProgressLayout; + singular_label = qtn_sie_pgn_searching_cliparts; + }; + } + }; + } + +//============================================================================= +// +// r_clipart_selection_dialog +// +// +//============================================================================= +// +RESOURCE DIALOG r_clipart_selection_dialog + { + flags = EEikDialogFlagCbaButtons | EEikDialogFlagWait | EEikDialogFlagFillAppClientRect; + buttons = R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT; + items = + { + DLG_LINE + { + type = EClipartCustomControlType ; + id = EClipartSelectionGrid; + control = GRID + { + flags = EAknGridHorizontalOrientation|EAknGridFollowsItemsAndLoops; + width = 0; + height = 0; + style = 0; + }; + } + }; + } + + +// PATHS CANNOT EXCEED 256 CHARACTERS TOGETHER +RESOURCE ARRAY r_clipart_dirs + { + items= + { + LBUF { txt = "c:\\private\101ffa91\\cliparts\\"; }, + LBUF { txt = ""text_memory_card_root_path"private\101ffa91\\cliparts\\"; }, + LBUF { txt = "z:\\private\101ffa91\\cliparts\\"; }, + LBUF { txt = "c:\\data\\images\\cliparts\\"; }, + LBUF { txt = ""text_memory_card_root_path"images\\cliparts\\"; } + }; + } + +// Context specific MSK menu +RESOURCE MENU_BAR r_clipart_context_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_clipart_context_menupane; + txt = " "; + } + }; + } + +RESOURCE MENU_PANE r_clipart_context_menupane + { + items = + { + MENU_ITEM + { + command = EClipartPgnMenuCmdMove; + txt = qtn_sie_options_move_clipart; + }, + MENU_ITEM + { + command = EClipartPgnMenuCmdResize; + txt = qtn_sie_options_resize_clipart; + }, + MENU_ITEM + { + command = EClipartPgnMenuCmdRotate; + txt = qtn_sie_options_rotate_clipart; + } + }; + } + +RESOURCE TBUF r_tooltip_clipart_resize { buf = qtn_sie_tooltip_resize; } +RESOURCE TBUF r_tooltip_clipart_move { buf = qtn_sie_tooltip_move; } +RESOURCE TBUF r_tooltip_clipart_rotate { buf = qtn_sie_tooltip_rotate; } + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ants.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ants.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ants_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ants_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_balloon_bunch.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_balloon_bunch.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_balloon_bunch_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_balloon_bunch_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_baseball.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_baseball.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_baseball_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_baseball_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_basketball.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_basketball.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_basketball_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_basketball_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_beanie.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_beanie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_beanie_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_beanie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blocks.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blocks.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blocks_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blocks_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blue_tie.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blue_tie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blue_tie_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_blue_tie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bow.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bow.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bow_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bow_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowling.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowling.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowling_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowling_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowtie.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowtie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowtie_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bowtie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_01.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_01.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_01_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_01_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_02.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_02.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_02_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubble_02_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubbles.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubbles.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubbles_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_bubbles_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_butterflies.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_butterflies.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_butterflies_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_butterflies_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cake.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cake.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cake_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cake_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cloud.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cloud.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cloud_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_cloud_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_confetti.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_confetti.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_confetti_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_confetti_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_crown.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_crown.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_crown_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_crown_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_disguise.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_disguise.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_disguise_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_disguise_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_duh.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_duh.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_duh_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_duh_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_exclamation.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_exclamation.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_exclamation_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_exclamation_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_fire.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_fire.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_fire_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_fire_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_flowers.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_flowers.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_flowers_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_flowers_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_graduation.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_graduation.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_graduation_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_graduation_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_happy.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_happy.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_happy_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_happy_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_headphones.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_headphones.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_headphones_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_headphones_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hearts.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hearts.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hearts_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hearts_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hmmm.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hmmm.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hmmm_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_hmmm_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_jacks.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_jacks.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_jacks_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_jacks_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_leaf.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_leaf.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_leaf_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_leaf_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_lightning.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_lightning.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_lightning_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_lightning_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_love.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_love.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_love_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_love_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_medal.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_medal.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_medal_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_medal_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_mustache.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_mustache.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_mustache_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_mustache_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_notes.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_notes.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_notes_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_notes_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_party_hat.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_party_hat.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_party_hat_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_party_hat_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_paws.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_paws.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_paws_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_paws_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_question.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_question.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_question_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_question_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_rattle.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_rattle.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_rattle_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_rattle_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_red_tie.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_red_tie.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_red_tie_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_red_tie_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ribbon.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ribbon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ribbon_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_ribbon_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sad.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sad.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sad_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sad_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_school.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_school.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_school_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_school_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_shooting_star.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_shooting_star.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_shooting_star_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_shooting_star_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_snowflakes.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_snowflakes.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_snowflakes_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_snowflakes_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_soccer.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_soccer.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_soccer_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_soccer_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_stars.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_stars.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_stars_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_stars_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sunflowers.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sunflowers.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sunflowers_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_sunflowers_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tattoo.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tattoo.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tattoo_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tattoo_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tiara.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tiara.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tiara_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_tiara_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_wink.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_wink.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_wink_mask_soft.bmp Binary file imageeditor/plugins/ClipartPlugin/data/cliparts/qgn_graf_ied_clipart_wink_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/icon.bmp Binary file imageeditor/plugins/ClipartPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/mask.bmp Binary file imageeditor/plugins/ClipartPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/data/qgn_plugin_clipart.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/data/qgn_plugin_clipart.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/group/ClipartPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/group/ClipartPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,514 @@ +/* +* 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: +* Clipart plugin mmp file. +* +*/ + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + + +// to get icon & bmp locations +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + +TARGET Clipart.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_CLIPART_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../../../src +SOURCE JpTimer.cpp + +SOURCEPATH ../src +SOURCE ImageEditorClipartPlugin.cpp +SOURCE ImageEditorClipartControl.cpp +SOURCE ClipartSelectionGrid.cpp +SOURCE ClipartScaler.cpp +SOURCE ClipartSelectionDialog.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/clipart.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY eikcore.lib +LIBRARY egul.lib +LIBRARY eikctl.lib +LIBRARY CommonEngine.lib +LIBRARY BitmapTransforms.lib +LIBRARY estor.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib +LIBRARY platformenv.lib +LIBRARY AknLayout2Scalable.lib +LIBRARY aknlayout2.lib +LIBRARY cdlengine.lib +LIBRARY aknskins.lib +LIBRARY aknskinsrv.lib +LIBRARY aknswallpaperutils.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + +// Initial clipart package +START BITMAP cliparts01.mbm +TARGETPATH /private/101ffa91/cliparts + +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_01.bmp +SOURCE 8 qgn_prop_imed_clipart_01_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_02.bmp +SOURCE 8 qgn_prop_imed_clipart_02_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_03.bmp +SOURCE 8 qgn_prop_imed_clipart_03_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_04.bmp +SOURCE 8 qgn_prop_imed_clipart_04_mask_soft.bmp + +END +// Initial clipart package +START BITMAP cliparts02.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_05.bmp +SOURCE 8 qgn_prop_imed_clipart_05_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_06.bmp +SOURCE 8 qgn_prop_imed_clipart_06_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_07.bmp +SOURCE 8 qgn_prop_imed_clipart_07_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_08.bmp +SOURCE 8 qgn_prop_imed_clipart_08_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_09.bmp +SOURCE 8 qgn_prop_imed_clipart_09_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts03.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_10.bmp +SOURCE 8 qgn_prop_imed_clipart_10_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_11.bmp +SOURCE 8 qgn_prop_imed_clipart_11_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_12.bmp +SOURCE 8 qgn_prop_imed_clipart_12_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_13.bmp +SOURCE 8 qgn_prop_imed_clipart_13_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_14.bmp +SOURCE 8 qgn_prop_imed_clipart_14_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts04.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_15.bmp +SOURCE 8 qgn_prop_imed_clipart_15_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_16.bmp +SOURCE 8 qgn_prop_imed_clipart_16_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_17.bmp +SOURCE 8 qgn_prop_imed_clipart_17_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_18.bmp +SOURCE 8 qgn_prop_imed_clipart_18_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_19.bmp +SOURCE 8 qgn_prop_imed_clipart_19_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts05.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_20.bmp +SOURCE 8 qgn_prop_imed_clipart_20_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_21.bmp +SOURCE 8 qgn_prop_imed_clipart_21_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_22.bmp +SOURCE 8 qgn_prop_imed_clipart_22_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_23.bmp +SOURCE 8 qgn_prop_imed_clipart_23_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_24.bmp +SOURCE 8 qgn_prop_imed_clipart_24_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts06.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_25.bmp +SOURCE 8 qgn_prop_imed_clipart_25_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_26.bmp +SOURCE 8 qgn_prop_imed_clipart_26_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_27.bmp +SOURCE 8 qgn_prop_imed_clipart_27_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_28.bmp +SOURCE 8 qgn_prop_imed_clipart_28_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_29.bmp +SOURCE 8 qgn_prop_imed_clipart_29_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts07.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_30.bmp +SOURCE 8 qgn_prop_imed_clipart_30_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_31.bmp +SOURCE 8 qgn_prop_imed_clipart_31_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_32.bmp +SOURCE 8 qgn_prop_imed_clipart_32_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_33.bmp +SOURCE 8 qgn_prop_imed_clipart_33_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_34.bmp +SOURCE 8 qgn_prop_imed_clipart_34_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts08.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_35.bmp +SOURCE 8 qgn_prop_imed_clipart_35_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_36.bmp +SOURCE 8 qgn_prop_imed_clipart_36_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_37.bmp +SOURCE 8 qgn_prop_imed_clipart_37_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_38.bmp +SOURCE 8 qgn_prop_imed_clipart_38_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_39.bmp +SOURCE 8 qgn_prop_imed_clipart_39_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts09.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_40.bmp +SOURCE 8 qgn_prop_imed_clipart_40_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_41.bmp +SOURCE 8 qgn_prop_imed_clipart_41_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_42.bmp +SOURCE 8 qgn_prop_imed_clipart_42_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_43.bmp +SOURCE 8 qgn_prop_imed_clipart_43_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_44.bmp +SOURCE 8 qgn_prop_imed_clipart_44_mask_soft.bmp + + + + +END + +// Initial clipart package +START BITMAP cliparts10.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_45.bmp +SOURCE 8 qgn_prop_imed_clipart_45_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_46.bmp +SOURCE 8 qgn_prop_imed_clipart_46_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_47.bmp +SOURCE 8 qgn_prop_imed_clipart_47_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_48.bmp +SOURCE 8 qgn_prop_imed_clipart_48_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_49.bmp +SOURCE 8 qgn_prop_imed_clipart_49_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts11.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_50.bmp +SOURCE 8 qgn_prop_imed_clipart_50_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_51.bmp +SOURCE 8 qgn_prop_imed_clipart_51_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_52.bmp +SOURCE 8 qgn_prop_imed_clipart_52_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_53.bmp +SOURCE 8 qgn_prop_imed_clipart_53_mask_soft.bmp + +END + + +// Initial clipart package +START BITMAP cliparts12.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_54.bmp +SOURCE 8 qgn_prop_imed_clipart_54_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_55.bmp +SOURCE 8 qgn_prop_imed_clipart_55_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_56.bmp +SOURCE 8 qgn_prop_imed_clipart_56_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_57.bmp +SOURCE 8 qgn_prop_imed_clipart_57_mask_soft.bmp + +END + + +// Initial clipart package +START BITMAP cliparts13.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_58.bmp +SOURCE 8 qgn_prop_imed_clipart_58_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_59.bmp +SOURCE 8 qgn_prop_imed_clipart_59_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_60.bmp +SOURCE 8 qgn_prop_imed_clipart_60_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_61.bmp +SOURCE 8 qgn_prop_imed_clipart_61_mask_soft.bmp + +END + + +// Initial clipart package +START BITMAP cliparts14.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_62.bmp +SOURCE 8 qgn_prop_imed_clipart_62_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_63.bmp +SOURCE 8 qgn_prop_imed_clipart_63_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_64.bmp +SOURCE 8 qgn_prop_imed_clipart_64_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_65.bmp +SOURCE 8 qgn_prop_imed_clipart_65_mask_soft.bmp + +END + + +// Initial clipart package +START BITMAP cliparts15.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_66.bmp +SOURCE 8 qgn_prop_imed_clipart_66_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_67.bmp +SOURCE 8 qgn_prop_imed_clipart_67_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_68.bmp +SOURCE 8 qgn_prop_imed_clipart_68_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_69.bmp +SOURCE 8 qgn_prop_imed_clipart_69_mask_soft.bmp + +END + + +// Initial clipart package +START BITMAP cliparts16.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_70.bmp +SOURCE 8 qgn_prop_imed_clipart_70_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_71.bmp +SOURCE 8 qgn_prop_imed_clipart_71_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_72.bmp +SOURCE 8 qgn_prop_imed_clipart_72_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_73.bmp +SOURCE 8 qgn_prop_imed_clipart_73_mask_soft.bmp + +END + + +// Initial clipart package +START BITMAP cliparts17.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_74.bmp +SOURCE 8 qgn_prop_imed_clipart_74_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_75.bmp +SOURCE 8 qgn_prop_imed_clipart_75_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_76.bmp +SOURCE 8 qgn_prop_imed_clipart_76_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_77.bmp +SOURCE 8 qgn_prop_imed_clipart_77_mask_soft.bmp + +END + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// Initial clipart package +START BITMAP cliparts18.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_78.bmp +SOURCE 8 qgn_prop_imed_clipart_78_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_79.bmp +SOURCE 8 qgn_prop_imed_clipart_79_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_80.bmp +SOURCE 8 qgn_prop_imed_clipart_80_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_81.bmp +SOURCE 8 qgn_prop_imed_clipart_81_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts19.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_82.bmp +SOURCE 8 qgn_prop_imed_clipart_82_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_83.bmp +SOURCE 8 qgn_prop_imed_clipart_83_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_84.bmp +SOURCE 8 qgn_prop_imed_clipart_84_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_85.bmp +SOURCE 8 qgn_prop_imed_clipart_85_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts20.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_86.bmp +SOURCE 8 qgn_prop_imed_clipart_86_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_87.bmp +SOURCE 8 qgn_prop_imed_clipart_87_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_88.bmp +SOURCE 8 qgn_prop_imed_clipart_88_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_89.bmp +SOURCE 8 qgn_prop_imed_clipart_89_mask_soft.bmp + +END + +// Initial clipart package +START BITMAP cliparts21.mbm +TARGETPATH /private/101ffa91/cliparts +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_clipart_90.bmp +SOURCE 8 qgn_prop_imed_clipart_90_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_91.bmp +SOURCE 8 qgn_prop_imed_clipart_91_mask_soft.bmp +SOURCE c24 qgn_prop_imed_clipart_92.bmp +SOURCE 8 qgn_prop_imed_clipart_92_mask_soft.bmp + +END +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: +* Clipart plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// ROM description file +../rom/ImageEditorClipartPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorClipartPlugin.iby) +../rom/ImageEditorClipartPluginSettings.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorClipartPluginSettings.iby) + +// mmp files +PRJ_MMPFILES +ClipartPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE clipart.mif +OPTION HEADERFILE clipart.mbg +OPTION SOURCES -c8 qgn_indi_imed_clipart +END + +// test project mmp files +PRJ_TESTMMPFILES + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/ClipartScaler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/ClipartScaler.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,104 @@ +/* +* 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: +* +*/ + + + +#ifndef ClipartScaler_h +#define ClipartScaler_h + +// INCLUDES +#include + +// FORWARD DECLARATIONS + +class CBitmapScaler; +class CFbsBitmap; + +/* CLASS: MClipartScalerNotifier +* +* Notifier class for CClipartScaler +* +*/ +class MClipartScalerNotifier + { + public: + virtual void ClipartScalerOperationReadyL(TInt aError) = 0; + }; + +/* CLASS: CClipartScaler +* +* Class is used for scaling bitmaps +* +*/ +class CClipartScaler : public CActive + { + +public: + + /** Default constructor, cannot leave. + * + * @param - + * @return - + */ + CClipartScaler (MClipartScalerNotifier* aNotifier); + + /** Destructor + * + * @param - + * @return - + */ + ~CClipartScaler (); + + /* Second phase constructor + * + * @param - + * @return - + */ + void ConstructL (); + + /* Second phase constructor + * + * @param aBitmap - bitmap to be scaled + * @return - + */ + void ScaleBitmapL(CFbsBitmap* aBitmap, TSize aNewSize); + +protected: + + /* DoCancel + * + * @see CActive + */ + void DoCancel(); + + /* RunL + * + * @see CActive + */ + void RunL(); + +private: + + CBitmapScaler* iBitmapScaler; + MClipartScalerNotifier* iNotifier; + +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionDialog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionDialog.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,259 @@ +/* +* 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: +* Dialog for clipart plugin. +* +*/ + + +#ifndef CLIPARTSELECTIONDIALOG_H +#define CLIPARTSELECTIONDIALOG_H + +#include +#include + +#include "clipartscaler.h" +#include "CallbackMethod.h" + +// FORWARD DECLARATION +class CClipartSelectionGrid; +class CGulIcon; +class CDir; +class CAknIconArray; +class CClipartScaler; +class CObCallback; + + +class CClipartSelectionDialog : public CEikDialog, + public MClipartScalerNotifier, + public MProgressDialogCallback, + public MEikListBoxObserver, + public MObCallbackMethod + { + + class TClipartListItem + { + public: + TFileName iFilename; + TInt iIndex; + }; + + typedef RArray RClipartList; + + enum TState + { + EIdle, + EScalingBitmap, + EScalingMask + }; + +public: + + /** Constructor + * + * @param aClipartFileName - Clipart filename + * @param aClipartFileNameIndex - Clipart filename index + * @return - + */ + CClipartSelectionDialog(TFileName& aClipartFileName, TInt& aClipartFileNameIndex); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CClipartSelectionDialog(); + + /** ConstructL + * + * Second phase constructor + * + * @param aParent - Parent control + * + */ + void ConstructL(MCoeControlObserver* aParent); + + /** 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 ); + + /** SetBusy + * + * @param aBusy - Set control busy + * + */ + void SetBusy(TBool aBusy); + + /** SetSizeAndPosition + * + * @see CEikDialog + * + */ + void SetSizeAndPosition( const TSize& /*aSize*/ ); + + /** ClipartFilenameL + * + * Get select clipart filename and index + * + * @param aFilename - Clipart filename with full path + * @param aIndex - Clipart index in the MBM file + * @return - + */ + void ClipartFilenameL(TDes& aFilename, TInt& aIndex); + + /** ClipartScalerOperationReadyL + * + * Called by the Clipart scaler when operation is ready + * + * @see MClipartScalerNotifier + * + */ + void ClipartScalerOperationReadyL(TInt aError) ; + + /** DialogDismissedL + * + * @see MProgressDialogCallback + * + */ + void DialogDismissedL( TInt aButtonId ); + + /** + * + * @see MObCallbackMethod + * + */ + TBool CallbackMethodL( TInt aParam ); + + /** PreLayoutDynInitL + * + * @see CEikDialog + * + */ + void PreLayoutDynInitL(); + + /** CreateCustomControlL + * + * @see CEikDialog + * + */ + SEikControlInfo CreateCustomControlL(TInt aControlType); + + /** OfferKeyEventL + * + * @see CEikDialog + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + virtual void HandleDialogPageEventL(TInt /*aEventId*/); + + virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + void HandleResourceChange(TInt aType); +private: + + /* SetupGrid + * + * Sets up grid every time the grid size changes. + * + * @param - + * @return - + */ + void SetupGrid(); + + /** FindClipartsL + * + * Find all cliparts in directories specified in the + * resource file + * + * @param - + * @return - + */ + void FindClipartsL(); + + /** LoadBitmapsL + * + * Loads clipart bitmap and mask + * + * @param - + * @return - + */ + void LoadBitmapsL(); + + /** AddIconL + * + * Adds icon to grid + * + * @param - + * @return - + */ + void AddIconL(); + + /** ExternalizeIconArrayL + * + * Externalize icon array + * + * @param - + * @return - + */ + void ExternalizeIconArrayL(); + + /** InternalizeIconArrayL + * + * Internalize icon array + * + * @param - + * @return - + */ + void InternalizeIconArrayL(); + +private: + + /// Selection grid + CClipartSelectionGrid* iGrid; + TFileName& iClipartFileName; + TInt& iClipartFileNameIndex; + + CAknIconArray* iIconArray; + CDesC16Array* iTextArray; + + CAknProgressDialog* iProgressDialog; + CClipartScaler* iClipartScaler; + RClipartList iClipartList; + CObCallback* iCallback; + CFbsBitmap* iCurrentBitmap; + CFbsBitmap* iCurrentMask; + TInt iClipartGridCellWidth; + TInt iClipartGridCellHeight; + TInt iCurrentIcon; + TInt iState; + TBool iBusy; + TBool iDoubleClick; + TBool iClick; + + }; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionGrid.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/ClipartSelectionGrid.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,106 @@ +/* +* 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: +* Header for clipart selection grid. +* +*/ + + +#ifndef CLIPARTINSELECTIONGRID_H +#define CLIPARTINSELECTIONGRID_H + +// INCLUDES +#include + + +// FORWARD DECLARATIONS + +/* CLASS: CClipartSelectionGrid +* +* CClipartSelectionGrid represents a clipart selection grid control in +* Nokia Still Image Editor. +*/ +class CClipartSelectionGrid : public CAknGrid +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CClipartSelectionGrid (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CClipartSelectionGrid (); + + /** Second phase constructor + * + * @param aParent - parent control + * @param aFlags - grid flags + * @param aItems - icon item array + * @return - + */ + virtual void ConstructL ( + const CCoeControl * aParent, + TInt aFlags); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /* MinimumSize + * + * @see CCoeControl + */ + virtual TSize MinimumSize(); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + +//@} + +/** @name Members:*/ +//@{ + + +//@} + +}; + + +#endif // EOF ClipartSelectionGrid.h diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/Clipart_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/Clipart_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,51 @@ +/* +* 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: +* +*/ + + +#include +#include "iepb_gen.loc" +#include + +// SOFTKEYS + +#define qtn_sie_pgn_sk1_options qtn_sie_iepb_softkey_options +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel + +#define qtn_sie_pgn_sk1_ok qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2_done qtn_sie_iepb_softkey_done + +// MENU ITEMS + +#define qtn_sie_pgn_menu_cancel qtn_sie_options_cancel_effect + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/ImageEditorClipartControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/ImageEditorClipartControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,623 @@ +/* +* 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: +* Control class for Clipart plugin. +* +*/ + + +#ifndef IMAGEEDITORCROPCONTROL_H +#define IMAGEEDITORCROPCONTROL_H + +// INCLUDES +#include +#include +#include +#include + +#include "PreviewControlBase.h" +#include "MTimerCallBack.h" +#include "ClipartSelectionDialog.h" + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; +class CSystemParameters; +class CClipartSelectionGrid; +class CJPTimer; +class CAknInfoPopupNoteController; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +/* CLASS: CImageEditorClipartControl +* +* CImageEditorClipartControl is a control for clipart insertion plug-in. +* +*/ +class CImageEditorClipartControl : public CPreviewControlBase, + public MCoeControlObserver, + public MEikListBoxObserver, + public MTimerCallBack + +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorClipartControl object + */ + static CImageEditorClipartControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorClipartControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + * + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Setter for view reference + * + * @see CImageEditorControlBase + * + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItem + * + * @see CImageEditorControlBase + * + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /** PrepareL + * + * @see CImageEditorControlBase + * + */ + virtual void PrepareL (); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL(); + + /* GetContextMenuResourceId + * + * @see CImageEditorControlBase + */ + virtual TInt GetContextMenuResourceId(); + + /* GetDimmedMenuItems + * + * @see CImageEditorControlBase + */ + virtual TBitField GetDimmedMenuItems(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetParam + * + * Gets pointer to the parameter struct. + * + * @param - + * @return - pointer to MIA parameter struct + */ + TDesC & GetParam (); + + /* SetSysteParameters + * + * Sets reference to system parameters to plug-in. + * + * @param aSysPars - System parameters instance + * @return - + */ + void SetSystemParameters (const CSystemParameters * aSysPars); + + /** IsReadyToRender + * + * Return ETrue if all parameters have valid value and filter + * can be rendered. + * + * @param - + * @return - ETrue if ready to render, otherwise EFalse + */ + TBool IsReadyToRender() const; + + /* GetHelpContext + * + * @see CCoeControl + * + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + /* TimerCallBack + * + * @see MTimerCallBack + * + */ + virtual void TimerCallBack(); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + /* HandleListBoxEventL + * + * @see CImageEditorControlBase + * + */ + void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType); + + /* HandleControlEventL + * + * @see CImageEditorControlBase + * + */ + void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType); + + /* SetBitmapL + * + * Sets clip-art bitmap to filter paramerters object + * + */ + void SetBitmapL(); + + /* SetBusy + * + * @see CImageEditorControlBase + * + */ + void SetBusy(); + + /* ResetBusy + * + * @see CImageEditorControlBase + * + */ + void ResetBusy(); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorClipartControl (); + + /** Draw + * + * @see CImageEditorControlBase + * + */ + virtual void Draw (const TRect & aRect) const; + + /** NaviDown + * + * Handles navi key down event. + * + * @param - + * @return - + */ + void NaviDown(); + + /** NaviUp + * + * Handles nave key up event. + * + * @param - + * @return - + */ + void NaviUp(); + + /** NaviRight + * + * Handles nave key right event. + * + * @param - + * @return - + */ + void NaviRight(); + + /** NaviLeft + * + * Handles nave key left event. + * + * @param - + * @return - + */ + void NaviLeft(); + + /** ToMoveState + * + * Handles transition to Move state. + * + * @param - + * @return - + */ + void ToMoveStateL(); + + /** ToResizeState + * + * Handles transition to Resize state. + * + * @param - + * @return - + */ + void ToResizeStateL(); + + /** ToRotateState + * + * Handles transition to Rotate state. + * + * @param - + * @return - + */ + void ToRotateStateL(); + + /** ToMainStateL + * + * Handles transition to Main state. + * + * @param - + * @return - + */ + void ToMainStateL(); + + /** StoreTempParams + * + * Store all parameters to temp variables. + * + * @param - + * @return - + */ + void StoreTempParams(); + + /** RestoreTempParams + * + * Restore parameters from temp variables. + * + * @param - + * @return - + */ + void RestoreTempParams(); + + /** SelectClipartL + * + * Select clipart and set to the parameter object + * + * @param - + * @return - + */ + void SelectClipartL(); + + /** LoadIndicatorL + * + * Loads indicator. + * + * @param aBitmapInd - indicator bitmap MBM index + * @param aMaskInd - indicator mask MBM index + * @return - + */ + void LoadIndicatorL ( + TInt aBitmapInd, + TInt aMaskInd + ); + + /** ComputeIndicatorPosition + * + * Computes indicator position. + * + * @param - + * @return - + */ + TPoint ComputeIndicatorPosition() const; + + /** StoreParameters + * + * Stores parameters to command line. + * + * @param - + * @return - + */ + void StoreParameters(); + + + /** StorePosAndScaleRelScreen + * + * Stores clipart position and scale relative to + * screen. + * + * @param - + * @return - + */ + void StorePosAndScaleRelScreen(); + + /** RestorePosAndScaleRelScreen + * + * Restores clipart position and scale relative to + * screen. + * + * @param - + * @return - + */ + void RestorePosAndScaleRelScreen(); + + /** StorePosAndScaleRelImage + * + * Stores scale and pan + * + * @param - + * @return - + */ + void StorePosAndScaleRelImage(); + + /** RestorePosAndScaleRelImage + * + * Stores scale and pan + * + * @param - + * @return - + */ + void RestorePosAndScaleRelImage(); + + /** ClipPosition + * + * Clips clipart position after screen mode change. + * + * @param - + * @return - + */ + void ClipPosition(); + + /** SetClipPosition + * + * Sets current clipart to a new position + * + * @param - aPointedPosition Middle point position on the screen where + * clip art should should be moved + * @return - + */ + void SetClipPosition( TPoint aPointedPosition ); + + /** ShowTooltip + * + * Show tooltip text on the screen. Tooltip text is set based + * on the current state. + * + * @param - + * @return - + */ + void ShowTooltip(); + + /** CalculateResize + * + * Function is used to calculate a new scale value when clipart is resized + * with touch. The value is calculated based on dragging start + * and end points. This function also changes scale variable member after + * calculation. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - TBool - ETrue if scale value is changed in the function + */ + TBool CalculateResize( TPoint aStartPoint, TPoint aEndPoint ); + + /** CalculateRotation + * + * Function is used to calculate rotation when clipart is rotated + * with touch. Needed rotation is calculated based on dragging start + * and end points. This function also changes rotation variables after + * calculation. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - TBool - ETrue if rotate value is changed in the function + */ + TBool CalculateRotation( TPoint aStartPoint, TPoint aEndPoint ); + +//@} + +/** @name Typedefs:*/ +//@{ + enum TInsertClipartState + { + // Invalid + EInsertClipartStateMin = 0, + // Select clipart + EInsertClipartStateSelect = 1<<1, + // Convert + EInsertClipartStateConvert = 1<<2, + // First time in main + EInsertClipartStateFirst = 1<<3, + // Main view + EInsertClipartStateMain = 1<<4, + // Move + EInsertClipartStateMove = 1<<5, + // Rotate + EInsertClipartStateRotate = 1<<6, + // Resize + EInsertClipartStateResize = 1<<7, + // Invalid + EInsertClipartStateMax = 1<<8 + } iState; + +//@} + + +/** @name Members:*/ +//@{ + + /// Editor view + CAknView * iEditorView; + + /// System parameters + const CSystemParameters* iSysPars; + + /// Plug-in info + CPluginInfo * iItem; + + /// Navigation pane text + TBuf<64> iNaviPaneText; + + /// Clipart x position + TInt iX; + /// Clipart y position + TInt iY; + /// Clipart scale + TInt iScale; + /// Clipart scale minimum + TInt iScaleMin; + /// Clipart scale maximum + TInt iScaleMax; + /// Clipart angle + TInt iAngle; + /// Do we scale clipart to maximum height + TBool iScaleToHeight; + + TInt iScaleOld; + TInt iPosXOld; + TInt iPosYOld; + + /// Temp params + TInt iTempX; + TInt iTempY; + TInt iTempScale; + TInt iTempAngle; + + /// Popup list + CClipartSelectionDialog* iPopupList; + + /// Clipart filename + TFileName iClipartFileName; + + /// Clipart filename index + TInt iClipartFileNameIndex; + + /// Resource reader + RConeResourceLoader iResLoader; + + /// Timer for fast key events + CJPTimer * iTimer; + TUint32 iKeyCode; + + /// Number of ticks since timer start + TInt iTickCount; + + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; + + /// Showing Ok options menu, where some items are dimmed + TBool iDisplayingOkOptionsMenu; + + /// Plug-in is ready to render the image + TBool iReadyToRender; + + /// State indicator glyph + CFbsBitmap * iIndicator; + CFbsBitmap * iIndicatorMask; + + /// Clipart parameter + TBuf<256> iParam; + + + // Popup controller + CAknInfoPopupNoteController* iPopupController; + // Tooltip texts + HBufC * iTooltipResize; + HBufC * iTooltipMove; + HBufC * iTooltipRotate; + + // Previous pen position. Make touch rotating and resizing possible + TPoint iPointerPosition; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ + +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/ImageEditorClipartPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/ImageEditorClipartPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,150 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORCLIPARTPLUGIN_H +#define IMAGEEDITORCLIPARTPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; +class CSystemParameters; + + +/* CLASS: CImageEditorClipartPlugin +* +* CImageEditorClipartPlugin represents clipart insertion plug-in for Image Editor +* application. +* +*/ +class CImageEditorClipartPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorClipartPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorClipartPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorClipartPlugin (const CImageEditorClipartPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorClipartPlugin & operator= (const CImageEditorClipartPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// System Parameters + const CSystemParameters * iSysPars; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/inc/clipart.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/inc/clipart.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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: +* +*/ + + + +#ifndef CLIPART_HRH +#define CLIPART_HRH + +#include "ImageEditorPluginBase.hrh" +#include "avkon.hrh" + +enum TClipartPgnCommandId +{ + EClipartPgnMenuCmdMin = EPgnMenuCmdIdBase, + EClipartPgnMenuCmdDone, + EClipartPgnMenuCmdMove, + EClipartPgnMenuCmdResize, + EClipartPgnMenuCmdRotate, + EClipartPgnMenuCmdCancel, + EClipartPgnMenuCmdMax +}; + +enum +{ + EClipartSelectionGrid = 5000 +}; + +enum +{ + EClipartCustomControlType = 10000 +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/rom/ImageEditorClipartPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/rom/ImageEditorClipartPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __CLIPARTPLUGIN_IBY__ +#define __CLIPARTPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Clipart.pgn SHARED_LIB_DIR\Clipart.pgn + +// Resources +data=DATAZ_\resource\apps\Clipart.mif \resource\apps\Clipart.mif + +#endif // __CLIPARTPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/rom/ImageEditorClipartPluginSettings.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/rom/ImageEditorClipartPluginSettings.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __CLIPARTPLUGINSETTINGS_IBY__ +#define __CLIPARTPLUGINSETTINGS_IBY__ + +// Clipart data +data=DATAZ_\private\101ffa91\cliparts\Cliparts01.mbm \private\101ffa91\cliparts\Cliparts01.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts02.mbm \private\101ffa91\cliparts\Cliparts02.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts03.mbm \private\101ffa91\cliparts\Cliparts03.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts04.mbm \private\101ffa91\cliparts\Cliparts04.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts05.mbm \private\101ffa91\cliparts\Cliparts05.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts06.mbm \private\101ffa91\cliparts\Cliparts06.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts07.mbm \private\101ffa91\cliparts\Cliparts07.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts08.mbm \private\101ffa91\cliparts\Cliparts08.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts09.mbm \private\101ffa91\cliparts\Cliparts09.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts10.mbm \private\101ffa91\cliparts\Cliparts10.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts11.mbm \private\101ffa91\cliparts\Cliparts11.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts12.mbm \private\101ffa91\cliparts\Cliparts12.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts13.mbm \private\101ffa91\cliparts\Cliparts13.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts14.mbm \private\101ffa91\cliparts\Cliparts14.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts15.mbm \private\101ffa91\cliparts\Cliparts15.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts16.mbm \private\101ffa91\cliparts\Cliparts16.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts17.mbm \private\101ffa91\cliparts\Cliparts17.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts18.mbm \private\101ffa91\cliparts\Cliparts18.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts19.mbm \private\101ffa91\cliparts\Cliparts19.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts20.mbm \private\101ffa91\cliparts\Cliparts20.mbm +data=DATAZ_\private\101ffa91\cliparts\Cliparts21.mbm \private\101ffa91\cliparts\Cliparts21.mbm +#endif // __CLIPARTPLUGINSETTINGS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/src/ClipartScaler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/src/ClipartScaler.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,78 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include + +#include "ClipartScaler.h" +#include "ImageEditorError.h" + + +//============================================================================= +CClipartScaler::CClipartScaler (MClipartScalerNotifier* aNotifier) +: CActive(0), iNotifier(aNotifier) + { + } + +//============================================================================= +CClipartScaler::~CClipartScaler () + { + Cancel(); + delete iBitmapScaler; + iBitmapScaler = 0; + } + +//============================================================================= +void CClipartScaler::ConstructL () + { + CActiveScheduler::Add(this); + iBitmapScaler = CBitmapScaler::NewL(); + } + +//============================================================================= +void CClipartScaler::ScaleBitmapL(CFbsBitmap* aBitmap, TSize aNewSize) + { + iBitmapScaler->Scale(&iStatus, *aBitmap, aNewSize); + SetActive(); + } + +//============================================================================= +void CClipartScaler::DoCancel() + { + if(IsActive()) + { + iBitmapScaler->Cancel(); + } + } + +//============================================================================= +void CClipartScaler::RunL() + { + if (iStatus == KErrNone) + { + iNotifier->ClipartScalerOperationReadyL(KErrNone); + } + else + { + iNotifier->ClipartScalerOperationReadyL(KSIEEInternal); + } + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/src/ClipartSelectionDialog.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/src/ClipartSelectionDialog.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,948 @@ +/* +* 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: +* Dialog for clipart plugin. +* +*/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ClipartSelectionGrid.h" +#include "ClipartScaler.h" +#include "Callback.h" +#include "Clipart.hrh" +#include "ClipartSelectionDialog.h" +#include "ResolutionUtil.h" +#include "ImageEditorUI.hrh" +#include "iepb.h" +#include "ImageEditorError.h" +#include + +// debug log +//#include "ImageEditorClipartLogFile.h" +#include "imageeditordebugutils.h" + +_LIT(KClipartPluginLogFile,"ClipartPlugin.log"); + +// Constants +const TInt KDefaultNumberOfCliparts = 51; + +const TInt KStandardClipartGridCellWidth = 40; +const TInt KStandardClipartGridCellHeight = 30; + +const TInt KQVGAClipartGridCellWidth = 55; +const TInt KQVGAClipartGridCellHeight = 46; + +const TInt KDoubleClipartGridCellWidth = 80; +const TInt KDoubleClipartGridCellHeight = 60; + +const TInt KVGAClipartGridCellWidth = 95; +const TInt KVGAClipartGridCellHeight = 60; + +const TInt KQHDClipartGridCellWidth = 75; +const TInt KQHDClipartGridCellHeight = 65; + +const TInt KClipartGridCellGap = 0; + +//const TInt KScrollBarWidth = 3; + +const TInt KProgressInterval = 5; + +_LIT (KClipartResourceFile, "clipart.rsc"); +_LIT (KClipartFileWild, "*.mbm"); +_LIT( KClipartExternalizeFile, "c:\\private\\101FFA91\\ClipartStorage.ini"); + + +//============================================================================= +CClipartSelectionDialog::CClipartSelectionDialog(TFileName& aClipartFileName, TInt& aClipartFileNameIndex) + : CEikDialog() + , iGrid(NULL) + , iClipartFileName(aClipartFileName) + , iClipartFileNameIndex(aClipartFileNameIndex) + , iIconArray(NULL) + , iTextArray(NULL) + , iProgressDialog(NULL) + , iClipartScaler(NULL) + , iCallback(NULL) + , iCurrentBitmap(NULL) + , iCurrentMask(NULL) + , iCurrentIcon(0) + , iState(EIdle) + , iBusy(ETrue) + , iDoubleClick(EFalse) + , iClick(EFalse) + { + + } +//============================================================================= +CClipartSelectionDialog::~CClipartSelectionDialog() + { + if (iCallback) + { + iCallback->Cancel(); + } + delete iCallback; + + if (iClipartScaler) + { + iClipartScaler->Cancel(); + } + delete iClipartScaler; + + if (iIconArray) + { + delete iIconArray; + iIconArray = NULL; + } + if (iTextArray) + { + delete iTextArray; + iTextArray = NULL; + } + + iClipartList.Close(); + delete iCurrentBitmap; + delete iCurrentMask; + delete iProgressDialog; + + delete iGrid; + } + + +//============================================================================= +void CClipartSelectionDialog::ConstructL(MCoeControlObserver* aParent) +{ + + SetObserver(aParent); + + iClipartScaler = new (ELeave) CClipartScaler(this); + iClipartScaler->ConstructL(); + + // Callback + iCallback = CObCallback::NewL(this); + + // Create icon and text arrays + iIconArray = new(ELeave) CAknIconArray(KDefaultNumberOfCliparts); + iTextArray = new(ELeave) CDesC16ArrayFlat(KDefaultNumberOfCliparts); + + TInt screenMode = CResolutionUtil::Self()->GetScreenMode(); + + switch (screenMode) + { + + case CResolutionUtil::EDouble: + case CResolutionUtil::EDoubleFullScreen: + case CResolutionUtil::EDoubleLandscape: + case CResolutionUtil::EDoubleLandscapeFullScreen: + { + iClipartGridCellWidth = KDoubleClipartGridCellWidth; + iClipartGridCellHeight = KDoubleClipartGridCellHeight; + break; + } + + case CResolutionUtil::EQVGA: + case CResolutionUtil::EQVGAFullScreen: + case CResolutionUtil::EQVGALandscape: + case CResolutionUtil::EQVGALandscapeFullScreen: + { + iClipartGridCellWidth = KQVGAClipartGridCellWidth; + iClipartGridCellHeight = KQVGAClipartGridCellHeight; + break; + } + + case CResolutionUtil::EVGA: + case CResolutionUtil::EVGAFullScreen: + case CResolutionUtil::EVGALandscape: + case CResolutionUtil::EVGALandscapeFullScreen: + { + iClipartGridCellWidth = KVGAClipartGridCellWidth; + iClipartGridCellHeight = KVGAClipartGridCellHeight; + break; + } + + case CResolutionUtil::EQHD: + case CResolutionUtil::EQHDFullScreen: + case CResolutionUtil::EQHDLandscape: + case CResolutionUtil::EQHDLandscapeFullScreen: + { + iClipartGridCellWidth = KQHDClipartGridCellWidth; + iClipartGridCellHeight = KQHDClipartGridCellHeight; + break; + } + default: + { + iClipartGridCellWidth = KStandardClipartGridCellWidth; + iClipartGridCellHeight = KStandardClipartGridCellHeight; + break; + } + } + + // Check that if externalize file exists + RFs& fs = ControlEnv()->FsSession(); + BaflUtils::EnsurePathExistsL( fs, KClipartExternalizeFile() ); + + if( BaflUtils::FileExists(fs, KClipartExternalizeFile()) ) + { + FindClipartsL(); + + // Internalize icons if externalize file exists + TRAPD(err, + InternalizeIconArrayL(); + ); + + if (err) + { + // if error delete externalization file + BaflUtils::DeleteFile( + ControlEnv()->FsSession(), + KClipartExternalizeFile() + ); + + User::Leave(err); + } + + iCallback->DoCallback(0); + } + else + { + + // Find Cliparts + FindClipartsL(); + + // Create progress note dialog + iProgressDialog = new ( ELeave ) CAknProgressDialog( reinterpret_cast(&iProgressDialog) ); + iProgressDialog->PrepareLC(R_CLIPART_PROGRESS_NOTE); + iProgressDialog->GetProgressInfoL()->SetFinalValue( iClipartList.Count() ); + iProgressDialog->SetCallback ( (MProgressDialogCallback *) this); + iProgressDialog->RunLD(); + + // Load clipart bitmaps for the grid - asynchronous method + LoadBitmapsL(); + + } + + +} + +//============================================================================= +void CClipartSelectionDialog::PreLayoutDynInitL () +{ + + CAknGrid* grid = (CAknGrid*)ControlOrNull(EClipartSelectionGrid); + + // Set icon array to grid + grid->ItemDrawer()->FormattedCellData()->SetIconArray(iIconArray); + iIconArray = NULL; // ownership moved + + grid->Model()->SetItemTextArray(iTextArray); + iTextArray = NULL; // ownership moved + + TRect clientRect; + CResolutionUtil::Self()->GetClientRect(clientRect); + + grid->SetRect(clientRect); + + TInt xOffset( 0 ); + TAknWindowLineLayout lineLayout; + TAknLayoutRect layoutRect; + TInt variety( 0 ); + TRect scrollPaneRect; + if( Layout_Meta_Data::IsLandscapeOrientation() ) + { + variety = 1; + } + + if( AknLayoutUtils::LayoutMirrored() ) + { + // scroll_pane_cp029 + lineLayout = + AknLayoutScalable_Apps::scroll_pane_cp029( variety ).LayoutLine(); + layoutRect.LayoutRect( Rect(), lineLayout ); + scrollPaneRect = layoutRect.Rect(); + xOffset = scrollPaneRect.Width() + 5; + } + + TInt rows = clientRect.Height() / iClipartGridCellHeight; + TInt columns = (clientRect.Width() - scrollPaneRect.Width()) / iClipartGridCellWidth; + + AknListBoxLayouts::SetupGridPos( *grid, + xOffset, + 0, + -1, + -1, + iClipartGridCellWidth, + iClipartGridCellHeight ); + + // Set grid layout + grid->SetLayoutL ( + EFalse, + ETrue, + ETrue, + columns, + rows, + TSize(iClipartGridCellWidth, iClipartGridCellHeight) + ); + + grid->SetPrimaryScrollingType (CAknGridView::EScrollIncrementLineAndLoops); + grid->SetSecondaryScrollingType (CAknGridView::EScrollIncrementLineAndLoops); + + // Set gaps between items + ((CAknGridView*)grid->View())-> + SetSpacesBetweenItems(TSize(KClipartGridCellGap,KClipartGridCellGap)); + + grid->SetCurrentDataIndex (0); + + SetupGrid(); + + // Set scroll bar + grid->CreateScrollBarFrameL(ETrue, EFalse); + grid->ScrollBarFrame()-> + SetScrollBarVisibilityL(CEikScrollBarFrame::EAuto, CEikScrollBarFrame::EAuto); + + // Inform list box about new icons + grid->HandleItemAdditionL(); + + grid->SetListBoxObserver(this); + TBool iLandscape = CResolutionUtil::Self()->GetLandscape(); + if (iLandscape) + { + grid->ItemDrawer()->ColumnData()->SetSkinEnabledL(ETrue); + CAknsListBoxBackgroundControlContext* context = static_cast(grid->ItemDrawer()->ColumnData()->SkinBackgroundContext()); + TRect bgRect = clientRect; + + TRect spRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EBatteryPane, spRect); + + bgRect.iTl.iY-=spRect.Height(); + context->SetRect(bgRect); + context->SetBitmap( KAknsIIDQsnBgAreaMainFlat ); + + } + // Reset busy flag + SetBusy(EFalse); + +} + +//============================================================================= +void CClipartSelectionDialog::SetSizeAndPosition( const TSize& aSize) +{ + CEikDialog::SetSizeAndPosition(aSize); + +} + +//============================================================================= +TBool CClipartSelectionDialog::OkToExitL( TInt aButtonId ) + { + if ( aButtonId == EAknSoftkeyOk || aButtonId == EAknSoftkeySelect) + { + ClipartFilenameL(iClipartFileName, iClipartFileNameIndex); + return ETrue; + } + else + { + return EFalse; + } + } + +//============================================================================= + +TBool CClipartSelectionDialog::CallbackMethodL ( TInt /*aParam*/ ) +{ + LOG(KClipartPluginLogFile, "CClipartSelectionDialog::CallbackMethodL()"); + + // Report that the grid is ready + ReportEventL(MCoeControlObserver::EEventStateChanged); + + return EFalse; +} + +//============================================================================= +TKeyResponse CClipartSelectionDialog::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + TKeyResponse result = EKeyWasNotConsumed; + if ( + ( aKeyEvent.iCode == EKeyEnter ) + ) + { + TryExitL( EAknSoftkeyOk ); + result = EKeyWasConsumed; + } + else + { + result = CEikDialog::OfferKeyEventL( aKeyEvent, aType ); + } + return result; + +} + +//============================================================================= +void CClipartSelectionDialog::FindClipartsL() +{ + LOG(KClipartPluginLogFile, "CClipartSelectionGrid::FindClipartsL()"); + + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KClipartResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Get reference to application file session + RFs & fs = ControlEnv()->FsSession(); + + // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile + // to search for a localised resource in proper search order + RConeResourceLoader resLoader( *ControlEnv() ); + resLoader.OpenL ( resourcefile ); + CleanupClosePushL(resLoader); + + CDesCArrayFlat* array = + ControlEnv()->ReadDesCArrayResourceL(R_CLIPART_DIRS); + CleanupStack::PushL(array); + + TBuf<256> pathList; + _LIT(KPathSeparator, ";"); + + for (TInt i = 0; i < array->Count(); ++i) + { + pathList.Append((*array)[i]); + pathList.Append(KPathSeparator); + } + CleanupStack::PopAndDestroy(2); // resLoader, array + + // Create a file finder + TFindFile fileFinder (fs); + CDir * fileList = NULL; + + // Find files by wild card and directory + TInt err = fileFinder.FindWildByPath ( + KClipartFileWild, + &pathList, + fileList + ); + + LOGFMT(KClipartPluginLogFile, "CClipartSelectionGrid::FindClipartsL: found %d cliparts", fileList->Count()); + + // Trace leave + if (err) + { + LOGFMT(KClipartPluginLogFile, "CClipartSelectionGrid::FindClipartsL: FindWildByPath returned %d. Leaving...", err); + User::LeaveIfError(KSIEEInternal); + } + + // Go through files + while (err == KErrNone) + { + CleanupStack::PushL (fileList); + + // Check all plug-in candidates + for (TInt i = 0; i < fileList->Count(); ++i) + { + + // Create a full file name for a MBM file + TParse fullentry; + fullentry.Set ( + (*fileList)[i].iName,& + fileFinder.File(), + 0 + ); + TPtrC fullname (fullentry.FullName()); + + // Check the amount of frames + TInt err_bmp = KErrNone; + TInt j = 0; + + while (err_bmp == KErrNone) + { + // Try to load next bitmap. + // KErrNotFound if no more bitmaps + CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL (bitmap); + err_bmp = bitmap->Load (fullname, j); + + CFbsBitmap* bitmapMask = new (ELeave) CFbsBitmap; + CleanupStack::PushL (bitmapMask); + TInt err_mask = bitmapMask->Load (fullname, j + 1); + + if (err_bmp == KErrNone && err_mask != KErrNone) + { + User::Leave(KSIEEInternal); + } + + if (err_bmp == KErrNone) + { + + // Add filename-index pair to the clipart list + TClipartListItem item; + item.iFilename = fullname; + item.iIndex = j; + iClipartList.Append(item); + + } + CleanupStack::PopAndDestroy(2); // bitmap, mask + + j += 2; + } + } + + CleanupStack::PopAndDestroy(); /// fileList + + // Try once again + err = fileFinder.FindWild (fileList); + + } + +} + + +//============================================================================= +void CClipartSelectionDialog::LoadBitmapsL() + { + LOG(KClipartPluginLogFile, "CClipartSelectionGrid::LoadBitmapsL()"); + + // Create and load new one + iCurrentBitmap = new (ELeave) CFbsBitmap; + User::LeaveIfError(iCurrentBitmap->Load( + iClipartList[iCurrentIcon].iFilename, + iClipartList[iCurrentIcon].iIndex)); + + // Create and load new one + iCurrentMask = new (ELeave) CFbsBitmap; + User::LeaveIfError(iCurrentMask->Load( + iClipartList[iCurrentIcon].iFilename, + iClipartList[iCurrentIcon].iIndex + 1)); + + // Scale bitmap to grid size + iState = EScalingBitmap; + iClipartScaler->ScaleBitmapL( + iCurrentBitmap, + TSize(iClipartGridCellWidth, iClipartGridCellHeight)); + } + +//============================================================================= +void CClipartSelectionDialog::AddIconL() + { + LOG(KClipartPluginLogFile, "CClipartSelectionGrid::AddIconL()"); + // Create icon + CGulIcon* icon = NULL; + icon = CGulIcon::NewLC(); + icon->SetBitmapsOwnedExternally (EFalse); + + // Set bitmap to icon and append icon to icon array + icon->SetBitmap (iCurrentBitmap); + iCurrentBitmap = NULL; + icon->SetMask(iCurrentMask); + iCurrentMask = NULL; + iIconArray->AppendL(icon); + + CleanupStack::Pop(); // icon + + // Create grid item text + TBuf<8> buf; + buf.AppendNum (iCurrentIcon); + buf.Append(_L("\t1")); + iTextArray->AppendL (buf); + + // Increase current icon index + iCurrentIcon++; + + // Load next icon + // one step begins. + if (iProgressDialog && (iCurrentIcon % KProgressInterval) == 0) + { + iProgressDialog->GetProgressInfoL()->IncrementAndDraw (KProgressInterval); + } + if (iCurrentIcon < iClipartList.Count()) + { + + LoadBitmapsL(); + } + else + { + + // Externalize loaded icons + TRAPD(err, + ExternalizeIconArrayL(); + ); + if (err) + { + // if error delete externalization file + BaflUtils::DeleteFile( + ControlEnv()->FsSession(), + KClipartExternalizeFile() + ); + } + // dismiss progress dialog + if (iProgressDialog) + { + iProgressDialog->ProcessFinishedL(); + } + + SetBusy(EFalse); + + // Report that the grid is ready + ReportEventL(MCoeControlObserver::EEventStateChanged); + } + } + + +//============================================================================= +void CClipartSelectionDialog::ClipartScalerOperationReadyL(TInt aError) + { + if (aError == KErrNone) + { + + switch (iState) + { + case EScalingBitmap: + { + // Scale the mask bitmap + iState = EScalingMask; + iClipartScaler->ScaleBitmapL( + iCurrentMask, + TSize(iClipartGridCellWidth, iClipartGridCellHeight)); + break; + } + case EScalingMask: + { + iState = EIdle; + // Add icon to grid + AddIconL(); + break; + } + default: + { + break; + } + } + } + else + { + User::Leave(KSIEEInternal); + } + } + +//============================================================================= +void CClipartSelectionDialog::DialogDismissedL( TInt aButtonId ) +{ + LOGFMT(KClipartPluginLogFile, "CClipartSelectionGrid::DialogDismissedL(%d)", aButtonId); + + CAknGrid* grid = (CAknGrid*)ControlOrNull(EClipartSelectionGrid); + + if( aButtonId == EAknSoftkeyCancel ) + { + // Cancel the on-going image decoding + iClipartScaler->Cancel(); + +// grid->HandleItemAdditionL(); + + // Report cancel request + ReportEventL(MCoeControlObserver::EEventRequestCancel); + } + +} + +//============================================================================= +void CClipartSelectionDialog::ClipartFilenameL(TDes& aFilename, TInt& aIndex) + { + CAknGrid* grid = (CAknGrid*)ControlOrNull(EClipartSelectionGrid); + + // Get MBM file and icon index of the selected clip-art + aFilename = iClipartList[grid->CurrentItemIndex()].iFilename; + aIndex = iClipartList[grid->CurrentItemIndex()].iIndex; + } + +//============================================================================= +void CClipartSelectionDialog::SetupGrid () +{ + + CAknGrid* grid = (CAknGrid*)ControlOrNull(EClipartSelectionGrid); + + LOG(KClipartPluginLogFile, "CClipartSelectionGrid::SetupGrid()"); + + // Setup text foreground and background colors to default + AknListBoxLayouts::SetupStandardGrid (*grid); + + // Get local copies of data we will need + CFormattedCellListBoxItemDrawer * itemDrawer = grid->ItemDrawer(); + + TInt cell_w = grid->ColumnWidth(); + TInt cell_h = grid->ItemHeight(); + + // Set up graphics sub-cells + AknListBoxLayouts::SetupGridFormGfxCell ( + *grid, // the grid + itemDrawer, // the grid's drawer + 0, // index of the graphic within item strings + 0, // left position + 0, // top position + 0, // right - unused + 0, // bottom - unused + cell_w, // width of graphic + cell_h, // height of graphic + TPoint (0, 0), // start position + TPoint (cell_w, cell_h) // end position + ); + +} + +//============================================================================= +void CClipartSelectionDialog::InternalizeIconArrayL() +{ + LOG(KClipartPluginLogFile, "CClipartSelectionGrid::InternalizeIconArrayL()"); + + // Internalize clipart icons + RFileReadStream stream; + + User::LeaveIfError ( + stream.Open ( + ControlEnv()->FsSession(), + KClipartExternalizeFile(), + EFileRead | EFileShareReadersOnly + )); + stream.PushL(); + + CGulIcon* icon = NULL; + CFbsBitmap* bitmap = NULL; + + TInt count = stream.ReadInt32L(); + for ( TInt i=0; i < count; i++ ) + { + icon = CGulIcon::NewLC(); + icon->SetBitmapsOwnedExternally (EFalse); + + // Text index + TInt len = stream.ReadInt32L(); + HBufC* iconText = HBufC::NewLC(len); + TPtr iconTextPtr = iconText->Des(); + stream >> iconTextPtr; + + iTextArray->AppendL(iconTextPtr); + + CleanupStack::PopAndDestroy(); // iconText + + // Bitmap Data + + bitmap = new(ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + + stream >> *bitmap; + + // Save data + //TBuf<20> name; + //name.Format(_L("bitmap%d.mbm"), i); + //bitmap->Save(name); + + // Set bitmap to icon - Ownership is transfered + icon->SetBitmap (bitmap); + + CleanupStack::Pop(); + + bitmap = new(ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + + stream >> *bitmap; + + //TBuf<20> name2; + //name2.Format(_L("mask%d.mbm"), i); + //bitmap->Save(name2); + + // Set bitmap to icon - Ownership transfers + icon->SetMask(bitmap); + + CleanupStack::Pop(); + bitmap = NULL; + + // Set icon to icon array + iIconArray->AppendL(icon); + + CleanupStack::Pop(); // icon + icon = NULL; + + } + + CleanupStack::PopAndDestroy(); // stream + +} + + +//============================================================================= +void CClipartSelectionDialog::ExternalizeIconArrayL() +{ + LOG(KClipartPluginLogFile, "CClipartSelectionGrid::ExternalizeIconArrayL()"); + + RFileWriteStream stream; + + User::LeaveIfError ( + stream.Replace ( + ControlEnv()->FsSession(), + KClipartExternalizeFile(), + EFileWrite + )); + stream.PushL(); + + // Externalize the contents of clipart + stream.WriteInt32L( iTextArray->Count() ); + + for ( TInt i=0; i< iTextArray->Count(); i++ ) + { + // Text index + TPtrC text = (*iTextArray)[i]; + stream.WriteInt32L(text.Length()); + stream << text; + + // Bitmap + CFbsBitmap* bitmap = (*iIconArray)[i]->Bitmap(); + stream << *bitmap; + bitmap = NULL; + + // Mask + bitmap = (*iIconArray)[i]->Mask(); + stream << *bitmap; + bitmap = NULL; + + } + + // Write extra before commiting + stream.WriteInt32L( 0 ); + + stream.CommitL(); + + CleanupStack::PopAndDestroy(); // stream + +} + +//============================================================================= +void CClipartSelectionDialog::SetBusy(TBool aBusy) +{ + iBusy = aBusy; +} + +//============================================================================= +SEikControlInfo CClipartSelectionDialog::CreateCustomControlL(TInt aControlType) +{ + + SEikControlInfo controlInfo; + controlInfo.iControl = NULL; + controlInfo.iTrailerTextId = 0; + controlInfo.iFlags = 0; + + switch (aControlType) + { + + case EClipartCustomControlType: + { + controlInfo.iControl = new(ELeave) CClipartSelectionGrid; + break; + } + + default: + { + break; + } + + } + + return controlInfo; +} + +void CClipartSelectionDialog::HandleListBoxEventL(CEikListBox* /*aListBox*/, TListBoxEvent aEventType) +{ + if ( aEventType == EEventItemDoubleClicked ) + { + iDoubleClick = ETrue; + } + // also single click is enough for selecting item + else if ( aEventType == EEventItemClicked ) + { + iClick = ETrue; + } +} + +void CClipartSelectionDialog::HandleDialogPageEventL(TInt /*aEventId*/) +{ + if( iDoubleClick || iClick ) + { + TryExitL( EAknSoftkeyOk ); + } +} + +void CClipartSelectionDialog::HandleResourceChange(TInt aType) +{ + CEikDialog::HandleResourceChange(aType); + if( aType == KEikDynamicLayoutVariantSwitch ) + { + CAknGrid* grid = (CAknGrid*)ControlOrNull(EClipartSelectionGrid); + if ( grid ) + { + TRect clientRect = Rect(); + grid->SetRect(clientRect); + TInt xOffset( 0 ); + TAknWindowLineLayout lineLayout; + TAknLayoutRect layoutRect; + TInt variety( 0 ); + TRect scrollPaneRect; + if( Layout_Meta_Data::IsLandscapeOrientation() ) + { + variety = 1; + } + + if( AknLayoutUtils::LayoutMirrored() ) + { + // scroll_pane_cp029 + lineLayout = + AknLayoutScalable_Apps::scroll_pane_cp029( variety ).LayoutLine(); + layoutRect.LayoutRect( Rect(), lineLayout ); + scrollPaneRect = layoutRect.Rect(); + xOffset = scrollPaneRect.Width() + 5; + } + TInt rows = clientRect.Height() / iClipartGridCellHeight; + TInt columns = (clientRect.Width() - scrollPaneRect.Width()) / iClipartGridCellWidth; + + // Set grid layout + + grid->SetLayoutL ( + EFalse, + ETrue, + ETrue, + columns, + rows, + TSize(iClipartGridCellWidth, iClipartGridCellHeight) + ); + + } + } +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/src/ClipartSelectionGrid.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/src/ClipartSelectionGrid.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// INCLUDE +#include "ClipartSelectionGrid.h" + + +//============================================================================= +CClipartSelectionGrid::CClipartSelectionGrid () : +CAknGrid() +{ + +} + +//============================================================================= +CClipartSelectionGrid::~CClipartSelectionGrid () +{ + +} + +//============================================================================= +void CClipartSelectionGrid::ConstructL ( + const CCoeControl * aParent, + TInt aFlags) +{ + + SetContainerWindowL(*aParent); + CAknGrid::ConstructL(aParent, aFlags); + + ActivateL(); + +} + +//============================================================================= +TSize CClipartSelectionGrid::MinimumSize() +{ + //return Rect().Size(); + return CEikonEnv::Static()->EikAppUi()->ClientRect().Size(); +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/src/ImageEditorClipartControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/src/ImageEditorClipartControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1747 @@ +/* +* 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: +* Control class for clipart plugin. +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "ImageEditorUI.hrh" +#include "ImageEditorPluginBase.hrh" +#include "clipart.hrh" +#include "JpTimer.h" +#include "PluginInfo.h" +#include "ImageEditorUids.hrh" +#include "ImageEditorUiDefs.h" +#include "iepb.h" +#include "SystemParameters.h" +#include "ResolutionUtil.h" + +#include "ImageEditorClipartControl.h" +#include "ClipartSelectionGrid.h" + +//#include "platform_security_literals.hrh" + +// debug log +#include "imageeditordebugutils.h" +_LIT(KClipartPluginLogFile,"ClipartPlugin.log"); + +// CONSTANTS + +// TIMER WAIT +const TInt KWait = 100; + +// CLIPART POSITION +const TInt KPosParamStep = 8; + +// CLIPART SCALE +const TInt KScaleParamStep = 50; +const TInt KTouchScaleMaxStepCount = 20; + +// CLIPART ANGLE +const TInt KDegreeMultiplier = 1000; +const TInt KAngleParamMax = 359000; +const TInt KAngleParam90Deg = 90000; +const TInt KAngleParamDef = 0; +const TInt KAngleParamStep = 2000; + +// RESOURCE INDICES +const TInt KSelectClipartIndex = 0; +const TInt KMainClipartIndex = 1; +const TInt KMoveClipartIndex = 2; +const TInt KResizeClipartIndex = 3; +const TInt KRotateClipartIndex = 4; + +_LIT (KPgnResourceFile, "clipart.rsc"); +_LIT(KComponentName, "ImageEditorClipartPlugin"); + +//============================================================================= +CImageEditorClipartControl * CImageEditorClipartControl::NewL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + CImageEditorClipartControl * self = new (ELeave) CImageEditorClipartControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CImageEditorClipartControl::CImageEditorClipartControl () : +iState (EInsertClipartStateMin), +iResLoader ( * ControlEnv() ), +iTickCount (0), +iNaviStepMultiplier (KDefaultSmallNavigationStepMultiplier), +iDisplayingOkOptionsMenu(EFalse), +iReadyToRender(EFalse) +{ + +} + +//============================================================================= +CImageEditorClipartControl::~CImageEditorClipartControl () +{ + delete iIndicator; + delete iIndicatorMask; + delete iTimer; + iResLoader.Close(); + iSysPars = NULL; + iEditorView = NULL; + iItem = NULL; + if (iPopupList) + { + delete iPopupList; + iPopupList = NULL; + } + delete iPopupController; + delete iTooltipResize; + delete iTooltipMove; + delete iTooltipRotate; +} + +//============================================================================= +void CImageEditorClipartControl::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * aParent + ) +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::ConstructL()"); + + // Set parent window + SetContainerWindowL (*aParent); + + // Create resource utility + TFileName resFile; + resFile.Append(KPgnResourcePath); + resFile.Append(KPgnResourceFile); + + 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 ); + + + iPopupController = CAknInfoPopupNoteController::NewL(); + + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read tooltip resources + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + RConeResourceLoader resLoader ( *CEikonEnv::Static() ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + iTooltipResize = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CLIPART_RESIZE); + iTooltipMove = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CLIPART_MOVE); + iTooltipRotate = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CLIPART_ROTATE); + CleanupStack::PopAndDestroy(); // resLoader + + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + // Activate control + ActivateL(); + + EnableDragEvents(); + +} + +//============================================================================= +void CImageEditorClipartControl::PrepareL () +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::PrepareL()"); + + // Set busy flag untill the bitmap has been decoded + SetBusy(); + + // Main view navi pane text + iNaviPaneText.Copy ( iItem->Parameters()[KSelectClipartIndex] ); + + // Popup list to contain the grid + iPopupList = new (ELeave) CClipartSelectionDialog(iClipartFileName, iClipartFileNameIndex); + iPopupList->ConstructL(this); + +} + +//============================================================================= +TBool CImageEditorClipartControl::IsReadyToRender() const +{ + return iReadyToRender; +} + + +//============================================================================= +void CImageEditorClipartControl::HandleControlEventL(CCoeControl* /*aControl*/,TCoeEvent aEventType) +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::HandleControlEventL()"); + + // When the icons have been decoded, launch the grid. + if (aEventType == EEventStateChanged) + { + __ASSERT_ALWAYS( iPopupList, User::Panic( KComponentName, KErrNotReady)); + + TBool fullscreen = CResolutionUtil::Self()->GetFullScreen(); + if (fullscreen) + { + iEditorView->HandleCommandL (EImageEditorMenuCmdNormalScreen); + } + TInt popupOk = iPopupList->ExecuteLD(R_CLIPART_SELECTION_DIALOG); + iPopupList = NULL; + + if (fullscreen) + { + iEditorView->HandleCommandL (EImageEditorMenuCmdFullScreen); + } + + if (popupOk) + { + ToMoveStateL(); + SelectClipartL(); + StoreTempParams(); + ResetBusy(); + } + else + { + LOG(KClipartPluginLogFile, "HandleControlEventL: Plugin cancelled from popup."); + iState = EInsertClipartStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + } + + // Cancelled the grid + else if (aEventType == EEventRequestCancel) + { + LOG(KClipartPluginLogFile, "HandleControlEventL: Grid cancelled."); + iState = EInsertClipartStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } +} + +//============================================================================= +void CImageEditorClipartControl::HandleListBoxEventL(CEikListBox* /*aListBox*/, + TListBoxEvent /*aEventType*/) + { + } + + + +//============================================================================= +void CImageEditorClipartControl::SelectClipartL() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::SelectClipartL()"); + + TRect rect = iSysPars->VisibleImageRect(); + + // Set default position + iX = (rect.iTl.iX + rect.iBr.iX) / 2; + iY = (rect.iTl.iY + rect.iBr.iY) / 2; + + // Set default angle + iAngle = KAngleParamDef; + + // Set default scale + if ( rect.Width() > rect.Height() ) + { + iScale = rect.Height() / 2; + iScaleMin = rect.Height() / 10; + iScaleMax = rect.Height(); + iScaleToHeight = ETrue; + } + else + { + iScale = rect.Width() / 2; + iScaleMin = rect.Width() / 10; + iScaleMax = rect.Width(); + iScaleToHeight = EFalse; + } + + iParam.Copy (_L("file \"")); + iParam.Append (iClipartFileName); + iParam.Append (_L("\"")); + + iParam.Append (_L(" clipart ")); + iParam.AppendNum (iClipartFileNameIndex); + iParam.Append (_L(" mask ")); + iParam.AppendNum (iClipartFileNameIndex + 1); + iParam.Append (_L(" load")); + + iParam.Append (_L(" x ")); + iParam.AppendNum (iX); + + iParam.Append (_L(" y ")); + iParam.AppendNum (iY); + + iParam.Append (_L(" angle ")); + iParam.AppendNum (iAngle); + + if ( iScaleToHeight ) + { + iParam.Append (_L(" height ")); + iParam.AppendNum (iScale); + } + else + { + iParam.Append (_L(" width ")); + iParam.AppendNum (iScale); + } + + ToMoveStateL(); + + LOGDES(KClipartPluginLogFile, iParam); + + LOG(KClipartPluginLogFile, "SelectClipartL: Ready to render"); + + iReadyToRender = ETrue; + + iEditorView->HandleCommandL (EImageEditorCmdRender); + + LOG(KClipartPluginLogFile, "SelectClipartL: Rendered"); + +} + +//============================================================================= +void CImageEditorClipartControl::SetView (CAknView * aView) +{ + iEditorView = aView; +} + +//============================================================================= +void CImageEditorClipartControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + iItem = aItem; +} + +//============================================================================= +void CImageEditorClipartControl::SetBusy () +{ + CImageEditorControlBase::SetBusy(); + if ( iPopupList ) + { + iPopupList->SetBusy(ETrue); + } +} + +//============================================================================= +void CImageEditorClipartControl::ResetBusy () +{ + // Reset busy flag only if selection grid is constructed + if (iState != EInsertClipartStateMin) + { + CImageEditorControlBase::ResetBusy(); + + if (iPopupList) + { + iPopupList->SetBusy(EFalse); + } + + } +} + +//============================================================================= +TKeyResponse CImageEditorClipartControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::OfferKeyEventL()"); +#ifdef VERBOSE + LOGFMT(KClipartPluginLogFile, "\taType: %d", aType); + LOGFMT(KClipartPluginLogFile, "\tiTickCount: %d", iTickCount); +#endif + + TKeyResponse response = EKeyWasNotConsumed; + + // If busy, do not handle anything + if ( Busy() ) + { + response = EKeyWasConsumed; + } + + // In main state handle the OK Options menu + else if ( aKeyEvent.iCode == EKeyOK && + (iState == EInsertClipartStateMain || iState == EInsertClipartStateFirst ) ) + { + iDisplayingOkOptionsMenu = ETrue; + iEditorView->HandleCommandL (EImageEditorTryDisplayMenuBar); + response = EKeyWasConsumed; + } + + // We handle only event keys + else if (EEventKey == aType) + { + + switch (aKeyEvent.iCode) + { + // Just consume keys + case EKeyDownArrow: + case EKeyUpArrow: + case EKeyRightArrow: + case EKeyLeftArrow: + // additional keycodes which are generated when holding navigation key + case 14: + case 15: + case 16: + case 17: + { + response = EKeyWasConsumed; + break; + } + + case EKeyOK: + { + if (iState == EInsertClipartStateMove || + iState == EInsertClipartStateRotate || + iState == EInsertClipartStateResize) + { + ToMainStateL(); + DrawNow(); + response = EKeyWasConsumed; + } + break; + } + + case EKeyEnter: + { + if (iState == EInsertClipartStateMove || + iState == EInsertClipartStateRotate || + iState == EInsertClipartStateResize) + { + ToMainStateL(); + DrawNow(); + } + else if ( iState == EInsertClipartStateMain ) + { + // Show context sensitive menu + iEditorView->HandleCommandL( EImageEditorOpenContextMenu ); + } + response = EKeyWasConsumed; + break; + + } + case 0x31: // 1 + { + // Rotate only in rotate state + if ( iState == EInsertClipartStateRotate ) + { + iAngle -= KAngleParam90Deg; + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + break; + } + + case 0x33: // 3 + { + // Rotate only in rotate state + if ( iState == EInsertClipartStateRotate ) + { + iAngle += KAngleParam90Deg; + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + break; + } + + case 0x30: // 0 + case 0x32: // 2 + case 0x34: // 4 + case 0x36: // 6 + case 0x38: // 8 + case EStdKeyDecVolume: // zoom out key + case 0x23: // # + { + StorePosAndScaleRelScreen(); + break; + } + + case 0x35: // 5 + case 0x2a: // * + case EStdKeyIncVolume: // zoom in key + { + StorePosAndScaleRelScreen(); + break; + } + + default: + { + break; + } + } + } + + // Key pressed down, mark pressed key + else if (aType == EEventKeyDown) + { + switch (aKeyEvent.iScanCode) + { + case EStdKeyUpArrow: + { + iKeyCode = 1; + response = EKeyWasConsumed; + break; + } + case EStdKeyDownArrow: + { + iKeyCode = 2; + response = EKeyWasConsumed; + break; + } + case EStdKeyLeftArrow: + { + iKeyCode = 3; + response = EKeyWasConsumed; + break; + } + case EStdKeyRightArrow: + { + iKeyCode = 4; + response = EKeyWasConsumed; + break; + } + default: + { + iKeyCode = 0; + break; + } + } + + 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(); + + break; + } + default: + { + iKeyCode = 0; + break; + } + } + } + + return response; +} + +//============================================================================= +TDesC & CImageEditorClipartControl::GetParam () +{ + return iParam; +} + +//============================================================================= +void CImageEditorClipartControl::SetSystemParameters (const CSystemParameters * aPars) +{ + iSysPars = aPars; +} + +//============================================================================= +void CImageEditorClipartControl::HandlePluginCommandL (const TInt aCommand) +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::HandlePluginCommandL()"); + + switch (aCommand) + { + case EPgnSoftkeyIdCancel: + { + iPopupController->HideInfoPopupNote(); + if (iState == EInsertClipartStateMin) + { + // ignore if the plugin is not ready yet + } + else if (iState == EInsertClipartStateMain || + iState == EInsertClipartStateFirst) + { + if ( !CImageEditorControlBase::Busy() ) + + { + LOG(KClipartPluginLogFile, "HandleControlEventL: Plug-in cancelled."); + + // Cancel plugin + iState = EInsertClipartStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + + } + } + else + { + // Return to plugin main view + RestoreTempParams(); + StoreParameters(); + ToMainStateL(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + break; + } + case EPgnSoftkeyIdOk: + { + iPopupController->HideInfoPopupNote(); + if (iState != EInsertClipartStateMin) + { + ToMainStateL(); + DrawNow(); + } + break; + } + case EPgnSoftkeyIdDone: + case EClipartPgnMenuCmdDone: + { + if (iState != EInsertClipartStateMin) + { + iState = EInsertClipartStateMin; + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + } + break; + } + case EClipartPgnMenuCmdMove: + { + ToMoveStateL(); + DrawDeferred(); + break; + } + case EClipartPgnMenuCmdResize: + { + ToResizeStateL(); + DrawDeferred(); + break; + } + case EClipartPgnMenuCmdRotate: + { + ToRotateStateL(); + DrawDeferred(); + break; + } + case EClipartPgnMenuCmdCancel: + { + LOG(KClipartPluginLogFile, "HandleControlEventL: Plug-in cancelled from menu."); + iState = EInsertClipartStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + break; + } + case EImageEditorPreGlobalZoomChange: + case EImageEditorPreGlobalPanChange: + { + StorePosAndScaleRelScreen(); + break; + } + case EImageEditorGlobalZoomChanged: + case EImageEditorGlobalPanChanged: + { + + RestorePosAndScaleRelScreen(); + ClipPosition(); + LOGFMT(KClipartPluginLogFile, "\tiX = %d", iX); + LOGFMT(KClipartPluginLogFile, "\tiY = %d", iY); + + StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + + DrawNow(); + break; + } + + case EImageEditorPreScreenModeChange: + { + if (iState != EInsertClipartStateMin) + { + StorePosAndScaleRelImage(); + } + break; + } + case EImageEditorPostScreenModeChange: + { + if (iState != EInsertClipartStateMin) + { + RestorePosAndScaleRelImage(); + ClipPosition(); + StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawNow(); + } + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +TInt CImageEditorClipartControl::GetSoftkeyIndexL() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::GetSoftkeyIndexL()"); + + TInt state = 0; + + switch (iState) + { + case EInsertClipartStateFirst: + { + state = 0; // Options - Cancel + break; + } + case EInsertClipartStateMove: + case EInsertClipartStateRotate: + case EInsertClipartStateResize: + { + state = 1; // Ok - Cancel + break; + } + case EInsertClipartStateMain: + { + state = 2; // Options - Done + break; + } + case EInsertClipartStateMin: + default: + { + state = 3; // Empty + break; + } + + } + + + return state; +} + +//============================================================================= +TInt CImageEditorClipartControl::GetContextMenuResourceId() +{ +return R_CLIPART_CONTEXT_MENUBAR; +} + +//============================================================================= +TBitField CImageEditorClipartControl::GetDimmedMenuItems() +{ + + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::GetDimmedMenuItems()"); + + TBitField dimmedMenuItems; + TInt count = iItem->MenuItems().Count(); + + if ( iDisplayingOkOptionsMenu ) + { + // Dim the command EClipartPgnMenuCmdCancel + for ( TInt i = 0; i < count; i++) + { + // get the menu item id + TInt menuItem = iItem->MenuItems().At(i).iCommandId; + if ( menuItem == EClipartPgnMenuCmdCancel ) + { + dimmedMenuItems.SetBit( i ); + } + } + iDisplayingOkOptionsMenu = EFalse; + } + + return dimmedMenuItems; +} + +//============================================================================= +TPtrC CImageEditorClipartControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::GetNaviPaneTextL()"); + + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return iNaviPaneText; +} + +//============================================================================= +void CImageEditorClipartControl::Draw (const TRect & aRect) const +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::Draw()"); + + CPreviewControlBase::DrawPreviewImage (aRect); + + if ( iIndicator && iIndicator->Handle() && + iIndicatorMask && iIndicatorMask->Handle() ) + { + CWindowGc & gc = SystemGc(); + + gc.SetPenStyle (CGraphicsContext::ENullPen); + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + + gc.BitBltMasked ( + ComputeIndicatorPosition(), + iIndicator, + TRect (iIndicator->SizeInPixels()), + iIndicatorMask, + EFalse + ); + } +} + +//============================================================================= +void CImageEditorClipartControl::NaviDown() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::NaviDown()"); + + switch (iState) + { + + case EInsertClipartStateMove: + { + iY += (KPosParamStep * iNaviStepMultiplier); + if ( iY > iSysPars->VisibleImageRect().iBr.iY ) + { + iY = iSysPars->VisibleImageRect().iBr.iY - 1; + } + break; + } + + case EInsertClipartStateResize: + { + iScale -= KScaleParamStep; + if (iScale < iScaleMin) + { + iScale = iScaleMin; + } + break; + } + + case EInsertClipartStateRotate: + { + iAngle -= (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorClipartControl::NaviUp() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::NaviUp()"); + + switch (iState) + { + + case EInsertClipartStateMove: + { + iY -= (KPosParamStep * iNaviStepMultiplier); + if ( iY < iSysPars->VisibleImageRect().iTl.iY ) + { + iY = iSysPars->VisibleImageRect().iTl.iY; + } + break; + } + + case EInsertClipartStateResize: + { + iScale += KScaleParamStep; + if (iScale > iScaleMax) + { + iScale = iScaleMax; + } + break; + } + + case EInsertClipartStateRotate: + { + iAngle += (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorClipartControl::NaviRight() +{ + + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::NaviRight()"); + + switch (iState) + { + + case EInsertClipartStateMove: + { + iX += (KPosParamStep * iNaviStepMultiplier); + if ( iX >= iSysPars->VisibleImageRect().iBr.iX ) + { + iX = iSysPars->VisibleImageRect().iBr.iX - 1; + } + break; + } + + case EInsertClipartStateResize: + { + iScale += KScaleParamStep; + if (iScale > iScaleMax) + { + iScale = iScaleMax; + } + break; + } + + case EInsertClipartStateRotate: + { + iAngle += (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorClipartControl::NaviLeft() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::NaviLeft()"); + + switch (iState) + { + + case EInsertClipartStateMove: + { + iX -= (KPosParamStep * iNaviStepMultiplier); + if ( iX < iSysPars->VisibleImageRect().iTl.iX ) + { + iX = iSysPars->VisibleImageRect().iTl.iX; + } + break; + } + + case EInsertClipartStateResize: + { + iScale -= KScaleParamStep; + if (iScale < iScaleMin) + { + iScale = iScaleMin; + } + break; + } + + case EInsertClipartStateRotate: + { + iAngle -= (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorClipartControl::ToMoveStateL() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::ToMoveStateL()"); + + iState = EInsertClipartStateMove; + iNaviPaneText.Copy ( iItem->Parameters()[KMoveClipartIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_move_super, + EMbmImageeditoruiQgn_indi_imed_move_super_mask + ); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorClipartControl::ToResizeStateL() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::ToResizeStateL()"); + + iState = EInsertClipartStateResize; + iNaviPaneText.Copy ( iItem->Parameters()[KResizeClipartIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_resize_super, + EMbmImageeditoruiQgn_indi_imed_resize_super_mask + ); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorClipartControl::ToRotateStateL() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::ToRotateStateL()"); + + iState = EInsertClipartStateRotate; + iNaviPaneText.Copy ( iItem->Parameters()[KRotateClipartIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_rotate_left_super, + EMbmImageeditoruiQgn_indi_imed_rotate_left_super_mask + ); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorClipartControl::ToMainStateL() +{ + + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::ToMainStateL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + iState = EInsertClipartStateMain; + iPopupController->HideInfoPopupNote(); + iNaviPaneText.Copy ( iItem->Parameters()[KMainClipartIndex] ); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); +} + +//============================================================================= +void CImageEditorClipartControl::StoreTempParams() + { + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::StoreTempParams()"); + iTempX = iX; + iTempY = iY; + iTempScale = iScale; + iTempAngle = iAngle; + } + +//============================================================================= +void CImageEditorClipartControl::RestoreTempParams() + { + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::RestoreTempParams()"); + iX = iTempX; + iY = iTempY; + iScale = iTempScale; + iAngle = iTempAngle; + } + +//============================================================================= +void CImageEditorClipartControl::GetHelpContext(TCoeHelpContext& aContext) const +{ + aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); + aContext.iContext = KSIE_HLP_EDIT_CLIPART; +} + +//============================================================================= +void CImageEditorClipartControl::LoadIndicatorL ( + TInt aBitmapInd, + TInt aMaskInd + ) +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::LoadIndicatorL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + SDrawUtils::GetIndicatorBitmapL ( + iIndicator, + iIndicatorMask, + aBitmapInd, + aMaskInd + ); +} + +//============================================================================= +TPoint CImageEditorClipartControl::ComputeIndicatorPosition() const +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::ComputeIndicatorPosition()"); + + TInt x( 0 ); + TInt y( 0 ); + // check if there is no indicator + if ( !iIndicator ) + { + return TPoint ( x, y ); + } + + TRect vprect = iSysPars->VisibleImageRect(); + TRect vpprect = iSysPars->VisibleImageRectPrev(); + + TInt s = 0; + if (iScaleToHeight) + { + s = (iScale * vpprect.Height()) / vprect.Height(); + + } + else + { + s = (iScale * vpprect.Width()) / vprect.Width(); + } + + x = ((iX - vprect.iTl.iX)* vpprect.Width()) / vprect.Width(); + x += vpprect.iTl.iX; + x -= iIndicator->SizeInPixels().iWidth / 2; + x -= s / 2; + + y = ((iY - vprect.iTl.iY) * vpprect.Height()) / vprect.Height(); + y += vpprect.iTl.iY; + y -= iIndicator->SizeInPixels().iHeight / 2; + y += s / 2; + + LOGFMT (KClipartPluginLogFile, "ComputeIndicatorPosition --- (iX == %d)", iX); + LOGFMT (KClipartPluginLogFile, "ComputeIndicatorPosition --- (iY == %d)", iY); + LOGFMT (KClipartPluginLogFile, "ComputeIndicatorPosition --- (x == %d)", x); + LOGFMT (KClipartPluginLogFile, "ComputeIndicatorPosition --- (y == %d)", y); + + return TPoint (x,y); +} + +//============================================================================= +void CImageEditorClipartControl::StoreParameters() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::StoreParameters()"); + iParam.Copy (_L("x ")); + iParam.AppendNum (iX); + iParam.Append (_L(" y ")); + iParam.AppendNum (iY); + iParam.Append (_L(" angle ")); + iParam.AppendNum (iAngle); + + if ( iScaleToHeight ) + { + iParam.Append (_L(" height ")); + iParam.AppendNum (iScale); + } + else + { + iParam.Append (_L(" width ")); + iParam.AppendNum (iScale); + } + LOGDES(KClipartPluginLogFile, iParam); +} + +//============================================================================= +void CImageEditorClipartControl::TimerCallBack() +{ + LOGFMT(KClipartPluginLogFile, "CImageEditorClipartControl::TimerCallBack() (iTickCount == %d)", iTickCount); + + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::TimerCallBack: switching to big steps"); + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } + + if (iKeyCode) + { + + switch (iKeyCode) + { + case 1: + { + NaviUp(); + break; + } + case 2: + { + NaviDown(); + break; + } + case 3: + { + NaviLeft(); + break; + } + case 4: + { + NaviRight(); + break; + } + default: + break; + } + LOG(KClipartPluginLogFile, "\tTimerCallBack: Render..."); + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + + iTimer->Call (KWait); + } +} + +//============================================================================= +void CImageEditorClipartControl::StorePosAndScaleRelScreen() +{ + + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); + + TReal relscale = iSysPars->Scale(); + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = virect.iBr.iX - virect.iTl.iX; + TInt viheight = virect.iBr.iY - virect.iTl.iY; + + TRect viprect = iSysPars->VisibleImageRectPrev(); + + TInt vipwidth = viprect.iBr.iX - viprect.iTl.iX; + TInt vipheight = viprect.iBr.iY - viprect.iTl.iY; + + // Scale + TInt dimold_pix = (TInt)((iScale / relscale) + 0.5); + if ( iScaleToHeight ) + { + iScaleOld = (TReal)(dimold_pix * vipheight) / viheight; + } + else + { + iScaleOld = (TReal)(dimold_pix * vipwidth) / viwidth; + } + + // Position + TInt xCurrent = (TInt)((iX / relscale) + 0.5); + TInt yCurrent = (TInt)((iY / relscale) + 0.5); + iPosXOld = viprect.iTl.iX + (TReal)((xCurrent - virect.iTl.iX) * vipwidth) / viwidth; + iPosYOld = viprect.iTl.iY + (TReal)((yCurrent - virect.iTl.iY) * vipheight) / viheight; + + LOGFMT(KClipartPluginLogFile, "\tiPosXOld = %d", iPosXOld); + LOGFMT(KClipartPluginLogFile, "\tiPosYOld = %d", iPosYOld); + + iParam.Copy(_L("nop")); + +} + +//============================================================================= +void CImageEditorClipartControl::RestorePosAndScaleRelScreen() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); + + TReal relscale = iSysPars->Scale(); + + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = virect.iBr.iX - virect.iTl.iX; + TInt viheight = virect.iBr.iY - virect.iTl.iY; + + TRect viprect = iSysPars->VisibleImageRectPrev(); + TInt vipwidth = viprect.iBr.iX - viprect.iTl.iX; + TInt vipheight = viprect.iBr.iY - viprect.iTl.iY; + + // Scale + if (iScaleToHeight) + { + iScale = (TInt)((iScaleOld * viheight) / vipheight + 0.5); + } + else + { + iScale = (TInt)((iScaleOld * viwidth) / vipwidth + 0.5); + } + iScale = (TInt)(iScale * relscale + 0.5); + + // Position + iX = (TInt)(virect.iTl.iX + (TReal)((iPosXOld - viprect.iTl.iX) * viwidth) / vipwidth + 0.5); + iY = (TInt)(virect.iTl.iY + (TReal)((iPosYOld - viprect.iTl.iY) * viheight) / vipheight + 0.5); + +} + +//============================================================================= +void CImageEditorClipartControl::StorePosAndScaleRelImage() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::StorePosAndScaleRelImage()"); + + TReal relscale = iSysPars->RelScale(); + + iPosXOld = (TInt)((iX / relscale) + 0.5); + iPosYOld = (TInt)((iY / relscale) + 0.5); + iScaleOld = (TInt)(iScale / relscale + 0.5); + + iParam.Copy(_L("nop")); +} + +//============================================================================= +void CImageEditorClipartControl::RestorePosAndScaleRelImage() +{ + LOG(KClipartPluginLogFile, "CImageEditorClipartControl::RestorePosAndScaleRelImage()"); + + TReal relscale = iSysPars->RelScale(); + + iX = (TInt)(iPosXOld * relscale + 0.5); + iY = (TInt)(iPosYOld * relscale + 0.5); + iScale = TInt(iScaleOld * relscale + 0.5); +} + +//============================================================================= +void CImageEditorClipartControl::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; + } +} + +//============================================================================= +void CImageEditorClipartControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent) + { + if( AknLayoutUtils::PenEnabled() ) + { + // If busy, do not handle anything + if ( Busy() ) + { + return; + } + + TBool render = ETrue; + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + if ( iState == EInsertClipartStateMove ) + { + iPopupController->HideInfoPopupNote(); + SetClipPosition( aPointerEvent.iPosition ); + } + else if ( iState == EInsertClipartStateRotate ) + { + iPopupController->HideInfoPopupNote(); + // Store current position. Rotating is handled in drag-event + // is pen position has changed + iPointerPosition = aPointerEvent.iPosition; + } + else if ( iState == EInsertClipartStateResize ) + { + iPopupController->HideInfoPopupNote(); + iPointerPosition = aPointerEvent.iPosition; + } +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorClipartControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + break; + } + case TPointerEvent::EDrag: + { + if ( iState == EInsertClipartStateMove ) + { + SetClipPosition( aPointerEvent.iPosition ); + iPointerPosition = aPointerEvent.iPosition; + } + else if ( iState == EInsertClipartStateRotate ) + { + if ( CalculateRotation( iPointerPosition, + aPointerEvent.iPosition ) ) + { + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else + { + render = EFalse; + } + } + else if ( iState == EInsertClipartStateResize ) + { + if ( CalculateResize( iPointerPosition, + aPointerEvent.iPosition ) ) + { + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else + { + render = EFalse; + } + } + + break; + } + case TPointerEvent::EButton1Up: + { + if ( iState == EInsertClipartStateMain ) + { + // Show context sensitive menu + iEditorView->HandleCommandL( EImageEditorOpenContextMenu ); + } + else + { + ShowTooltip(); + } + break; + } + + default: + { + break; + } + } + + StoreParameters(); + + if ( render ) + { + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + + CCoeControl::HandlePointerEventL( aPointerEvent ); + + } + } + +//============================================================================= +void CImageEditorClipartControl::SetClipPosition( TPoint aPointedPosition ) + { + + // Get system parameters + TRect visibleImageRect( iSysPars->VisibleImageRect() ); + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + TInt xPosFactorDivider + ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX ); + TInt yPosFactorDivider + ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY ); + + // 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 ); + + // Calculate position on visible image + iX = visibleImageRect.iTl.iX + + ( visibleImageRect.iBr.iX - visibleImageRect.iTl.iX ) * + xPositionFactor; + + iY = visibleImageRect.iTl.iY + + ( visibleImageRect.iBr.iY - visibleImageRect.iTl.iY ) * + yPositionFactor; + } + + // Check that not out of bounds + ClipPosition(); + + } + +//============================================================================= +void CImageEditorClipartControl::ShowTooltip() + { + iPopupController->HideInfoPopupNote(); + + if ( iState != EInsertClipartStateMove && + iState != EInsertClipartStateResize && + iState != EInsertClipartStateRotate ) + { + return; + } + + TPoint iconPosition = ComputeIndicatorPosition(); + + if ( iState == EInsertClipartStateMove ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVBottom, + *iTooltipMove ); + } + // resize + else if ( iState == EInsertClipartStateResize ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVBottom, + *iTooltipResize ); + } + // rotate + else if ( iState == EInsertClipartStateRotate ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVBottom, + *iTooltipRotate ); + } + + } + +//============================================================================= +TBool CImageEditorClipartControl::CalculateResize( TPoint aStartPoint, + TPoint aEndPoint ) + { + // Whether clipart is resized in this function or not + TBool clipartResized( EFalse ); + // Store old scale value + TInt oldScale = iScale; + + // Get system parameters + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Compute change on the screen + TInt deltaX = aEndPoint.iX - aStartPoint.iX; + TInt deltaY = aEndPoint.iY - aStartPoint.iY; + + // Use bigger dimension + TInt maxChangeInPixels; + if ( visibleImageRectPrev.Height() > visibleImageRectPrev.Width() ) + { + maxChangeInPixels = visibleImageRectPrev.Height(); + } + else + { + maxChangeInPixels = visibleImageRectPrev.Width(); + } + + TInt oneStepInPixels = maxChangeInPixels / KTouchScaleMaxStepCount; + TInt scaleStep = ( iScaleMax - iScaleMin ) / KTouchScaleMaxStepCount + 1; + + // Relates to second and fourth corners. Defines how steep/gentle the + // moving angle has to be in order to scale. + TInt slopeAngleFactor = 3; + + // The first quarter (movement towards upper-right corner) + if( ( deltaX > 0 && deltaY <= 0 ) || ( deltaX >= 0 && deltaY < 0 ) ) + { + // use bigger value + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iScale += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iScale += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The second (movement towards lower-right corner) + else if( ( deltaX > 0 && deltaY >= 0 ) || ( deltaX >= 0 && deltaY > 0 ) ) + { + if( deltaX > slopeAngleFactor * deltaY ) + { + iScale += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + + else if ( slopeAngleFactor * deltaX < deltaY ) + { + iScale -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The third (movement towards lower-left corner) + else if( ( deltaX < 0 && deltaY >= 0 ) || ( deltaX <= 0 && deltaY > 0 ) ) + { + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iScale -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iScale -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The fourth (movement towards upper-left corner) + else if( ( deltaX < 0 && deltaY <= 0 ) || ( deltaX <= 0 && deltaY < 0 ) ) + { + if( slopeAngleFactor * Abs( deltaX ) < Abs( deltaY ) ) + { + iScale += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + else if ( Abs( deltaX ) > slopeAngleFactor * Abs( deltaY ) ) + { + iScale -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + } + + // Check the limits + if (iScale > iScaleMax) + { + iScale = iScaleMax; + clipartResized = ETrue; + } + if (iScale < iScaleMin) + { + iScale = iScaleMin; + clipartResized = ETrue; + } + + if ( oldScale != iScale ) + { + clipartResized = ETrue; + } + + return clipartResized; + + } + +//============================================================================= +TBool CImageEditorClipartControl::CalculateRotation( TPoint aStartPoint, + TPoint aEndPoint ) + { + TBool angleChanged( EFalse ); + TInt oldAngle = iAngle; + + // Get system parameters + TRect visibleImageRect( iSysPars->VisibleImageRect() ); + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Calculate clipart real center point on the screen (physical coordinates) + TReal posFactorX( TReal( iX - visibleImageRect.iTl.iX ) / + visibleImageRect.Width() ); + TInt clipartCenterX = posFactorX * visibleImageRectPrev.Width() + + visibleImageRectPrev.iTl.iX; + + TReal posFactorY( TReal( iY - visibleImageRect.iTl.iY ) / + visibleImageRect.Height() ); + TInt clipartCenterY = posFactorY * visibleImageRectPrev.Height() + + visibleImageRectPrev.iTl.iY; + + // Calculate start and end positions of the movement assuming that + // clipart centre is in origo. + // Note! y-axis is mirrored on screen coordinates compared to standard 2-d + // co-ordinates->mirror y-axis to ease the calculation + TPoint startPos( ( aStartPoint.iX - clipartCenterX ), + ( clipartCenterY - aStartPoint.iY ) ); + TPoint endPos( ( aEndPoint.iX - clipartCenterX ), + ( clipartCenterY - aEndPoint.iY ) ); + + TReal angleInRadStart; + TReal angleInRadEnd; + + // Calculate start and end angles in radians + TInt err1 = Math::ATan( angleInRadStart, startPos.iY, startPos.iX ); + TInt err2 = Math::ATan( angleInRadEnd, endPos.iY, endPos.iX ); + + if( !err1 && !err2 ) + { + // Calculate change in angle and convert it to degrees + TReal changeInDegrees = + ( angleInRadEnd - angleInRadStart ) * KRadToDeg; + + iAngle -= ( KDegreeMultiplier * TInt( changeInDegrees ) ) + % KAngleParamMax; + } + + if ( iAngle != oldAngle ) + { + angleChanged = ETrue; + } + + return angleChanged; + + } + +// End of file + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ClipartPlugin/src/ImageEditorClipartPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ClipartPlugin/src/ImageEditorClipartPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,169 @@ +/* +* 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: +* Clipart plugin's plugin class. +* +*/ + + +#include "ImageEditorClipartPlugin.h" +#include "ImageEditorClipartControl.h" +#include "ImageEditorPluginBaseDefs.h" +#include "DrawUtils.h" +#include "SystemParameters.h" + +// CONSTANTS +_LIT (KPgnResourceFile, "clipart.rsc"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorClipartPlugin * plugin = new (ELeave) CImageEditorClipartPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorClipartPlugin::CImageEditorClipartPlugin () +{ + +} + +//============================================================================= +void CImageEditorClipartPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorClipartPlugin::~CImageEditorClipartPlugin () +{ + iSysPars = NULL; + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorClipartPlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (const CSystemParameters *)tempval; + return KErrNone; + } + default: + { + return CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorClipartPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + // Control found + if (iControl) + { + aPropertyValue.Copy ( ((CImageEditorClipartControl *)iControl)->GetParam() ); + return KErrNone; + } + + // Control not found, return KErrNotReady + else + { + return KErrNotReady; + } + } + case KCapReadyToRender: + { + TBool readyToRender = EFalse; + if ( iControl ) + { + readyToRender = ((CImageEditorClipartControl *)iControl)->IsReadyToRender(); + } + aPropertyValue.AppendNum ((TInt)readyToRender); + return KErrNone; + } + case KCapIsSlowPlugin: + { + aPropertyValue.AppendNum ((TInt)ETrue); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorClipartPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + // Delete previous control + ReleasePlugin(); + + // Create the control + iControl = CImageEditorClipartControl::NewL (aRect, aParent); + aPluginControl = iControl; + + // Set system parameters + ((CImageEditorClipartControl*)iControl)->SetSystemParameters (iSysPars); + + return KErrNone; +} + +//============================================================================= +void CImageEditorClipartPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + +} + +//============================================================================= +void CImageEditorClipartPlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/EABI/Contrast.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/EABI/Contrast.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI26CImageEditorContrastPlugin @ 2 NONAME ; ## + _ZTV26CImageEditorContrastPlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/bwins/Contrast.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/bwins/Contrast.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/data/contrast.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/data/contrast.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,124 @@ +/* +* 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: +* Resource definitions for Contrast plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "contrast_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_CONTRAST_PLUGIN; + uitype = EPluginUiTypeSingleParam; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 2; + pluginname = qtn_sie_plugin_name_contrast; + iconfile = "contrast.mif"; + filterfile = "FilterContrast.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // Horizontal slider title + qtn_sie_slider_title_contrast + + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_msk; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/data/icon.bmp Binary file imageeditor/plugins/ContrastPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/data/mask.bmp Binary file imageeditor/plugins/ContrastPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/data/qgn_plugin_contrast.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/data/qgn_plugin_contrast.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,15 @@ + + + + +]> + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/group/ContrastPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/group/ContrastPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET Contrast.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_CONTRAST_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorContrastPlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/contrast.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib + +LIBRARY imageeditorui.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY eikcoctl.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Contrast plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorContrastPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorContrastPlugin.iby) + +// mmp files +PRJ_MMPFILES +ContrastPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE contrast.mif +OPTION HEADERFILE contrast.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_contrast -c8,1 qgn_indi_imed_contrast_super +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/inc/Contrast_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/inc/Contrast_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* String generalisations for contrast plugin. +* +*/ + + +#include +#include "iepb_gen.loc" + +// SOFTKEYS + +#define qtn_sie_pgn_sk1 qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2 qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_msk qtn_sie_iepb_softkey_ok + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/inc/ImageEditorContrastPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/inc/ImageEditorContrastPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,165 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORCONTRASTPLUGIN_H +#define IMAGEEDITORCONTRASTPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" +#include "SingleParamControlObserver.h" + + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; + + +/* CLASS: CImageEditorContrastPlugin +* +* CImageEditorBrightnessPlugin represents contrast adjustment plug-in for +* Image Editor application. +* +*/ +class CImageEditorContrastPlugin : public CImageEditorPluginBase, + public MSingleParControlObserver +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorContrastPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorContrastPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + /** ParamOperation + * + * @see MSingleParControlObserver + */ + virtual void ParamOperation (const TParamOperation aOperation); + + /** GetParam + * + * @see MSingleParControlObserver + */ + virtual TReal GetParam() const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorContrastPlugin (const CImageEditorContrastPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorContrastPlugin & operator= (const CImageEditorContrastPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// Contrast parameter + TInt iContrast; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/rom/ImageEditorContrastPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/rom/ImageEditorContrastPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __CONTRASTPLUGIN_IBY__ +#define __CONTRASTPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Contrast.pgn SHARED_LIB_DIR\Contrast.pgn + +// Resources +data=DATAZ_\resource\apps\Contrast.mif \resource\apps\Contrast.mif + +#endif // __CONTRASTPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ContrastPlugin/src/ImageEditorContrastPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ContrastPlugin/src/ImageEditorContrastPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,194 @@ +/* +* 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: +* Contrast plugin plugin base class. +* +*/ + + +/// INCLUDES +#include +#include +#include "ImageEditorContrastPlugin.h" +#include "SingleParamControl.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "contrast.rsc"); + +const long KParamMin = -100; +const long KParamMax = 100; +const long KParamStep = 10; +const long KParamDef = 0; +const TInt KContrastHSTitleIndex = 0; + +_LIT (KContrastTag, "contrast "); +_LIT (KResourceDir, "\\resource\\apps\\"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorContrastPlugin * plugin = new (ELeave) CImageEditorContrastPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorContrastPlugin::CImageEditorContrastPlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorContrastPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorContrastPlugin::~CImageEditorContrastPlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorContrastPlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorContrastPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + aPropertyValue.Copy (KContrastTag); + aPropertyValue.AppendNum (iContrast); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorContrastPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + ReleasePlugin(); + iControl = CSingleParamControl::NewL (aRect, aParent); + ((CSingleParamControl *)iControl)->SetParObserver ( (MSingleParControlObserver*)this ); + aPluginControl = iControl; + + // initialize horizontal slider + ((CSingleParamControl *)iControl)->SetSliderMinimumAndMaximum(KParamMin, KParamMax); + ((CSingleParamControl *)iControl)->SetSliderStep(KParamStep); + ((CSingleParamControl *)iControl)->SetSliderPosition(KParamDef); + TFileName iconFile (KResourceDir); + TBuf<256> readbuf; + User::LeaveIfError ( GetProperty (KCapIconName, readbuf) ); + iconFile.Append(readbuf); + CEikImage* icon = new (ELeave) CEikImage; + icon->CreatePictureFromFileL(iconFile, + EMbmContrastQgn_indi_imed_contrast_super, + EMbmContrastQgn_indi_imed_contrast_super_mask); + ((CSingleParamControl *)iControl)->SetIcon(icon); + + // Get caption from plugin properties + User::LeaveIfError ( GetProperty (KCapPluginParamNames, readbuf) ); + TLex parser; + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + CDesCArray * parameters = (CDesCArray *)tempval; + ((CSingleParamControl *)iControl)->SetCaption( (*parameters)[KContrastHSTitleIndex] ); + + return KErrNone; +} + +//============================================================================= +void CImageEditorContrastPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorContrastPlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + +//============================================================================= +void CImageEditorContrastPlugin::ParamOperation (const TParamOperation aOperation) +{ + switch (aOperation) + { + case EParamOperationSubtract: + { + iContrast -= KParamStep; + if (iContrast < KParamMin) + { + iContrast = KParamMin; + } + break; + } + case EParamOperationAdd: + { + iContrast += KParamStep; + if ( iContrast > KParamMax ) + { + iContrast = KParamMax; + } + break; + } + case EParamOperationDefault: + { + iContrast = KParamDef; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +TReal CImageEditorContrastPlugin::GetParam () const +{ + return (TReal)(iContrast) / (KParamMax - KParamMin); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/EABI/Crop.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/EABI/Crop.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI22CImageEditorCropPlugin @ 2 NONAME ; ## + _ZTI23CImageEditorCropControl @ 3 NONAME ; ## + _ZTV22CImageEditorCropPlugin @ 4 NONAME ; ## + _ZTV23CImageEditorCropControl @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/bwins/Crop.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/bwins/Crop.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/data/crop.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/data/crop.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,230 @@ +/* +* 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: +* Resource definitions for Crop plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "Crop.rh" +#include "crop_gen.loc" + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_CROP_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 5; + pluginname = qtn_sie_plugin_name_crop; + iconfile = "crop.mif"; + filterfile = "FilterCrop.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // Select aspect ratio + qtn_sie_heading_aspect_ratio, + + // Move crop rectangle navi pane text + " ", + + // Crop area size + qtn_sie_navi_crop_area, + + // Manual + qtn_sie_crop_aspect_ratio_manual + + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdSet; + text=qtn_sie_pgn_sk1_set; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_softkey_crop; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdSet; + text=qtn_sie_pgn_sk1_set; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdBack; + text=qtn_sie_pgn_sk2_back; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdBack; + text=qtn_sie_pgn_sk2_back; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdSet; + text=qtn_sie_pgn_sk1_set; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_softkey_crop; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdSet; + text=qtn_sie_pgn_sk1_set; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdEmpty; + text=" "; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +RESOURCE CROPMODES r_crop_modes +{ + items= + { + CROPMODE + { + text=qtn_sie_crop_aspect_ratio_4x6; + w=6; + h=4; + }, + CROPMODE + { + text=qtn_sie_crop_aspect_ratio_6x4; + w=4; + h=6; + }, + CROPMODE + { + text=qtn_sie_crop_aspect_ratio_5x7; + w=7; + h=5; + }, + CROPMODE + { + text=qtn_sie_crop_aspect_ratio_7x5; + w=5; + h=7; + }, + CROPMODE + { + text=qtn_sie_crop_aspect_ratio_8x10; + w=10; + h=8; + }, + CROPMODE + { + text=qtn_sie_crop_aspect_ratio_10x8; + w=8; + h=10; + } + }; +} + +//Wallpaper aspect ratio texts +RESOURCE TBUF r_crop_aspect_ratio_wallpaper { buf = qtn_sie_crop_wallpaper; } +RESOURCE TBUF r_crop_aspect_ratio_wallpaper_prt { buf = qtn_sie_crop_wallpaper_prt; } +RESOURCE TBUF r_crop_aspect_ratio_wallpaper_lnds { buf = qtn_sie_crop_wallpaper_lnds; } + +RESOURCE TBUF r_tooltip_crop_resize_area { buf = qtn_sie_tooltip_crop_resize_area; } +RESOURCE TBUF r_tooltip_crop_move_area { buf = qtn_sie_tooltip_crop_move_area; } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/data/icon.bmp Binary file imageeditor/plugins/CropPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/data/mask.bmp Binary file imageeditor/plugins/CropPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/data/qgn_plugin_crop.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/data/qgn_plugin_crop.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/group/CropPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/group/CropPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,98 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + +#if defined( __DOUBLE_BUFFERED_CROP__ ) +MACRO DOUBLE_BUFFERED_CROP +LIBRARY bitgdi.lib +#endif + +#if defined(__LANDSCAPE_ROTATE_HOTKEYS__) +MACRO LANDSCAPE_ROTATE_HOTKEYS +#endif + +TARGET Crop.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_CROP_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorCropPlugin.cpp +SOURCE ImageEditorCropControl.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/crop.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY cone.lib +LIBRARY efsrv.lib +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY fbscli.lib +LIBRARY avkon.lib +LIBRARY commonengine.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib +LIBRARY aknicon.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Crop plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorCropPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorCropPlugin.iby) + +// mmp files +PRJ_MMPFILES +CropPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE crop.mif +OPTION HEADERFILE crop.mbg +OPTION SOURCES -c8 qgn_indi_imed_crop +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/inc/Crop.rh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/inc/Crop.rh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* +*/ + + + +#ifndef CROP_RH +#define CROP_RH + +STRUCT CROPMODE +{ + LTEXT text=""; + LONG w=0; + LONG h=0; +} + +STRUCT CROPMODES +{ + STRUCT items[]; +} + + +#endif // EOF Crop.rh + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/inc/Crop_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/inc/Crop_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,44 @@ +/* +* 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: +* +*/ + + + +#include +#include "iepb_gen.loc" +#include + +// SOFTKEYS + +#define qtn_sie_pgn_sk1_set qtn_sie_softkey_set +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_sk2_back qtn_sie_iepb_softkey_back + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/inc/ImageEditorCropControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/inc/ImageEditorCropControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,677 @@ +/* +* 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: +* Crop plugin control class header. +* +*/ + + +#ifndef IMAGEEDITORCROPCONTROL_H +#define IMAGEEDITORCROPCONTROL_H + +// INCLUDES +#include + +#include "PreviewControlBase.h" + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; +class CSystemParameters; +class CPeriodic; +class CAknInfoPopupNoteController; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +/* CLASS: CImageEditorCropControl +* +* CImageEditorCropControl is a control for crop plug-in. +* +*/ +class CImageEditorCropControl : public CPreviewControlBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorCropControl object + */ + static CImageEditorCropControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** DancingAntsCallback + * + * Static callback for rotating dancing ants. + * + * @param aPtr - parameter given for TCallBack + * @return TInt + */ + static TInt DancingAntsCallback (TAny * aPtr); + + /** FastKeyCallback + * + * Static callback for triggering keys faster. + * + * @param aPtr - parameter given for TCallBack + * @return TInt + */ + static TInt FastKeyCallback (TAny * aPtr); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorCropControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + * + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Setter for view reference + * + * @see CImageEditorControlBase + * + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + * + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + +#ifdef DOUBLE_BUFFERED_CROP + + /* SetImage + * + * @see CImageEditorControlBase + * + */ + virtual void SetImageL (CFbsBitmap * aBitmap); + +#endif + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetParam + * + * Gets pointer to the parameter struct. + * + * @param - + * @return - pointer to MIA parameter struct + */ + TDesC & GetParam (); + + /* SetSysteParameters + * + * Sets reference to system parameters to plug-in. + * + * @param aWidth - image width + * @return - + */ + void SetSystemParameters (const CSystemParameters * aSysPars); + + /* SetCropModeL + * + * Sets cropping mode and aspect ratio. + * + * @param aRatio - crop aspect ratio + * @return - + */ + void SetCropModeL ( + const TInt aMode, + const float aRatio + ); + + /* IsReadyToRender + * + * Returns boolean value indicating when the parameters + * are set and filter is ready to be rendered + * + * @param - + * @return TBool - is ready to render? + */ + TBool IsReadyToRender () const; + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + /* SizeChanged + * + * @see CImageEditorControlBase + * + */ + virtual void SizeChanged(); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorCropControl (); + + /** Draw + * + * @see CImageEditorControlBase + * + */ + virtual void Draw (const TRect & aRect) const; + + /** DrawDancingAnts + * + * Drawing function for dancing ants crop rectangle. + * + * @param aRect - control rectangle in need of refreshing + * @return - + */ + void DrawDancingAnts (const TRect & aRect) const; + + /** DrawCursors + * + * Drawing function for both of the cropping cursors. + * + * @param aCropRect - cropping rectangle which indicates + * top left and bottom right corners (i.e. + * places for the cursors.) + * @return - + */ + void DrawCursors ( const TRect& aCropRect ) const; + + /** ComputeCropParams + * + * Computes cropping parameters. + * + * @param - + * @return - + */ + void ComputeCropParams (); + + /** NaviDownL + * + * Handles navi key down event. + * + * @param - + * @return - + */ + void NaviDownL(); + + /** NaviUpL + * + * Handles nave key up event. + * + * @param - + * @return - + */ + void NaviUpL(); + + /** NaviRightL + * + * Handles nave key right event. + * + * @param - + * @return - + */ + void NaviRightL(); + + /** NaviLeftL + * + * Handles nave key left event. + * + * @param - + * @return - + */ + void NaviLeftL(); + + /** SetInitialPointsL + * + * Sets initial crop points based on wanted cropping aspect + * ratio (crop mode). + * + * @param - + * @return - + */ + void SetInitialPointsL (); + + /** StartDancingAntsTimer + * + * Starts dancing ants timer. + * + * @param - + * @return - + */ + void StartDancingAntsTimer(); + + /** StartDancingAntsTimer + * + * Starts dancing ants timer. + * + * @param - + * @return - + */ + void StartFastKeyTimer(); + + /** OnDancingAntsCallBack + * + * Timer event handler for dancing ants. + * + * @param - + * @return - + */ + void OnDancingAntsCallBack(); + + /** OnFastKeyCallBackL + * + * Timer event handler for fast keys. + * + * @param - + * @return - + */ + void OnFastKeyCallBackL(); + + /** CalculateMinCrop + * + * Calculates minimum crop area + * + * @param - + * @return - + */ + void CalculateMinCrop(); + + /** ComputePreservedULC + * + * Computes aspect ratio preserver ULC coordinate. + * + * @param - + * @return - + */ + void ComputePreservedULC(); + + /** ComputePreservedULC + * + * Computes aspect ratio preserver LRC coordinate. + * + * @param - + * @return - + */ + void ComputePreservedLRC(); + + /** ComputePreservedULR + * + * Computes aspect ratio preserver ULR coordinate. + * + * @param - + * @return - + */ + void ComputePreservedULR(); + + /** ComputePreservedLRR + * + * Computes aspect ratio preserver LRR coordinate. + * + * @param - + * @return - + */ + void ComputePreservedLRR(); + +#ifdef DOUBLE_BUFFERED_CROP + + /** ClonePreviewBitmapL + * + * Copy preview image data to buffer. + * + * @param - + * @return - + */ + void ClonePreviewBitmapL(); + + /** DarkenUnselectedAreaL + * + * Darkens the area outside crop region in the buffer. + * + * @param - + * @return - + */ + void DarkenUnselectedAreaL(); + +#endif + + /** UpdateCropRectangle + * + * Update crop rectangle after cropping. + * + * @param - + * @return - + */ + void UpdateCropRectangle(); + + void StoreCropRelScreen(); + void RestoreCropRelScreen(); + void StoreCropRelImage(); + void RestoreCropRelImage(); + + /** SetTLPosition + * + * Touch related function. + * Calculates the stylus movement according to the given parameters + * and moves top-left corner respectively. + * + * @param aOldPosition Previous pointer position. + * aNewPosition Current pointer position. + * @return - + */ + void SetTLPosition( TPoint aOldPosition, TPoint aNewPosition ); + + /** SetBRPosition + * + * Touch related function. + * Calculates the stylus movement according to the given parameters + * and moves bottom-right corner respectively. + * + * @param aOldPosition Previous pointer position. + * aNewPosition Current pointer position. + * @return - + */ + void SetBRPosition( TPoint aOldPosition, TPoint aNewPosition ); + + /** IsCursorTapped + * + * Touch related function. + * Checks if user has tapped inside the cursor area + * + * @param aTappedPosition A position value to check + * @return ETrue if cursor area contains tapped position, EFalse otherwise + */ + TBool IsCursorTapped( TPoint aTappedPosition ) const; + + /** IsOppositeCornerTapped + * + * Touch related function. + * Checks if user has tapped opposite corner to the current + * cursor corner. + * + * @param aTappedPosition A position value to check + * @return ETrue if cursor area in opposite corner contains tapped position, + * EFalse otherwise + */ + TBool IsOppositeCornerTapped( TPoint aTappedPosition ) const; + + /** IsCropAreaTapped + * + * Touch related function. + * Checks if user has tapped inside the crop rectangle + * + * @param aTappedPosition A position value to check + * @return ETrue if current crop rectangle contains tapped position, + * EFalse otherwise + */ + TBool IsCropAreaTapped( TPoint aTappedPosition ) const; + + /** IsMinCropAreaTapped + * + * Touch related function. + * Checks if user has tapped inside the minimum crop rectangle. + * Minimum crop rectangle is inside crop regtacgle. A smallest + * possible rectangle to crop. + * + * @param aTappedPosition A position value to check + * @return ETrue if current minimum crop rectangle contains + tapped position, + * EFalse otherwise + */ + TBool IsMinCropAreaTapped( TPoint aTappedPosition ) const; + + /** IsCornerTapped + * + * Touch related function. + * Checks if either Top-Left or Bottom-Right corner is tapped. + * + * @param aTappedPosition Pointer position to check + * aTappedCorner Possible tapped corner index is returned here. + * @return ETrue if either one of the corners is tapped, EFalse otherwise + */ + TBool IsCornerTapped( TPoint aTappedPosition, TInt& aTappedCorner ) const; + + /** MoveCropArea + * + * Touch related function. + * Calculates the movement according to the given parameters and moves + * current crop rect respectively. + * + * @param aOldPosition Previous pointer position. + * aNewPosition Current pointer position. + * @return - + */ + void MoveCropArea( TPoint aOldPosition, TPoint aNewPosition ); + + /** ShowTooltip + * + * Show tooltip text on the screen. Tooltip text is set based + * on the current state. + * + * @param - + * @return - + */ + void ShowTooltip(); + +//@} + +/** @name Typedefs:*/ +//@{ + enum TCropState + { + // Invalid + ECropStateMin = 0, + // ULC + ECropStateFirst, + // LRC + ECropStateSecond, + // Move + ECropStateMove, + // Minimum crop + ECropStateMinCrop, + // Invalid + ECropStateMax + } iState; + + enum TFastKeyTimerState + { + // Inactive + ETimerInactive, + // Started but has not yet run + ETimerStarted, + // Started and running + ETimerRunning + } iFastKeyTimerState; + + enum TCropRectCorner + { + ETLCorner, + EBRCorner, + EInvalidCorner + }; +//@} + + +/** @name Members:*/ +//@{ + + /// Editor view + CAknView * iEditorView; + + /// Plug-in info + CPluginInfo * iItem; + + /// Navigation pane text + TBuf<64> iNaviPaneText; + + /// Cross hair icon + CFbsBitmap * iCrossHair; + CFbsBitmap * iCrossHairMask; + + /// Secondary cross hair icon + CFbsBitmap * iSecondaryCrossHair; + CFbsBitmap * iSecondaryCrossHairMask; + + /// Periodic timer for dancing ants and fast key events + CPeriodic * iTimer; + + /// Dancing ants flag + TBool iAntFlag; + + /// Pressed key event code + TInt iPressedKeyScanCode; + + /// Are event keys handled + TBool iHandleEventKeys; + + /// Number of ticks since timer start + TInt iTickCount; + + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; + + /// Ready to render + TBool iReadyToRender; + + const CSystemParameters * iSysPars; + + /// Relative crop rect coordinates + float iULC; + float iULR; + float iLRC; + float iLRR; + + /// Minimum crop parameters + float iMinX; + float iMinY; + + /// Wanted aspect ratio + float iCropRatio; + + /// Crop mode + TBool iIsCropModeManual; + + /// Is input image too small + TBool iIsCropDisabled; + +#ifdef DOUBLE_BUFFERED_CROP + + /// Double buffer bitmap + CFbsBitmap * iPrevBitmap; + CFbsBitmap * iBufBitmap; + +#endif + + TRect iOldCropRectPrev; + TBool iBackground; + + TBuf<256> iParam; + TInt iCropX; + TInt iCropY; + TInt iCropW; + TInt iCropH; + // Popup controller + CAknInfoPopupNoteController* iPopupController; + // Tooltip texts + HBufC * iTooltipResize; + HBufC * iTooltipMove; + + // Indicates whether touch dragging is allowed or not + // (cursor or the whole crop rect) + TBool iTouchDragEnabled; + // Stores the position for previously tapped screen point (touch enabler) + TPoint iTappedPosition; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/inc/ImageEditorCropPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/inc/ImageEditorCropPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,189 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORCROPPLUGIN_H +#define IMAGEEDITORCROPPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; +class CSystemParameters; + + +/* CLASS: CImageEditorCropPlugin +* +* CImageEditorCropPlugin represents crop plug-in for Image Editor +* application. +* +*/ +class CImageEditorCropPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorCropPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorCropPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorCropPlugin (const CImageEditorCropPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorCropPlugin & operator= (const CImageEditorCropPlugin & rhs); + + /** ReadWallPaperCropDefinitionsL + * + * Adds the crop ratio names to aCropTexts and aspect ratio description + * to aCropRatios. Aspect ratio is current screen resolution either in + * portrait or in landscape. + * + * The aspect ratio is defined by two integers W for width and H for + * height. On return, aCropRatios have the aspect ratio definitions + * inserted as follows: W1 H1 W2 H2... + + * @param aCropTexts - on return includes crop ratio names + * @param aCropRatios - on return includes crop ratio definitions + * @return - + */ + void ReadWallPaperCropDefinitionsL ( + CDesCArray & aCropTexts, + RArray & aCropRatios + ) const; + + /** ReadCropDefinitionsL + * + * Reads crop definition resource. Adds the crop ratio names to + * aCropTexts and aspect ratio description to aCropRatios. + * + * The aspect ratio is defined by two integers W for width and H for + * height. On return, aCropRatios have the aspect ratio definitions + * inserted as follows: W1 H1 W2 H2... This means that after this method + * is called, count of aCropRatios is three times the count of aCropTexts. + * + * @param aCropTexts - on return includes crop ratio names + * @param aCropRatios - on return includes crop ratio definitions + * @return - + */ + void ReadCropDefinitionsL ( + CDesCArray & aCropTexts, + RArray & aCropRatios + ) const; + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// Image height + const CSystemParameters * iSysPars; + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/rom/ImageEditorCropPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/rom/ImageEditorCropPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __CROPPLUGIN_IBY__ +#define __CROPPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Crop.pgn SHARED_LIB_DIR\Crop.pgn + +// Resources +data=DATAZ_\resource\apps\Crop.mif \resource\apps\Crop.mif + +#endif // __CROPPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/src/ImageEditorCropControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/src/ImageEditorCropControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,2361 @@ +/* +* 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: +* Crop plugin's control class. +* +*/ + + +// INCLUDES +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "ImageEditorUI.hrh" +#include "ImageEditorPluginBase.hrh" +#include "PluginInfo.h" +#include "DrawUtils.h" +#include "SystemParameters.h" +#include "JpTimer.h" +#include "ImageEditorUIDefs.h" +#include "iepb.h" + +#include "ImageEditorCropControl.h" +#include "ImageEditorError.h" + +// debug log +#include "imageeditordebugutils.h" +_LIT(KCropPluginLogFile,"CropPlugin.log"); + +// Resource file name +_LIT (KPgnResourceFile, "crop.rsc"); +// Separator to navi pane text +_LIT( KCropNaviTextSeparator, "x" ); + +// CONSTANTS +const float KParamStep = 0.005F; +const float KMinCropRelDistFrac = 0.01F; +const float KCursorScalingFactor = 0.7F; + +const TInt KMaxCropAbsoluteMin = 75; +const TInt KMinSourceSize = 75; + +//const TInt KStatusPaneTextMoveIndex = 1; +const TInt KStatusPaneTextAreaIndex = 2; + +// Default value from CPreviewControlBase not used +const TInt KCropFastKeyTimerDelayInMicroseconds = 1000; + +// Used fixed point resolution for scales +//const TInt KScaleBits = 12; + +//============================================================================= +CImageEditorCropControl * CImageEditorCropControl::NewL ( + const TRect& aRect, + CCoeControl* aParent + ) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::NewL()"); + + CImageEditorCropControl * self = new (ELeave) CImageEditorCropControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +TInt CImageEditorCropControl::DancingAntsCallback (TAny * aPtr) +{ + ((CImageEditorCropControl *)aPtr)->OnDancingAntsCallBack(); + return KErrNone; +} + +//============================================================================= +TInt CImageEditorCropControl::FastKeyCallback (TAny * aPtr) +{ + TRAPD( err, ((CImageEditorCropControl *)aPtr)->OnFastKeyCallBackL() ); + return err; +} + +//============================================================================= +CImageEditorCropControl::CImageEditorCropControl () : +iState (ECropStateFirst), +iFastKeyTimerState (ETimerInactive), +iHandleEventKeys (ETrue), +iTickCount (0), +iNaviStepMultiplier (KDefaultSmallNavigationStepMultiplier), +iReadyToRender(EFalse) +{ + +} + +//============================================================================= +CImageEditorCropControl::~CImageEditorCropControl () +{ + iEditorView = NULL; + iItem = NULL; + iSysPars = NULL; + + delete iCrossHair; + delete iCrossHairMask; + + delete iSecondaryCrossHair; + delete iSecondaryCrossHairMask; + if (iTimer) + { + iTimer->Cancel(); + } + delete iTimer; + + delete iPopupController; + delete iTooltipResize; + delete iTooltipMove; + +#ifdef DOUBLE_BUFFERED_CROP + + delete iBufBitmap; + +#endif // DOUBLE_BUFFERED_CROP + +} + +//============================================================================= +void CImageEditorCropControl::ConstructL ( + const TRect& /*aRect*/, + CCoeControl* aParent + ) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::ConstructL()"); + + // Set parent window + SetContainerWindowL (*aParent); + + // Load MAIN CROSSHAIR image + SDrawUtils::GetIndicatorBitmapL ( + iCrossHair, + iCrossHairMask, + EMbmImageeditoruiQgn_indi_imed_cursor_super, + EMbmImageeditoruiQgn_indi_imed_cursor_super_mask + ); + + // Load SECOND CROSSHAIR image + SDrawUtils::GetIndicatorBitmapL ( + iSecondaryCrossHair, + iSecondaryCrossHairMask, + EMbmImageeditoruiQgn_indi_imed_cursor2_super, + EMbmImageeditoruiQgn_indi_imed_cursor2_super_mask + ); + + TSize chSize = iCrossHair->SizeInPixels(); + TSize chNewSize = TSize( ( chSize.iWidth * KCursorScalingFactor ), + ( chSize.iHeight * KCursorScalingFactor ) ); + // Set secondary cursor size smaller than the main cursor + AknIconUtils::SetSize( iSecondaryCrossHair, chNewSize ); + AknIconUtils::SetSize( iSecondaryCrossHairMask, chNewSize ); + + // Create and start timer for dancing ants and fast key events + iTimer = CPeriodic::NewL (CActive::EPriorityStandard); + StartDancingAntsTimer(); + + iPopupController = CAknInfoPopupNoteController::NewL(); + + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read tooltip resources + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + RConeResourceLoader resLoader ( *CEikonEnv::Static() ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + iTooltipResize = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CROP_RESIZE_AREA); + iTooltipMove = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_CROP_MOVE_AREA); + + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + CleanupStack::PopAndDestroy(); // resLoader + + EnableDragEvents(); + + // Activate control + ActivateL(); +} + +//============================================================================= +void CImageEditorCropControl::Draw (const TRect & aRect) const +{ + +#ifndef DOUBLE_BUFFERED_CROP + + CPreviewControlBase::DrawPreviewImage (aRect); + +#endif // DOUBLE_BUFFERED_CROP + + if ( iState != ECropStateMin ) + { + // Get graphics context + CWindowGc & gc = SystemGc(); + +#ifdef DOUBLE_BUFFERED_CROP + + if ( iBufBitmap && iBufBitmap->Handle() ) + { + gc.BitBlt(TPoint(0,0), iBufBitmap); + } + +#endif // DOUBLE_BUFFERED_CROP + + // Compute crop rectangle inside the image area + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = (rect.iBr.iX - rect.iTl.iX); + TInt h = (rect.iBr.iY - rect.iTl.iY); + TInt ulc = (TInt) (iULC * w + 0.5) + rect.iTl.iX; + TInt ulr = (TInt) (iULR * h + 0.5) + rect.iTl.iY; + TInt lrc = (TInt) (iLRC * w + 0.5) + rect.iTl.iX; + TInt lrr = (TInt) (iLRR * h + 0.5) + rect.iTl.iY; + +#ifndef DOUBLE_BUFFERED_CROP + + // Darken areas in the image that are outside crop rectangle + gc.SetDrawMode (CGraphicsContext::EDrawModeAND); + gc.SetPenStyle (CGraphicsContext::ENullPen); + gc.SetPenColor (KRgbBlack); + gc.SetBrushStyle (CGraphicsContext::EDiamondCrossHatchBrush); + gc.SetBrushColor (KRgbWhite); + + // Darken top + gc.DrawRect ( TRect ( rect.iTl.iX, 0, rect.iBr.iX, ulr ) ); + + // Darken left side + gc.DrawRect ( TRect( rect.iTl.iX, ulr, ulc, lrr ) ); + + // Darken right side + gc.DrawRect ( TRect( lrc, ulr, rect.iBr.iX, lrr ) ); + + // Darken bottom + gc.DrawRect ( TRect( rect.iTl.iX, lrr, rect.iBr.iX, Rect().iBr.iY ) ); + +#endif // DOUBLE_BUFFERED_CROP + + // Draw crop rectangle with dancing antz + DrawDancingAnts (aRect); + + DrawCursors( TRect( ulc, ulr, lrc, lrr ) ); + + } +} + +//============================================================================= +void CImageEditorCropControl::DrawCursors (const TRect& aCropRect) const + { + CWindowGc & gc = SystemGc(); + + CFbsBitmap* mainCrossHair; + CFbsBitmap* mainCrossHairMask; + if ( iState == ECropStateMove ) + { + mainCrossHair = iSecondaryCrossHair; + mainCrossHairMask = iSecondaryCrossHairMask; + } + else + { + mainCrossHair = iCrossHair; + mainCrossHairMask = iCrossHairMask; + } + + // Draw the main cross hair + if ( mainCrossHair && mainCrossHair ) + { + TInt cx = 0; + TInt cy = 0; + if (iState == ECropStateFirst || iState == ECropStateMove) + { + cx = aCropRect.iTl.iX; + cy = aCropRect.iTl.iY; + } + else if (iState == ECropStateSecond) + { + cx = aCropRect.iBr.iX - 1; + cy = aCropRect.iBr.iY - 1; + } + + TSize chSize = mainCrossHair->SizeInPixels(); + gc.BitBltMasked ( + TPoint(cx - (chSize.iWidth >> 1), cy - (chSize.iHeight >> 1)), + mainCrossHair, + TRect (chSize), + mainCrossHairMask, + EFalse + ); + } + + // Draw the secondary cross hair + if ( iSecondaryCrossHair && iSecondaryCrossHairMask ) + { + + TInt cx = 0; + TInt cy = 0; + if (iState == ECropStateFirst || iState == ECropStateMove) + { + cx = aCropRect.iBr.iX - 1; + cy = aCropRect.iBr.iY - 1; + } + else if (iState == ECropStateSecond) + { + cx = aCropRect.iTl.iX; + cy = aCropRect.iTl.iY; + } + + TSize chSize = iSecondaryCrossHair->SizeInPixels(); + gc.BitBltMasked ( + TPoint(cx - (chSize.iWidth >> 1), cy - (chSize.iHeight >> 1)), + iSecondaryCrossHair, + TRect (chSize), + iSecondaryCrossHairMask, + EFalse + ); + } + } + +//============================================================================= +void CImageEditorCropControl::DrawDancingAnts (const TRect & /*aRect*/) const +{ + // Get graphics context + CWindowGc & gc = SystemGc(); + + // Compute crop rectangle inside the image area + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = (rect.iBr.iX - rect.iTl.iX); + TInt h = (rect.iBr.iY - rect.iTl.iY); + TInt ulc = (TInt) (iULC * w) + rect.iTl.iX; + TInt ulr = (TInt) (iULR * h) + rect.iTl.iY; + TInt lrc = (TInt) (iLRC * w) + rect.iTl.iX; + TInt lrr = (TInt) (iLRR * h) + rect.iTl.iY; + + // Crop needed rectangles + TRect cr (ulc, ulr, lrc, lrr); + + // Draw the "dancing ants" rectangle + gc.SetDrawMode (CGraphicsContext::EDrawModePEN); + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + gc.SetBrushColor (KRgbBlack); + + // Draw + gc.SetPenStyle (CGraphicsContext::ESolidPen); + gc.SetPenColor ((iAntFlag) ? (KRgbBlack) : (KRgbWhite)); + gc.DrawRect (cr); + + // Draw dashed line + gc.SetPenStyle (CGraphicsContext::EDashedPen); + gc.SetPenColor ((iAntFlag) ? (KRgbWhite) : (KRgbBlack)); + gc.DrawRect (cr); + +} + + +//============================================================================= +void CImageEditorCropControl::SetView (CAknView * aView) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::SetView()"); + + iEditorView = aView; +} + +//============================================================================= +void CImageEditorCropControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::SetSelectedUiItemL()"); + iItem = aItem; +} + +#ifdef DOUBLE_BUFFERED_CROP + +//============================================================================= +void CImageEditorCropControl::SetImageL (CFbsBitmap * aBitmap) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::SetImageL()"); + + // Create preview bitmap + iPrevBitmap = aBitmap; + TSize size = iPrevBitmap->SizeInPixels(); + TDisplayMode dmode = iPrevBitmap->DisplayMode(); + + delete iBufBitmap; + iBufBitmap = 0; + iBufBitmap = new (ELeave) CFbsBitmap; + User::LeaveIfError ( iBufBitmap->Create(size, dmode) ); + + // Copy bitmap data + ClonePreviewBitmapL(); + DarkenUnselectedAreaL(); + DrawNow(); +} + +#endif // DOUBLE_BUFFERED_CROP + +//============================================================================= +TKeyResponse CImageEditorCropControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::OfferKeyEventL()"); + + TKeyResponse response = EKeyWasNotConsumed; + + // If busy, do not handle anything + if ( Busy() ) + { + response = EKeyWasConsumed; + } + + // EVENTKEY + else if (EEventKey == aType && iHandleEventKeys) + { + + switch (aKeyEvent.iCode) + { + + case EKeyDownArrow: + { + // Adjust crop point + NaviDownL(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + response = EKeyWasConsumed; + iPopupController->HideInfoPopupNote(); + break; + } + + case EKeyUpArrow: + { + // Adjust crop point + NaviUpL(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + response = EKeyWasConsumed; + iPopupController->HideInfoPopupNote(); + break; + } + + case EKeyRightArrow: + { + // Adjust crop point + NaviRightL(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + response = EKeyWasConsumed; + iPopupController->HideInfoPopupNote(); + break; + } + + case EKeyLeftArrow: + { + // Adjust crop point + NaviLeftL(); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + response = EKeyWasConsumed; + iPopupController->HideInfoPopupNote(); + break; + } + + case EKeyOK: + case EKeyEnter: + { + StartDancingAntsTimer(); + + if ( iIsCropModeManual ) + { + + if (iState == ECropStateFirst) + { + iState = ECropStateSecond; + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + } + else if (iState == ECropStateSecond) + { + iState = ECropStateMove; + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + } + else + { + iState = ECropStateMin; + iReadyToRender = ETrue; + iEditorView->HandleCommandL (EImageEditorResetZoom); + + if ( iULC == 0.00 && iULR == 0.00 && iLRC == 1.00 && iLRR == 1.00) + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + else + { + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + } + + } + response = EKeyWasConsumed; + } + else + { + if (iState == ECropStateFirst) + { + iState = ECropStateSecond; + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + } + else if (iState == ECropStateSecond) + { + iState = ECropStateMove; + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + } + else + { + ComputeCropParams(); + iState = ECropStateMin; + iReadyToRender = ETrue; + iEditorView->HandleCommandL (EImageEditorResetZoom); + if ( iULC == 0.00 && iULR == 0.00 && iLRC == 1.00 && iLRR == 1.00) + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + else + { + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + } + + } + response = EKeyWasConsumed; + } + break; + } + + case 0x2a: // * + case EStdKeyIncVolume: // zoom in key + { + + // Check for minimum crop size + TRect virect = iSysPars->VisibleImageRect(); + TInt width = (TInt)((iLRC - iULC) * (virect.iBr.iX - virect.iTl.iX) + 0.5F); + width = (TInt)(width * iSysPars->Scale() + 0.5); + TInt height = (TInt)((iLRR - iULR) * (virect.iBr.iY - virect.iTl.iY) + 0.5F); + height = (TInt)(height * iSysPars->Scale() + 0.5); + + TReal relscale = iSysPars->RelScale(); + TInt minCrop = (TInt)(KMaxCropAbsoluteMin * relscale + 0.5); + + if ( (width <= minCrop) || (height <= minCrop) ) + { + response = EKeyWasConsumed; + } + + // Store crop rectangle relative to screen + StoreCropRelScreen(); + break; + } + + case 0x23: // # + case EStdKeyDecVolume: // zoom out key + { + // Store crop rectangle relative to screen + StoreCropRelScreen(); + break; + } + + // Consume rotation keys to disable rotation +#ifndef LANDSCAPE_ROTATE_HOTKEYS + case 0x31: // 1 +#else + case 0x33: // 3 +#endif +#ifndef LANDSCAPE_ROTATE_HOTKEYS + case 0x33: // 3 +#else + case 0x39: // 9 +#endif + { + response = EKeyWasConsumed; + break; + } + + default: + { + break; + } + } + + // If the device is really slow, it may happen that the timer + // does not get execution time and slows down or halts completely. + // (Ideally, this should not happen.) + // This block is just to make sure that the cursor keeps moving + // even if the timer halts. + if (ETimerStarted == iFastKeyTimerState) + { + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } + } + } + + else if (EEventKey == aType && !iHandleEventKeys) + { + response = EKeyWasConsumed; + } + + // EVENTKEYDOWN + else if (EEventKeyDown == aType) + { + + switch (aKeyEvent.iScanCode) + { + + case EStdKeyLeftArrow: + case EStdKeyRightArrow: + case EStdKeyUpArrow: + case EStdKeyDownArrow: + { + iPressedKeyScanCode = aKeyEvent.iScanCode; + StartFastKeyTimer(); + response = EKeyWasConsumed; + break; + } + default: + break; + } + } + + // EVENTKEYUP + else if (EEventKeyUp == aType) + { + if (aKeyEvent.iScanCode == iPressedKeyScanCode) + { + iHandleEventKeys = ETrue; + iFastKeyTimerState = ETimerInactive; + StartDancingAntsTimer(); + response = EKeyWasConsumed; + ShowTooltip(); + } + } + + return response; +} + +//============================================================================= +void CImageEditorCropControl::SizeChanged() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::SizeChanged()"); + +} + +//============================================================================= +TDesC & CImageEditorCropControl::GetParam () +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::GetParam()"); + + // Do not set crop paramater before valid area is selected, + // otherwise preview image is cropped when zooming or panning + if (iReadyToRender) + { + iParam.Copy (_L("x1 ")); + iParam.AppendNum (iCropX); + iParam.Append (_L(" y1 ")); + iParam.AppendNum (iCropY); + iParam.Append (_L(" x2 ")); + iParam.AppendNum (iCropX + iCropW); + iParam.Append (_L(" y2 ")); + iParam.AppendNum (iCropY + iCropH); + } + return iParam; +} + +//============================================================================= +void CImageEditorCropControl::SetSystemParameters ( const CSystemParameters * aPars) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::SetSystemParameters()"); + iSysPars = aPars; +} + +//============================================================================= +void CImageEditorCropControl::SetCropModeL ( + const TInt aMode, + const float aRatio + ) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::SetCropModeL()"); + + // Store crop mode + iIsCropModeManual = (aMode == 0); + + // Store wanted aspect ratio + iCropRatio = aRatio; + + // Set initial points according to the cropping mode (aspect ratio) + SetInitialPointsL (); + // Shows the first tooltip when the plugin is entered + ShowTooltip(); +} + +//============================================================================= +void CImageEditorCropControl::HandlePluginCommandL (const TInt aCommand) +{ + LOGFMT(KCropPluginLogFile, "CImageEditorCropControl::HandlePluginCommandL(), aCommand = %d", aCommand); + + switch (aCommand) + { + + // Control focus gained, start dancing ants timer + case EImageEditorFocusGained: + { + StartDancingAntsTimer(); + break; + } + + // Control focus lost, stop dancing ants timer + case EImageEditorFocusLost: + { + if (iTimer) + { + iTimer->Cancel(); + } + break; + } + + // Visible image area changes => update crop parameters and + // screen buffer + case EImageEditorGlobalZoomChanged: + case EImageEditorGlobalPanChanged: + case EImageEditorGlobalRotationChanged: + case EImageEditorPostScreenModeChange: + { + + if ( aCommand == EImageEditorGlobalZoomChanged ) + { + RestoreCropRelScreen(); + UpdateCropRectangle(); + } + else if ( aCommand == EImageEditorPostScreenModeChange ) + { + RestoreCropRelImage(); + UpdateCropRectangle(); + } + +#ifdef DOUBLE_BUFFERED_CROP + + ClonePreviewBitmapL(); + DarkenUnselectedAreaL(); + DrawNow(); + +#endif // DOUBLE_BUFFERED_CROP + + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + break; + } + + // Set softkey + case EPgnSoftkeyIdSet: + { + if (iState == ECropStateFirst) + { + iState = ECropStateSecond; + } + else + { + iState = ECropStateMove; + } + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + ShowTooltip(); + break; + } + + // Done softkey + case EPgnSoftkeyIdDone: + { + ComputeCropParams(); + iState = ECropStateMin; + iReadyToRender = ETrue; + iEditorView->HandleCommandL (EImageEditorResetZoom); + if ( iULC == 0.00 && iULR == 0.00 && iLRC == 1.00 && iLRR == 1.00) + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + else + { + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + } + + break; + } + + // Cancel softkey + case EPgnSoftkeyIdCancel: + { + iEditorView->HandleCommandL (EImageEditorResetZoom); + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + break; + } + + // Back softkey + case EPgnSoftkeyIdBack: + { + if (iState == ECropStateSecond) + { + iState = ECropStateFirst; + } + else + { + iState = ECropStateSecond; + } + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + ShowTooltip(); + break; + } + + // Screen mode changed (portrait, portrait full, landscape, landscape full) + case EImageEditorPreScreenModeChange: + { + // Store crop rectangle relative to image + StoreCropRelImage(); + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +TInt CImageEditorCropControl::GetSoftkeyIndexL() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::GetSoftkeyIndexL()"); + + switch (iState) + { + case ECropStateFirst: + { + return 0; + } + case ECropStateSecond: + { + return 2; + } + case ECropStateMove: + { + return 1; + } + case ECropStateMinCrop: + { + return 3; // empty - cancel + } + default: + { + return -1; + } + } +} + +//============================================================================= +TPtrC CImageEditorCropControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::GetNaviPaneTextL()"); + + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + + + // Update parameters - needed for the zoom update + ComputeCropParams(); + + // Getting string from resources + TPtrC ptr = iItem->Parameters()[KStatusPaneTextAreaIndex]; + + // Compute scaled width and height + TReal width = iSysPars->Scale() * iCropW; + TReal height = iSysPars->Scale() * iCropH; + + // Convert the width and height relative to the + TReal relscale = iSysPars->RelScale(); + TInt scaledWidth = (TInt)((width / relscale) + 0.5); + TInt scaledHeight = (TInt)((height / relscale) + 0.5); + + iNaviPaneText.Zero(); + + // Generate string to be added to %U + TBuf< 20 > valueStr; + + valueStr.AppendNum( scaledWidth ); + valueStr.Append( KCropNaviTextSeparator ); + valueStr.AppendNum( scaledHeight ); + AknTextUtils::LanguageSpecificNumberConversion ( valueStr ); + + StringLoader::Format( iNaviPaneText, ptr, -1, valueStr ); + + CalculateMinCrop(); + return iNaviPaneText; +} + +//============================================================================= +void CImageEditorCropControl::ComputeCropParams() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputeCropParams()"); + + TRect virect = iSysPars->VisibleImageRect(); + + TInt w = (virect.iBr.iX - virect.iTl.iX); + TInt h = (virect.iBr.iY - virect.iTl.iY); + + TInt ulc = (TInt)(iULC * w + 0.5); + TInt ulr = (TInt)(iULR * h + 0.5); + TInt lrc = (TInt)(iLRC * w + 0.5); + TInt lrr = (TInt)(iLRR * h + 0.5); + + // Set parameter struct + w = lrc - ulc; + h = lrr - ulr; + iCropX = iSysPars->VisibleImageRect().iTl.iX + ulc; + iCropY = iSysPars->VisibleImageRect().iTl.iY + ulr; + iCropW = w; + if (iCropX + w > virect.iBr.iX) + { + iCropW = virect.iBr.iX - iCropX; + } + iCropH = h; + if (iCropY + h > virect.iBr.iY) + { + iCropH = virect.iBr.iY - iCropY; + } +} + +//============================================================================= +void CImageEditorCropControl::NaviDownL() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviDownL()"); + + // MANUAL MODE + if (iIsCropModeManual) + { + + // FIRST: UPPER LEFT CORNER + if (iState == ECropStateFirst) + { + iULR += (KParamStep * iNaviStepMultiplier); + if (iULR > iLRR - iMinY) + { + iULR = iLRR - iMinY; + } + } + + // SECOND: LOWER RIGHT CORNER + else if (iState == ECropStateSecond) + { + iLRR += (KParamStep * iNaviStepMultiplier); + if (iLRR > 1.0) + { + iLRR = 1.0; + } + } + // MOVE (ADDED FOR MANUAL) + else + { + float old = iLRR; + iLRR += (KParamStep * iNaviStepMultiplier); + if (iLRR > 1.0) + { + iLRR = 1.0; + } + iULR += (iLRR - old); + } + } + + // ASPECT RATIO PRESERVING MODE + else + { + + // FIRST: UPPER LEFT CORNER + if (iState == ECropStateFirst) + { + if ( ((iLRC - iULC) > iMinX) && ((iLRR - iULR) > iMinY) ) + { + iULR += (KParamStep * iNaviStepMultiplier); + if (iULR > iLRR - iMinY) + { + iULR = iLRR - iMinY; + } + ComputePreservedULC(); + if (iULC > iLRC - iMinX) + { + iULC = iLRC - iMinX; + } + } + } + + // SECOND: LOWER RIGHT CORNER + else if (iState == ECropStateSecond) + { + iLRR += (KParamStep * iNaviStepMultiplier); + if (iLRR > 1.0) + { + iLRR = 1.0; + } + ComputePreservedLRC(); + if (iLRC > 1.0) + { + iLRC = 1.0; + ComputePreservedLRR(); + } + } + + // MOVE (ONLY WITH ASPECT RATIO PRESERVING) + // NOWADAYS ALSO WITH MANUAL + else + { + float old = iLRR; + iLRR += (KParamStep * iNaviStepMultiplier); + if (iLRR > 1.0) + { + iLRR = 1.0; + } + iULR += (iLRR - old); + } + } + ComputeCropParams(); + +#ifdef DOUBLE_BUFFERED_CROP + + if (iState == ECropStateSecond || iState == ECropStateMove) + { + ClonePreviewBitmapL(); + } + + DarkenUnselectedAreaL(); + DrawNow(); + +#endif // DOUBLE_BUFFERED_CROP + +} + +//============================================================================= +void CImageEditorCropControl::NaviUpL() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviUpL()"); + + // MANUAL MODE + if (iIsCropModeManual) + { + + // FIRST: UPPER LEFT CORNER + if (iState == ECropStateFirst) + { + iULR -= (KParamStep * iNaviStepMultiplier); + if (iULR < 0.0) + { + iULR = 0.0; + } + } + + // SECOND: LOWER RIGHT CORNER + else if (iState == ECropStateSecond) + { + iLRR -= (KParamStep * iNaviStepMultiplier); + if (iLRR < iULR + iMinY) + { + iLRR = iULR + iMinY; + } + } + // MOVE (ADDED FOR MANUAL) + else + { + float old = iULR; + iULR -= (KParamStep * iNaviStepMultiplier); + if (iULR < 0.0) + { + iULR = 0.0; + } + iLRR -= (old - iULR); + } + } + + // ASPECT RATIO PRESERVING MODE + else + { + + // FIRST: UPPER LEFT CORNER + if (iState == ECropStateFirst) + { + iULR -= (KParamStep * iNaviStepMultiplier); + if (iULR < 0.0) + { + iULR = 0.0; + } + ComputePreservedULC(); + if (iULC < 0.0) + { + iULC = 0.0; + ComputePreservedULR(); + } + } + + // SECOND: LOWER RIGHT CORNER + else if (iState == ECropStateSecond) + { + if ( ((iLRC - iULC) > iMinX) && ((iLRR - iULR) > iMinY) ) + { + iLRR -= (KParamStep * iNaviStepMultiplier); + if ((iLRR - iULR) < iMinY) + { + iLRR = iULR + iMinY; + } + ComputePreservedLRC(); + if ((iLRC - iULC) < iMinX) + { + iLRC = iULC + iMinX; + } + } + } + + // MOVE (ONLY WITH ASPECT RATIO PRESERVING) + // NOWADAYS ALSO WITH MANUAL + else + { + float old = iULR; + iULR -= (KParamStep * iNaviStepMultiplier); + if (iULR < 0.0) + { + iULR = 0.0; + } + iLRR -= (old - iULR); + } + } + ComputeCropParams(); + +#ifdef DOUBLE_BUFFERED_CROP + + if (iState == ECropStateFirst || iState == ECropStateMove) + { + ClonePreviewBitmapL(); + } + + DarkenUnselectedAreaL(); + DrawNow(); + +#endif // DOUBLE_BUFFERED_CROP + +} + +//============================================================================= +void CImageEditorCropControl::NaviRightL() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviRightL()"); + + // MANUAL MODE + if (iIsCropModeManual) + { + + // FIRST: UPPER LEFT CORNER + if (iState == ECropStateFirst) + { + iULC += (KParamStep * iNaviStepMultiplier); + if (iULC > iLRC - iMinX) + { + iULC = iLRC - iMinX; + } + } + + // SECOND: LOWER RIGHT CORNER + else if (iState == ECropStateSecond) + { + iLRC += (KParamStep * iNaviStepMultiplier); + if (iLRC > 1.0) + { + iLRC = 1.0; + } + } + // MOVE (ADDED FOR MANUAL) + else if (iState == ECropStateMove) + { + float old = iLRC; + iLRC += (KParamStep * iNaviStepMultiplier); + if (iLRC > 1.0) + { + iLRC = 1.0; + } + iULC += (iLRC - old); + } + } + + // ASPECT RATIO PRESERVING MODE + else + { + + // MOVE (ONLY WITH ASPECT RATIO PRESERVING) + // NOWADAYS ALSO WITH MANUAL + if (iState == ECropStateMove) + { + float old = iLRC; + iLRC += (KParamStep * iNaviStepMultiplier); + if (iLRC > 1.0) + { + iLRC = 1.0; + } + iULC += (iLRC - old); + } + } + ComputeCropParams(); + +#ifdef DOUBLE_BUFFERED_CROP + + if (iState == ECropStateSecond || iState == ECropStateMove) + { + ClonePreviewBitmapL(); + } + + DarkenUnselectedAreaL(); + DrawNow(); + +#endif // DOUBLE_BUFFERED_CROP + +} + +//============================================================================= +void CImageEditorCropControl::NaviLeftL() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::NaviLeftL()"); + + // MANUAL MODE + if (iIsCropModeManual) + { + + // FIRST: UPPER LEFT CORNER + if (iState == ECropStateFirst) + { + iULC -= (KParamStep * iNaviStepMultiplier); + if (iULC < 0.0) + { + iULC = 0.0; + } + } + + // SECOND: LOWER RIGHT CORNER + else if (iState == ECropStateSecond) + { + iLRC -= (KParamStep * iNaviStepMultiplier); + if (iLRC < iULC + iMinX) + { + iLRC = iULC + iMinX; + } + } + // MOVE (ADDED FOR MANUAL) + else if (iState == ECropStateMove) + { + float old = iULC; + iULC -= (KParamStep * iNaviStepMultiplier); + if (iULC < 0.0) + { + iULC = 0.0; + } + iLRC -= (old - iULC); + } + } + + // ASPECT RATIO PRESERVING MODE + else + { + + // MOVE (ONLY WITH ASPECT RATIO PRESERVING) + // NOWADAYS ALSO WITH MANUAL + if (iState == ECropStateMove) + { + float old = iULC; + iULC -= (KParamStep * iNaviStepMultiplier); + if (iULC < 0.0) + { + iULC = 0.0; + } + iLRC -= (old - iULC); + } + } + ComputeCropParams(); + +#ifdef DOUBLE_BUFFERED_CROP + + if (iState == ECropStateFirst || iState == ECropStateMove) + { + ClonePreviewBitmapL(); + } + + DarkenUnselectedAreaL(); + DrawNow(); + +#endif // DOUBLE_BUFFERED_CROP + +} + +//============================================================================= +void CImageEditorCropControl::SetInitialPointsL () +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::SetInitialPointsL()"); + + const TSize vps = iSysPars->ViewPortRect().Size(); + if (vps.iWidth <= KMinSourceSize || vps.iHeight <= KMinSourceSize) + { + iULC = 0.00F; + iULR = 0.00F; + iLRC = 1.00F; + iLRR = 1.00F; + iState = ECropStateMinCrop; + } + + // MANUAL + else if (iIsCropModeManual) + { + iULC = 0.02F; + iULR = 0.02F; + iLRC = 0.98F; + iLRR = 0.98F; + } + + // ASPECT RATIO PRESERVED + else + { + + TRect virect = iSysPars->VisibleImageRect(); + TInt width = (virect.iBr.iX - virect.iTl.iX); + TInt height = (virect.iBr.iY - virect.iTl.iY); + + float current = (float)width / (float)height; + + if (iCropRatio > current) + { + float tmp = 0.5F * (current / iCropRatio); + iULC = 0.0F; + iULR = 0.5F - tmp; + iLRC = 1.0F; + iLRR = 0.5F + tmp; + } + else + { + float tmp = 0.5F * (iCropRatio / current); + iULC = 0.5F - tmp; + iULR = 0.0F; + iLRC = 0.5F + tmp; + iLRR = 1.0F; + } + } + + ComputeCropParams(); + StoreCropRelScreen(); + +#ifdef DOUBLE_BUFFERED_CROP + + DarkenUnselectedAreaL(); + DrawNow(); + +#endif // DOUBLE_BUFFERED_CROP + +} + +//============================================================================= +void CImageEditorCropControl::StartDancingAntsTimer() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::StartDancingAntsTimer()"); + + if (iTimer) + { + iTimer->Cancel(); + iTimer->Start( + TTimeIntervalMicroSeconds32 (KDancingAntzTimerDelayInMicroseconds), + TTimeIntervalMicroSeconds32 (KDancingAntzTimerIntervalInMicroseconds), + TCallBack (DancingAntsCallback, this) + ); + } +} + +//============================================================================= +void CImageEditorCropControl::StartFastKeyTimer() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::StartFastKeyTimer()"); + + iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; + iTickCount = 0; + iFastKeyTimerState = ETimerStarted; + + if (iTimer) + { + iTimer->Cancel(); + iTimer->Start( + TTimeIntervalMicroSeconds32 (KCropFastKeyTimerDelayInMicroseconds), + TTimeIntervalMicroSeconds32 (KDefaultFastKeyTimerIntervalInMicroseconds), + TCallBack (FastKeyCallback, this) + ); + } +} + +//============================================================================= +void CImageEditorCropControl::OnDancingAntsCallBack() +{ + iAntFlag = !iAntFlag; + ActivateGc(); + DrawDancingAnts (Rect()); + DeactivateGc(); +} + +//============================================================================= +void CImageEditorCropControl::OnFastKeyCallBackL() +{ + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } + + // If first time here, reset the tick counter. + if (ETimerStarted == iFastKeyTimerState) + { + iFastKeyTimerState = ETimerRunning; + iTickCount = 0; + } + + iHandleEventKeys = EFalse; + + switch (iPressedKeyScanCode) + { + case EStdKeyDownArrow: + { + NaviDownL(); + break; + } + case EStdKeyUpArrow: + { + NaviUpL(); + break; + } + case EStdKeyLeftArrow: + { + NaviLeftL(); + break; + } + case EStdKeyRightArrow: + { + NaviRightL(); + break; + } + default: + break; + } + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); +} + +//============================================================================= +TBool CImageEditorCropControl::IsReadyToRender() const +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::IsReadyToRender()"); + + // Always ready to render. However selected crop are is not set in GetParam()¨ + // until closing the plug-in. + return ETrue; +} + +//============================================================================= +void CImageEditorCropControl::CalculateMinCrop() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::CalculateMinCrop()"); + + TInt im_width = (iSysPars->VisibleImageRect().iBr.iX - iSysPars->VisibleImageRect().iTl.iX); + im_width = (TInt)(im_width * iSysPars->Scale() + 0.5); + TInt im_height = (iSysPars->VisibleImageRect().iBr.iY - iSysPars->VisibleImageRect().iTl.iY); + im_height = (TInt)(im_height * iSysPars->Scale() + 0.5); + TInt im_maxdim = (im_width < im_height) ? (im_height) : (im_width); + + TInt im_min_crop_rel = (TInt)(KMinCropRelDistFrac * im_maxdim + 0.5F); + TInt im_min_crop_abs = KMaxCropAbsoluteMin; + TInt im_maxcrop = (im_min_crop_rel > im_min_crop_abs) ? + (im_min_crop_rel) : (im_min_crop_abs); + + TReal relscale = iSysPars->RelScale(); + TInt image_maxcrop_prev = (TInt)(im_maxcrop * relscale + 0.5); + + iMinX = (float)image_maxcrop_prev / (float)im_width; + iMinY = (float)image_maxcrop_prev / (float)im_height; +} + +//============================================================================= +void CImageEditorCropControl::ComputePreservedULC() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedULC()"); + + TRect virect = iSysPars->VisibleImageRect(); + TInt viwidth = (virect.iBr.iX - virect.iTl.iX); + TInt viheight = (virect.iBr.iY - virect.iTl.iY); + iULC = (iLRC * viwidth - iCropRatio * ((iLRR - iULR) * viheight)) / viwidth; +} + +//============================================================================= +void CImageEditorCropControl::ComputePreservedLRC() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedLRC()"); + + TRect virect = iSysPars->VisibleImageRect(); + TInt viwidth = (virect.iBr.iX - virect.iTl.iX); + TInt viheight =(virect.iBr.iY - virect.iTl.iY); + iLRC = (iULC * viwidth + iCropRatio * ((iLRR - iULR) * viheight)) / viwidth; +} + +//============================================================================= +void CImageEditorCropControl::ComputePreservedULR() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedULR()"); + + TRect virect = iSysPars->VisibleImageRect(); + TInt viwidth = (virect.iBr.iX - virect.iTl.iX); + TInt viheight =(virect.iBr.iY - virect.iTl.iY); + iULR = (iLRR * viheight - (((iLRC - iULC) * viwidth) / iCropRatio)) / viheight; +} + +//============================================================================= +void CImageEditorCropControl::ComputePreservedLRR() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::ComputePreservedLRR()"); + + TRect virect = iSysPars->VisibleImageRect(); + TInt viwidth = (virect.iBr.iX - virect.iTl.iX); + TInt viheight =(virect.iBr.iY - virect.iTl.iY); + iLRR = (iULR * viheight + (((iLRC - iULC) * viwidth) / iCropRatio)) / viheight; +} + +#ifdef DOUBLE_BUFFERED_CROP + +//============================================================================= +void CImageEditorCropControl::ClonePreviewBitmapL() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::ClonePreviewBitmapL()"); + + TBitmapUtil bmptls (iPrevBitmap); + bmptls.Begin(TPoint(0,0)); + + TSize size = iPrevBitmap->SizeInPixels(); + TDisplayMode dmode = iPrevBitmap->DisplayMode(); + + TInt bufsize = size.iHeight * iPrevBitmap->ScanLineLength (size.iWidth, dmode); + TUint8 * ps = (TUint8*)( iPrevBitmap->DataAddress() ); + TUint8 * pd = (TUint8*)( iBufBitmap->DataAddress() ); + Mem::Copy (pd, ps, bufsize); + + bmptls.End(); +} + +//============================================================================= +void CImageEditorCropControl::DarkenUnselectedAreaL() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::DarkenUnselectedAreaL()"); + + if (iBufBitmap) + { + // Compute crop rectangle inside the image area + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = (rect.iBr.iX - rect.iTl.iX); + TInt h = (rect.iBr.iY - rect.iTl.iY); + TInt ulc = (TInt) (iULC * w + 0.5) + rect.iTl.iX; + TInt ulr = (TInt) (iULR * h + 0.5) + rect.iTl.iY; + TInt lrc = (TInt) (iLRC * w + 0.5) + rect.iTl.iX; + TInt lrr = (TInt) (iLRR * h + 0.5) + rect.iTl.iY; + + // Darken areas in the image that are outside crop rectangle + CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL (iBufBitmap); + CleanupStack::PushL (bitmapDevice); + + // Create bitmap graphics context + CFbsBitGc * bitmapContext = 0; + User::LeaveIfError (bitmapDevice->CreateContext (bitmapContext)); + CleanupStack::PushL (bitmapContext) ; + + + bitmapContext->SetDrawMode (CGraphicsContext::EDrawModeAND); + bitmapContext->SetPenStyle (CGraphicsContext::ENullPen); + bitmapContext->SetPenColor (KRgbBlack); + bitmapContext->SetBrushStyle (CGraphicsContext::EDiamondCrossHatchBrush); + bitmapContext->SetBrushColor (KRgbWhite); + + // Darken top + bitmapContext->DrawRect ( TRect ( rect.iTl.iX, 0, rect.iBr.iX, ulr ) ); + + // Darken left side + bitmapContext->DrawRect ( TRect( rect.iTl.iX, ulr, ulc, lrr ) ); + + // Darken right side + bitmapContext->DrawRect ( TRect( lrc, ulr, rect.iBr.iX, lrr ) ); + + // Darken bottom + bitmapContext->DrawRect ( TRect( rect.iTl.iX, lrr, rect.iBr.iX, Rect().iBr.iY ) ); + + CleanupStack::PopAndDestroy(2); // bitmapContext, bitmapDevice + } +} + +#endif // DOUBLE_BUFFERED_CROP + +//============================================================================= +void CImageEditorCropControl::UpdateCropRectangle() +{ + + LOG(KCropPluginLogFile, "CImageEditorCropControl::UpdateCropRectangle()"); + + if ( iOldCropRectPrev == TRect (0,0,0,0) ) + { + return; + } + if (iULC < 0.0) + { + iULC = 0.0; + if ( !iIsCropModeManual ) + { + ComputePreservedLRR(); + } + } + if (iULR < 0.0) + { + iULR = 0.0; + if ( !iIsCropModeManual ) + { + ComputePreservedLRC(); + } + } + if (iLRC > 1.0) + { + iLRC = 1.0; + if ( !iIsCropModeManual ) + { + ComputePreservedLRR(); + } + } + if (iLRR > 1.0) + { + iLRR = 1.0; + if ( !iIsCropModeManual ) + { + ComputePreservedLRC(); + } + } +} + +//============================================================================= +void CImageEditorCropControl::StoreCropRelScreen() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::StoreCropRelScreen()"); + + TRect viprect = iSysPars->VisibleImageRectPrev(); + + TInt vipwidth = (viprect.iBr.iX - viprect.iTl.iX); + TInt vipheight = (viprect.iBr.iY - viprect.iTl.iY); + iOldCropRectPrev.iTl.iX = viprect.iTl.iX + (TInt)(iULC * vipwidth + 0.5); + iOldCropRectPrev.iTl.iY = viprect.iTl.iY + (TInt)(iULR * vipheight + 0.5); + iOldCropRectPrev.iBr.iX = viprect.iTl.iX + (TInt)(iLRC * vipwidth + 0.5); + iOldCropRectPrev.iBr.iY = viprect.iTl.iY + (TInt)(iLRR * vipheight + 0.5); +} + +//============================================================================= +void CImageEditorCropControl::RestoreCropRelScreen() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::RestoreCropRelScreen()"); + + TRect viprect = iSysPars->VisibleImageRectPrev(); + TInt width = (viprect.iBr.iX - viprect.iTl.iX); + TInt height = (viprect.iBr.iY - viprect.iTl.iY); + iULC = (float)(iOldCropRectPrev.iTl.iX - viprect.iTl.iX) / (float)width; + iULR = (float)(iOldCropRectPrev.iTl.iY - viprect.iTl.iY) / (float)height; + iLRC = (float)(iOldCropRectPrev.iBr.iX - viprect.iTl.iX) / (float)width; + iLRR = (float)(iOldCropRectPrev.iBr.iY - viprect.iTl.iY) / (float)height; +} + +//============================================================================= +void CImageEditorCropControl::StoreCropRelImage() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::StoreCropRelImage()"); + + TReal relscale = iSysPars->RelScale(); + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = (virect.iBr.iX - virect.iTl.iX); + TInt viheight = (virect.iBr.iY - virect.iTl.iY); + + iOldCropRectPrev.iTl.iX = virect.iTl.iX + (TInt)(iULC * viwidth + 0.5); + iOldCropRectPrev.iTl.iY = virect.iTl.iY + (TInt)(iULR * viheight + 0.5); + iOldCropRectPrev.iBr.iX = virect.iTl.iX + (TInt)(iLRC * viwidth + 0.5); + iOldCropRectPrev.iBr.iY = virect.iTl.iY + (TInt)(iLRR * viheight + 0.5); + +} + +//============================================================================= +void CImageEditorCropControl::RestoreCropRelImage() +{ + LOG(KCropPluginLogFile, "CImageEditorCropControl::RestoreCropRelImage()"); + + TReal relscale = iSysPars->RelScale(); + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)(virect.iTl.iX / relscale + 0.5); + virect.iTl.iY = (TInt)(virect.iTl.iY / relscale + 0.5); + virect.iBr.iX = (TInt)(virect.iBr.iX / relscale + 0.5); + virect.iBr.iY = (TInt)(virect.iBr.iY / relscale + 0.5); + + TInt width = (virect.iBr.iX - virect.iTl.iX); + TInt height = (virect.iBr.iY - virect.iTl.iY); + + iULC = (float)(iOldCropRectPrev.iTl.iX - virect.iTl.iX) / width; + iULR = (float)(iOldCropRectPrev.iTl.iY - virect.iTl.iY) / height; + iLRC = (float)(iOldCropRectPrev.iBr.iX - virect.iTl.iX) / width; + iLRR = (float)(iOldCropRectPrev.iBr.iY - virect.iTl.iY) / height; + +} + +//============================================================================= +void CImageEditorCropControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + TBool redraw( ETrue ); + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + iPopupController->HideInfoPopupNote(); + iTouchDragEnabled = EFalse; + // Store tapped position + iTappedPosition = aPointerEvent.iPosition; + + if ( iState == ECropStateFirst || iState == ECropStateSecond ) + { + // Check first if minimum crop area is tapped (priority 1) + if ( IsMinCropAreaTapped( aPointerEvent.iPosition ) ) + { + // enables immediate rectangle moving + redraw = ETrue; + iTouchDragEnabled = ETrue; + iState = ECropStateMove; + iEditorView->HandleCommandL ( + EImageEditorUpdateSoftkeys ); + } + // Check if corners are tapped (priority 2) + else if ( IsCursorTapped( aPointerEvent.iPosition ) ) + { +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorCropControl: ETouchFeedback 1" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + // Just enable dragging, no need to change position + // here + iTouchDragEnabled = ETrue; + redraw = EFalse; + } + else if ( IsOppositeCornerTapped( + aPointerEvent.iPosition ) ) + { +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorCropControl: ETouchFeedback 2" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + iTouchDragEnabled = ETrue; + if ( iState == ECropStateFirst ) + { + iState = ECropStateSecond; + } + else + { + iState = ECropStateFirst; + } + iEditorView->HandleCommandL ( + EImageEditorUpdateSoftkeys ); + redraw = ETrue; + } + // Change to move state + else if ( IsCropAreaTapped( aPointerEvent.iPosition ) ) + { + // enables immediate rectangle moving + redraw = ETrue; + iTouchDragEnabled = ETrue; + iState = ECropStateMove; + iEditorView->HandleCommandL ( + EImageEditorUpdateSoftkeys ); + } + } + else if ( iState == ECropStateMove ) + { + TInt corner; + + if ( IsMinCropAreaTapped( aPointerEvent.iPosition ) ) + { + // enables immediate rectangle moving + redraw = ETrue; + iTouchDragEnabled = ETrue; + iState = ECropStateMove; + //iEditorView->HandleCommandL ( + // EImageEditorUpdateSoftkeys ); + } + // Moving back to first or second state from Move state + // by pressing top-left or bottom-right corner + else if( IsCornerTapped( aPointerEvent.iPosition , corner) ) + { +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorCropControl: ETouchFeedback 3" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + if ( corner == ETLCorner ) + { + // enables immediate dragging + redraw = ETrue; + iTouchDragEnabled = ETrue; + iState = ECropStateFirst; + iEditorView->HandleCommandL ( + EImageEditorUpdateSoftkeys ); + } + else if ( corner == EBRCorner ) + { + redraw = ETrue; + iTouchDragEnabled = ETrue; + iState = ECropStateSecond; + iEditorView->HandleCommandL ( + EImageEditorUpdateSoftkeys ); + } + } + else if ( IsCropAreaTapped( aPointerEvent.iPosition ) ) + { + redraw = EFalse; + iTouchDragEnabled = ETrue; + iTappedPosition = aPointerEvent.iPosition; + } + } + break; + } + case TPointerEvent::EDrag: + { + if ( iState == ECropStateFirst && + iTouchDragEnabled ) + { + SetTLPosition( iTappedPosition, aPointerEvent.iPosition ); + iTappedPosition = aPointerEvent.iPosition; + } + else if ( iState == ECropStateSecond && + iTouchDragEnabled ) + { + SetBRPosition( iTappedPosition, aPointerEvent.iPosition ); + iTappedPosition = aPointerEvent.iPosition; + } + else if ( iState == ECropStateMove && iTouchDragEnabled ) + { + MoveCropArea( iTappedPosition, aPointerEvent.iPosition ); + iTappedPosition = aPointerEvent.iPosition; + } + redraw = ETrue; + break; + } + case TPointerEvent::EButton1Up: + { + iTouchDragEnabled = EFalse; + redraw = EFalse; + ShowTooltip(); + break; + } + + default: + { + break; + } + } + + if ( redraw ) + { + ComputeCropParams(); + +#ifdef DOUBLE_BUFFERED_CROP + + if ( iState == ECropStateFirst || + iState == ECropStateSecond || + iState == ECropStateMove ) + { + ClonePreviewBitmapL(); + } + DarkenUnselectedAreaL(); + +#endif // DOUBLE_BUFFERED_CROP + + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); + } + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + } + +//============================================================================= +void CImageEditorCropControl::SetTLPosition( TPoint aOldPosition, + TPoint aNewPosition ) + { + // Get system parameters + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + //Set new x value + iULC += TReal( aNewPosition.iX - aOldPosition.iX ) / + ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX ); + + //Set new y value + iULR += TReal( aNewPosition.iY - aOldPosition.iY ) / + ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY ); + + // check the limits + if (iULR < 0.0) + { + iULR = 0.0; + } + else if (iULR > iLRR - iMinY) + { + iULR = iLRR - iMinY; + } + + if ( !iIsCropModeManual ) + { + // To preserve selected aspect ratio + ComputePreservedULC(); + } + + if (iULC < 0.0) + { + iULC = 0.0; + } + else if (iULC > iLRC - iMinX) + { + iULC = iLRC - iMinX; + } + + if ( !iIsCropModeManual ) + { + // To preserve selected aspect ratio + ComputePreservedULR(); + } + } + +//============================================================================= +void CImageEditorCropControl::SetBRPosition( TPoint aOldPosition, + TPoint aNewPosition ) + { + + // Get system parameters + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + //Set new x value + iLRC += TReal( aNewPosition.iX - aOldPosition.iX ) / + ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX ); + + //Set new y value + iLRR += TReal( aNewPosition.iY - aOldPosition.iY ) / + ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY ); + + // check the limits + if (iLRR < iULR + iMinY) + { + iLRR = iULR + iMinY; + } + else if (iLRR > 1.0) + { + iLRR = 1.0; + } + + if ( !iIsCropModeManual ) + { + // To preserve selected aspect ratio + ComputePreservedLRC(); + } + + if (iLRC < iULC + iMinX) + { + iLRC = iULC + iMinX; + } + else if (iLRC > 1.0) + { + iLRC = 1.0; + } + + if ( !iIsCropModeManual ) + { + // To preserve selected aspect ratio + ComputePreservedLRR(); + } + } + +//============================================================================= +TBool CImageEditorCropControl::IsCursorTapped( TPoint aTappedPosition ) const + { + TInt corner; + + if ( IsCornerTapped( aTappedPosition, corner ) ) + { + if ( corner == ETLCorner && iState == ECropStateFirst ) + { + return ETrue; + } + else if ( corner == EBRCorner && iState == ECropStateSecond ) + { + return ETrue; + } + } + return EFalse; + } + +//============================================================================= +TBool CImageEditorCropControl::IsOppositeCornerTapped( + TPoint aTappedPosition ) const + { + TInt corner; + + if ( IsCornerTapped( aTappedPosition, corner ) ) + { + if ( corner == ETLCorner && iState == ECropStateSecond ) + { + return ETrue; + } + else if ( corner == EBRCorner && iState == ECropStateFirst ) + { + return ETrue; + } + } + return EFalse; + } + +//============================================================================= +TBool CImageEditorCropControl::IsCropAreaTapped( TPoint aTappedPosition ) const + { + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = ( rect.iBr.iX - rect.iTl.iX ); + TInt h = ( rect.iBr.iY - rect.iTl.iY ); + TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX; + TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY; + TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX; + TInt lrr = ( TInt) ( iLRR * h + 0.5 ) + rect.iTl.iY; + + TRect areaRect ( TPoint( ulc, ulr ), TPoint( lrc, lrr ) ); + + return areaRect.Contains( aTappedPosition ); + + } + +//============================================================================= +TBool CImageEditorCropControl::IsMinCropAreaTapped( TPoint aTappedPosition ) const + { + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = ( rect.iBr.iX - rect.iTl.iX ); + TInt h = ( rect.iBr.iY - rect.iTl.iY ); + TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX; + TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY; + TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX; + TInt lrr = ( TInt) ( iLRR * h + 0.5 ) + rect.iTl.iY; + + TPoint middlePoint = TPoint( ulc + ( lrc - ulc ) / 2, + ulr + ( lrr - ulr ) / 2 ); + + TReal relscale = iSysPars->RelScale(); + TInt minCrop = (TInt)(KMaxCropAbsoluteMin * relscale + 0.5); + + TRect areaRect ( TPoint( middlePoint.iX - minCrop, middlePoint.iY - minCrop ), + TPoint( middlePoint.iX + minCrop, middlePoint.iY + minCrop ) ); + + // restrict min crop area inside total cropping area + if( areaRect.iTl.iX < ulc ) + { + areaRect.iTl.iX = ulc; + } + if( areaRect.iTl.iY < ulr ) + { + areaRect.iTl.iY = ulr; + } + if( areaRect.iBr.iX > lrc ) + { + areaRect.iBr.iX = lrc; + } + if( areaRect.iBr.iY > lrr ) + { + areaRect.iBr.iY = lrr; + } + + return areaRect.Contains( aTappedPosition ); + + } + +//============================================================================= +TBool CImageEditorCropControl::IsCornerTapped( TPoint aTappedPosition, + TInt& aTappedCorner ) const + { + // Compute crop rectangle inside the image area + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = ( rect.iBr.iX - rect.iTl.iX ); + TInt h = ( rect.iBr.iY - rect.iTl.iY ); + TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX; + TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY; + TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX; + TInt lrr = ( TInt ) ( iLRR * h + 0.5 ) + rect.iTl.iY; + + TBool topLeftTapped = EFalse; + TBool bottomRightTapped = EFalse; + + TSize cursorSize = iCrossHair->SizeInPixels(); + TSize tripleCursorSize( 3 * cursorSize.iWidth, + 3 * cursorSize.iHeight ); + + // Case1, upper left corner + TInt cx = ulc; + TInt cy = ulr; + TRect cursorRect( TPoint( cx - ( tripleCursorSize.iWidth / 2 ), + cy - ( tripleCursorSize.iHeight / 2 ) ), + tripleCursorSize ); + + // Calculate an estimate for the distance to top-left corner + // Change more accurate implementation if needed in future + // (this is fast) + TInt distTL = Abs( cx - aTappedPosition.iX ) + + Abs( cy - aTappedPosition.iY ); + + if ( cursorRect.Contains( aTappedPosition ) ) + { + topLeftTapped = ETrue; + } + + // Case2, lower right corner + cx = lrc - 1; + cy = lrr - 1; + cursorRect = TRect( TPoint( cx - ( tripleCursorSize.iWidth / 2 ), + cy - ( tripleCursorSize.iHeight / 2 ) ), + tripleCursorSize ); + + // Calculate an estimate for the distance to bottom-right corner + // Change more accurate implementation if needed in future + // (this is fast) + TInt distBR = Abs( cx - aTappedPosition.iX ) + + Abs( cy - aTappedPosition.iY ); + + if ( cursorRect.Contains( aTappedPosition ) ) + { + bottomRightTapped = ETrue; + } + + // Check tapped corner + if ( topLeftTapped || bottomRightTapped ) + { + if( topLeftTapped && !bottomRightTapped ) + { + aTappedCorner = ETLCorner; + } + else if( !topLeftTapped && bottomRightTapped ) + { + aTappedCorner = EBRCorner; + } + // Tapping happened inside of both corners. Check the closest. + else + { + if( distTL < distBR ) + { + aTappedCorner = ETLCorner; + } + else + { + aTappedCorner = EBRCorner; + } + } + return ETrue; + } + + // no top-left nor bottom-righ corner tapped + aTappedCorner = EInvalidCorner; + return EFalse; + } + +//============================================================================= +void CImageEditorCropControl::MoveCropArea( TPoint aOldPosition, + TPoint aNewPosition ) + { + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Change can be positive or negative + TInt xChange ( aNewPosition.iX - aOldPosition.iX ); + TInt yChange ( aNewPosition.iY - aOldPosition.iY ); + + // X-components + // store old x-values so they can be used if crop rect is trying to be + // moved outside the visible area + TReal ulcOld = iULC; + iULC += TReal( xChange ) / ( visibleImageRectPrev.iBr.iX - + visibleImageRectPrev.iTl.iX ); + TReal lrcOld = iLRC; + iLRC += TReal( xChange ) / ( visibleImageRectPrev.iBr.iX - + visibleImageRectPrev.iTl.iX ); + + // if limits are reached, move as much as possible (both sides) + if ( iULC < 0.0 ) + { + iULC = 0.0; + iLRC = lrcOld; + // ulc min limit reached, move lrc as much as it was possible + // to move ulc + iLRC += ( iULC - ulcOld ); + } + else if ( iLRC > 1.0 ) + { + iLRC = 1.0; + iULC = ulcOld; + iULC += ( iLRC - lrcOld ); + } + + // Y-components + TReal ulrOld = iULR; + iULR += TReal( yChange ) / ( visibleImageRectPrev.iBr.iY - + visibleImageRectPrev.iTl.iY ); + TReal lrrOld = iLRR; + iLRR += TReal( yChange ) / ( visibleImageRectPrev.iBr.iY - + visibleImageRectPrev.iTl.iY ); + + if ( iULR < 0.0 ) + { + iULR = 0.0; + iLRR = lrrOld; + iLRR += ( iULR - ulrOld ); + } + else if ( iLRR > 1.0 ) + { + iLRR = 1.0; + iULR = ulrOld; + iULR += ( iLRR - lrrOld ); + } + } + +//============================================================================= +void CImageEditorCropControl::ShowTooltip() + { + iPopupController->HideInfoPopupNote(); + + // Calculate visible image rect corner positions + TRect rect = iSysPars->VisibleImageRectPrev(); + TInt w = ( rect.iBr.iX - rect.iTl.iX ); + TInt h = ( rect.iBr.iY - rect.iTl.iY ); + TInt ulc = ( TInt ) ( iULC * w + 0.5 ) + rect.iTl.iX; + TInt ulr = ( TInt ) ( iULR * h + 0.5 ) + rect.iTl.iY; + TInt lrc = ( TInt ) ( iLRC * w + 0.5 ) + rect.iTl.iX; + TInt lrr = ( TInt ) ( iLRR * h + 0.5 ) + rect.iTl.iY; + + TSize cursorSize = iCrossHair->SizeInPixels(); + + // user is setting upper left corner + if ( iState == ECropStateFirst ) + { + TPoint middlePoint = TPoint( ulc, ulr ); + + SDrawUtils::ShowToolTip( iPopupController, + this, + middlePoint, + EHLeftVBottom, + *iTooltipResize ); + } + // user is setting lower right corner + else if ( iState == ECropStateSecond ) + { + TPoint middlePoint = TPoint( lrc - 1 , + lrr - 1 ); + + SDrawUtils::ShowToolTip ( iPopupController, + this, + middlePoint, + EHRightVBottom, + *iTooltipResize ); + } + // in move state + else if ( iState == ECropStateMove ) + { + TPoint middlePoint = TPoint( ulc + ( lrc - ulc ) / 2, + ulr + ( lrr - ulr ) / 2 ); + + SDrawUtils::ShowToolTip ( iPopupController, + this, + middlePoint, + EHCenterVCenter, + *iTooltipMove ); + } + } + + +// End of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/CropPlugin/src/ImageEditorCropPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/CropPlugin/src/ImageEditorCropPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,361 @@ +/* +* 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: +* +*/ + + + +#include +#include +#include +#include +#include + +#include + +#include +#include "ImageEditorCropPlugin.h" +#include "ImageEditorCropControl.h" +#include "ImageEditorPluginBaseDefs.h" +#include "DrawUtils.h" +#include "ResolutionUtil.h" +#include "definitions.def" + +//#include "platform_security_literals.hrh" + + +// CONSTANTS +_LIT (KPgnResourceFile, "crop.rsc"); + +const TInt KManualCropQueryIndex = 3; + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorCropPlugin * plugin = new (ELeave) CImageEditorCropPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorCropPlugin::CImageEditorCropPlugin () +{ + +} + +//============================================================================= +void CImageEditorCropPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorCropPlugin::~CImageEditorCropPlugin () +{ + iSysPars = NULL; + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorCropPlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (const CSystemParameters *)tempval; + return KErrNone; + } + default: + { + return CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorCropPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + // Control found + if (iControl) + { + aPropertyValue.Copy ( ((CImageEditorCropControl *)iControl)->GetParam() ); + return KErrNone; + } + + // Control not found, return KErrNotReady + else + { + return KErrNotReady; + } + } + case KCapReadyToRender: + { + TBool readyToRender = EFalse; + if (iControl) + { + readyToRender = ((CImageEditorCropControl *)iControl)->IsReadyToRender(); + } + aPropertyValue.AppendNum ((TInt)readyToRender); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorCropPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + // Delete previous control + ReleasePlugin(); + + // Query dialog texts + CDesCArray * queries = new (ELeave) CDesCArraySeg (8); + CleanupStack::PushL (queries); + + // Aspect ratio definition array + RArray aspect_ratios; + + // Get pointer to the parameter descriptor array + TBuf<256> readbuf; + TLex parser; + User::LeaveIfError ( CImageEditorPluginBase::GetProperty (KCapPluginParamNames, readbuf) ); + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + CDesCArray * pars = (CDesCArraySeg *)tempval; + + // Append manual crop query + queries->AppendL( (*pars)[KManualCropQueryIndex] ); + + ReadWallPaperCropDefinitionsL(*queries, aspect_ratios); + +#ifdef __SHOW_OPTIONAL_ASPECT_RATIOS__ + ReadCropDefinitionsL (*queries, aspect_ratios); +#endif + + // Create new control + iControl = CImageEditorCropControl::NewL (aRect, aParent); + + // Set system parameters + ((CImageEditorCropControl*)iControl)->SetSystemParameters (iSysPars); + + // Show selection dialog + TPtrC query = (*pars)[0]; + TInt index = SDrawUtils::LaunchListQueryDialogL (queries, query); + + // If canceled, return with NULL pointer and error value + TInt ret = KErrNone; + if (index <= -1) + { + // Relasing created plugin if canceled + ReleasePlugin(); + ret = KErrNotSupported; + } + else + { + // Compute and set crop mode and aspect ratio + float ar = 1.0F; + if (index != 0) + { + TInt index2 = (index - 1) * 2; + ar = (float)aspect_ratios[index2] / (float)aspect_ratios[index2 + 1]; + } + + ((CImageEditorCropControl*)iControl)->SetCropModeL (index, ar); + } + + if (queries) + { + for (TInt i = 0; i < queries->Count(); ++i) + { + queries->Delete(i); + } + queries->Reset(); + } + aspect_ratios.Reset(); + CleanupStack::PopAndDestroy(); // queries + aPluginControl = iControl; + return ret; +} + +//============================================================================= +void CImageEditorCropPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + +} + +//============================================================================= +void CImageEditorCropPlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + +//============================================================================= +void CImageEditorCropPlugin::ReadWallPaperCropDefinitionsL ( + CDesCArray & aCropTexts, + RArray & aCropRatios + ) const +{ + // find out screen resolution + TRect screenRect; + CResolutionUtil::Self()->GetScreenRect(screenRect); + TInt screenWidth = screenRect.Width(); + TInt screenHeight = screenRect.Height(); + + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read aspect ratio definitions from resource file + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + CEikonEnv *env = CEikonEnv::Static(); + RConeResourceLoader resLoader ( *env ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + // To find out if in landscape or in portrait mode + TInt shortSize; + TInt longSize; + if ( screenHeight > screenWidth ) + { + shortSize = screenWidth; + longSize = screenHeight; + } + else + { + longSize = screenWidth; + shortSize = screenHeight; + } + +#ifndef __SHOW_TWO_WALLPAPER_ASPECT_RATIOS__ + + // If only this one wallpaper option is shown crop ratio is set as portrait + HBufC * wallpaperText = + env->AllocReadResourceL( R_CROP_ASPECT_RATIO_WALLPAPER ); + CleanupStack::PushL( wallpaperText ); + aCropTexts.AppendL( wallpaperText->Des() ); + CleanupStack::PopAndDestroy(); + aCropRatios.Append( shortSize ); + aCropRatios.Append( longSize ); + +#else + + HBufC * wallpaperText2 = + env->AllocReadResourceL( R_CROP_ASPECT_RATIO_WALLPAPER_PRT ); + CleanupStack::PushL( wallpaperText2 ); + aCropTexts.AppendL( wallpaperText2->Des() ); + CleanupStack::PopAndDestroy(); + aCropRatios.Append( shortSize ); + aCropRatios.Append( longSize ); + + + HBufC * wallpaperText3 = + env->AllocReadResourceL( R_CROP_ASPECT_RATIO_WALLPAPER_LNDS ); + CleanupStack::PushL( wallpaperText3 ); + aCropTexts.AppendL( wallpaperText3->Des() ); + CleanupStack::PopAndDestroy(); + aCropRatios.Append( longSize ); + aCropRatios.Append( shortSize ); + +#endif + + CleanupStack::PopAndDestroy(1); //resLoader +} + + +//============================================================================= +void CImageEditorCropPlugin::ReadCropDefinitionsL ( + CDesCArray & aCropTexts, + RArray & aCropRatios + ) const +{ + + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read aspect ratio definitions from resource file + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + CEikonEnv *env = CEikonEnv::Static(); + RConeResourceLoader resLoader ( *env ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + HBufC8 * res8 = env->AllocReadResourceAsDes8LC (R_CROP_MODES); + TResourceReader resource; + resource.SetBuffer (res8); + + TInt16 arraycount = (TInt16)resource.ReadInt16(); + if (arraycount > 0) + { + // Read extra parameters to array + for (TInt i = 0; i < arraycount; ++i) + { + // Read the crop ratio text + HBufC * crop_text = resource.ReadHBufCL(); + CleanupStack::PushL(crop_text); + aCropTexts.AppendL ( crop_text->Des() ); + CleanupStack::PopAndDestroy(); + + // Add width + aCropRatios.Append ( resource.ReadInt32() ); + + // Add height + aCropRatios.Append ( resource.ReadInt32() ); + } + } + + CleanupStack::PopAndDestroy(2); // res8, resLoader +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/EABI/draw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/EABI/draw.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _Z24CreateImageEditorPluginLv @ 1 NONAME + _ZTI22CImageEditorDrawPlugin @ 2 NONAME ; ## + _ZTI23CImageEditorDrawControl @ 3 NONAME ; ## + _ZTI8CJPTimer @ 4 NONAME ; ## + _ZTV22CImageEditorDrawPlugin @ 5 NONAME ; ## + _ZTV23CImageEditorDrawControl @ 6 NONAME ; ## + _ZTV8CJPTimer @ 7 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/bwins/draw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/bwins/draw.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPluginL@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/data/draw.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/data/draw.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,209 @@ +/* +* 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: +* Resource definition file for the plugin. +* +*/ + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "draw.hrh" +#include "draw_gen.loc" +#include "ImageEditor.loc" + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info + { + pluginuid = UID_DRAW_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeAdjustmentEngine; + plugindisplayorder = 11; + pluginname = "Draw";//qtn_sie_plugin_name_text; + iconfile = "draw.mif"; + filterfile = "filterdraw.dll"; + } + +RESOURCE PARAMNAMES r_plugin_pars + { + parameters= + { + // Insert text + //qtn_sie_heading_insert_text, + "Drow", + + // Move text + //qtn_sie_pgn_move_text, // old + " ", // currently no navi pane text + + // Resize text + //qtn_sie_pgn_resize_text, //old + " ", // currently no navi pane text + + // Rotate text + //qtn_sie_pgn_rotate_text, // old + " " // currently no navi pane text + + }; + } + +RESOURCE PGNUIITEMS r_sk1_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + } + }; + } + +RESOURCE PGNUIITEMS r_sk2_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_pgn_sk2_done; + } + }; + } + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items + { + items= + { + // Resize + PGNUIITEM + { + id=EDrawPgnMenuCmdResize; + text=qtn_sie_options_resize; + }, + // Color + PGNUIITEM + { + id=EDrawPgnMenuCmdColor; + text=qtn_sie_options_change_color; + }, + // Cancel + PGNUIITEM + { + id=EDrawPgnMenuCmdCancel; + text=qtn_sie_options_cancel_effect; + } + }; + } + +// Context specific MSK menu +RESOURCE MENU_BAR r_text_context_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_text_context_menupane; + txt = " "; + } + }; + } + +RESOURCE MENU_PANE r_text_context_menupane + { + items = + { + MENU_ITEM + { + command = EDrawPgnMenuCmdResize; + txt = qtn_sie_options_resize; + }, + MENU_ITEM + { + command = EDrawPgnMenuCmdColor; + txt = qtn_sie_options_change_color; + } + }; + } + + +// Tooltip texts +RESOURCE TBUF r_tooltip_text_resize { buf = qtn_sie_tooltip_resize; } + +RESOURCE TBUF r_title_line_weight { buf = "Line width/weight"; } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,46 @@ +/* +* 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: +* +*/ + + +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/imageeditordrawplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(imageeditordrawplugin.iby) + +// mmp files +PRJ_MMPFILES +drawplugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE draw.mif +OPTION HEADERFILE draw.mbg +OPTION SOURCES -c8,1 qgn_indi_ai_nt_erotic +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/group/drawplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/group/drawplugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,110 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +LIBRARY efsrv.lib +#endif + +#if defined( __LANDSCAPE_SUPPORT__ ) +MACRO LANDSCAPE_SUPPORT +#endif + +#if defined( __LANDSCAPE_ONLY__ ) +MACRO LANDSCAPE_ONLY +#endif + +#if defined( __TEXT_INSERTION_IN_PORTRAIT_ONLY__ ) +MACRO TEXT_INSERTION_IN_PORTRAIT_ONLY +#endif + +TARGET draw.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_DRAW_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../../../src +SOURCE JpTimer.cpp + +SOURCEPATH ../src +SOURCE imageeditordrawplugin.cpp +SOURCE imageeditordrawcontrol.cpp +SOURCE drawpath.cpp +SOURCE selectionpopup.cpp + + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/draw.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY AknLayout2.lib +LIBRARY aknicon.lib +LIBRARY avkon.lib +LIBRARY bafl.lib +LIBRARY bitgdi.lib +LIBRARY CdlEngine.lib +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY eikcore.lib +LIBRARY eikcoctl.lib +LIBRARY eikdlg.lib +LIBRARY fbscli.lib +LIBRARY gdi.lib +LIBRARY ws32.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib +LIBRARY CommonEngine.lib + +//#if defined (__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/inc/draw.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/draw.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifndef DRAW_HRH +#define DRAW_HRH + +#include "ImageEditorPluginBase.hrh" + +enum TDrawPgnCommandId +{ + EDrawPgnMenuCmdMin = EPgnMenuCmdIdBase, + EDrawPgnMenuCmdDone, + EDrawPgnMenuCmdResize, + EDrawPgnMenuCmdColor, + EDrawPgnMenuCmdCancel, + EDrawPgnMenuCmdMax +}; + +#endif // DRAW_HRH diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/inc/draw_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/draw_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: +* +*/ + + + +#include +#include "iepb_gen.loc" +#include "ImageEditor.loc" + +// SOFTKEY TEXTS + +#define qtn_sie_pgn_sk1_options qtn_sie_iepb_softkey_options +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel + +#define qtn_sie_pgn_sk1_ok qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2_done qtn_sie_iepb_softkey_done + +// MENU OPTIONS + +#define qtn_sie_pgn_menu_cancel qtn_sie_options_cancel_effect + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/inc/drawpath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/drawpath.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,113 @@ +/* +* 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: +* Container for draw path. +* +*/ + + +#ifndef T_DRAWPATH_H +#define T_DRAWPATH_H + + +#include +#include +#include + +/** + * Container for draw path (i.e.TDrawItems) + * + * + * @lib internal(filterdraw.dll) + * @since S60 5.0 + */ +NONSHARABLE_CLASS( CDrawPath ) : public CBase + { +public: + + static CDrawPath* NewL(); + ~CDrawPath(); + +public: + /** + * AddItemL. + * + * @since S60 5.0 + * Add new Item to array + */ + void AddItemL(TPoint aItem); + + /** + * ItemArray. + * + * @since S60 5.0 + * @return Pointer to item array. + * ownership not transferred. + */ + CArrayFix* ItemArray() const {return iItemArray;}; + + /** + * Color. + * + * @since S60 5.0 + * @return Path color + */ + TRgb Color() const {return iColor;}; + + /** + * SetColor. (defalt KRgbRed) + * + * @since S60 5.0 + * @param aRgb Path color + */ + void SetColor(TRgb aRgb){iColor=aRgb;}; + + /** + * Size. + * + * @since S60 5.0 + * @return Path size + */ + TSize Size() const {return iSize;}; + + /** + * SetSize. + * + * @since S60 5.0 + * @param aSize Path size + */ + void SetSize(TSize aSize){iSize=aSize;}; + +private: // C'tor + + CDrawPath(); + +private: // data + + /** + * Path color + */ + TRgb iColor; + /** + * Path Size + */ + TSize iSize; + /** + * Array of pahts + */ + CArrayFix* iItemArray; + }; + +#endif // T_DRAWPATH_H diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/inc/imageeditordrawcontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/imageeditordrawcontrol.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,300 @@ +/* +* 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 + +// INCLUDES +#include "PreviewControlBase.h" +#include "MTimerCallBack.h" + +#include +#include + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; +class CSystemParameters; +class CJPTimer; +class CAknInfoPopupNoteController; +class CDrawPath; + +/* CLASS: CImageEditorDrawControl +* +* CImageEditorDrawControl is a control for text insertion plug-in. +* +*/ +class CImageEditorDrawControl : public CPreviewControlBase, + public MTimerCallBack +{ +public: + +/** @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 + ); + + /** Destructor */ + ~CImageEditorDrawControl(); + +protected: // From CImageEditorControlBase + /** Second phase constructor + * + * @see CImageEditorControlBase + */ + void ConstructL( + const TRect& aRect, + CCoeControl* aParent + ); + + /* Setter for view reference + * + * @see CImageEditorControlBase + */ + void SetView(CAknView* aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + */ + void SetSelectedUiItemL(CPluginInfo* aItem); + + /** PrepareL + * + * @see CImageEditorControlBase + */ + void PrepareL(); + + /* 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); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + TInt GetSoftkeyIndexL(); + + /* GetContextMenuResourceId + * + * @see CImageEditorControlBase + */ + TInt GetContextMenuResourceId(); + + /* GetDimmedMenuItems + * + * @see CImageEditorControlBase + */ + TBitField GetDimmedMenuItems(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + TPtrC GetNaviPaneTextL( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); +public: + /* 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; + +protected: + + /* GetHelpContext + * + * @see CCoeControl + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + /* TimerCallBack + * + * @see MTimerCallBack + */ + void TimerCallBack(); + +//@} + + +protected: + +/** @name Methods:*/ +//@{ + /* SizeChanged + * + * @see CImageEditorControlBase + */ + void SizeChanged(); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + + CImageEditorDrawControl (); + + /** Draw + * + * @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; + 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; + +//@} + +/** @name Members:*/ +//@{ + + /// Ref: to Editor view + CAknView* iEditorView; + + /// Source image size + const CSystemParameters* iSysPars; + + /// Ref: to Plug-in info + CPluginInfo* iItem; + + /// Own: Navigation pane text + HBufC* iNaviPaneText; + + /// X position + TInt iX; + /// Y position + TInt iY; + /// Color + TRgb iRgb; + + /// Timer for fast key events + CJPTimer* iTimer; + TUint32 iKeyCode; + + /// Pressed key event code + TInt iPressedKeyScanCode; + + /// Number of ticks since timer start + TInt iTickCount; + + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; + + /// Showing Ok options menu, where some items are dimmed + TBool iDisplayingOkOptionsMenu; + + /// Own: State indicator glyph + CFbsBitmap* iIndicator; + CFbsBitmap* iIndicatorMask; + + /// 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 + RConeResourceLoader iResLoader; + /// Line size + TSize iSize; + /// Own: drawn paths + RPointerArray iPaths; + +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/inc/imageeditordrawplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/imageeditordrawplugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,111 @@ +/* +* 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 UI. +* +*/ + + +#ifndef IMAGEEDITORDRAWPLUGIN_H +#define IMAGEEDITORDRAWPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; +class CSystemParameters; + + +/* CLASS: CImageEditorDrawPlugin +* +* CImageEditorDrawPlugin represents draw plug-in for Image Editor +* application. +*/ +class CImageEditorDrawPlugin : public CImageEditorPluginBase +{ + +public: +/** @name Methods:*/ +//@{ + + /** Default constructor */ + CImageEditorDrawPlugin (); + + /** Second phase constructor */ + void ConstructL (); + + /** Destructor */ + ~CImageEditorDrawPlugin (); + + /** SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC& aPropertyValue + ); + + /** GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes& aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect& aRect, + CCoeControl* aParent, + CCoeControl*& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage* aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +private: // Data +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl* iControl; + /// System parameters + const CSystemParameters* iSysPars; + /// Is landscape enabled, Must be EFalse until text is set + TBool iLandscapeEnabled; +//@} + +}; + +#endif // IMAGEEDITORDRAWPLUGIN_H + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/inc/selectionpopup.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/inc/selectionpopup.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,292 @@ +/* +* 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 + +// INCLUDES +#include +#include +#include + +#include "PreviewControlBase.h" + +class CFbsBitmap; +//class TAknLayoutText; + +NONSHARABLE_CLASS( CSelectionPopup ):public CPreviewControlBase +{ + +public: + + /** Default constructor, cannot leave. + * + * @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 ); + + /** OfferKeyEventL + * + * @see CCoeControl + */ + TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, + TEventCode aType ); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + +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 ); + +protected: + + /** SizeChanged + * + * @see CCoeControl + */ + virtual void SizeChanged(); + + /** Draw + * + * @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; + + +}; + + +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 ); + + + 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 ); + + /** Draw + * + * + * @see CAknDialog + * + */ + void Draw(const TRect& aRect) const; + + /** SizeChanged + * + * + * @see CCoeControl + * + */ + virtual void SizeChanged(); + + /** 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(); + + /** 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); + +private: + + // Own: popup component + CSelectionPopup* iPopup; + + // Ref: Selected color + TInt& iCurrentValue; + + }; + +#endif // _SELECTIONPOPUP_H diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/rom/imageeditordrawplugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/rom/imageeditordrawplugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,37 @@ +/* +* 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: +* ROM files. +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR +#ifdef RD_IE_DRAW_PLUGIN + +#ifndef __DRAW_PLUGIN_IBY__ +#define __DRAW_PLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\draw.pgn SHARED_LIB_DIR\draw.pgn + +// Resources +data=DATAZ_\resource\apps\draw.mif \resource\apps\draw.mif + +#endif // __DRAW_PLUGIN_IBY__ +#endif // RD_IE_DRAW_PLUGIN +#endif // RD_S60_IMAGE_EDITOR +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/src/drawpath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/drawpath.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,66 @@ +/* +* 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: +* Container for draw path. +* +*/ + +#include "drawpath.h" + +// ======== MEMBER FUNCTIONS ======== + + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CDrawPath* CDrawPath::NewL() + { + CDrawPath* self = new( ELeave ) CDrawPath; + TInt arrayGranularity(8); + CleanupStack::PushL( self ); + self->iItemArray = new( ELeave ) + CArrayFixFlat ( arrayGranularity ); + CleanupStack::Pop( self ); + return self; + } + +// --------------------------------------------------------------------------- +// ~CDrawPath +// --------------------------------------------------------------------------- +// +CDrawPath::~CDrawPath() + { + delete iItemArray; + } + +// --------------------------------------------------------------------------- +// AddItemL +// --------------------------------------------------------------------------- +// +void CDrawPath::AddItemL(TPoint aItem) + { + ASSERT( iItemArray ); + iItemArray->AppendL( aItem ); + } + +// --------------------------------------------------------------------------- +// CDrawPath +// --------------------------------------------------------------------------- +// +CDrawPath::CDrawPath():iColor(KRgbWhite) + { + } + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/src/imageeditordrawcontrol.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/imageeditordrawcontrol.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1065 @@ +/* +* 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" +#include "ImageEditorUiDefs.h" +#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 +#include +#include +#include +#include + +// Log file +_LIT(KDrawPluginLogFile,"drawplugin.log"); + +// CONSTANTS +const TInt KWait = 1; +const TInt KMainTextIndex = 0; + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CImageEditorDrawControl* CImageEditorDrawControl::NewL( + const TRect& aRect, + CCoeControl* aParent ) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NewL()"); + + CImageEditorDrawControl * self = new (ELeave) CImageEditorDrawControl; + 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::~CImageEditorDrawControl() + { + LOG(KDrawPluginLogFile, + "CImageEditorDrawControl::~CImageEditorDrawControl()"); + delete iTimer; + delete iIndicator; + delete iIndicatorMask; + delete iPopupController; + delete iTooltipResize; + iPaths.ResetAndDestroy(); + delete iNaviPaneText; + iResLoader.Close(); + } + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::ConstructL( + const TRect& /*aRect*/, CCoeControl* aParent ) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::ConstructL()"); + // Set parent window + SetContainerWindowL(*aParent); + + // Create resource utility + TFileName resFile; + // resource file name + _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 ); + + // Create timer for fast key repeat + iTimer = CJPTimer::NewL( this ); + + iPopupController = CAknInfoPopupNoteController::NewL(); + iTooltipResize = ControlEnv()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); + + EnableDragEvents(); + + // Activate control + ActivateL(); + } + +// --------------------------------------------------------------------------- +// SetView +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::SetView(CAknView* 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); + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL +// --------------------------------------------------------------------------- +// +TKeyResponse CImageEditorDrawControl::OfferKeyEventL( + const TKeyEvent& aKeyEvent, + TEventCode aType) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::OfferKeyEventL()"); + + TKeyResponse response = EKeyWasNotConsumed; + + // 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; + } + + // 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 ); + response = EKeyWasConsumed; + break; + } + + 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; + } + + default: + { + break; + } + } + } + + // Key pressed down, mark pressed key + else if (aType == EEventKeyDown) + { + switch (aKeyEvent.iScanCode) + { + case EStdKeyUpArrow: + { + iKeyCode = 1; + response = EKeyWasConsumed; + break; + } + case EStdKeyDownArrow: + { + iKeyCode = 2; + response = EKeyWasConsumed; + break; + } + case EStdKeyLeftArrow: + { + iKeyCode = 3; + response = EKeyWasConsumed; + break; + } + case EStdKeyRightArrow: + { + iKeyCode = 4; + response = EKeyWasConsumed; + break; + } + } + + 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(); + break; + } + } + } + + return response; + } + +// --------------------------------------------------------------------------- +// SizeChanged +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::SizeChanged() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::SizeChanged()"); + } + +// --------------------------------------------------------------------------- +// GetParam +// --------------------------------------------------------------------------- +// +TDesC& CImageEditorDrawControl::GetParam() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetParam()"); + LOGDES(KDrawPluginLogFile, iParam); + return iParam; + } + +// --------------------------------------------------------------------------- +// SetSystemParameters +// --------------------------------------------------------------------------- +// +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()"); + + 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); + + //DrawNow(); + break; + } + + case EImageEditorPreScreenModeChange: + { + StorePosAndScaleRelImage(); + break; + } + + case EImageEditorPostScreenModeChange: + { + RestorePosAndScaleRelImage(); + ClipPosition(); + //StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + //DrawNow(); + break; + } + + default: + { + break; + } + } + } + +// --------------------------------------------------------------------------- +// GetSoftkeyIndexL +// --------------------------------------------------------------------------- +// +TInt CImageEditorDrawControl::GetSoftkeyIndexL() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetSoftkeyIndexL()"); + // : Check needed states + TInt state(2); + return state; + } + +// --------------------------------------------------------------------------- +// GetContextMenuResourceId +// --------------------------------------------------------------------------- +// +TInt CImageEditorDrawControl::GetContextMenuResourceId() + { + return R_TEXT_CONTEXT_MENUBAR; + } + +// --------------------------------------------------------------------------- +// GetDimmedMenuItems +// --------------------------------------------------------------------------- +// +TBitField CImageEditorDrawControl::GetDimmedMenuItems() +{ + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetDimmedMenuItems()"); + + 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; +} + +// --------------------------------------------------------------------------- +// GetNaviPaneTextL +// --------------------------------------------------------------------------- +// +TPtrC CImageEditorDrawControl::GetNaviPaneTextL( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetNaviPaneTextL()"); + + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return *iNaviPaneText; + } + +// --------------------------------------------------------------------------- +// Draw +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::Draw(const TRect& aRect) const + { + CWindowGc & gc = SystemGc(); + if( IsReadyToRender() ) + { + CPreviewControlBase::DrawPreviewImage(aRect); + } + + 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 + ); + }*/ + } + +// --------------------------------------------------------------------------- +// NaviDown +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::NaviDown() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviDown()"); + } + +// --------------------------------------------------------------------------- +// NaviUp +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::NaviUp() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviUp()"); + } + +// --------------------------------------------------------------------------- +// NaviRight +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::NaviRight() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::NaviRight()"); + } + +// --------------------------------------------------------------------------- +// NaviLeft +// --------------------------------------------------------------------------- +// +void 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); + } + +// --------------------------------------------------------------------------- +// StoreTempParams +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::StoreTempParams() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::StoreTempParams()"); + } + +// --------------------------------------------------------------------------- +// RestoreTempParams +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::RestoreTempParams() + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::RestoreTempParams()"); + } + +// --------------------------------------------------------------------------- +// GetHelpContext +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::GetHelpContext(TCoeHelpContext& aContext) const +{ + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::GetHelpContext()"); + + aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); + aContext.iContext = KSIE_HLP_EDIT_TEXT; +} + +// --------------------------------------------------------------------------- +// PrepareL +// --------------------------------------------------------------------------- +// +void 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; + + // Set default size + TInt defaultSize(8); + iSize = TSize(defaultSize, defaultSize); + iReadyToRender = ETrue; + + iEditorView->HandleCommandL( EImageEditorCmdRender ); + } + +// --------------------------------------------------------------------------- +// LoadIndicatorL +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::LoadIndicatorL( + TInt aBitmapInd, TInt aMaskInd ) + { + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::LoadIndicatorL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + // Load new indicator + SDrawUtils::GetIndicatorBitmapL ( + iIndicator, + iIndicatorMask, + aBitmapInd, + aMaskInd + ); + } + +// --------------------------------------------------------------------------- +// ComputeIndicatorPosition +// --------------------------------------------------------------------------- +// +TPoint CImageEditorDrawControl::ComputeIndicatorPosition() const + { + TRect vprect = iSysPars->VisibleImageRect(); + TRect vpprect = iSysPars->VisibleImageRectPrev(); + + TInt x( 0 ); + TInt y( 0 ); + // check if there is no indicator + 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 += vpprect.iTl.iX; + //x -= iIndicator->SizeInPixels().iWidth / 2; + + return TPoint (x,y); + } + +// --------------------------------------------------------------------------- +// IsReadyToRender +// --------------------------------------------------------------------------- +// +TBool CImageEditorDrawControl::IsReadyToRender() const + { + 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()); + + iParam.Copy(_L("x ")); + 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.Append(_L(" lastItem ")); + } + if( aDone ) + { + iParam.Append(_L("done")); + } + } + +// --------------------------------------------------------------------------- +// TimerCallBack +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::TimerCallBack() +{ + LOG(KDrawPluginLogFile, "CImageEditorDrawControl::TimerCallBack()"); + + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } + + if (iKeyCode) + { + + switch (iKeyCode) + { + case 1: + { + NaviUp(); + break; + } + case 2: + { + NaviDown(); + break; + } + case 3: + { + NaviLeft(); + break; + } + case 4: + { + NaviRight(); + break; + } + default: + break; + } + //StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL(EImageEditorCmdRender) ); + iTimer->Call (KWait); + } +} + +// --------------------------------------------------------------------------- +// StorePosAndScaleRelScreen +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::StorePosAndScaleRelScreen() + { + LOG(KDrawPluginLogFile, + "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); + iParam.Copy(_L("nop")); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::RestorePosAndScaleRelScreen() + { + LOG(KDrawPluginLogFile, + "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); + } + + +// --------------------------------------------------------------------------- +// StorePosAndScaleRelImage +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::StorePosAndScaleRelImage() + { + TReal relscale = iSysPars->RelScale(); + LOGFMT(KDrawPluginLogFile, + "CImageEditorClipartControl::StorePosAndScaleRelImage():%g", + relscale); + } + +// --------------------------------------------------------------------------- +// RestorePosAndScaleRelImage +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::RestorePosAndScaleRelImage() + { + 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; + } +} + +// --------------------------------------------------------------------------- +// HandlePointerEventL +// --------------------------------------------------------------------------- +// +void CImageEditorDrawControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent) + { + RDebug::Print(_L("CImageEditorDrawControl::HandlePointerEventL pen[%d]"), + AknLayoutUtils::PenEnabled()); + if( AknLayoutUtils::PenEnabled() && !Busy()) + { + RDebug::Print(_L("CImageEditorDrawControl::iType [%d]"), + aPointerEvent.iType); + TBool lastItem( EFalse ); + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + 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 ); + break; + } + 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; + } + case TPointerEvent::EButton1Up: + { + iReadyToRender = ETrue; + ShowTooltip(); + lastItem = ETrue; + break; + } + + default: + { + break; + } + } + + StoreParameters( lastItem, EFalse ); + iEditorView->HandleCommandL( EImageEditorCmdRender );//results Draw call + CCoeControl::HandlePointerEventL( aPointerEvent ); + } + } + +// --------------------------------------------------------------------------- +// SetPositionOnImage +// --------------------------------------------------------------------------- +// +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()); + + // 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); + // Calculate position on visible image + + 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); + // Check that not out of bounds + //ClipPosition(); + } + +// --------------------------------------------------------------------------- +// GetPositionOnView +// --------------------------------------------------------------------------- +// +TPoint CImageEditorDrawControl::GetPositionOnView() + { + 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 ); + + 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(); + + TPoint iconPosition = ComputeIndicatorPosition(); + TRect iconRect( iconPosition.iX, iconPosition.iY, + iconPosition.iX, iconPosition.iY ); + + + /*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++; + } + + LOGFMT3(KDrawPluginLogFile, + "CImageEditorDrawControl::ScaledLineSize w:%d h:%d S:%g", + sizew, sizeh, iSysPars->RelScale()); + return TSize(sizew , sizeh); + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/src/imageeditordrawplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/imageeditordrawplugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,264 @@ +/* +* 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" + +#ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY +#include +#endif +#include + +// CONSTANTS +_LIT (KPgnResourceFile, "draw.rsc"); + + +// --------------------------------------------------------------------------- +// CreateImageEditorPlugin +// --------------------------------------------------------------------------- +// +EXPORT_C CImageEditorPluginBase * CreateImageEditorPluginL() + { + CImageEditorDrawPlugin * plugin = new (ELeave) CImageEditorDrawPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; + } + +// --------------------------------------------------------------------------- +// CImageEditorDrawPlugin +// --------------------------------------------------------------------------- +// +CImageEditorDrawPlugin::CImageEditorDrawPlugin() : iLandscapeEnabled(EFalse) + {} + +// --------------------------------------------------------------------------- +// ConstructL +// --------------------------------------------------------------------------- +// +inline void CImageEditorDrawPlugin::ConstructL() + { + CImageEditorPluginBase::ConstructL(KPgnResourcePath, KPgnResourceFile); + } + +// --------------------------------------------------------------------------- +// ?description_if_needed +// --------------------------------------------------------------------------- +// +CImageEditorDrawPlugin::~CImageEditorDrawPlugin() + { + ReleasePlugin(); + iSysPars = NULL; + } + +// --------------------------------------------------------------------------- +// SetProperty +// --------------------------------------------------------------------------- +// +TInt CImageEditorDrawPlugin::SetProperty( + TInt aPropertyId, TDesC& aPropertyValue) + { + TInt err(KErrNone); + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (const CSystemParameters *)tempval; + err = KErrNone; + break; + } + default: + { + err = CImageEditorPluginBase::SetProperty( + aPropertyId, aPropertyValue); + break; + } + } + return err; + } + +// --------------------------------------------------------------------------- +// GetProperty +// --------------------------------------------------------------------------- +// +TInt CImageEditorDrawPlugin::GetProperty( + TInt aPropertyId, TDes& aPropertyValue) + { + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + // Control found + if (iControl) + { + aPropertyValue.Copy( + ((CImageEditorDrawControl *)iControl)->GetParam() ); + return KErrNone; + } + + // Control not found, return KErrNotReady + else + { + return KErrNotReady; + } + } + case KCapReadyToRender: + { + TBool readytorender = ETrue; + if (iControl) + { + readytorender = + ((CImageEditorDrawControl *)iControl)->IsReadyToRender(); + } + aPropertyValue.AppendNum ((TInt)readytorender); + return KErrNone; + } + case KCapIsLandscapeEnabled: + { + aPropertyValue.AppendNum ((TInt)iLandscapeEnabled); + return KErrNone; + } + case KCapIsSlowPlugin: + { + aPropertyValue.AppendNum ((TInt)ETrue); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty( + aPropertyId, aPropertyValue); + } + } + } + +// --------------------------------------------------------------------------- +// InitPluginL +// --------------------------------------------------------------------------- +// +TInt CImageEditorDrawPlugin::InitPluginL( + const TRect& aRect, + CCoeControl* aParent, + CCoeControl*& aPluginControl) + { + // 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); + TInt tempval = 0; + parser.Val( tempval ); + //CDesCArray * pars = (CDesCArray *)tempval; + +#ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY + // 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); +#endif + + iControl = CImageEditorDrawControl::NewL (aRect, aParent); + aPluginControl = iControl; + + // Set system parameters + ((CImageEditorDrawControl*)iControl)->SetSystemParameters (iSysPars); + + iLandscapeEnabled = ETrue; + + +#ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY + // Set always back to original orientation, even if leaves + CAknAppUiBase::TAppUiOrientation orientation = appUi->Orientation(); + + if (orientation != originalOrientation) + { + appUi->SetOrientationL(originalOrientation); + + // Send screen device change event to validate screen + TWsEvent event; + + RWsSession& rws = CEikonEnv::Static()->WsSession(); + event.SetType( EEventScreenDeviceChanged ); + event.SetTimeNow(); + event.SetHandle( rws.WsHandle() ); + + User::LeaveIfError( rws.SendEventToAllWindowGroups(event) ); + } +#else +#ifdef LANDSCAPE_ONLY + + appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); + + // Send screen device change event to validate screen + TWsEvent event; + + RWsSession& rws = CEikonEnv::Static()->WsSession(); + event.SetType( EEventScreenDeviceChanged ); + event.SetTimeNow(); + event.SetHandle( rws.WsHandle() ); + + User::LeaveIfError( rws.SendEventToAllWindowGroups(event) ); + +#endif +#endif + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// ProcessImageL +// --------------------------------------------------------------------------- +// +void CImageEditorDrawPlugin::ProcessImageL(CEditorImage * /*aImage*/ ) + { + } + +// --------------------------------------------------------------------------- +// ReleasePlugin +// --------------------------------------------------------------------------- +// +void CImageEditorDrawPlugin::ReleasePlugin() + { + delete iControl; + iControl = NULL; + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/DrawPlugin/src/selectionpopup.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/DrawPlugin/src/selectionpopup.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,792 @@ +/* +* 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 + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/EABI/Frame.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/EABI/Frame.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI23CImageEditorFramePlugin @ 2 NONAME ; ## + _ZTI24CImageEditorFrameControl @ 3 NONAME ; ## + _ZTV23CImageEditorFramePlugin @ 4 NONAME ; ## + _ZTV24CImageEditorFrameControl @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/bwins/Frame.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/bwins/Frame.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frame.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/data/frame.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,139 @@ +/* +* 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: +* Resource definitions for Frame plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "frame.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "frame_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_FRAME_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeAdjustmentEngine; + plugindisplayorder = 11; + pluginname = qtn_sie_plugin_name_frame; + iconfile = "frame.mif"; + filterfile = "FilterFrame.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // Plugin name + qtn_sie_plugin_name_frame, + // navi pane label + qtn_sie_navi_current_frame + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_msk_ok; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +RESOURCE ARRAY r_frame_dirs +{ + items= + { + LBUF { txt = "c:\\private\101ffa91\\frames\\"; }, + LBUF { txt = ""text_memory_card_root_path"private\101ffa91\\frames\\"; }, + LBUF { txt = "z:\\private\101ffa91\\frames\\"; }, + LBUF { txt = "c:\\data\\images\\frames\\"; }, + LBUF { txt = ""text_memory_card_root_path"images\\frames\\"; } + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_bubbles.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_bubbles.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_bubbles_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_bubbles_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_canvas.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_canvas.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_canvas_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_canvas_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_digits.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_digits.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_digits_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_digits_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_dots.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_dots.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_dots_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_dots_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_fashion.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_fashion.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_fashion_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_fashion_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_floral.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_floral.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_floral_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_floral_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_greek.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_greek.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_greek_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_greek_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_honey.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_honey.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_honey_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_honey_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_hook.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_hook.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_hook_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_hook_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_jungle.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_jungle.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_jungle_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_jungle_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_metal.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_metal.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_metal_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_metal_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_screen.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_screen.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_screen_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_screen_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_sport.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_sport.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_sport_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_sport_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_stripes.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_stripes.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_stripes_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_stripes_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_submarine.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_submarine.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_submarine_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_submarine_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_swirl.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_swirl.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_swirl_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_swirl_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tiles.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tiles.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tiles_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tiles_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tribal.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tribal.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tribal_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_tribal_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wanted.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wanted.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wanted_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wanted_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wood.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wood.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wood_mask_soft.bmp Binary file imageeditor/plugins/FramePlugin/data/frames/qgn_graf_ied_frame_wood_mask_soft.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/icon.bmp Binary file imageeditor/plugins/FramePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/mask.bmp Binary file imageeditor/plugins/FramePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/data/qgn_plugin_frame.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/data/qgn_plugin_frame.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,14 @@ + + + + +]> + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/group/FramePlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/group/FramePlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,178 @@ +/* +* 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: +* Frame plugin mmp file. +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +// to get icon & bmp locations +#include + +#include "../../../inc/imageeditoruids.hrh" +#include "../../../inc/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + +#if defined( __LANDSCAPE_ONLY__ ) +MACRO LANDSCAPE_ONLY +#endif + +#if defined(__LANDSCAPE_ROTATE_HOTKEYS__) +MACRO LANDSCAPE_ROTATE_HOTKEYS +#endif + +#if defined(__LANDSCAPE_PAN_HOTKEYS__) +MACRO LANDSCAPE_PAN_HOTKEYS +#endif + +TARGET Frame.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_FRAME_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorFramePlugin.cpp +SOURCE ImageEditorFrameControl.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/frame.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY fbscli.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib + +LIBRARY CommonEngine.lib +LIBRARY Avkon.lib +LIBRARY platformenv.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + + +// Initial frames package +START BITMAP frames01.mbm +TARGETPATH /private/101ffa91/frames +HEADER + +SOURCEPATH S60_SRC_BITMAP_DIR + +SOURCE c24 qgn_prop_imed_frame_01.bmp +SOURCE 8 qgn_prop_imed_frame_01_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_02.bmp +SOURCE 8 qgn_prop_imed_frame_02_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_03.bmp +SOURCE 8 qgn_prop_imed_frame_03_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_04.bmp +SOURCE 8 qgn_prop_imed_frame_04_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_05.bmp +SOURCE 8 qgn_prop_imed_frame_05_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_06.bmp +SOURCE 8 qgn_prop_imed_frame_06_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_07.bmp +SOURCE 8 qgn_prop_imed_frame_07_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_08.bmp +SOURCE 8 qgn_prop_imed_frame_08_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_09.bmp +SOURCE 8 qgn_prop_imed_frame_09_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_10.bmp +SOURCE 8 qgn_prop_imed_frame_10_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_11.bmp +SOURCE 8 qgn_prop_imed_frame_11_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_12.bmp +SOURCE 8 qgn_prop_imed_frame_12_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_13.bmp +SOURCE 8 qgn_prop_imed_frame_13_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_14.bmp +SOURCE 8 qgn_prop_imed_frame_14_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_15.bmp +SOURCE 8 qgn_prop_imed_frame_15_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_16.bmp +SOURCE 8 qgn_prop_imed_frame_16_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_17.bmp +SOURCE 8 qgn_prop_imed_frame_17_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_18.bmp +SOURCE 8 qgn_prop_imed_frame_18_mask_soft.bmp + +SOURCE c24 qgn_prop_imed_frame_19.bmp +SOURCE 8 qgn_prop_imed_frame_19_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_20.bmp +SOURCE 8 qgn_prop_imed_frame_20_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_21.bmp +SOURCE 8 qgn_prop_imed_frame_21_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_22.bmp +SOURCE 8 qgn_prop_imed_frame_22_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_23.bmp +SOURCE 8 qgn_prop_imed_frame_23_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_24.bmp +SOURCE 8 qgn_prop_imed_frame_24_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_25.bmp +SOURCE 8 qgn_prop_imed_frame_25_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_26.bmp +SOURCE 8 qgn_prop_imed_frame_26_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_27.bmp +SOURCE 8 qgn_prop_imed_frame_27_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_28.bmp +SOURCE 8 qgn_prop_imed_frame_28_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_29.bmp +SOURCE 8 qgn_prop_imed_frame_29_mask_soft.bmp +SOURCE c24 qgn_prop_imed_frame_30.bmp +SOURCE 8 qgn_prop_imed_frame_30_mask_soft.bmp + +END + + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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: +* Frame plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// mmp files +PRJ_MMPFILES +FramePlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE frame.mif +OPTION HEADERFILE frame.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_frame +END + +// test project mmp files +PRJ_TESTMMPFILES + +// project exports +PRJ_EXPORTS +../rom/ImageEditorFramePlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorFramePlugin.iby) +../rom/ImageEditorFramePluginSettings.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorFramePluginSettings.iby) + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/inc/Frame_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/inc/Frame_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* String generalisations for Frame plugin. +* +*/ + + + +#include +#include "iepb_gen.loc" + +// SOFTKEY TEXTS + +#define qtn_sie_pgn_sk1_ok qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_msk_ok qtn_sie_iepb_softkey_ok + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/inc/ImageEditorFrameControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/inc/ImageEditorFrameControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,300 @@ +/* +* 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: +* Frame plugin control's header. +* +*/ + + +#ifndef IMAGEEDITORCROPCONTROL_H +#define IMAGEEDITORCROPCONTROL_H + +// INCLUDES +#include + +#include "PreviewControlBase.h" + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + + +/* CLASS: CImageEditorFrameControl +* +* CImageEditorFrameControl is a control for red eye reduction plug-in. +* +*/ +class CImageEditorFrameControl : public CPreviewControlBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorFrameControl object + */ + static CImageEditorFrameControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorFrameControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + * + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Setter for view reference + * + * @see CImageEditorControlBase + * + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + * + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetParam + * + * Gets pointer to the parameter struct. + * + * @param - + * @return - pointer to MIA parameter struct + */ + TDesC & GetParam (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + /* SizeChanged + * + * @see CImageEditorControlBase + * + */ + virtual void SizeChanged(); + + /* PrepareL + * + * @see CImageEditorControlBase + * + */ + virtual void PrepareL (); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorFrameControl (); + + /** Draw + * + * @see CImageEditorControlBase + * + */ + virtual void Draw (const TRect & aRect) const; + + /** NaviRightL + * + * Handles nave key right event. + * + * @param - + * @return - + */ + void NaviRightL(); + + /** NaviLeftL + * + * Handles nave key left event. + * + * @param - + * @return - + */ + void NaviLeftL(); + + /** FindFramesL + * + * Search all the frames available in the system + */ + void FindFramesL(); + + /** + * Select and decode frame bitmap. + * Done asyncronously. + */ + void SelectFrameL(); + + /** SetNaviPaneTextL + * + * Update the navi pane. + */ + void SetNaviPaneTextL(); + + /** Copy constructor, disabled + */ + CImageEditorFrameControl (const CImageEditorFrameControl & rhs); + + /** Assignment operator, disabled + */ + CImageEditorFrameControl & operator= (const CImageEditorFrameControl & rhs); + +//@} + +/** @name Typedefs:*/ +//@{ + enum TFrameControlState + { + // Invalid + EFrameControlStateMin = 0, + // Loading initial frame + EFrameControlStateInitializing, + // Loading frame + EFrameControlStateLoadingFrame, + // Ready + EFrameControlStateIdle, + // Invalid + EFrameControlStateMax + } iState; + + enum TFrameChangeDirection + { + // No direction + ENoDirection = 0, + // Direciton from right to left (x-axis) + EPreviousFrame, + // Direciton from left to right (x-axis) + ENextFrame + }; +//@} + +/** @name Members:*/ +//@{ + /// Editor view + CAknView * iEditorView; + /// Plug-in info + CPluginInfo * iItem; + /// Navigation pane text + TBuf<64> iNaviPaneText; + /// Frame file array + CDesCArray* iFrameFileArray; + /// Array of frames in each file + RArray iMultiplicities; + /// Current frame bitmap + TInt iCurrentFrameIndex; + /// Number of frame bitmaps + TInt iFrameCount; + /// Parameter + TBuf<256> iParameter; + + // Pointer event enablers + // Pointer position in last pointer event + TPoint iPointerPosition; + // Position on button down event + TPoint iInitialPointerPosition; + // Position on button up event + TPoint iFinalPointerPosition; + // Whether stylus has been moved to one direction only or not + // (in x direction) + TBool iOneDirectionalChange; + // Change direction on previous drag event + TFrameChangeDirection iPreviousChange; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/inc/ImageEditorFramePlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/inc/ImageEditorFramePlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,150 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORFRAMEPLUGIN_H +#define IMAGEEDITORFRAMEPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// debug log +#include "imageeditordebugutils.h" +_LIT(KFramePluginLogFile,"FramePlugin.log"); + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; + + +/* CLASS: CImageEditorFramePlugin +* +* CImageEditorFramePlugin represents Frame insertion plug-in for Image Editor +* application. +* +*/ +class CImageEditorFramePlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorFramePlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorFramePlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorFramePlugin (const CImageEditorFramePlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorFramePlugin & operator= (const CImageEditorFramePlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; +//@} + +}; + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/inc/ImageEditorFramePlugin.pan --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/inc/ImageEditorFramePlugin.pan Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,42 @@ +/* +* 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: +* +*/ + + + +#ifndef __IMAGEEDITORFRAMEPLUGIN_PAN__ +#define __IMAGEEDITORFRAMEPLUGIN_PAN__ + +#include + +void Panic(TInt aCategory) +{ + _LIT(KComponentName, "ImageEditorFramePlugin"); + User::Panic(KComponentName, aCategory); +} + +enum TFramePluginPanicIds +{ + EFrameBitmapIndexOutOfBounds = 0, + EFrameBitmapNotReady, + EFrameAlphaBitmapNotReady, + EFrameUnsupportedDisplayMode +}; + +#endif __IMAGEEDITORFRAMEPLUGIN_PAN__ + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/inc/frame.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/inc/frame.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + + + +#ifndef FRAME_HRH +#define FRAME_HRH + +#include "ImageEditorPluginBase.hrh" +#include "avkon.hrh" + +//enum TFramePgnCommandId +//{ +// EFramePgnMenuCmdMin = EPgnMenuCmdIdBase, +// EFramePgnMenuCmdDone, +// EFramePgnMenuCmdCancel, +// EFramePngMenuCmdChange, +// EFramePgnMenuCmdMax +//}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/rom/ImageEditorFramePlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/rom/ImageEditorFramePlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FRAMEPLUGIN_IBY__ +#define __FRAMEPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Frame.pgn SHARED_LIB_DIR\Frame.pgn + +// Resources +data=DATAZ_\resource\apps\Frame.mif \resource\apps\Frame.mif + +#endif // __FRAMEPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/rom/ImageEditorFramePluginSettings.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/rom/ImageEditorFramePluginSettings.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FRAMEPLUGINSETTINGS_IBY__ +#define __FRAMEPLUGINSETTINGS_IBY__ + +// Frame data +data=DATAZ_\private\101ffa91\frames\frames01.mbm \private\101ffa91\frames\frames01.mbm + + +#endif // __FRAMEPLUGINSETTINGS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/src/ImageEditorFrameControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/src/ImageEditorFrameControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,636 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "ImageEditorUI.hrh" +#include "ImageEditorPluginBase.hrh" +#include "Frame.hrh" +#include "PluginInfo.h" +#include "ImageEditorError.h" +#include "ResolutionUtil.h" +#include + +#include "ImageEditorFrameControl.h" +#include "ImageEditorFramePlugin.h" +#include "ImageEditorFramePlugin.pan" + +//#include "platform_security_literals.hrh" + + +// CONSTANTS +const TInt KCurrentFrameIndex = 1; +const TInt KFrameChangeThreshold = 30; +const TInt KDirectionChangeThreshold = 7; + +_LIT (KPgnResourceFile, "frame.rsc"); +_LIT (KFrameWild, "*.mbm"); + +//============================================================================= +CImageEditorFrameControl * CImageEditorFrameControl::NewL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + CImageEditorFrameControl * self = new (ELeave) CImageEditorFrameControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CImageEditorFrameControl::CImageEditorFrameControl () : +iState (EFrameControlStateMin) +{ + +} + +//============================================================================= +CImageEditorFrameControl::~CImageEditorFrameControl () +{ + iMultiplicities.Close(); + + if (iFrameFileArray) + { + iFrameFileArray->Reset(); + delete iFrameFileArray; + iFrameFileArray = NULL; + } + iEditorView = NULL; + iItem = NULL; +} + +//============================================================================= +void CImageEditorFrameControl::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * aParent + ) +{ + + // Set parent window + SetContainerWindowL (*aParent); + + iFrameFileArray = new (ELeave) CDesCArrayFlat (8); + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + // Activate control + ActivateL(); + + EnableDragEvents(); +} + +//============================================================================= +void CImageEditorFrameControl::SetView (CAknView * aView) +{ + iEditorView = aView; +} + +//============================================================================= +void CImageEditorFrameControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + iItem = aItem; +} + +//============================================================================= +void CImageEditorFrameControl::PrepareL () +{ + iState = EFrameControlStateInitializing; + + // Find frames + FindFramesL(); + + // Select the first frame to be drawn + iCurrentFrameIndex = 0; + SetNaviPaneTextL(); + + // Load the first frame synchronously to avoid timing problems + SelectFrameL(); + + iState = EFrameControlStateIdle; +} + +//============================================================================= +TKeyResponse CImageEditorFrameControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + TKeyResponse response = EKeyWasNotConsumed; + + // If busy, do not handle anything + if ( iState < EFrameControlStateIdle ) + { + response = EKeyWasConsumed; + } + else if (aType != EEventKey ) + { + switch (aKeyEvent.iScanCode) + { + // Just consume these keys (No EEventKey type event delivered for + // these keys so this must be done here) + case EStdKeyRightShift: + case EStdKeyLeftShift: + { + response = EKeyWasConsumed; + break; + } + } + } + // We handle only event keys + else if (EEventKey == aType) + { + + TBool rotated = CResolutionUtil::Self()->GetLandscape(); + + switch (aKeyEvent.iCode) + { + + // Just consume these keys + case 0x31: // 1 + case 0x33: // 3 + case 0x35: // 5 + case 0x37: // 7 + case 0x39: // 9 + case 0x2a: // * + case 0x23: // # + case EKeyDownArrow: + case EKeyUpArrow: + case EStdKeyIncVolume: // zoom in key + case EStdKeyDecVolume: // zoom out key + { + response = EKeyWasConsumed; + break; + } + + case 0x32: // 2 + { + if (rotated) + { + // Switch to next frame + NaviLeftL(); + } + response = EKeyWasConsumed; + break; + } + case 0x38: // 8 + { + if (rotated) + { + // Switch to next frame + NaviRightL(); + } + response = EKeyWasConsumed; + break; + } + + case 0x34: + { + if (!rotated) + { + // Switch to previous frame + NaviLeftL(); + } + response = EKeyWasConsumed; + break; + } + + case 0x36: + { + if (!rotated) + { + // Switch to next frame + NaviRightL(); + } + response = EKeyWasConsumed; + break; + } + + + case EKeyRightArrow: + { + NaviRightL(); + response = EKeyWasConsumed; + break; + } + + case EKeyLeftArrow: + { + NaviLeftL(); + response = EKeyWasConsumed; + break; + } + + case EKeyOK: + case EKeyEnter: + { + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + response = EKeyWasConsumed; + break; + } + + default: + { + break; + } + } + } + return response; +} + +//============================================================================= +void CImageEditorFrameControl::SizeChanged() +{ + +} + +//============================================================================= +TDesC & CImageEditorFrameControl::GetParam () +{ + return iParameter; +} + +//============================================================================= +void CImageEditorFrameControl::HandlePluginCommandL (const TInt aCommand) +{ + switch (aCommand) + { + case EPgnSoftkeyIdCancel: + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + break; + } + case EPgnSoftkeyIdOk: + { + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + break; + } + default: + { + break; + } + } +} + +//============================================================================= +TInt CImageEditorFrameControl::GetSoftkeyIndexL() +{ + return 0; +} + +//============================================================================= +TPtrC CImageEditorFrameControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + if ( iFrameCount > 1) + { + aLeftNaviPaneScrollButtonVisibile = ETrue; + aRightNaviPaneScrollButtonVisible = ETrue; + } + else + { + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + } + return iNaviPaneText; +} + +//============================================================================= +void CImageEditorFrameControl::Draw (const TRect & aRect) const +{ + CPreviewControlBase::DrawPreviewImage (aRect); +} + +//============================================================================= +void CImageEditorFrameControl::NaviRightL() +{ + LOG(KFramePluginLogFile, "CImageEditorFrameControl::NaviRightL()"); + + // Switch to the next frame bitmap + iCurrentFrameIndex++; + if (iCurrentFrameIndex > iFrameCount - 1 ) + { + // loop back to first + iCurrentFrameIndex = 0; + } + SetNaviPaneTextL(); + SelectFrameL(); +} + +//============================================================================= +void CImageEditorFrameControl::NaviLeftL() +{ + LOG(KFramePluginLogFile, "CImageEditorFrameControl::NaviLeftL()"); + + // Switch to the previous frame bitmap + iCurrentFrameIndex--; + if ( iCurrentFrameIndex < 0 ) + { + // loop to last + iCurrentFrameIndex = iFrameCount - 1; + } + SetNaviPaneTextL(); + SelectFrameL(); +} + +//============================================================================= +void CImageEditorFrameControl::FindFramesL() +{ + LOG(KFramePluginLogFile, "CImageEditorFrameControl::FindFrames()"); + + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + RConeResourceLoader resLoader( *ControlEnv() ); + resLoader.OpenL ( resourcefile ); + CleanupClosePushL(resLoader); + + CDesCArrayFlat* array = ControlEnv()->ReadDesCArrayResourceL(R_FRAME_DIRS); + CleanupStack::PushL(array); + + TFileName pathList; + _LIT(KPathSeparator, ";"); + + for (TInt k = 0; k < array->Count(); ++k) + { + TPtrC path = (*array)[k]; + LOGFMT(KFramePluginLogFile, "\tSearch path: %S", &path); + pathList.Append(path); + pathList.Append(KPathSeparator); + } + + // Create a file finder + TFindFile fileFinder (ControlEnv()->FsSession()); + CDir * fileList = 0; + + // Find files by wild card and directory + TInt err = fileFinder.FindWildByPath ( + KFrameWild, + &pathList, + fileList + ); + + User::LeaveIfError(err); + + CleanupStack::PopAndDestroy(2); // resLoader, array + + // Go through all drives + while (err == KErrNone) + { + CleanupStack::PushL (fileList); + + // Check all plug-in candidates + for (TInt i = 0; i < fileList->Count(); ++i) + { + + // Create a full file name for a frame file + TParse fullentry; + TPtrC name = (*fileList)[i].iName; + const TDesC* related = &(fileFinder.File()); + fullentry.Set ( name, related, 0 ); + TPtrC fullname (fullentry.FullName()); + + // Store frame file names + iFrameFileArray->AppendL (fullname); + + // Check the amount of frames + TInt err_bmp = KErrNone; + TInt err_bmp_mask = KErrNone; + TInt j = 0; + while (KErrNone == err_bmp && KErrNone == err_bmp_mask) + { + CFbsBitmap * tmp = new (ELeave) CFbsBitmap; + CleanupStack::PushL (tmp); + err_bmp = tmp->Load (fullname, j); + CleanupStack::PopAndDestroy(); // tmp + + tmp = new (ELeave) CFbsBitmap; + CleanupStack::PushL (tmp); + err_bmp_mask = tmp->Load (fullname, j + 1); + CleanupStack::PopAndDestroy(); // tmp + + if (KErrNone == err_bmp && KErrNone == err_bmp_mask) + { + ++iFrameCount; + } + j += 2; + } + User::LeaveIfError( iMultiplicities.Append (j - 1) ); + } + + CleanupStack::PopAndDestroy(); /// fileList + + // Try once again + err = fileFinder.FindWild (fileList); + + } + +} + +//============================================================================= +void CImageEditorFrameControl::SelectFrameL () +{ + LOG(KFramePluginLogFile, "CImageEditorFrameControl::SelectFrameL ()"); + + // Select frame + TInt file = 0; + TInt frame = 0; + TInt index = 0; + TBool bContinue = ETrue; + for (TInt i = 0 ; (i < iFrameFileArray->Count()) && bContinue; ++i) + { + for (TInt j = 0 ; j < iMultiplicities[i]; j += 2) + { + if (index == iCurrentFrameIndex) + { + file = i; + frame = j; + bContinue = EFalse; + break; + } + ++index; + } + } + + iParameter.Copy ( _L("file \"")); + iParameter.Append ( (*iFrameFileArray)[file] ); + iParameter.Append ( _L("\" frame ") ); + iParameter.AppendNum ( frame ); + iParameter.Append ( _L(" mask ") ); + iParameter.AppendNum ( frame + 1 ); + iParameter.Append ( _L(" load")); + + iEditorView->HandleCommandL (EImageEditorCmdRender); + +} + +//============================================================================= +void CImageEditorFrameControl::SetNaviPaneTextL() +{ + // Update the navi pane text with the frame index and count + // (make sure this is not called before the view exists) + if ( iEditorView && iItem ) + { + // .loc file parameter format strings + _LIT(KParameter1, "%0N"); + _LIT(KParameter2, "%1N"); + + // Getting string from resources + TPtrC ptr = iItem->Parameters()[KCurrentFrameIndex]; + + // Finding format patterns + TInt pos1 = ptr.Find(KParameter1); + TInt pos2 = ptr.Find(KParameter2); + + if(pos1 == KErrNotFound || pos2 == KErrNotFound) + { + User::Leave(KSIEEInternal); + } + + // Clear navi pane + iNaviPaneText.Zero(); + + // Add new text and replace format strings with current frame + // index and frame count + iNaviPaneText.Append(ptr.Left(pos1)); + iNaviPaneText.AppendNum ( iCurrentFrameIndex + 1 ); + iNaviPaneText.Append (ptr.Mid(pos1 + 3, pos2 - (pos1 + 3))); + iNaviPaneText.AppendNum ( iFrameCount ); + iNaviPaneText.Append (ptr.Mid(pos2 + 3)); + + AknTextUtils::LanguageSpecificNumberConversion ( iNaviPaneText ); + + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + } +} + +//============================================================================= +void CImageEditorFrameControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent ) + { + if( AknLayoutUtils::PenEnabled() ) + { + + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + // Initialize change values + iPreviousChange = ENoDirection; + iOneDirectionalChange = ETrue; + // Store positions + iPointerPosition = aPointerEvent.iPosition; + iInitialPointerPosition = iPointerPosition; + +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorFrameControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + break; + } + case TPointerEvent::EDrag: + { + // Moving direction is from right to left + // KDirectionChangeThreshold is here instead of 0, because + // touch screen tends to give drag events though finger is + // kept still on the screen. + if( ( iPointerPosition.iX - aPointerEvent.iPosition.iX ) > + KDirectionChangeThreshold ) + { + if( iPreviousChange == ENextFrame ) + { + iOneDirectionalChange = EFalse; + } + iPreviousChange = EPreviousFrame; + } + // Moving direction is from left to right + else if(( aPointerEvent.iPosition.iX - iPointerPosition.iX ) > + KDirectionChangeThreshold ) + { + if (iPreviousChange == EPreviousFrame) + { + iOneDirectionalChange = EFalse; + } + iPreviousChange = ENextFrame; + } + + // store current pen position + iPointerPosition = aPointerEvent.iPosition; + break; + } + case TPointerEvent::EButton1Up: + { + iFinalPointerPosition = aPointerEvent.iPosition; + // pen has been moved only one direction (x-wise) + // after button down event + if( iOneDirectionalChange ) + { + TInt xChange = iFinalPointerPosition.iX - + iInitialPointerPosition.iX; + TInt yChange = iFinalPointerPosition.iY - + iInitialPointerPosition.iY; + + // check if threshold value has been exceeded and that + // x directional change is bigger than y directional + if ( xChange > KFrameChangeThreshold && + Abs( xChange ) > Abs ( yChange ) ) + { + NaviLeftL(); + } + else if( xChange < ( -KFrameChangeThreshold ) && + Abs( xChange ) > Abs( yChange ) ) + { + NaviRightL(); + } + } + + break; + } + } + } + } +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/FramePlugin/src/ImageEditorFramePlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/FramePlugin/src/ImageEditorFramePlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,132 @@ +/* +* 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: +* +*/ + + +#include + +#include "ImageEditorFramePlugin.h" +#include "ImageEditorFrameControl.h" +#include "ImageEditorPluginBaseDefs.h" +#include "DrawUtils.h" + +// CONSTANTS +_LIT (KPgnResourceFile, "frame.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorFramePlugin * plugin = new (ELeave) CImageEditorFramePlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorFramePlugin::CImageEditorFramePlugin () +{ + +} + +//============================================================================= +void CImageEditorFramePlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorFramePlugin::~CImageEditorFramePlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorFramePlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorFramePlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + LOG(KFramePluginLogFile, "CImageEditorFrameControl::GetProperty()"); + aPropertyValue.Copy (((CImageEditorFrameControl*)iControl)->GetParam()); + LOGDES (KFramePluginLogFile, aPropertyValue); + return KErrNone; + } + case KCapGlobalZoomDisabled: + { + aPropertyValue.AppendNum((TInt)ETrue); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorFramePlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + // create log file if the logging is enabled + LOG_INIT(KFramePluginLogFile); + + // Delete previous control + ReleasePlugin(); + + // Create new control + iControl = CImageEditorFrameControl::NewL (aRect, aParent); + aPluginControl = iControl; + + return KErrNone; +} + +//============================================================================= +void CImageEditorFramePlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + +} + +//============================================================================= +void CImageEditorFramePlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/EABI/Negative.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/EABI/Negative.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI26CImageEditorNegativePlugin @ 2 NONAME ; ## + _ZTV26CImageEditorNegativePlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/bwins/Negative.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/bwins/Negative.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/data/icon.bmp Binary file imageeditor/plugins/NegativePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/data/mask.bmp Binary file imageeditor/plugins/NegativePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/data/negative.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/data/negative.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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: +* Resource definitions for Negative plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "negative_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_NEGATIVE_PLUGIN; + uitype = EPluginUiTypeNone; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 15; + pluginname = qtn_sie_plugin_name_negative; + iconfile = "negative.mif"; + filterfile = "FilterNegate.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // NO PARAMETERS + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + }; + } + +RESOURCE PGNUIITEMS r_pgn_menuitems +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/data/qgn_plugin_negative.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/data/qgn_plugin_negative.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,43 @@ + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/group/NegativePlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/group/NegativePlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,70 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET Negative.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_NEGATIVE_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorNegativePlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/negative.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib + +LIBRARY iepb.lib +LIBRARY pb.lib + + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Negative plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorNegativePlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorNegativePlugin.iby) + +// mmp files +PRJ_MMPFILES +NegativePlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE negative.mif +OPTION HEADERFILE negative.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_negative +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/inc/ImageEditorNegativePlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/inc/ImageEditorNegativePlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,146 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORNEGATIVEPLUGIN_H +#define IMAGEEDITORNEGATIVEPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; + + +/* CLASS: CImageEditorNegativePlugin +* +* CImageEditorNegativePlugin represents negative color conversion plug-in +* for Image Editor application. +*/ +class CImageEditorNegativePlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorNegativePlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorNegativePlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorNegativePlugin (const CImageEditorNegativePlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorNegativePlugin & operator= (const CImageEditorNegativePlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/inc/Negative_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/inc/Negative_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,22 @@ +/* +* 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: +* +*/ + + +#include + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/rom/ImageEditorNegativePlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/rom/ImageEditorNegativePlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __NEGATIVEPLUGIN_IBY__ +#define __NEGATIVEPLUGIN_IBY__ + + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Negative.pgn SHARED_LIB_DIR\Negative.pgn + +// Resources +data=DATAZ_\resource\apps\Negative.mif \resource\apps\Negative.mif + +#endif // __NEGATIVEPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/NegativePlugin/src/ImageEditorNegativePlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/NegativePlugin/src/ImageEditorNegativePlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,111 @@ +/* +* 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: +* +*/ + + + +#include "ImageEditorNegativePlugin.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "negative.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorNegativePlugin * plugin = new (ELeave) CImageEditorNegativePlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorNegativePlugin::CImageEditorNegativePlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorNegativePlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorNegativePlugin::~CImageEditorNegativePlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorNegativePlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorNegativePlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorNegativePlugin::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +void CImageEditorNegativePlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorNegativePlugin::ReleasePlugin () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/EABI/RedEyeReduction.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/EABI/RedEyeReduction.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI33CImageEditorRedEyeReductionPlugin @ 2 NONAME ; ## + _ZTI34CImageEditorRedEyeReductionControl @ 3 NONAME ; ## + _ZTV33CImageEditorRedEyeReductionPlugin @ 4 NONAME ; ## + _ZTV34CImageEditorRedEyeReductionControl @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/bwins/RedEyeReduction.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/bwins/RedEyeReduction.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/data/icon.bmp Binary file imageeditor/plugins/RedEyePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/data/mask.bmp Binary file imageeditor/plugins/RedEyePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/data/qgn_plugin_redeye.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/data/qgn_plugin_redeye.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,24 @@ + + + + +]> + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/data/redeyereduction.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/data/redeyereduction.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,199 @@ +/* +* 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: +* Resource definitions for RedEyeReduction plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "redeyereduction.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "redeyereduction_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info + { + pluginuid = UID_REDEYEREDUCTION_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 12; + pluginname = qtn_sie_plugin_name_redeye; + iconfile = "RedEyeReduction.mif"; + filterfile = "FilterRedEye.dll"; + } + +RESOURCE PARAMNAMES r_plugin_pars + { + parameters= + { + // Set croshair state navi pane text + qtn_sie_navi_edit_redeye, + + // Set the radius state navi pane text (N.B. same text in both) + qtn_sie_navi_edit_redeye + }; + } + +RESOURCE PGNUIITEMS r_sk1_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + } + }; + } + +RESOURCE PGNUIITEMS r_sk2_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_pgn_sk2_done; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_pgn_sk2_done; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + } + }; + } + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id = EPgnSoftkeyIdSet; + text = qtn_sie_msk_set; + }, + PGNUIITEM + { + id = EPgnSoftkeyIdReduceRed; + text = qtn_sie_msk_reduce_red; + }, + PGNUIITEM + { + id = EPgnSoftkeyIdSet; + text = qtn_sie_msk_set; + }, + PGNUIITEM + { + id = EPgnSoftkeyIdReduceRed; + text = qtn_sie_msk_reduce_red; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items + { + items= + { + // Set + PGNUIITEM + { + id=ERedEyeReductionPgnMenuCmdSet; + text=qtn_sie_options_set; + }, + // Remove + PGNUIITEM + { + id=ERedEyeReductionPgnMenuCmdReduceRed; + text=qtn_sie_options_reduce_red; + }, + // Undo + PGNUIITEM + { + id=ERedEyeReductionPgnMenuCmdUndo; + text=qtn_sie_options_undo; + }, + // Cancel + PGNUIITEM + { + id=ERedEyeReductionPgnMenuCmdCancel; + text=qtn_sie_options_cancel_effect; + } + }; + } + +// Tooltip texts +RESOURCE TBUF r_tooltip_redeye_locate { buf = qtn_sie_tooltip_redeye_locate; } +RESOURCE TBUF r_tooltip_redeye_outline { buf = qtn_sie_tooltip_redeye_outline; } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/group/RedEyeReductionPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/group/RedEyeReductionPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,90 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +LIBRARY efsrv.lib +#endif + +TARGET RedEyeReduction.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_REDEYEREDUCTION_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorRedEyeReductionPlugin.cpp +SOURCE ImageEditorRedEyeReductionControl.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/redeyereduction.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + + +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY fbscli.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib +LIBRARY avkon.lib +LIBRARY CommonEngine.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Red Eye Reduction plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorRedEyeReductionPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorRedEyeReductionPlugin.iby) + +// mmp files +PRJ_MMPFILES +RedEyeReductionPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE redeyereduction.mif +OPTION HEADERFILE redeyereduction.mbg +OPTION SOURCES -c8 qgn_indi_imed_eye +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/inc/ImageEditorRedEyeReductionControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/inc/ImageEditorRedEyeReductionControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,564 @@ +/* +* 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: +* Header file for RedEyeReduction plugin control class. +* +*/ + + + +#ifndef IMAGEEDITORCROPCONTROL_H +#define IMAGEEDITORCROPCONTROL_H + +// INCLUDES +#include +#include "PreviewControlBase.h" + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; +class CSystemParameters; +class CAknInfoPopupNoteController; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +/* CLASS: CImageEditorRedEyeReductionControl +* +* CImageEditorRedEyeReductionControl is a control for red eye reduction plug-in. +* +*/ +class CImageEditorRedEyeReductionControl : public CPreviewControlBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorRedEyeReductionControl object + */ + static CImageEditorRedEyeReductionControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** DancingAntzCallback + * + * Static callback for rotating dancing ants. + * + * @param aPtr - parameter given for TCallBack + * @return TInt + */ + static TInt DancingAntzCallback (TAny * aPtr); + + /** FastKeyCallback + * + * Static callback for triggering keys faster. + * + * @param aPtr - parameter given for TCallBack + * @return TInt + */ + static TInt FastKeyCallback (TAny * aPtr); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorRedEyeReductionControl (); + + /* Setter for view reference + * + * @see CImageEditorControlBase + * + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + * + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /** PrepareL + * + * @see CImageEditorControlBase + * + */ + virtual void PrepareL (); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetDimmedMenuItems + * + * @see CImageEditorControlBase + */ + virtual TBitField GetDimmedMenuItems(); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetParam + * + * Gets pointer to the parameter struct. + * + * @param - + * @return - pointer to MIA parameter struct + */ + TRect GetParam (); + + /* SetSysteParameters + * + * Sets reference to system parameters to plug-in. + * + * @param aSysPars - System parameters instance + * @return - + */ + void SetSystemParameters (const CSystemParameters * aSysPars); + + /** IsReadyToRender + * + * Return ETrue if all parameters have valid value and filter + * can be rendered. + * + * @param - + * @return - ETrue if ready to render, otherwise EFalse + */ + TBool IsReadyToRender() const; + + /* GetHelpContext + * + * @see CCoeControl + * + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + /* SizeChanged + * + * @see CImageEditorControlBase + * + */ + virtual void SizeChanged(); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorRedEyeReductionControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + * + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** Draw + * + * @see CImageEditorControlBase + * + */ + virtual void Draw (const TRect & aRect) const; + + /** DrawDancingAntz + * + * Drawing function for dancing ants selection border. + * + * @param aRect - control rectangle in need of refreshing + * @return - + */ + void DrawDancingAntz (const TRect & aRect) const; + + /** NaviDown + * + * Handles navi key down event. + * + * @param - + * @return - + */ + void NaviDown(); + + /** NaviUp + * + * Handles nave key up event. + * + * @param - + * @return - + */ + void NaviUp(); + + /** NaviRight + * + * Handles nave key right event. + * + * @param - + * @return - + */ + void NaviRight(); + + /** NaviLeft + * + * Handles navi key left event. + * + * @param - + * @return - + */ + void NaviLeft(); + + /** KeyOkL + * + * Handles OK key event. + * + * @param - + * @return - + */ + void KeyOkL(); + + /** CancelPluginL + * + * Handles the cancel command; Undo all the filters + * except for the first; the plugin manager takes care of that. + * + * @param - + * @return - + */ + void CancelPluginL(); + + /** ToMoveState + * + * Handles transition to Move state. + * + * @param - + * @return - + */ + void ToMoveStateL(); + + /** ToResizeState + * + * Handles transition to Resize state. + * + * @param - + * @return - + */ + void ToResizeStateL(); + + /** CursorLocation + * + * Calculates the selection point in real coordinates + * relative to the preview image. + * + * @param - + * @return TPoint + */ + TPoint CursorLocation() const; + + /** SelectionRect + * + * Calculates a rectangle from the current coordinates and selection radius, + * in real coordinates relative to the preview image. + * + * @param aCenter centerpoint in real coordinates + * @return TRect + */ + TRect SelectionRect( const TPoint& aCenter ) const; + + /** ComputeParams + * + * Calculates the filter parameters and + * updates them to the engine parameter struct. + * + * @param - + * @return - + */ + void ComputeParams(); + + /** AddFilterToEngineL + * + * + * + * + * @param - + * @return - + */ + void AddFilterToEngineL(); + + /** UndoL + * + * Undo one step of the red-eye reduction process. + * (The scope is different from the global undo.) + * + * @param - + * @return - + */ + void UndoL(); + + /** StartDancingAntzTimer + * + * Starts dancing ants timer. + * + * @param - + * @return - + */ + void StartDancingAntzTimer(); + + /** StartFastKeyTimer + * + * Starts fast key timer. + * + * @param - + * @return - + */ + void StartFastKeyTimer(); + + /** OnDancingAntzCallBack + * + * Timer event handler for dancing ants. + * + * @param - + * @return - + */ + void OnDancingAntzCallBack(); + + /** OnFastKeyCallBackL + * + * Timer event handler for fast keys. + * + * @param - + * @return - + */ + void OnFastKeyCallBackL(); + + /** Copy constructor, disabled + */ + CImageEditorRedEyeReductionControl (const CImageEditorRedEyeReductionControl & rhs); + + /** Assignment operator, disabled + */ + CImageEditorRedEyeReductionControl & operator= (const CImageEditorRedEyeReductionControl & rhs); + + /** ClipPosition + * + * Clips clipart position after screen mode change. + * + * @param - + * @return - + */ + void ClipPosition(); + + /** SetCursorPosition + * + * Sets the cursor to a position given as a parameter + * + * @param aNewPosition a point where to set the cursor + * @return - + */ + void SetCursorPosition( TPoint aNewPosition ); + + /** CrossHairCursorRect + * + * Returns the rect of Cross hair cursor + * + * @param - + * @return TRect cursor rect + */ + TRect CrossHairCursorRect() const; + + /** CursorTapped + * + * Gets a point as an parameter and returns whether + * current cursor rect includes that point + * + * @param aTappedPosition a point that was tapped by pen + * @return TBool ETrue if cursor includes tapped point + * EFalse otherwise + */ + TBool CursorTapped( TPoint aTappedPosition ) const; + + /** ShowTooltip + * + * Show tooltip text on the screen. Tooltip text is set based + * on the current state. + * + * @param - + * @return - + */ + void ShowTooltip(); + + /** CalculateResize + * + * Function is used to calculate a new redius value for outline circle + * when circle is resized with touch. The value is calculated based on + * dragging start and end points. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - TBool - ETrue if radius value is changed in the function + */ + TBool CalculateResize( TPoint aStartPoint, TPoint aEndPoint ); + +//@} + +/** @name Typedefs:*/ +//@{ + /** UI state + */ + enum TRedEyeReductionStateState + { + // Invalid + ERedEyeReductionStateMin = 0, + // Move + ERedEyeReductionStateMoveCrosshair, + // Resize + ERedEyeReductionStateResizeSelection, + // Done - preparing to close + ERedEyeReductionStateDone, + // Invalid + ERedEyeReductionStateMax + } iState; +//@} + + +/** @name Members:*/ +//@{ + /// Editor view + CAknView * iEditorView; + /// Cross hair icon + CFbsBitmap * iCrossHair; + CFbsBitmap * iCrossHairMask; + /// Visible image rect + const TRect* iVisibleImageRectPrev; + /// Viewport rect (the original image) + const TRect* iVisibleImageRect; + /// Plug-in info + CPluginInfo * iItem; + /// Navigation pane text + TBuf<64> iNaviPaneText; + /// Relative X position of the crosshair + TReal iX; + /// Relative Y position of the crosshair + TReal iY; + /// Relative selection radius + TReal iR; + /// Array of already selected red eye locations + RArray iUndoArray; + /// Periodic timer for dancing ants and fast key events + CPeriodic * iTimer; + /// Dancing ants flag + TBool iAntFlag; + /// Pressed key event code + TInt iPressedKeyScanCode; + /// Are event keys handled + TBool iHandleEventKeys; + /// Number of ticks since timer start + TInt iTickCount; + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; + /// Ready to render + TBool iReadyToRender; + /// Red-eye removal region + TRect iRedEyeRect; + /// If the flag is set, return empty paraeters + TBool iDoNotUpdateParameters; + /// Selection point on image, used when changing modes + TPoint iLockPoint; + /// System parameters + const CSystemParameters * iSysPars; + // Popup controller + CAknInfoPopupNoteController* iPopupController; + // Tooltip texts + HBufC * iTooltipLocate; + HBufC * iTooltipOutline; + + // Cursor can be dragged or not with pen + TBool iCursorDragEnabled; + + // Tapped position + TPoint iPointerPosition; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/inc/ImageEditorRedEyeReductionPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/inc/ImageEditorRedEyeReductionPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,150 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORREDEYEREDUCTIONPLUGIN_H +#define IMAGEEDITORREDEYEREDUCTIONPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; +class CSystemParameters; + +/* CLASS: CImageEditorRedEyeReductionPlugin +* +* CImageEditorRedEyeReductionPlugin represents red eye reduction +* plug-in for Image Editor application. +* +*/ +class CImageEditorRedEyeReductionPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorRedEyeReductionPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorRedEyeReductionPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorRedEyeReductionPlugin (const CImageEditorRedEyeReductionPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorRedEyeReductionPlugin & operator= (const CImageEditorRedEyeReductionPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// System parameters (width and height used) + const CSystemParameters * iSysPars; + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/inc/RedEyeReduction.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/inc/RedEyeReduction.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,37 @@ +/* +* 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: +* +*/ + + + +#ifndef REDEYEREDUCTION_HRH +#define REDEYEREDUCTION_HRH + +#include "ImageEditorPluginBase.hrh" +#include "avkon.hrh" + +enum TRedEyeReductionPgnCommandId +{ + ERedEyeReductionPgnMenuCmdMin = EPgnMenuCmdIdBase, + ERedEyeReductionPgnMenuCmdSet, + ERedEyeReductionPgnMenuCmdReduceRed, + ERedEyeReductionPgnMenuCmdUndo, + ERedEyeReductionPgnMenuCmdCancel, + ERedEyeReductionPgnMenuCmdMax +}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/inc/RedEyeReduction_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/inc/RedEyeReduction_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + + +#include +#include "iepb_gen.loc" +#include + +// SOFTKEY TEXTS + +#define qtn_sie_pgn_sk1_options qtn_sie_iepb_softkey_options +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_sk2_done qtn_sie_iepb_softkey_done + +// MENU OPTIONS + +#define qtn_sie_pgn_menu_set qtn_sie_options_set +#define qtn_sie_pgn_menu_undo qtn_sie_iepb_menu_undo +#define qtn_sie_pgn_menu_cancel qtn_sie_options_cancel_effect + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/rom/ImageEditorRedEyeReductionPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/rom/ImageEditorRedEyeReductionPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __REDEYEREDUCTIONPLUGIN_IBY__ +#define __REDEYEREDUCTIONPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\RedEyeReduction.pgn SHARED_LIB_DIR\RedEyeReduction.pgn + +// Resources +data=DATAZ_\resource\apps\RedEyeReduction.mif \resource\apps\RedEyeReduction.mif + +#endif // __REDEYEREDUCTIONPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/src/ImageEditorRedEyeReductionControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/src/ImageEditorRedEyeReductionControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1530 @@ +/* +* 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: +* Control class for RedEyeReduction plugin. +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + + +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "ImageEditorUI.hrh" +#include "ImageEditorPluginBase.hrh" +#include "RedEyeReduction.hrh" +#include "DrawUtils.h" +#include "PluginInfo.h" +#include "SystemParameters.h" +#include "ImageEditorUids.hrh" + +#include "ImageEditorRedEyeReductionControl.h" +#include "ImageEditorUIDefs.h" +#include "iepb.h" +#include "definitions.def" + +// DEBUG LOG +#include "imageeditordebugutils.h" +_LIT(KRedEyeReductionPluginLogFile, "RedEyeReductionPlugin.log"); + +// CONSTANTS +const TReal KPosParamMin = 0.0; +const TReal KPosParamMax = 1.0; +const TReal KPosParamStep = 0.01; +const TReal KPosParamDef = 0.5; + +const TReal KRadiusParamMin = 0.0; +const TReal KRadiusParamMax = 0.4; +const TReal KRadiusParamStep = 0.0025; +const TReal KRadiusParamDef = 0.05; + +const TInt KMoveSelectionIndex = 0; +const TInt KResizeSelectionIndex = 1; + +// Default values from CPreviewControlBase not used +const TInt KRedEyeFastKeyTimerDelayInMicroseconds = 500000; +const TInt KRedEyeFastKeyTimerIntervalInMicroseconds = 50000; +const TInt KRedEyeFastKeyTimerMultiplyThresholdInTicks = 9; +const TInt KRedEyeBigNavigationStepMultiplier = 3; + +// Touch constants +const TInt KTouchScaleMaxStepCount = 50; + +// Panic category +_LIT (KComponentName, "ImageEditorRedEyeReduction" ); + +// Resource file name +_LIT (KPgnResourceFile, "redeyereduction.rsc"); + +//============================================================================= +TInt CImageEditorRedEyeReductionControl::DancingAntzCallback (TAny * aPtr) +{ + ((CImageEditorRedEyeReductionControl *)aPtr)->OnDancingAntzCallBack(); + return KErrNone; +} + +//============================================================================= +TInt CImageEditorRedEyeReductionControl::FastKeyCallback (TAny * aPtr) +{ + TRAPD( err, ((CImageEditorRedEyeReductionControl *)aPtr)->OnFastKeyCallBackL() ); + return err; +} + +//============================================================================= +CImageEditorRedEyeReductionControl * CImageEditorRedEyeReductionControl::NewL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + CImageEditorRedEyeReductionControl * self = new (ELeave) CImageEditorRedEyeReductionControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CImageEditorRedEyeReductionControl::CImageEditorRedEyeReductionControl () : +iState( ERedEyeReductionStateMin ), +iX( KPosParamDef ), +iY( KPosParamDef ), +iR( KRadiusParamDef ), +iHandleEventKeys (ETrue), +iTickCount (0), +iNaviStepMultiplier (KDefaultSmallNavigationStepMultiplier), +iReadyToRender(ETrue), +iDoNotUpdateParameters(EFalse), +iCursorDragEnabled( EFalse ) +{ + +} + +//============================================================================= +CImageEditorRedEyeReductionControl::~CImageEditorRedEyeReductionControl () +{ + delete iCrossHair; + delete iCrossHairMask; + iUndoArray.Close(); + if( iTimer ) + { + iTimer->Cancel(); + } + delete iTimer; + iVisibleImageRectPrev = NULL; + iVisibleImageRect = NULL; + iEditorView = NULL; + iItem = NULL; + + delete iPopupController; + delete iTooltipLocate; + delete iTooltipOutline; + +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * aParent + ) +{ + LOG_INIT(KRedEyeReductionPluginLogFile); + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::ConstructL" ); + + // Set parent window + SetContainerWindowL (*aParent); + + // Create timer for fast keys and dancing ants + iTimer = CPeriodic::NewL (CActive::EPriorityStandard); + + // Create CROSSHAIR image + SDrawUtils::GetIndicatorBitmapL( + iCrossHair, + iCrossHairMask, + EMbmImageeditoruiQgn_indi_imed_cursor_super, // cross-hair + EMbmImageeditoruiQgn_indi_imed_cursor_super_mask + ); + + iPopupController = CAknInfoPopupNoteController::NewL(); + + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read tooltip resources + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + RConeResourceLoader resLoader ( *CEikonEnv::Static() ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + iTooltipLocate = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_REDEYE_LOCATE); + iTooltipOutline = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_REDEYE_OUTLINE); + + CleanupStack::PopAndDestroy(); // resLoader + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + // Activate control + ActivateL(); + + EnableDragEvents(); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::SetView (CAknView * aView) +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::SetView" ); + + iEditorView = aView; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::SetSelectedUiItemL" ); + + iItem = aItem; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::PrepareL () +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::PrepareL" ); + +#ifdef __TOUCH_ONLY_DEVICE_RER_PLUGIN_ACTION__ + // The whole crosshair set state is skipped totally in touch-only devices + ToResizeStateL(); +#else + ToMoveStateL(); +#endif + + // Store parameters for the initial filter. + // This is a special case. For the other filters, the parameters + // are stored implicitly when calling + iEditorView->HandleCommandL (EImageEditorStoreParameters); +} + +//============================================================================= +TKeyResponse CImageEditorRedEyeReductionControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + TKeyResponse response = EKeyWasNotConsumed; + + // If busy, do not handle anything + if ( Busy() ) + { + response = EKeyWasConsumed; + } + + // EEventKey + else if (EEventKey == aType && iHandleEventKeys) + { + + switch (aKeyEvent.iCode) + { + + case EKeyDownArrow: + { + // Adjust crop point + NaviDown(); + DrawNow(); + response = EKeyWasConsumed; + break; + } + + case EKeyUpArrow: + { + // Adjust crop point + NaviUp(); + DrawNow(); + response = EKeyWasConsumed; + break; + } + + case EKeyRightArrow: + { + // Adjust crop point + NaviRight(); + DrawNow(); + response = EKeyWasConsumed; + break; + } + + case EKeyLeftArrow: + { + // Adjust crop point + NaviLeft(); + DrawNow(); + response = EKeyWasConsumed; + break; + } + + case EKeyOK: + case EKeyEnter: + { + KeyOkL(); + DrawNow(); + response = EKeyWasConsumed; + break; + } + + default: + { + break; + } + } + } + + else if (EEventKey == aType && !iHandleEventKeys) + { + response = EKeyWasConsumed; + } + + // EEventKeyDown + else if (EEventKeyDown == aType) + { + switch (aKeyEvent.iScanCode) + { + case EStdKeyLeftArrow: + case EStdKeyRightArrow: + case EStdKeyUpArrow: + case EStdKeyDownArrow: + { + iPressedKeyScanCode = aKeyEvent.iScanCode; + StartFastKeyTimer(); + response = EKeyWasConsumed; + break; + } + default: + break; + } + } + + // EEventKeyUp + else if (EEventKeyUp == aType) + { + if (aKeyEvent.iScanCode == iPressedKeyScanCode) + { + iHandleEventKeys = ETrue; + if (iState == ERedEyeReductionStateResizeSelection) + { + StartDancingAntzTimer(); + } + else if( iTimer ) + { + iTimer->Cancel(); + } + response = EKeyWasConsumed; + + ShowTooltip(); + } + } + + return response; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::SizeChanged() +{ +} + +//============================================================================= +TRect CImageEditorRedEyeReductionControl::GetParam () +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::GetParam" ); + if (iUndoArray.Count() == 0 || iDoNotUpdateParameters) + { + LOG( KRedEyeReductionPluginLogFile, "\tiRedEyeRect: (0,0), (0,0)" ); + return TRect(); + } + else + { + LOGFMT4( KRedEyeReductionPluginLogFile, "\tiRedEyeRect: (%d,%d), (%d,%d)", iRedEyeRect.iTl.iX, iRedEyeRect.iTl.iY, iRedEyeRect.iBr.iX, iRedEyeRect.iBr.iY ); + ComputeParams(); + return iRedEyeRect; + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::SetSystemParameters (const CSystemParameters * aPars) +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::SetSystemParameters" ); + + iVisibleImageRect = &(aPars->VisibleImageRect()); + iVisibleImageRectPrev = &(aPars->VisibleImageRectPrev()); + iSysPars = aPars; + + __ASSERT_ALWAYS( iVisibleImageRectPrev && iVisibleImageRectPrev, User::Panic(KComponentName, KErrNotReady) ); + LOGFMT4( KRedEyeReductionPluginLogFile, "\tiVisibleImageRect: (%d,%d), (%d,%d)", iVisibleImageRect->iTl.iX, iVisibleImageRect->iTl.iY, iVisibleImageRect->iBr.iX, iVisibleImageRect->iBr.iY ); + LOGFMT2( KRedEyeReductionPluginLogFile, "\tVisible image rect size: %d,%d", (iVisibleImageRect->iBr.iX - iVisibleImageRect->iTl.iX) + 1, (iVisibleImageRect->iBr.iY - iVisibleImageRect->iTl.iY) + 1 ); + LOGFMT2( KRedEyeReductionPluginLogFile, "\tSize(): %d,%d", Size().iWidth, Size().iHeight ); + LOGFMT4( KRedEyeReductionPluginLogFile, "\tiVisibleImageRectPrev: (%d,%d), (%d,%d)", iVisibleImageRectPrev->iTl.iX, iVisibleImageRectPrev->iTl.iY, iVisibleImageRectPrev->iBr.iX, iVisibleImageRectPrev->iBr.iY ); + LOGFMT2( KRedEyeReductionPluginLogFile, "\tiVisibleImageRectPrev size: %d,%d", iVisibleImageRectPrev->Width(), iVisibleImageRectPrev->Height() ); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::HandlePluginCommandL (const TInt aCommand) +{ + LOGFMT( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::HandlePluginCommandL: %d", aCommand ); + + switch (aCommand) + { + case EImageEditorFocusGained: + { + if (iState == ERedEyeReductionStateResizeSelection) + { + StartDancingAntzTimer(); + } + break; + } + case EImageEditorFocusLost: + { + if (iTimer) + { + iTimer->Cancel(); + } + break; + } + case EPgnSoftkeyIdCancel: + { + CancelPluginL(); + break; + } + case EPgnSoftkeyIdDone: + { + iDoNotUpdateParameters = ETrue; + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + break; + } + case ERedEyeReductionPgnMenuCmdSet: + case EPgnSoftkeyIdSet: + { + KeyOkL(); + DrawNow(); + break; + } + case ERedEyeReductionPgnMenuCmdReduceRed: + case EPgnSoftkeyIdReduceRed: + { + KeyOkL(); + DrawNow(); + break; + } + case ERedEyeReductionPgnMenuCmdUndo: + { + UndoL(); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + break; + } + case ERedEyeReductionPgnMenuCmdCancel: + { + CancelPluginL(); + break; + } + case EImageEditorPreGlobalZoomChange: + case EImageEditorPreGlobalPanChange: + { + iDoNotUpdateParameters = ETrue; + break; + } + case EImageEditorGlobalZoomChanged: + case EImageEditorGlobalPanChanged: + { + iDoNotUpdateParameters = EFalse; + DrawNow(); + break; + } + + case EImageEditorPreScreenModeChange: + { + TReal relscale = iSysPars->RelScale(); + TRect virect = *iVisibleImageRect; + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + iLockPoint.iX = virect.iTl.iX + iX * virect.Width(); + iLockPoint.iY = virect.iTl.iY + iY * virect.Height(); + break; + } + case EImageEditorPostScreenModeChange: + { + TReal relscale = iSysPars->RelScale(); + TRect virect = *iVisibleImageRect; + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + iX = (TReal)(iLockPoint.iX - virect.iTl.iX) / virect.Width(); + iY = (TReal)(iLockPoint.iY - virect.iTl.iY) / virect.Height(); + ClipPosition(); + DrawNow(); + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +TInt CImageEditorRedEyeReductionControl::GetSoftkeyIndexL() +{ + + TInt index = -1; + if ( iState == ERedEyeReductionStateResizeSelection ) + { + if ( !iUndoArray.Count() ) + { + index = 3; + } + else + { + index = 1; + } + } + else if ( iState == ERedEyeReductionStateMoveCrosshair ) + { + if ( !iUndoArray.Count() ) + { + index = 0; + } + else + { + index = 2; + } + } + + + + LOGFMT( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::GetSoftkeyIndexL: %d", index ); + + return index; +} + +//============================================================================= +TBitField CImageEditorRedEyeReductionControl::GetDimmedMenuItems() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::GetDimmedMenuItems" ); + + TBitField dimmedMenuItems; + TInt count = iItem->MenuItems().Count(); + + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + // Dim the command ERedEyeReductionPgnMenuCmdReduceRed, and also + // ERedEyeReductionPgnMenuCmdUndo if selecting the first eye. + for ( TInt i = 0; i < count; i++) + { + // get the menu item id + TInt menuItem = iItem->MenuItems().At(i).iCommandId; + if ( menuItem == ERedEyeReductionPgnMenuCmdReduceRed || + ( iUndoArray.Count() == 0 && menuItem == ERedEyeReductionPgnMenuCmdUndo) + ) + { + dimmedMenuItems.SetBit( i ); + } + } + break; + } + case ERedEyeReductionStateResizeSelection: + { + // Dim the command ERedEyeReductionPgnMenuCmdSet. + for ( TInt i = 0; i < count; i++) + { + // get the menu item id + TInt menuItem = iItem->MenuItems().At(i).iCommandId; + +#ifdef __TOUCH_ONLY_DEVICE_RER_PLUGIN_ACTION__ + if ( menuItem == ERedEyeReductionPgnMenuCmdSet || + ( iUndoArray.Count() == 0 && menuItem == ERedEyeReductionPgnMenuCmdUndo)) + { + dimmedMenuItems.SetBit( i ); + } +#else + if ( menuItem == ERedEyeReductionPgnMenuCmdSet ) + { + dimmedMenuItems.SetBit( i ); + } +#endif + + } + break; + } + default: + { + ASSERT( EFalse ); + break; + } + } + return dimmedMenuItems; +} + +//============================================================================= +TPtrC CImageEditorRedEyeReductionControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return iNaviPaneText; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::Draw (const TRect & aRect) const +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::Draw()" ); + + CPreviewControlBase::DrawPreviewImage (aRect); + +#ifdef VERBOSE + LOGFMT4( KRedEyeReductionPluginLogFile, "\tiVisibleImageRect: (%d,%d), (%d,%d)", iVisibleImageRect->iTl.iX, iVisibleImageRect->iTl.iY, iVisibleImageRect->iBr.iX, iVisibleImageRect->iBr.iY ); + LOGFMT2( KRedEyeReductionPluginLogFile, "\tVisible image rect size: %d,%d", (iVisibleImageRect->iBr.iX - iVisibleImageRect->iTl.iX) + 1, (iVisibleImageRect->iBr.iY - iVisibleImageRect->iTl.iY) + 1 ); + LOGFMT2( KRedEyeReductionPluginLogFile, "\tSize(): %d,%d", Size().iWidth, Size().iHeight ); + LOGFMT4( KRedEyeReductionPluginLogFile, "\tiVisibleImageRectPrev: (%d,%d), (%d,%d)", iVisibleImageRectPrev->iTl.iX, iVisibleImageRectPrev->iTl.iY, iVisibleImageRectPrev->iBr.iX, iVisibleImageRectPrev->iBr.iY ); + LOGFMT2( KRedEyeReductionPluginLogFile, "\tiVisibleImageRectPrev size: %d,%d", iVisibleImageRectPrev->Width(), iVisibleImageRectPrev->Height() ); +#endif + + // In move state draw the crosshair + if ( iState == ERedEyeReductionStateMoveCrosshair ) + { + // Get graphics context + CWindowGc & gc = SystemGc(); + + gc.SetPenStyle (CGraphicsContext::ENullPen); + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + + TSize chSize = iCrossHair->SizeInPixels(); + TPoint center = CursorLocation(); + gc.BitBltMasked ( + TPoint(center.iX - (chSize.iWidth >> 1), center.iY - (chSize.iHeight >> 1)), + iCrossHair, + TRect (chSize), + iCrossHairMask, + EFalse + ); + } + + // In resize state draw the selection circle + else if ( iState == ERedEyeReductionStateResizeSelection ) + { + DrawDancingAntz(Rect()); + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::DrawDancingAntz (const TRect & /*aRect*/) const +{ + // Get graphics context + CWindowGc & gc = SystemGc(); + + // Compute center point of the area + TPoint center = CursorLocation(); + + // Compute selection rectangle + TRect rect ( SelectionRect( center ) ); + + // Draw the "dancing ants" ellipse + gc.SetDrawMode (CGraphicsContext::EDrawModePEN); + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + gc.SetBrushColor (KRgbBlack); + + // Draw + gc.SetPenStyle (CGraphicsContext::ESolidPen); + gc.SetPenColor ((iAntFlag) ? (KRgbBlack) : (KRgbWhite)); + gc.DrawEllipse (rect); + + // Draw dashed line + gc.SetPenStyle (CGraphicsContext::EDashedPen); + gc.SetPenColor ((iAntFlag) ? (KRgbWhite) : (KRgbBlack)); + gc.DrawEllipse (rect); + +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::UndoL() + { + TInt count = iUndoArray.Count(); + + LOGFMT( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::UndoL(): iUndoArray.Count() == %d", count ); + + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + if ( count > 0 ) + { + // Remove the latest selected red eye area + // (It would be possible to set the cursor back to the point + // which was the location of the previous eye, but that + // depends also on the zoom and pan values, which are not + // available for plugins) + iUndoArray.Remove( count - 1 ); + + // Undo the filter + iEditorView->HandleCommandL (EImageEditorUndoFilter); + + if ( iUndoArray.Count() == 0) + { + // One filter is added already when opening the plugin. If + // this initial filter is undone, we need to create a new one. + iEditorView->HandleCommandL (EImageEditorStoreParameters); + iEditorView->HandleCommandL (EImageEditorAddFilterToEngine); + + } + else + { + // Restore parameters + iRedEyeRect = iUndoArray[ count - 2 ]; + } + } + break; + } + case ERedEyeReductionStateResizeSelection: + { + +#ifdef __TOUCH_ONLY_DEVICE_RER_PLUGIN_ACTION__ + // in touch-only device do the same thing here in resize state as + // in non-touch device in move state->remove/undo filter + if ( count > 0 ) + { + + iUndoArray.Remove( count - 1 ); + + // Undo the filter + iEditorView->HandleCommandL (EImageEditorUndoFilter); + + if ( iUndoArray.Count() == 0) + { + // One filter is added already when opening the plugin. If this + // initial filter is undone, we need to create a new one. + iEditorView->HandleCommandL (EImageEditorStoreParameters); + iEditorView->HandleCommandL (EImageEditorAddFilterToEngine); + + } + else + { + // Restore parameters + iRedEyeRect = iUndoArray[ count - 2 ]; + } + } + +#else + + // In the resize state consider that undo means + // going back to the move crosshair state (non-touch) + ToMoveStateL(); +#endif + + break; + } + + default: + { + ASSERT( EFalse ); + break; + } + } + + DrawNow(); + } + + +//============================================================================= +void CImageEditorRedEyeReductionControl::NaviDown() +{ + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + iY += (KPosParamStep * iNaviStepMultiplier); + if (iY > KPosParamMax) + { + iY = KPosParamMax; + } + break; + } + case ERedEyeReductionStateResizeSelection: + { + iR -= (KRadiusParamStep * iNaviStepMultiplier); + if (iR < KRadiusParamMin) + { + iR = KRadiusParamMin; + } + break; + } + default: + { + ASSERT( EFalse ); + break; + } + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::NaviUp() +{ + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + iY -= (KPosParamStep * iNaviStepMultiplier); + if (iY < KPosParamMin) + { + iY = KPosParamMin; + } + break; + } + case ERedEyeReductionStateResizeSelection: + { + iR += (KRadiusParamStep * iNaviStepMultiplier); + if (iR > KRadiusParamMax) + { + iR = KRadiusParamMax; + } + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::NaviRight() +{ + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + iX += (KPosParamStep * iNaviStepMultiplier); + if (iX > KPosParamMax) + { + iX = KPosParamMax; + } + break; + } + case ERedEyeReductionStateResizeSelection: + { + iR += (KRadiusParamStep * iNaviStepMultiplier); + if (iR > KRadiusParamMax) + { + iR = KRadiusParamMax; + } + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::NaviLeft() +{ + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + iX -= (KPosParamStep * iNaviStepMultiplier); + if (iX < KPosParamMin) + { + iX = KPosParamMin; + } + break; + } + case ERedEyeReductionStateResizeSelection: + { + iR -= (KRadiusParamStep * iNaviStepMultiplier); + if (iR < KRadiusParamMin) + { + iR = KRadiusParamMin; + } + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::KeyOkL() +{ + switch (iState) + { + case ERedEyeReductionStateMoveCrosshair: + { + ToResizeStateL(); + break; + } + case ERedEyeReductionStateResizeSelection: + { + if ( iUndoArray.Count() > 0) + { + AddFilterToEngineL(); + } + else + { + + // Update the filter parameters + ComputeParams(); + + // Store coodinates + iUndoArray.Append( iRedEyeRect ); + + // Render + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + + +#ifdef __TOUCH_ONLY_DEVICE_RER_PLUGIN_ACTION__ + // Loop only inside Resize state in touch-only devices + ToResizeStateL(); + +#else + + // Go back to move state (non-touch) + ToMoveStateL(); +#endif + + break; + } + + case ERedEyeReductionStateDone: + { + if ( iUndoArray.Count() > 0) + { + AddFilterToEngineL(); + } + else + { + // Update the filter parameters + ComputeParams(); + + // Store coodinates + iUndoArray.Append( iRedEyeRect ); + + // Render + iEditorView->HandleCommandL (EImageEditorCmdRender); + + } + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::CancelPluginL() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::CancelPluginL" ); + + iState = ERedEyeReductionStateMin; + + // Undo all the filters exept for the first one, + // which is cancelled by the framework. + TInt count = iUndoArray.Count(); + while ( count > 1) + { + iEditorView->HandleCommandL (EImageEditorUndoFilter); + count--; + } + + iEditorView->HandleCommandL (EImageEditorCancelPlugin); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::ToMoveStateL() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::ToMoveState" ); + + // Stop dancing antz timer + if (iTimer) + { + iTimer->Cancel(); + } + + // Update navi pane text + iState = ERedEyeReductionStateMoveCrosshair; + iNaviPaneText.Copy ( iItem->Parameters()[KMoveSelectionIndex] ); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + // Update softkeys + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + + ShowTooltip(); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::ToResizeStateL() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::ToResizeState" ); + + // Start the timer + StartDancingAntzTimer(); + + // Reset the selection radius + iR = KRadiusParamDef; + + // Update navi pane text + iState = ERedEyeReductionStateResizeSelection; + iNaviPaneText.Copy ( iItem->Parameters()[KResizeSelectionIndex] ); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + + // Update softkeys + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + + ShowTooltip(); +} + +//============================================================================= +TPoint CImageEditorRedEyeReductionControl::CursorLocation() const +{ + __ASSERT_ALWAYS( iVisibleImageRectPrev, User::Panic(KComponentName, KErrNotReady) ); + TInt x = (TInt) (iX * (iVisibleImageRectPrev->Width())) + iVisibleImageRectPrev->iTl.iX; + TInt y = (TInt) (iY * (iVisibleImageRectPrev->Height())) + iVisibleImageRectPrev->iTl.iY; + return TPoint( x, y ); +} + +//============================================================================= +TRect CImageEditorRedEyeReductionControl::SelectionRect( const TPoint& aCenter ) const +{ + __ASSERT_ALWAYS( iVisibleImageRectPrev, User::Panic(KComponentName, KErrNotReady) ); + + // Radius iR is relative to the real image's x dimension. + // To obtain a circe, y-dimenson must be scaled accordingly. + TInt vpWidth = (iVisibleImageRect->iBr.iX - iVisibleImageRect->iTl.iX); + TInt vpHeight = (iVisibleImageRect->iBr.iY - iVisibleImageRect->iTl.iY); + TReal xyRatio = (TReal) vpHeight / vpWidth; + + // Compute rectangle inside the image area + TInt width = iVisibleImageRectPrev->Width(); + TInt height = iVisibleImageRectPrev->Height(); + + TInt ulc = aCenter.iX - (TInt)( iR * width + 0.5 ); // upper left corner x + TInt ulr = aCenter.iY - (TInt)( iR * height / xyRatio + 0.5); // upper left corner y + TInt lrc = aCenter.iX + (TInt)( iR * width + 0.5 ); // lower right corner x + TInt lrr = aCenter.iY + (TInt)( iR * height / xyRatio + 0.5); // lower right corner y + + return TRect ( ulc, ulr, lrc, lrr ); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::ComputeParams() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::ComputeParams()" ); + + __ASSERT_ALWAYS( iVisibleImageRect, User::Panic(KComponentName, KErrNotReady) ); + + // Compute the coordinates + + TInt vpWidth = iVisibleImageRect->iBr.iX - iVisibleImageRect->iTl.iX; + TInt vpHeight = iVisibleImageRect->iBr.iY - iVisibleImageRect->iTl.iY; + + TInt r = (TInt) (iR * vpWidth + 0.5); + TInt ulc = (TInt) (iX * vpWidth + 0.5 ) - r; + TInt ulr = (TInt) (iY * vpHeight + 0.5 ) - r; + TInt side = (TInt) (2 * iR * vpWidth + 0.5); + + // Set the filter parameters. + // The coordinates iX and iR are relative to the viewport image, + // whereas the filter parameters are relative to the source image. + iRedEyeRect.iTl.iX = iVisibleImageRect->iTl.iX + ulc; + iRedEyeRect.iTl.iY = iVisibleImageRect->iTl.iY + ulr; + iRedEyeRect.iBr.iX = iRedEyeRect.iTl.iX + side; + iRedEyeRect.iBr.iY = iRedEyeRect.iTl.iY + side; + + iReadyToRender = ETrue; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::AddFilterToEngineL() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::AddFilterToEngineL" ); + + // Update the filter parameters + ComputeParams(); + + // Store coodinates for undo + iUndoArray.Append( iRedEyeRect ); + + // Force adding the filter to the engine. This includes setting the undo point. + iEditorView->HandleCommandL (EImageEditorAddFilterToEngine); + iEditorView->HandleCommandL (EImageEditorStoreParameters); + + // Render + iEditorView->HandleCommandL (EImageEditorCmdRender); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::StartDancingAntzTimer() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::StartDancingAntzTimer()" ); + + iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; + + if (iTimer) + { + iTimer->Cancel(); + iTimer->Start( + TTimeIntervalMicroSeconds32 (KDancingAntzTimerDelayInMicroseconds), + TTimeIntervalMicroSeconds32 (KDancingAntzTimerIntervalInMicroseconds), + TCallBack (DancingAntzCallback, this) + ); + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::StartFastKeyTimer() +{ + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::StartFastKeyTimer()" ); + + iNaviStepMultiplier = KDefaultSmallNavigationStepMultiplier; + iTickCount = 0; + + if (iTimer) + { + iTimer->Cancel(); + iTimer->Start( + TTimeIntervalMicroSeconds32 (KRedEyeFastKeyTimerDelayInMicroseconds), + TTimeIntervalMicroSeconds32 (KRedEyeFastKeyTimerIntervalInMicroseconds), + TCallBack (FastKeyCallback, this) + ); + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::OnDancingAntzCallBack() +{ + iAntFlag = !iAntFlag; + ActivateGc(); + DrawDancingAntz (Rect()); + DeactivateGc(); +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::OnFastKeyCallBackL() +{ +#ifdef VERBOSE + LOGFMT2( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::OnFastKeyCallBackL: iNaviStepMultiplier: %d, iTickCount: %d", iNaviStepMultiplier, iTickCount ); +#endif + + if (iTickCount > KRedEyeFastKeyTimerMultiplyThresholdInTicks) + { + iNaviStepMultiplier = KRedEyeBigNavigationStepMultiplier; + LOG( KRedEyeReductionPluginLogFile, "CImageEditorRedEyeReductionControl::OnFastKeyCallBackL: switching to big steps" ); + } + else + { + iTickCount++; + } + + iHandleEventKeys = EFalse; + + switch (iPressedKeyScanCode) + { + case EStdKeyDownArrow: + { + NaviDown(); + break; + } + case EStdKeyUpArrow: + { + NaviUp(); + break; + } + case EStdKeyLeftArrow: + { + NaviLeft(); + break; + } + case EStdKeyRightArrow: + { + NaviRight(); + break; + } + default: + break; + } + DrawNow(); +} + +//============================================================================= +TBool CImageEditorRedEyeReductionControl::IsReadyToRender() const +{ + return iReadyToRender; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::GetHelpContext(TCoeHelpContext& aContext) const +{ + aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); + aContext.iContext = KSIE_HLP_REDEYE; +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::ClipPosition() +{ + if (iX < KPosParamMin) + { + iX = KPosParamMin; + } + else if (iX > KPosParamMax) + { + iX = KPosParamMax; + } + + if (iY < KPosParamMin) + { + iY = KPosParamMin; + } + else if (iY > KPosParamMax) + { + iY = KPosParamMax; + } +} + +//============================================================================= +void CImageEditorRedEyeReductionControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent) + { + if( AknLayoutUtils::PenEnabled() ) + { + TBool drawNow ( EFalse ); + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + iPopupController->HideInfoPopupNote(); + // Enable dragging if in cursor area tapped + // (both move and resize cases) + if ( CursorTapped( aPointerEvent.iPosition ) ) + { + iCursorDragEnabled = ETrue; + drawNow = EFalse; + } + else if ( iState == ERedEyeReductionStateResizeSelection ) + { + // Tapping outside cursor area just stores the pointer + // position + if ( !CursorTapped( aPointerEvent.iPosition ) ) + { + iPointerPosition = aPointerEvent.iPosition; + drawNow = EFalse; + } + } + +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorRedEyeReductionControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + break; + } + case TPointerEvent::EDrag: + { + // Sets the new cursor position when drag is enabled + // (i.e. EButton1Down has happened in cursor area) + if ( ( iState == ERedEyeReductionStateMoveCrosshair || + iState ==ERedEyeReductionStateResizeSelection ) + && iCursorDragEnabled ) + { + SetCursorPosition( aPointerEvent.iPosition ); + // prevents user to move cursor outside image area + ClipPosition(); + drawNow = ETrue; + } + + // Selection cursor can be grown or made smaller moving + // pen up and down outside the cursor area + if ( iState == ERedEyeReductionStateResizeSelection && + !iCursorDragEnabled ) + { + if ( CalculateResize( iPointerPosition, + aPointerEvent.iPosition ) ) + { + iPointerPosition = aPointerEvent.iPosition; + drawNow = ETrue; + } + else + { + drawNow = EFalse; + } + } + + break; + } + case TPointerEvent::EButton1Up: + { + // Sets crosshair cursor to a new position + if ( iState == ERedEyeReductionStateMoveCrosshair ) + { + SetCursorPosition( aPointerEvent.iPosition ); + ClipPosition(); + drawNow = ETrue; + } + + ShowTooltip(); + + iCursorDragEnabled = EFalse; + break; + } + + default: + { + break; + } + } + + CCoeControl::HandlePointerEventL( aPointerEvent ); + + if ( drawNow ) + { + DrawNow(); + } + } + } + +//============================================================================= +void CImageEditorRedEyeReductionControl::SetCursorPosition( TPoint aNewPosition ) + { + //Set new x value + iX = TReal( aNewPosition.iX - iVisibleImageRectPrev->iTl.iX ) / + ( iVisibleImageRectPrev->iBr.iX - iVisibleImageRectPrev->iTl.iX ); + + //Set new y value + iY = TReal( aNewPosition.iY - iVisibleImageRectPrev->iTl.iY ) / + ( iVisibleImageRectPrev->iBr.iY - iVisibleImageRectPrev->iTl.iY ); + } + + +//============================================================================= +TRect CImageEditorRedEyeReductionControl::CrossHairCursorRect() const + { + + TSize chSize = iCrossHair->SizeInPixels(); + TPoint center = CursorLocation(); + TPoint topLeftCorner(center.iX - (chSize.iWidth >> 1), + center.iY - (chSize.iHeight >> 1)); + + TRect moveCursorRect( topLeftCorner, chSize ); + + return moveCursorRect; + + } + +//============================================================================= +TBool CImageEditorRedEyeReductionControl::CursorTapped( TPoint aTappedPosition ) const + { + TBool cursorTapped( EFalse ); + TRect cursorRect; + + if ( iState == ERedEyeReductionStateMoveCrosshair ) + { + cursorRect = CrossHairCursorRect(); + + TPoint newTLCorner = TPoint( cursorRect.iTl.iX - ( cursorRect.Width() / 2 ), + cursorRect.iTl.iY - ( cursorRect.Height() / 2 ) ); + TPoint newBRCorner = TPoint( cursorRect.iBr.iX + ( cursorRect.Width() / 2 ), + cursorRect.iBr.iY + ( cursorRect.Height() / 2 )); + + // Make tappable rect double sized to crosshair rect + TRect doubleCursorRect = TRect( newTLCorner, newBRCorner ); + + cursorTapped = doubleCursorRect.Contains( aTappedPosition ); + } + else if ( iState == ERedEyeReductionStateResizeSelection ) + { + cursorRect = SelectionRect( CursorLocation() ); + cursorTapped = cursorRect.Contains( aTappedPosition ); + } + + return cursorTapped; + } + +//============================================================================= +void CImageEditorRedEyeReductionControl::ShowTooltip() + { + iPopupController->HideInfoPopupNote(); + + if ( iState == ERedEyeReductionStateMoveCrosshair ) + { + TPoint center = CursorLocation(); + SDrawUtils::ShowToolTip( iPopupController, + this, + center, + EHLeftVBottom, + *iTooltipLocate ); + } + else if ( iState == ERedEyeReductionStateResizeSelection ) + { + TRect circleRect ( SelectionRect( CursorLocation() ) ); + TPoint center( circleRect.Center() ); + + SDrawUtils::ShowToolTip( iPopupController, + this, + center, + EHLeftVBottom, + *iTooltipOutline ); + } + } + +//============================================================================= +TBool CImageEditorRedEyeReductionControl::CalculateResize( TPoint aStartPoint, + TPoint aEndPoint ) + { + // Whether bubble is resized in this function or not + TBool radiusChanged( EFalse ); + // Store old scale value + TReal oldRadius = iR; + TReal changeThreshold( 0.001 ); + + // Get system parameters + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Compute change on the screen + TInt deltaX = aEndPoint.iX - aStartPoint.iX; + TInt deltaY = aEndPoint.iY - aStartPoint.iY; + + // Use bigger dimension + TInt maxChangeInPixels; + if ( visibleImageRectPrev.Height() > visibleImageRectPrev.Width() ) + { + maxChangeInPixels = visibleImageRectPrev.Height(); + } + else + { + maxChangeInPixels = visibleImageRectPrev.Width(); + } + + TInt oneStepInPixels = maxChangeInPixels / KTouchScaleMaxStepCount; + TReal scaleStep = ( KRadiusParamMax - KRadiusParamMin ) / KTouchScaleMaxStepCount; + + // Relates to second and fourth corners. Defines how steep/gentle the + // moving angle has to be in order to scale. + TInt slopeAngleFactor = 3; + + // The first quarter (movement towards upper-right corner) + if( ( deltaX > 0 && deltaY <= 0 ) || ( deltaX >= 0 && deltaY < 0 ) ) + { + // use bigger value + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iR += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iR += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The second (movement towards lower-right corner) + else if( ( deltaX > 0 && deltaY >= 0 ) || ( deltaX >= 0 && deltaY > 0 ) ) + { + if( deltaX > slopeAngleFactor * deltaY ) + { + iR += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + + else if ( slopeAngleFactor * deltaX < deltaY ) + { + iR -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The third (movement towards lower-left corner) + else if( ( deltaX < 0 && deltaY >= 0 ) || ( deltaX <= 0 && deltaY > 0 ) ) + { + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iR -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iR -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The fourth (movement towards upper-left corner) + else if( ( deltaX < 0 && deltaY <= 0 ) || ( deltaX <= 0 && deltaY < 0 ) ) + { + if( slopeAngleFactor * Abs( deltaX ) < Abs( deltaY ) ) + { + iR += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + else if ( Abs( deltaX ) > slopeAngleFactor * Abs( deltaY ) ) + { + iR -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + } + + // Check the limits + if (iR > KRadiusParamMax) + { + iR = KRadiusParamMax; + radiusChanged = ETrue; + } + + if (iR < KRadiusParamMin) + { + iR = KRadiusParamMin; + radiusChanged = ETrue; + } + + if ( Abs( oldRadius - iR ) > changeThreshold ) + { + radiusChanged = ETrue; + } + + return radiusChanged; + + } +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RedEyePlugin/src/ImageEditorRedEyeReductionPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RedEyePlugin/src/ImageEditorRedEyeReductionPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,173 @@ +/* +* 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 RedEyeReduction plugin implementation. +* +*/ + + + +#include + +#include "ImageEditorRedEyeReductionPlugin.h" +#include "ImageEditorRedEyeReductionControl.h" +#include "ImageEditorPluginBaseDefs.h" +#include "DrawUtils.h" + +// CONSTANTS +_LIT (KPgnResourceFile, "redeyereduction.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorRedEyeReductionPlugin * plugin = new (ELeave) CImageEditorRedEyeReductionPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorRedEyeReductionPlugin::CImageEditorRedEyeReductionPlugin () +{ + +} + +//============================================================================= +void CImageEditorRedEyeReductionPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorRedEyeReductionPlugin::~CImageEditorRedEyeReductionPlugin () +{ + ReleasePlugin(); + iSysPars = NULL; + iControl = NULL; +} + +//============================================================================= +TInt CImageEditorRedEyeReductionPlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (const CSystemParameters *)tempval; + return KErrNone; + } + default: + { + return CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorRedEyeReductionPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + TRect rect = ((CImageEditorRedEyeReductionControl *)iControl)->GetParam(); + if (rect.iBr.iX <= 0 || rect.iBr.iY <= 0) + { + aPropertyValue.Copy (_L("nop")); + } + else + { + aPropertyValue.Copy (_L("ulc ")); + aPropertyValue.AppendNum (rect.iTl.iX); + aPropertyValue.Append (_L(" ulr ")); + aPropertyValue.AppendNum (rect.iTl.iY); + aPropertyValue.Append (_L(" lrc ")); + aPropertyValue.AppendNum (rect.iBr.iX); + aPropertyValue.Append (_L(" lrr ")); + aPropertyValue.AppendNum (rect.iBr.iY); + } + return KErrNone; + } + case KCapReadyToRender: + { + TBool readyToRender = EFalse; + if (iControl) + { + readyToRender = ((CImageEditorRedEyeReductionControl *)iControl)->IsReadyToRender(); + } + + aPropertyValue.AppendNum ((TInt)readyToRender); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorRedEyeReductionPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + // Delete previous control + ReleasePlugin(); + + // Create the control + iControl = CImageEditorRedEyeReductionControl::NewL (aRect, aParent); + aPluginControl = iControl; + + // Set system parameters + ((CImageEditorRedEyeReductionControl*)iControl)->SetSystemParameters (iSysPars); + + return KErrNone; +} + +//============================================================================= +void CImageEditorRedEyeReductionPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + +} + +//============================================================================= +void CImageEditorRedEyeReductionPlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/EABI/Resize.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/EABI/Resize.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI24CImageEditorResizePlugin @ 2 NONAME ; ## + _ZTV24CImageEditorResizePlugin @ 3 NONAME ; ## + _ZTI14CResizeControl @ 4 NONAME ; ## + _ZTV14CResizeControl @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/bwins/Resize.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/bwins/Resize.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/data/Resize_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/data/Resize_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,41 @@ +/* +* 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: +* String generalisations for Resize plugin. +* +*/ + + + +#include +#include "iepb_gen.loc" + +// SOFTKEYS + +#define qtn_sie_pgn_sk1 qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2 qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_msk qtn_sie_iepb_softkey_ok + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/data/icon.bmp Binary file imageeditor/plugins/ResizePlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/data/mask.bmp Binary file imageeditor/plugins/ResizePlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/data/qgn_plugin_scaledown.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/data/qgn_plugin_scaledown.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,18 @@ + + + + +]> + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/data/resize.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/data/resize.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,132 @@ +/* +* 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: +* Resource definitions for Resize plugin. +* +*/ + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "resize_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_RESIZE_PLUGIN; + uitype = EPluginUiTypeSingleParam; + plugintype = EPluginFilterTypeSystem; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 4; + pluginname = qtn_sie_plugin_name_resize; + iconfile = "resize.mif"; + filterfile = " "; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // Horizontal slider title + qtn_sie_slider_title_resize + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_msk; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +RESOURCE TBUF r_sie_resize_resolution_changed +{ + buf = qtn_sie_resize_resolution_changed; +} + +RESOURCE TBUF r_sie_too_small_to_resize +{ + buf = qtn_sie_too_small_to_resize; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/group/ResizePlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/group/ResizePlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,85 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined( __RESIZE_CIF_SIZES_SUPPORTED__ ) +MACRO RESIZE_CIF_SIZES_SUPPORTED +#endif + +TARGET Resize.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_RESIZE_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorResizePlugin.cpp +SOURCE ResizeControl.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/resize.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY fbscli.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY SystemParameters.lib +LIBRARY eikcoctl.lib +LIBRARY aknnotify.lib +LIBRARY eiksrv.lib +LIBRARY avkon.lib +LIBRARY eikcore.lib +LIBRARY commonengine.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Resize plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorResizePlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorResizePlugin.iby) + +// mmp files +PRJ_MMPFILES +ResizePlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE resize.mif +OPTION HEADERFILE resize.mbg +OPTION SOURCES -c8 qgn_indi_imed_downple_super +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/inc/ImageEditorResizePlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/inc/ImageEditorResizePlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,175 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORRESIZEPLUGIN_H +#define IMAGEEDITORRESIZEPLUGIN_H + +// INCLUDES +#include "iepb.h" + + +// FORWARD DECLARATIONS +class CEditorImage; +class CSystemParameters; + + +/* CLASS: CImageEditorResizePlugin +* +* CImageEditorResizePlugin represents resize adjustment plug-in for +* Image Editor application. +* +*/ +class CImageEditorResizePlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorResizePlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorResizePlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + /* ShowPopupNote + * + * @see CImageEditorPluginBase + */ + virtual void ShowPopupNote (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: +/** @name Methods:*/ +//@{ + + /* ComputeSizeAndScale + * + * Computers current image size and scale. + * + * @param - + * @return - + */ + void ComputeSizeAndScale(); + + /* ComputeImageSizes + * + * Computers available target sizes. + * + * @param - + * @return - + */ + void ComputeImageSizes(); + + /* PopulateParamArray + * + * Add target size to param array if appropriate. + * + * @param - + * @return - + */ + void PopulateParamArray(const TSize& aTargetSize); + +//@} + +/** @name Members:*/ +//@{ + + /// Plug-in UI control + CCoeControl * iControl; + /// System parameter reference + CSystemParameters * iSysPars; + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/inc/ResizeControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/inc/ResizeControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,289 @@ +/* +* 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: +* +*/ + + +/* +* File: ResizeControl.h +* Created: 22-10-2004 +* Author: Wellu Mäkinen +*/ + +#ifndef RESIZECONTROL_H +#define RESIZECONTROL_H + +// INCLUDES +#include "PreviewControlBase.h" +#include "ImageEditorPluginBaseDefs.h" +#include "SingleParamControlObserver.h" + +// FORWARD DECLARATIONS +class CCoeControl; +class CAknView; +class CPluginInfo; +class CSystemParameters; +class CImageEditorResizePlugin; + +/* CLASS: CResizeControl +* +* CResizeControl represents a single parameter adjustment UI control, +* that can be used by any of the plug-ins just by defining a UI type to +* resource file. +*/ +class CResizeControl : public CPreviewControlBase, + public MSingleParControlObserver +{ + +public: + +/** @name Methods:*/ +//@{ + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return - pointer to the newly created CResizeControl instance + */ + static CResizeControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* ConstructL + * + * @see CImageEditorControlBase + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CResizeControl (); + + /* SetView + * + * @see CImageEditorControlBase + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /** PrepareL + * + * @see CImageEditorControlBase + * + */ + virtual void PrepareL (); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /** HandlePointerEventL + * + * @see CCoeControl + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + /* CountComponentControls + * + * @see CImageEditorControlBase + */ + virtual TInt CountComponentControls() const; + + /* ComponentControl + * + * @see CImageEditorControlBase + */ + virtual CCoeControl * ComponentControl (TInt aIndex) const; + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL (); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ +// virtual TPtrC GetNaviPaneTextL ( +// TBool& aLeftNaviPaneScrollButtonVisibile, +// TBool& aRightNaviPaneScrollButtonVisible); + + /* GetDimmedMenuItems + * + * @see CImageEditorControlBase + */ + virtual TBitField GetDimmedMenuItems (); + + /* SetSysteParameters + * + * Sets reference to system parameters to plug-in. + * + * @param aWidth - image width + * @return - + */ + void SetSystemParameters (CSystemParameters * aSysPars, CImageEditorResizePlugin* aParent); + + /** ParamOperation + * + * @see MSingleParControlObserver + */ + virtual void ParamOperation (const TParamOperation aOperation); + + /* ShowPopupNote + * + * @see CImageEditorPluginBase + */ + virtual void ShowPopupNote (); + +//@} + + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + /** Default constructor + * + * @param - + * @return - + */ + CResizeControl (); + + /* SizeChanged + * + * @see CImageEditorControlBase + */ + virtual void SizeChanged(); + + /* Draw + * + * @see CImageEditorControlBase + */ + virtual void Draw (const TRect & aRect) const; + + /* ComputeAndSetSliderParameters + * + * Computers and sets parameters for slider. + * + * @param - + * @return - + */ + void ComputeAndSetSliderParameters (CImageEditorResizePlugin* aParent); + + /* ComputeSizeAndScale + * + * Computers current image size and scale. + * + * @param - + * @return - + */ + void ComputeSizeAndScale(); + + /* ComputeImageSizes + * + * Computers available target sizes. + * + * @param - + * @return - + */ + void ComputeImageSizes(); + + /* PopulateParamArray + * + * Add target size to param array if appropriate. + * + * @param - + * @return - + */ + void PopulateParamArray(const TSize& aTargetSize); + + /** GetParam + * + * @see MSingleParControlObserver + */ + virtual TReal GetParam() const; + +//@} + +/** @name Members:*/ +//@{ + + /// Plug-in UI control + CCoeControl * iControl; + /// Reference to view +// CAknView * iEditorView; + /// Plug-in info + CPluginInfo * iPluginInfo; + /// Reference to system parameters + CSystemParameters * iSysPars; + /// Navi pane text +// TBuf<64> iNaviPaneText; + /// Array of allowed heights / widths + RArray iParamArray; + /// Original input image size + TSize iOrigSize; + /// Current image size + TSize iSize; + // Initial position + TInt iInitPosition; + // Array for storing parameter strings (from rss file) + CDesCArray * iParameters; + // Preview buffer + CFbsBitmap * iBufBitmap; + +//@} + +}; + + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/rom/ImageEditorResizePlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/rom/ImageEditorResizePlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __RESIZEPLUGIN_IBY__ +#define __RESIZEPLUGIN_IBY__ + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Resize.pgn SHARED_LIB_DIR\Resize.pgn + +// Resources +data=DATAZ_\resource\apps\Resize.mif \resource\apps\Resize.mif + +#endif // __RESIZEPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/src/ImageEditorResizePlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/src/ImageEditorResizePlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,206 @@ +/* +* 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: +* Resize plugin plugin base class. +* +*/ + + + +/// INCLUDES +#include +#include +#include +#include +#include +#include +#include "ImageEditorResizePlugin.h" +#include "ImageEditorPluginBaseDefs.h" +#include "ResizeControl.h" +#include "SystemParameters.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "resize.rsc"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () + { + CImageEditorResizePlugin * plugin = new (ELeave) CImageEditorResizePlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; + } + +//============================================================================= +CImageEditorResizePlugin::CImageEditorResizePlugin () : + CImageEditorPluginBase() + { + + } + +//============================================================================= +void CImageEditorResizePlugin::ConstructL () + { + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); + } + +//============================================================================= +CImageEditorResizePlugin::~CImageEditorResizePlugin () + { + ReleasePlugin(); + iSysPars = NULL; + iControl = NULL; + } + +//============================================================================= +TInt CImageEditorResizePlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (CSystemParameters *)tempval; + return KErrNone; + } + default: + { + return CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorResizePlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clear buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapGlobalZoomDisabled: + { + aPropertyValue.AppendNum ( (TInt)ETrue ); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorResizePlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl* & aPluginControl + ) + { + ReleasePlugin(); + + // Store image size + TInt width = + (iSysPars->ViewPortRect().iBr.iX - + iSysPars->ViewPortRect().iTl.iX); + TInt height = + (iSysPars->ViewPortRect().iBr.iY - + iSysPars->ViewPortRect().iTl.iY); + TInt origSize = 0; + // Landscape + if (height < width) + { + origSize = (TInt)(iSysPars->Scale() * width + 0.5); + } + else + { + origSize = (TInt)(iSysPars->Scale() * height + 0.5); + } + +#ifdef RESIZE_CIF_SIZES_SUPPORTED + const TInt KMinSize(128); +#else + const TInt KMinSize(320); +#endif + + if (origSize <= KMinSize) + { + + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Get reference to application file session + RFs & fs = CEikonEnv::Static()->FsSession(); + + // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile + // to search for a localised resource in proper search order + RConeResourceLoader resLoader( *CEikonEnv::Static() ); + resLoader.OpenL ( resourcefile ); + CleanupClosePushL(resLoader); + + TBuf<256> readbuf; + CEikonEnv::Static()->ReadResourceAsDes16L(readbuf, R_SIE_TOO_SMALL_TO_RESIZE); + CleanupStack::PopAndDestroy(); // resLoader + + CAknInformationNote* infoNote = new( ELeave ) CAknInformationNote( ETrue ); + infoNote->ExecuteLD( readbuf ); // ignore return value, not used + + return KErrNotSupported; + } + + iControl = CResizeControl::NewL (aRect, aParent); + ((CResizeControl *)iControl)->SetSystemParameters (iSysPars, this); + aPluginControl = iControl; + + return KErrNone; + } + +//============================================================================= +void CImageEditorResizePlugin::ProcessImageL (CEditorImage * /*aImage*/ ) + { + // Own image processing functionality here + } + +//============================================================================= +void CImageEditorResizePlugin::ReleasePlugin() + { + delete iControl; + iControl = NULL; + } + +void CImageEditorResizePlugin::ShowPopupNote () + { + ((CResizeControl *)iControl)->ShowPopupNote(); + } + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/ResizePlugin/src/ResizeControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/ResizePlugin/src/ResizeControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,625 @@ +/* +* 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: +* +*/ + + +/// INCLUDES +#include +#include +#include +#include +#include +#include +#include "SingleParamControl.h" +#include "SystemParameters.h" +#include "ResizeControl.h" +#include "ImageEditorResizePlugin.h" +#include "PluginInfo.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "resize.rsc"); +_LIT (KResourceDir, "\\resource\\apps\\"); + +const TInt KResizeHSTitleIndex = 0; +const TInt KMinDimension = 25; +const TInt KMaxCaptionLength = 50; + +//============================================================================= +CResizeControl * CResizeControl::NewL (const TRect& aRect, CCoeControl* aParent) +{ + CResizeControl * self = new (ELeave) CResizeControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CResizeControl::CResizeControl() +{ + // EMPTY +} + +//============================================================================= +CResizeControl::~CResizeControl() +{ + delete iControl; + iControl = NULL; + iParamArray.Reset(); +// iEditorView = NULL; + iSysPars = NULL; + iPluginInfo = NULL; + iParameters = NULL; + delete iBufBitmap; +} + +//============================================================================= +void CResizeControl::ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + // Set parent + SetContainerWindowL (*aParent); + + + iControl = CSingleParamControl::NewL (aRect, aParent); + ((CSingleParamControl *)iControl)->SetParObserver ( (MSingleParControlObserver*)this ); +// aPluginControl = iControl; + + // Activate control + ActivateL(); +} + +//============================================================================= +void CResizeControl::SetView (CAknView * aView) +{ + ((CSingleParamControl *)iControl)->SetView(aView); +// iEditorView = aView; +} + +//============================================================================= +void CResizeControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + iPluginInfo = aItem; +} + +//============================================================================= +void CResizeControl::PrepareL () +{ + +} + +//============================================================================= +TKeyResponse CResizeControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + TKeyResponse response = EKeyWasNotConsumed; + + if ( Busy() ) + { + response = EKeyWasConsumed; + } + else if (aType != EEventKey ) + { + switch (aKeyEvent.iScanCode) + { + // Just consume these keys (No EEventKey type event delivered for + // these keys so this must be done here) + case EStdKeyRightShift: + case EStdKeyLeftShift: + { + response = EKeyWasConsumed; + break; + } + } + } + else if (EEventKey == aType) + { + switch (aKeyEvent.iCode) + { + // Just consume the keys + case 0x31: // 1 + case 0x32: // 2 + case 0x33: // 3 + case 0x37: // 7 + case 0x38: // 8 + case 0x39: // 9 + case EKeyDownArrow: + case EStdKeyDecVolume: + case 0x30: + case EKeyUpArrow: + case EStdKeyIncVolume: + case 0x35: + case 0x2a: // * + case 0x23: // # +// case EKeyLeftArrow: +// case EKeyRightArrow: + { + response = EKeyWasConsumed; + break; + } + case 0x34: // 4 + { + TKeyEvent kevent; + TEventCode ecode = EEventKey; + kevent.iCode = EKeyLeftArrow; + iControl->OfferKeyEventL(kevent, ecode); + + response = EKeyWasConsumed; + break; + } + case 0x36: // 6 + { + TKeyEvent kevent; + TEventCode ecode = EEventKey; + kevent.iCode = EKeyRightArrow; + iControl->OfferKeyEventL(kevent, ecode); + + response = EKeyWasConsumed; + break; + } + default: + { + response = iControl->OfferKeyEventL(aKeyEvent, aType); + } + } + } + return response; +} + +//============================================================================= +void CResizeControl::HandlePointerEventL( const TPointerEvent &aPointerEvent ) +{ + return iControl->HandlePointerEventL( aPointerEvent ); +} + +//============================================================================= +TInt CResizeControl::CountComponentControls() const +{ + TInt count(0); + if (iControl) + { + ++count; + } + return count; +} + +//============================================================================= +CCoeControl * CResizeControl::ComponentControl (TInt aIndex) const +{ + switch (aIndex) + { + case 0: + { + return iControl; + } + default: + { + return 0; + } + } +} + + +//============================================================================= +void CResizeControl::HandlePluginCommandL (const TInt aCommand) + { + return ((CSingleParamControl *)iControl)->HandlePluginCommandL(aCommand); + +/* + switch(aCommand) + { + case EPgnSoftkeyIdCancel: + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + break; + } + case EPgnSoftkeyIdOk: + { + if ( iControl->Position() != iInitPosition ) + { + ((CImageEditorUIView*)iEditorView)-> + ShowConfirmationNoteL(iPluginInfo->Parameters()[KResolutionChangedTextIndex] ); + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + + } + else + { + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + } + } +*/ + } + + +//============================================================================= +TInt CResizeControl::GetSoftkeyIndexL () +{ + return 0; +} + +/* +//============================================================================= +TPtrC CResizeControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + + // .loc file parameter format strings + _LIT(KParameter1, "%0N"); + _LIT(KParameter2, "%1N"); + + // Getting string from resources + TPtrC ptr = iPluginInfo->Parameters()[KStatusPaneTextIndex]; + + // Finding format patterns + TInt pos1 = ptr.Find(KParameter1); + TInt pos2 = ptr.Find(KParameter2); + + if(pos1 == KErrNotFound || pos2 == KErrNotFound) + { + User::Leave(KSIEEInternal); + } + + // Clear navi pane + iNaviPaneText.Zero(); + + // Add new text and replace format strings with new resolution + iNaviPaneText.Append(ptr.Left(pos1)); + iNaviPaneText.AppendNum (iSize.iWidth); + iNaviPaneText.Append (ptr.Mid(pos1 + 3, pos2 - (pos1 + 3))); + iNaviPaneText.AppendNum (iSize.iHeight); + iNaviPaneText.Append (ptr.Mid(pos2 + 3)); + + return iNaviPaneText; + } +*/ + +//============================================================================= +TBitField CResizeControl::GetDimmedMenuItems () +{ + return TBitField(); +} + +//============================================================================= +void CResizeControl::SetSystemParameters (CSystemParameters * aSysPars, CImageEditorResizePlugin* aParent) +{ + iSysPars = aSysPars; + ComputeAndSetSliderParameters(aParent); +} + +//============================================================================= +void CResizeControl::SizeChanged() +{ + iControl->SetRect(Rect()); +} + +//============================================================================= +void CResizeControl::Draw (const TRect & aRect) const +{ + // Fill the background with black + CWindowGc & gc = SystemGc(); + gc.SetPenStyle (CGraphicsContext::ESolidPen); + gc.SetPenColor (KRgbBlack); + gc.SetBrushStyle (CGraphicsContext::ESolidBrush); + gc.SetBrushColor (KRgbBlack); + + if ( iPreview && iPreview->Handle() ) + { + + if ( ((CSingleParamControl *)iControl)->Position() == iInitPosition ) + { + gc.BitBlt ( TPoint(0,0), iPreview ); + } + else + { + gc.Clear (aRect); + + TReal ratio = (TReal)iSize.iHeight / (TReal)iOrigSize.iHeight; + TInt w = (TInt)(ratio * (TReal)Rect().Width()); + TInt h = (TInt)(ratio * (TReal)Rect().Height()); + + TRect target; + target.iTl.iX = ((Rect().Width() - w) >> 1); + target.iTl.iY = ((Rect().Height() - h) >> 1); + target.iBr.iX = ((Rect().Width() + w) >> 1) + 1; + target.iBr.iY = ((Rect().Height() + h) >> 1) + 1; + TRect rect ( iPreview->SizeInPixels() ); + //rect.iBr.iX++; + //rect.iBr.iY++; + + gc.DrawBitmap (target, iPreview, rect); + } + } +} + + +//============================================================================= +void CResizeControl::ComputeAndSetSliderParameters (CImageEditorResizePlugin* aParent) +{ + // Store image size + TInt width = + (iSysPars->ViewPortRect().iBr.iX - + iSysPars->ViewPortRect().iTl.iX); + + TInt height = + (iSysPars->ViewPortRect().iBr.iY - + iSysPars->ViewPortRect().iTl.iY); + + iOrigSize = TSize ( + (TInt)(iSysPars->Scale() * width + 0.5), + (TInt)(iSysPars->Scale() * height + 0.5) + ); + + ComputeImageSizes(); + + // Set slider properties + TInt count = iParamArray.Count(); + if ( count > 0 ) + { + ((CSingleParamControl *)iControl)->SetSliderMinimumAndMaximum(0, iParamArray.Count() - 1); + } + else + { + ((CSingleParamControl *)iControl)->SetSliderMinimumAndMaximum(0, 0); + } + ((CSingleParamControl *)iControl)->SetSliderStep(1); + + iInitPosition = 0; + width = (TInt)(iSysPars->Scale() * width + 0.5); + height = (TInt)(iSysPars->Scale() * height + 0.5); + for (TInt i = 0; i < iParamArray.Count(); ++i) + { + if ( (width == iParamArray[i]) || ((height == iParamArray[i])) ) + { + ((CSingleParamControl *)iControl)->SetSliderPosition(i); + iInitPosition = i; + } + } + + ComputeSizeAndScale(); + + TFileName iconFile (KResourceDir); + TBuf<256> readbuf; + User::LeaveIfError ( aParent->GetProperty (KCapIconName, readbuf) ); + iconFile.Append(readbuf); + CEikImage* icon = new (ELeave) CEikImage; + icon->CreatePictureFromFileL(iconFile, + EMbmResizeQgn_indi_imed_downple_super); + + ((CSingleParamControl *)iControl)->SetIcon(icon); + + // Get caption from plugin properties + User::LeaveIfError ( aParent->GetProperty (KCapPluginParamNames, readbuf) ); + TLex parser; + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + iParameters = (CDesCArray *)tempval; + + // Format the resolutions + TBuf< KMaxCaptionLength > caption_temp; + TBuf< KMaxCaptionLength > caption; + StringLoader::Format( caption_temp, (*iParameters)[KResizeHSTitleIndex], 0, iSize.iWidth ); + StringLoader::Format( caption, caption_temp, 1, iSize.iHeight ); + ((CSingleParamControl *)iControl)->SetCaption( caption ); +} + + +//============================================================================= +void CResizeControl::ComputeSizeAndScale() +{ + // Compute current image size and scale + TReal ar = (TReal)iOrigSize.iWidth / (TReal)iOrigSize.iHeight; + if ( iOrigSize.iHeight < iOrigSize.iWidth ) + { + iSize.iHeight = iParamArray[ ((CSingleParamControl *)iControl)->Position() ]; + iSize.iWidth = (TReal)(ar * iSize.iHeight) + 0.5; + } + else + { + iSize.iWidth = iParamArray[ ((CSingleParamControl *)iControl)->Position() ]; + iSize.iHeight = (TReal)(iSize.iWidth / ar) + 0.5; + + } + + iSysPars->Scale() = + (TReal)iSize.iHeight / + (TReal)((iSysPars->ViewPortRect().iBr.iY - + iSysPars->ViewPortRect().iTl.iY)); +} + +//============================================================================= +void CResizeControl::ComputeImageSizes() +{ + + const TSize KQSXGASize(2592, 1944); + const TSize KQXGASize(2048, 1536); + const TSize KUXGASize(1600, 1200); + const TSize KSXGASize(1280, 960); + const TSize KSVGASize(800, 600); + const TSize KVGASize(640, 480); + const TSize KQVGASize(320, 240); + +#ifdef RESIZE_CIF_SIZES_SUPPORTED + const TSize KCIFSize(352, 288); + const TSize KQCIFSize(176, 144); + const TSize KSubQCIFSize(128, 96); +#endif + +#ifdef RESIZE_CIF_SIZES_SUPPORTED + PopulateParamArray(KSubQCIFSize); + PopulateParamArray(KQCIFSize); +#endif + + PopulateParamArray(KQVGASize); + +#ifdef RESIZE_CIF_SIZES_SUPPORTED + PopulateParamArray(KCIFSize); +#endif + + PopulateParamArray(KVGASize); + PopulateParamArray(KSVGASize); + PopulateParamArray(KSXGASize); + PopulateParamArray(KUXGASize); + PopulateParamArray(KQSXGASize); + + // Landscape + if (iOrigSize.iHeight < iOrigSize.iWidth) + { + iParamArray.Append(iOrigSize.iHeight); + } + else + { + iParamArray.Append(iOrigSize.iWidth); + } +} + +//============================================================================= +void CResizeControl::PopulateParamArray(const TSize& aTargetSize ) +{ + + TReal origRatio = 0.0; + if (iOrigSize.iWidth < iOrigSize.iHeight) + { + origRatio = (TReal)iOrigSize.iHeight / iOrigSize.iWidth; + } + else + { + origRatio = (TReal)iOrigSize.iWidth / iOrigSize.iHeight; + + } + + TReal targetRatio = (TReal)aTargetSize.iWidth / aTargetSize.iHeight; + + if (aTargetSize.iWidth < iOrigSize.iWidth && aTargetSize.iHeight < iOrigSize.iHeight) + { + + // Landscape + if (iOrigSize.iHeight < iOrigSize.iWidth) + { + if (origRatio > targetRatio) + { + TInt h = (TReal)(aTargetSize.iWidth * iOrigSize.iHeight) / iOrigSize.iWidth + 0.5; + + if (h > KMinDimension) + { + iParamArray.Append(h); + } + + + } + else + { + iParamArray.Append(aTargetSize.iHeight); + + } + } + // Portrait + else + { + if (origRatio > targetRatio) + { + TInt w = (TReal)(aTargetSize.iWidth * iOrigSize.iWidth) / iOrigSize.iHeight + 0.5; + + if (w > KMinDimension) + { + iParamArray.Append(w); + } + } + else + { + iParamArray.Append(aTargetSize.iHeight); + + } + } + } +} + +//============================================================================= +void CResizeControl::ParamOperation (const TParamOperation aOperation) +{ + switch (aOperation) + { + case EParamOperationSubtract: + case EParamOperationAdd: + { + ComputeSizeAndScale(); + + // Format the resolutions to caption text + TBuf< KMaxCaptionLength > caption_temp; + TBuf< KMaxCaptionLength > caption; + StringLoader::Format( caption_temp, (*iParameters)[KResizeHSTitleIndex], 0, iSize.iWidth ); + StringLoader::Format( caption, caption_temp, 1, iSize.iHeight ); + ((CSingleParamControl *)iControl)->SetCaption( caption ); + + break; + } + case EParamOperationDefault: + { + break; + } + default: + { + break; + } + } +} + +TReal CResizeControl::GetParam () const +{ + return 0; +} + +void CResizeControl::ShowPopupNote () + { + if (iOrigSize != iSize) + { + // Read resource + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Get reference to application file session + RFs & fs = CEikonEnv::Static()->FsSession(); + + // Implementation of RConeResourceLoader uses BaflUtils::NearestLanguageFile + // to search for a localised resource in proper search order + RConeResourceLoader resLoader( *CEikonEnv::Static() ); + resLoader.OpenL ( resourcefile ); + CleanupClosePushL(resLoader); + + TBuf<256> readbuf; + CEikonEnv::Static()->ReadResourceAsDes16L(readbuf, R_SIE_RESIZE_RESOLUTION_CHANGED); + CleanupStack::PopAndDestroy(); // resLoader + + + CAknGlobalNote * globalnote = CAknGlobalNote::NewLC(); + globalnote->ShowNoteL (EAknGlobalConfirmationNote, readbuf); + CleanupStack::PopAndDestroy(); // globalnote + } + } + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/EABI/RotateLeft.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/EABI/RotateLeft.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI28CImageEditorRotateLeftPlugin @ 2 NONAME ; ## + _ZTV28CImageEditorRotateLeftPlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/bwins/RotateLeft.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/bwins/RotateLeft.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/data/icon.bmp Binary file imageeditor/plugins/RotateLPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/data/mask.bmp Binary file imageeditor/plugins/RotateLPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/data/qgn_plugin_rotaleft.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/data/qgn_plugin_rotaleft.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + + +]> + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/data/rotateleft.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/data/rotateleft.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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: +* Resource definition file for RotateLeft plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "rotateleft_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_ROTATEL_PLUGIN; + uitype = EPluginUiTypeNone; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 16; + pluginname = qtn_sie_plugin_name_rotate_left; //to be removed? + iconfile = "rotateleft.mif"; + filterfile = "FilterRotate.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // NO PARAMETERS + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/group/RotateLPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/group/RotateLPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET RotateLeft.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_ROTATEL_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorRotateLeftPlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/rotateleft.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib + +LIBRARY iepb.lib +LIBRARY pb.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Rotate Left plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorRotateLPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorRotateLPlugin.iby) + +// mmp files +PRJ_MMPFILES +RotateLPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE rotateleft.mif +OPTION HEADERFILE rotateleft.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_rotate_left +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/inc/ImageEditorRotateLeftPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/inc/ImageEditorRotateLeftPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,145 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORROTATELEFTPLUGIN_H +#define IMAGEEDITORROTATELEFTPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; + + +/* CLASS: CImageEditorRotateLeftPlugin +* +* CImageEditorRotateLeftPlugin represents rotate left 90 degrees plug-in +* for Image Editor application. +*/ +class CImageEditorRotateLeftPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorRotateLeftPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorRotateLeftPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorRotateLeftPlugin (const CImageEditorRotateLeftPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorRotateLeftPlugin & operator= (const CImageEditorRotateLeftPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/inc/RotateLeft_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/inc/RotateLeft_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + + +#include + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/rom/ImageEditorRotateLPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/rom/ImageEditorRotateLPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __ROTATELPLUGIN_IBY__ +#define __ROTATELPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\RotateLeft.pgn SHARED_LIB_DIR\RotateLeft.pgn + +// Resources +data=DATAZ_\resource\apps\RotateLeft.mif \resource\apps\RotateLeft.mif + +#endif // __ROTATELPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateLPlugin/src/ImageEditorRotateLeftPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateLPlugin/src/ImageEditorRotateLeftPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,113 @@ +/* +* 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: +* +*/ + + + +#include "ImageEditorRotateLeftPlugin.h" +#include "commondefs.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "rotateleft.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorRotateLeftPlugin * plugin = new (ELeave) CImageEditorRotateLeftPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorRotateLeftPlugin::CImageEditorRotateLeftPlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorRotateLeftPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorRotateLeftPlugin::~CImageEditorRotateLeftPlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorRotateLeftPlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + return CImageEditorPluginBase::SetProperty(aPropertyId, aPropertyValue); +} + +//============================================================================= +TInt CImageEditorRotateLeftPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + aPropertyValue.Copy (_L("rotateccw")); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorRotateLeftPlugin::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +void CImageEditorRotateLeftPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorRotateLeftPlugin::ReleasePlugin () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/EABI/RotateRight.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/EABI/RotateRight.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI29CImageEditorRotateRightPlugin @ 2 NONAME ; ## + _ZTV29CImageEditorRotateRightPlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/bwins/RotateRight.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/bwins/RotateRight.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/data/icon.bmp Binary file imageeditor/plugins/RotateRPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/data/mask.bmp Binary file imageeditor/plugins/RotateRPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/data/qgn_plugin_rotaright.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/data/qgn_plugin_rotaright.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + + +]> + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/data/rotateright.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/data/rotateright.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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: +* Resource definitions for RotateRight plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "rotateright_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_ROTATER_PLUGIN; + uitype = EPluginUiTypeNone; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 6; + pluginname = qtn_sie_plugin_name_rotate_right; + iconfile = "rotateright.mif"; + filterfile = "FilterRotate.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // NO PARAMETERS + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/group/RotateRPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/group/RotateRPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET RotateRight.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_ROTATER_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorRotateRightPlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/rotateright.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib + +LIBRARY iepb.lib +LIBRARY pb.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Rotate Right plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorRotateRPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorRotateRPlugin.iby) + +// mmp files +PRJ_MMPFILES +RotateRPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE rotateright.mif +OPTION HEADERFILE rotateright.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_rotate_right +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/inc/ImageEditorRotateRightPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/inc/ImageEditorRotateRightPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,146 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORROTATERIGHTPLUGIN_H +#define IMAGEEDITORROTATERIGHTPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; + + +/* CLASS: CImageEditorRotateRightPlugin +* +* CImageEditorRotateRightPlugin represents rotate right 90 degrees plug-in +* for Image Editor application. +*/ +class CImageEditorRotateRightPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorRotateRightPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorRotateRightPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorRotateRightPlugin (const CImageEditorRotateRightPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorRotateRightPlugin & operator= (const CImageEditorRotateRightPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/inc/RotateRight_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/inc/RotateRight_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + + +#include + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/rom/ImageEditorRotateRPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/rom/ImageEditorRotateRPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __ROTATERPLUGIN_IBY__ +#define __ROTATERPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\RotateRight.pgn SHARED_LIB_DIR\RotateRight.pgn + +// Resources +data=DATAZ_\resource\apps\RotateRight.mif \resource\apps\RotateRight.mif + +#endif // __ROTATERPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/RotateRPlugin/src/ImageEditorRotateRightPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/RotateRPlugin/src/ImageEditorRotateRightPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,112 @@ +/* +* 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: +* +*/ + + + +#include "ImageEditorRotateRightPlugin.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "rotateright.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorRotateRightPlugin * plugin = new (ELeave) CImageEditorRotateRightPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorRotateRightPlugin::CImageEditorRotateRightPlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorRotateRightPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorRotateRightPlugin::~CImageEditorRotateRightPlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorRotateRightPlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + return CImageEditorPluginBase::SetProperty(aPropertyId, aPropertyValue); +} + +//============================================================================= +TInt CImageEditorRotateRightPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + aPropertyValue.Copy (_L("rotatecw")); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorRotateRightPlugin::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +void CImageEditorRotateRightPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorRotateRightPlugin::ReleasePlugin () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/EABI/Sepia.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/EABI/Sepia.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI23CImageEditorSepiaPlugin @ 2 NONAME ; ## + _ZTV23CImageEditorSepiaPlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/bwins/Sepia.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/bwins/Sepia.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/data/icon.bmp Binary file imageeditor/plugins/SepiaPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/data/mask.bmp Binary file imageeditor/plugins/SepiaPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/data/qgn_plugin_sepia.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/data/qgn_plugin_sepia.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,22 @@ + + + + +]> + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/data/sepia.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/data/sepia.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,109 @@ +/* +* 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: +* Resource definitions for Sepia plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "sepia_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_SEPIA_PLUGIN; + uitype = EPluginUiTypeNone; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 14; + pluginname = qtn_sie_plugin_name_sepia; + iconfile = "sepia.mif"; + filterfile = "FilterSepia.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // NO PARAMETERS + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/group/SepiaPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/group/SepiaPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET Sepia.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_SEPIA_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorSepiaPlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/sepia.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib + +LIBRARY iepb.lib +LIBRARY pb.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Sepia plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorSepiaPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorSepiaPlugin.iby) + +// mmp files +PRJ_MMPFILES +SepiaPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE sepia.mif +OPTION HEADERFILE sepia.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_sepia +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/inc/ImageEditorSepiaPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/inc/ImageEditorSepiaPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,149 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORSEPIAPLUGIN_H +#define IMAGEEDITORSEPIAPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CPluginParameters; + + +/* CLASS: CImageEditorSepiaPlugin +* +* CImageEditorSepiaPlugin represents Sepia color conversion plug-in +* for Image Editor application. +*/ +class CImageEditorSepiaPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorSepiaPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorSepiaPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorSepiaPlugin (const CImageEditorSepiaPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorSepiaPlugin & operator= (const CImageEditorSepiaPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Crop rectangle + TInt iRotation; + /// MIA parameter struct for brightness + CPluginParameters * iPars; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/inc/Sepia_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/inc/Sepia_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,20 @@ +/* +* 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: +* +*/ + + +#include diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/rom/ImageEditorSepiaPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/rom/ImageEditorSepiaPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __SEPIAPLUGIN_IBY__ +#define __SEPIAPLUGIN_IBY__ + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Sepia.pgn SHARED_LIB_DIR\Sepia.pgn + +// Resources +data=DATAZ_\resource\apps\Sepia.mif \resource\apps\Sepia.mif + +#endif // __SEPIAPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SepiaPlugin/src/ImageEditorSepiaPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SepiaPlugin/src/ImageEditorSepiaPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,110 @@ +/* +* 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: +* +*/ + + +#include "ImageEditorSepiaPlugin.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "sepia.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorSepiaPlugin * plugin = new (ELeave) CImageEditorSepiaPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorSepiaPlugin::CImageEditorSepiaPlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorSepiaPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorSepiaPlugin::~CImageEditorSepiaPlugin () +{ + ReleasePlugin(); +} + +//============================================================================= +TInt CImageEditorSepiaPlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorSepiaPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorSepiaPlugin::InitPluginL ( + const TRect & /*aRect*/, + CCoeControl * /*aParent*/, + CCoeControl *& aPluginControl + ) +{ + aPluginControl = 0; + return KErrNone; +} + +//============================================================================= +void CImageEditorSepiaPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorSepiaPlugin::ReleasePlugin () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/EABI/sharpness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/EABI/sharpness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI27CImageEditorSharpnessPlugin @ 2 NONAME ; ## + _ZTV27CImageEditorSharpnessPlugin @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/bwins/sharpness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/bwins/sharpness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/data/icon.bmp Binary file imageeditor/plugins/SharpnessPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/data/mask.bmp Binary file imageeditor/plugins/SharpnessPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/data/qgn_plugin_sharpness.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/data/qgn_plugin_sharpness.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,14 @@ + + + + +]> + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/data/sharpness.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/data/sharpness.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,124 @@ +/* +* 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: +* Resource definitions for Sharpness plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "sharpness_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info +{ + pluginuid = UID_SHARPNESS_PLUGIN; + uitype = EPluginUiTypeSingleParam; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeMainEngine; + plugindisplayorder = 3; + pluginname = qtn_sie_plugin_name_sharpness; + iconfile = "sharpness.mif"; + filterfile = "FilterSharpness.dll"; +} + +RESOURCE PARAMNAMES r_plugin_pars +{ + parameters= + { + // Horizontal slider title + qtn_sie_slider_title_sharpness + + }; +} + +RESOURCE PGNUIITEMS r_sk1_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1; + } + }; +} + +RESOURCE PGNUIITEMS r_sk2_items +{ + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2; + } + }; +} + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items +{ + items= + { + + }; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/group/SharpnessPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/group/SharpnessPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET sharpness.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_SHARPNESS_PLUGIN +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorSharpnessPlugin.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +SYSTEMINCLUDE . + +START RESOURCE ../data/sharpness.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY euser.lib +LIBRARY imageeditorui.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY eikcoctl.lib + +//#if defined(__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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: +* Sharpness plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorSharpnessPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorSharpnessPlugin.iby) + + +// mmp files +PRJ_MMPFILES +SharpnessPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE sharpness.mif +OPTION HEADERFILE sharpness.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_sharpness -c8,1 qgn_indi_imed_sharpness_super +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/inc/ImageEditorSharpnessPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/inc/ImageEditorSharpnessPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,161 @@ +/* +* 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: +* +*/ + + +#ifndef IMAGEEDITORSHARPNESSPLUGIN_H +#define IMAGEEDITORSHARPNESSPLUGIN_H + +// INCLUDES +#include "ImageEditorPluginBaseDefs.h" +#include "iepb.h" +#include "SingleParamControlObserver.h" + +// FORWARD DECLARATIONS +class CEditorImage; + +/* CLASS: CImageEditorSharpnessPlugin +* +* CImageEditorSharpnessPlugin represents sharpness adjustment plug-in for +* Image Editor application. +* +*/ +class CImageEditorSharpnessPlugin : public CImageEditorPluginBase, + public MSingleParControlObserver +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorSharpnessPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorSharpnessPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + + /** ParamOperation + * + * @see MSingleParControlObserver + */ + virtual void ParamOperation (const TParamOperation aOperation); + + /** GetParam + * + * @see MSingleParControlObserver + */ + virtual TReal GetParam() const; + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorSharpnessPlugin (const CImageEditorSharpnessPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorSharpnessPlugin & operator= (const CImageEditorSharpnessPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + // Sharpness parameter + TInt iSharpness; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/inc/Sharpness_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/inc/Sharpness_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#include +#include "iepb_gen.loc" + +// SOFTKEYS + +#define qtn_sie_pgn_sk1 qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2 qtn_sie_iepb_softkey_cancel +#define qtn_sie_pgn_msk qtn_sie_iepb_softkey_ok diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/rom/ImageEditorSharpnessPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/rom/ImageEditorSharpnessPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __SHARPNESSPLUGIN_IBY__ +#define __SHARPNESSPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Sharpness.pgn SHARED_LIB_DIR\Sharpness.pgn + +// Resources +data=DATAZ_\resource\apps\Sharpness.mif \resource\apps\Sharpness.mif + +#endif // __SHARPNESSPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/SharpnessPlugin/src/ImageEditorSharpnessPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/SharpnessPlugin/src/ImageEditorSharpnessPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,196 @@ +/* +* 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: +* Sharpness plugin plugin base class. +* +*/ + + +/// INCLUDES +#include +#include "ImageEditorSharpnessPlugin.h" +#include "SingleParamControl.h" + +/// CONSTANTS +_LIT (KPgnResourceFile, "sharpness.rsc"); + +const long KParamMin = -100; +const long KParamMax = 100; +const long KParamStep = 10; +const long KParamDef = 0; +const TInt KSharpnessHSTitleIndex = 0; + +_LIT (KSharpnessTag, "sharpness "); +_LIT (KResourceDir, "\\resource\\apps\\"); + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorSharpnessPlugin * plugin = new (ELeave) CImageEditorSharpnessPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorSharpnessPlugin::CImageEditorSharpnessPlugin () : +CImageEditorPluginBase() +{ + +} + +//============================================================================= +void CImageEditorSharpnessPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorSharpnessPlugin::~CImageEditorSharpnessPlugin () +{ + ReleasePlugin(); + iControl = NULL; +} + +//============================================================================= +TInt CImageEditorSharpnessPlugin::SetProperty ( + TInt /*aPropertyId*/, + TDesC & /*aPropertyValue*/ + ) +{ + return KErrNotSupported; +} + +//============================================================================= +TInt CImageEditorSharpnessPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + aPropertyValue.Copy (KSharpnessTag); + aPropertyValue.AppendNum (iSharpness); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorSharpnessPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + ReleasePlugin(); + iControl = CSingleParamControl::NewL (aRect, aParent, ETrue); + ((CSingleParamControl *)iControl)->SetParObserver ( (MSingleParControlObserver*)this ); + aPluginControl = iControl; + + // initialize vertical slider + ((CSingleParamControl *)iControl)->SetSliderMinimumAndMaximum(KParamMin, KParamMax); + ((CSingleParamControl *)iControl)->SetSliderStep(KParamStep); + ((CSingleParamControl *)iControl)->SetSliderPosition(KParamDef); + TFileName iconFile (KResourceDir); + TBuf<256> readbuf; + User::LeaveIfError ( GetProperty (KCapIconName, readbuf) ); + iconFile.Append(readbuf); + CEikImage* icon = new (ELeave) CEikImage; + icon->CreatePictureFromFileL(iconFile, + EMbmSharpnessQgn_indi_imed_sharpness_super, + EMbmSharpnessQgn_indi_imed_sharpness_super_mask); + ((CSingleParamControl *)iControl)->SetIcon(icon); + + // Get caption from plugin properties + User::LeaveIfError ( GetProperty (KCapPluginParamNames, readbuf) ); + TLex parser; + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + CDesCArray * parameters = (CDesCArray *)tempval; + ((CSingleParamControl *)iControl)->SetCaption( (*parameters)[KSharpnessHSTitleIndex] ); + + + return KErrNone; +} + +//============================================================================= +void CImageEditorSharpnessPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + // Own image processing functionality here +} + +//============================================================================= +void CImageEditorSharpnessPlugin::ReleasePlugin () +{ + delete iControl; + iControl = 0; +} + +//============================================================================= +void CImageEditorSharpnessPlugin::ParamOperation (const TParamOperation aOperation) +{ + switch (aOperation) + { + case EParamOperationSubtract: + { + iSharpness += KParamStep; + if (iSharpness < KParamMin) + { + iSharpness = KParamMin; + } + break; + } + case EParamOperationAdd: + { + iSharpness -= KParamStep; + if (iSharpness > KParamMax) + { + iSharpness = KParamMax; + } + break; + } + case EParamOperationDefault: + { + iSharpness = KParamDef; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +TReal CImageEditorSharpnessPlugin::GetParam () const +{ + return (TReal)(iSharpness) / (KParamMax - KParamMin); +} + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/EABI/Text.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/EABI/Text.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _Z23CreateImageEditorPluginv @ 1 NONAME + _ZTI22CImageEditorTextPlugin @ 2 NONAME ; ## + _ZTI23CImageEditorTextControl @ 3 NONAME ; ## + _ZTV22CImageEditorTextPlugin @ 4 NONAME ; ## + _ZTV23CImageEditorTextControl @ 5 NONAME ; ## + _ZTI8CJPTimer @ 6 NONAME ; ## + _ZTV8CJPTimer @ 7 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/bwins/Text.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/bwins/Text.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?CreateImageEditorPlugin@@YAPAVCImageEditorPluginBase@@XZ @ 1 NONAME ; class CImageEditorPluginBase * CreateImageEditorPlugin(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/data/icon.bmp Binary file imageeditor/plugins/TextPlugin/data/icon.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/data/mask.bmp Binary file imageeditor/plugins/TextPlugin/data/mask.bmp has changed diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/data/qgn_plugin_text.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/data/qgn_plugin_text.svg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/data/text.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/data/text.rss Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,249 @@ +/* +* 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: +* Resource definition file for Text plugin. +* +*/ + + + +//============================================================================= +// RESOURCE INDENTIFIER +//============================================================================= +NAME PGN0 + + +//============================================================================= +// INCLUDES +//============================================================================= +#include +#include + +#include "definitions.def" +#include "ImageEditorPluginBase.hrh" +#include "ImageEditorPluginBase.rh" +#include "ImageEditorUids.hrh" +#include "text.hrh" +#include "text_gen.loc" +#include + + +//============================================================================= +// CONSTANTS +//============================================================================= + + +//============================================================================= +// MACROS +//============================================================================= + + +//============================================================================= +// RESOURCE DEFINITIONS +//============================================================================= + +RESOURCE RSS_SIGNATURE { } + +RESOURCE PGNINFO r_plugin_info + { + pluginuid = UID_TEXT_PLUGIN; + uitype = EPluginUiTypeCustomized; + plugintype = EPluginFilterTypeABITO; + pluginscope = EPluginScopeAdjustmentEngine; + plugindisplayorder = 9; + pluginname = qtn_sie_plugin_name_text; + iconfile = "text.mif"; + filterfile = "FilterText.dll"; + } + +RESOURCE PARAMNAMES r_plugin_pars + { + parameters= + { + // Insert text + qtn_sie_heading_insert_text, + + // Plugin main + qtn_sie_navi_edit_text, + + // Move text + qtn_sie_navi_edit_text, + + // Resize text + qtn_sie_navi_edit_text, + + // Rotate text + qtn_sie_navi_edit_text + + }; + } + +RESOURCE PGNUIITEMS r_sk1_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOptions; + text=qtn_sie_pgn_sk1_options; + } + }; + } + +RESOURCE PGNUIITEMS r_sk2_items + { + items= + { + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdCancel; + text=qtn_sie_pgn_sk2_cancel; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdDone; + text=qtn_sie_pgn_sk2_done; + } + }; + } + +RESOURCE PGNUIITEMS r_msk_items + { + items= + { + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + }, + PGNUIITEM + { + id=EPgnSoftkeyIdOk; + text=qtn_sie_pgn_sk1_ok; + }, + PGNUIITEM + { + id = EAknSoftkeyContextOptions; + text = text_softkey_option; + } + }; + } + +RESOURCE PGNUIITEMS r_menu_items + { + items= + { + // Move + PGNUIITEM + { + id=ETextPgnMenuCmdMove; + text=qtn_sie_options_move; + }, + // Resize + PGNUIITEM + { + id=ETextPgnMenuCmdResize; + text=qtn_sie_options_resize; + }, + // Rotate + PGNUIITEM + { + id=ETextPgnMenuCmdRotate; + text=qtn_sie_options_rotate; + }, + // Color + PGNUIITEM + { + id=ETextPgnMenuCmdColor; + text=qtn_sie_options_change_color; + }, + // Font +// PGNUIITEM +// { +// id=ETextPgnMenuCmdFont; +// text=qtn_sie_pgn_menu_font; +// }, + // Cancel + PGNUIITEM + { + id=ETextPgnMenuCmdCancel; + text=qtn_sie_options_cancel_effect; + } + }; + } + +// Context specific MSK menu +RESOURCE MENU_BAR r_text_context_menubar + { + titles = + { + MENU_TITLE + { + menu_pane = r_text_context_menupane; + txt = " "; + } + }; + } + +RESOURCE MENU_PANE r_text_context_menupane + { + items = + { + MENU_ITEM + { + command = ETextPgnMenuCmdMove; + txt = qtn_sie_options_move; + }, + MENU_ITEM + { + command = ETextPgnMenuCmdResize; + txt = qtn_sie_options_resize; + }, + MENU_ITEM + { + command = ETextPgnMenuCmdRotate; + txt = qtn_sie_options_rotate; + }, + MENU_ITEM + { + command = ETextPgnMenuCmdColor; + txt = qtn_sie_options_change_color; + } + }; + } + + +// Tooltip texts +RESOURCE TBUF r_tooltip_text_resize { buf = qtn_sie_tooltip_resize; } +RESOURCE TBUF r_tooltip_text_move { buf = qtn_sie_tooltip_move; } +RESOURCE TBUF r_tooltip_text_rotate { buf = qtn_sie_tooltip_rotate; } + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/group/TextPlugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/group/TextPlugin.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,105 @@ +/* +* 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: +* +*/ + + +// To get the APP_LAYER_SYSTEMINCLUDE-definition +#include +#include + +#include "../../../inc/definitions.def" +#include "../../../inc/imageeditoruids.hrh" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +LIBRARY efsrv.lib +#endif + +#if defined( __LANDSCAPE_SUPPORT__ ) +MACRO LANDSCAPE_SUPPORT +#endif + +#if defined( __LANDSCAPE_ONLY__ ) +MACRO LANDSCAPE_ONLY +#endif + +#if defined( __TEXT_INSERTION_IN_PORTRAIT_ONLY__ ) +MACRO TEXT_INSERTION_IN_PORTRAIT_ONLY +#endif + +TARGET Text.pgn +TARGETTYPE dll +UID UID_PLUGIN_INTERFACE UID_TEXT_PLUGIN + +TARGETPATH SHARED_LIB_DIR + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../../../src +SOURCE JpTimer.cpp + +SOURCEPATH ../src +SOURCE ImageEditorTextPlugin.cpp +SOURCE ImageEditorTextControl.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../../inc + +// Default system include paths for application layer modules. +APP_LAYER_SYSTEMINCLUDE + +START RESOURCE ../data/text.rss +HEADER +TARGETPATH /private/101ffa91/plugins +LANGUAGE_IDS +END + +LIBRARY cone.lib +LIBRARY euser.lib +LIBRARY fbscli.lib +LIBRARY bafl.lib +LIBRARY eikcore.lib +LIBRARY bitgdi.lib +LIBRARY avkon.lib +LIBRARY ws32.lib +LIBRARY gdi.lib + +LIBRARY imageeditorui.lib +LIBRARY imageeditorutils.lib +LIBRARY iepb.lib +LIBRARY pb.lib +LIBRARY systemparameters.lib +LIBRARY CommonEngine.lib + +#ifdef RD_TACTILE_FEEDBACK +LIBRARY touchfeedback.lib +#endif /* RD_TACTILE_FEEDBACK */ + + +//#if defined (__EXPORT_UNFROZEN_PLUGINS__) +//EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,48 @@ +/* +* 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: +* Text plugin bld.inf file. +* +*/ + + +#include +#include + +#include "../../../inc/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorTextPlugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(ImageEditorTextPlugin.iby) + +// mmp files +PRJ_MMPFILES +TextPlugin.mmp + +PRJ_EXTENSIONS +START EXTENSION s60/mifconv +OPTION TARGETFILE text.mif +OPTION HEADERFILE text.mbg +OPTION SOURCES -c8,1 qgn_indi_imed_text +END + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/inc/ImageEditorTextControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/inc/ImageEditorTextControl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,587 @@ +/* +* 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: +* Text plugin control class header. +* +*/ + + + +#ifndef IMAGEEDITORTEXTCONTROL_H +#define IMAGEEDITORTEXTCONTROL_H + +// INCLUDES +#include + +#include "PreviewControlBase.h" +#include "MTimerCallBack.h" +#include + +// FORWARD DECLARATIONS +class CAknView; +class CFbsBitmap; +class CPluginInfo; +class CSystemParameters; +class CJPTimer; +class CAknInfoPopupNoteController; + +#ifdef RD_TACTILE_FEEDBACK +class MTouchFeedback; +#endif /* RD_TACTILE_FEEDBACK */ + +/* CLASS: CImageEditorTextControl +* +* CImageEditorTextControl is a control for text insertion plug-in. +* +*/ +class CImageEditorTextControl : public CPreviewControlBase, + public MTimerCallBack + +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanupstack + * + * @param aRect - control rectangle + * @param aParent - pointer to window owning control + * @return pointer to created CImageEditorTextControl object + */ + static CImageEditorTextControl * NewL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorTextControl (); + + /** Second phase constructor + * + * @see CImageEditorControlBase + * + */ + virtual void ConstructL ( + const TRect & aRect, + CCoeControl * aParent + ); + + /* Setter for view reference + * + * @see CImageEditorControlBase + * + */ + virtual void SetView (CAknView * aView); + + /* SetSelectedUiItemL + * + * @see CImageEditorControlBase + * + */ + virtual void SetSelectedUiItemL (CPluginInfo * aItem); + + /** PrepareL + * + * @see CImageEditorControlBase + * + */ + virtual void PrepareL (); + + /* OfferKeyEventL + * + * @see CImageEditorControlBase + * + */ + virtual TKeyResponse OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ); + + /* HandlePointerEventL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePointerEventL( const TPointerEvent &aPointerEvent ); + + /* HandlePluginCommandL + * + * @see CImageEditorControlBase + * + */ + virtual void HandlePluginCommandL (const TInt aCommand); + + /* GetSoftkeyIndexL + * + * @see CImageEditorControlBase + */ + virtual TInt GetSoftkeyIndexL(); + + /* GetContextMenuResourceId + * + * @see CImageEditorControlBase + */ + virtual TInt GetContextMenuResourceId(); + + /* GetDimmedMenuItems + * + * @see CImageEditorControlBase + */ + virtual TBitField GetDimmedMenuItems(); + + /* GetNaviPaneTextL + * + * @see CImageEditorControlBase + */ + virtual TPtrC GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible); + + /* GetParam + * + * Gets pointer to the parameter struct. + * + * @param - + * @return - pointer to MIA parameter struct + */ + TDesC & GetParam (); + + /* SetSysteParameters + * + * Sets reference to system parameters to plug-in. + * + * @param aSysPars - System parameters instance + * @return - + */ + void SetSystemParameters (const CSystemParameters * aSysPars); + + /* SetTextL + * + * Sets user inputted text to text plug-in. + * + * @param aText - text data + * @return - + */ + void SetTextL (const TDesC & aText); + + /* GetHelpContext + * + * @see CCoeControl + * + */ + virtual void GetHelpContext(TCoeHelpContext& aContext) const; + + /* IsReadyToRender + * + * @param - + * @return - + */ + TBool IsReadyToRender () const; + + /* TimerCallBack + * + * @see MTimerCallBack + * + */ + virtual void TimerCallBack(); + +//@} + + +protected: + +/** @name Methods:*/ +//@{ + /* SizeChanged + * + * @see CImageEditorControlBase + * + */ + virtual void SizeChanged(); + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorTextControl (); + + /** Draw + * + * @see CImageEditorControlBase + * + */ + virtual void Draw (const TRect & aRect) const; + + /** NaviDown + * + * Handles navi key down event. + * + * @param - + * @return - + */ + void NaviDown(); + + /** NaviUp + * + * Handles nave key up event. + * + * @param - + * @return - + */ + void NaviUp(); + + /** NaviRight + * + * Handles nave key right event. + * + * @param - + * @return - + */ + void NaviRight(); + + /** NaviLeft + * + * Handles nave key left event. + * + * @param - + * @return - + */ + void NaviLeft(); + + /** ToMoveStateL + * + * Handles transition to Move state. + * + * @param - + * @return - + */ + void ToMoveStateL(); + + /** ToResizeStateL + * + * Handles transition to Resize state. + * + * @param - + * @return - + */ + void ToResizeStateL(); + + /** ToRotateStateL + * + * Handles transition to Rotate state. + * + * @param - + * @return - + */ + void ToRotateStateL(); + + /** ToMainStateL + * + * Handles transition to Main state. + * + * @param - + * @return - + */ + void ToMainStateL(); + + /** StoreTempParams + * + * Store all parameters to temp variables. + * + * @param - + * @return - + */ + void StoreTempParams(); + + /** RestoreTempParams + * + * Restore parameters from temp variables. + * + * @param - + * @return - + */ + void RestoreTempParams(); + + /** RenderTextImageL + * + * Renders the text into a EGray2 binary bitmap and copies the contents + * of the bitmap to a binary buffer. + * + * @param - + * @return - + */ + void RenderTextImageL(); + + /** LoadIndicatorL + * + * Loads indicator. + * + * @param aBitmapInd - indicator bitmap MBM index + * @param aMaskInd - indicator mask MBM index + * @return - + */ + void LoadIndicatorL ( + TInt aBitmapInd, + TInt aMaskInd + ); + + /** ComputeIndicatorPosition + * + * Computes indicator position. + * + * @param - + * @return - + */ + TPoint ComputeIndicatorPosition() const; + + /** StoreParameters + * + * Stores parameters to command line. + * + * @param - + * @return - + */ + void StoreParameters(); + + /** StorePosAndScaleRelScreen + * + * Stores text position and scale relative to + * screen. + * + * @param - + * @return - + */ + void StorePosAndScaleRelScreen(); + + /** RestorePosAndScaleRelScreen + * + * Restores text position and scale relative to + * screen. + * + * @param - + * @return - + */ + void RestorePosAndScaleRelScreen(); + + /** StorePosAndScaleRelImage + * + * Stores position and scale relative to image. + * + * @param - + * @return - + */ + void StorePosAndScaleRelImage(); + + /** StoreParameters + * + * Restores position and scale relative to image. + * + * @param - + * @return - + */ + void RestorePosAndScaleRelImage(); + + /** ClipPosition + * + * Clips clipart position after screen mode change. + * + * @param - + * @return - + */ + void ClipPosition(); + + /** SetTextPosition + * + * Sets current Text to a new position + * + * @param - aPointedPosition Middle point position on the screen where + * text should should be moved + * @return - + */ + void SetTextPosition( TPoint aPointedPosition ); + + /** ShowTooltip + * + * Show tooltip text on the screen. Tooltip text is set based + * on the current state. + * + * @param - + * @return - + */ + void ShowTooltip(); + + /** CalculateRotation + * + * Function is used to calculate rotation when text is rotated + * with touch. Needed rotation is calculated based on dragging start + * and end points. This function also changes rotation variables after + * calculation. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - ETrue if rotate value is changed in the function + */ + TBool CalculateRotation( TPoint aStartPoint, TPoint aEndPoint ); + + /** CalculateResize + * + * Function is used to calculate new scale value when text is resized + * with touch. The value is calculated based on dragging start + * and end points. This function also changes scale member variable + * after calculation. + * + * @param - aStartPoint - A position where dragging started + * @param - aEndPoint - A position where dragging ended + * @return - TBool - ETrue if scale value is changed in the function + */ + TBool CalculateResize( TPoint aStartPoint, TPoint aEndPoint ); + +//@} + +/** @name Typedefs:*/ +//@{ + enum TInsertTextState + { + // Invalid + EInsertTextStateMin = 0, + // Plugin main view first time + EInsertTextStateFirst, + // Plugin main view + EInsertTextStateMain, + // Move + EInsertTextStateMove, + // Rotate + EInsertTextStateRotate, + // Resize + EInsertTextStateResize, + // Invalid + ECropStateMax + } iState; +//@} + + +/** @name Members:*/ +//@{ + // Parent control + CCoeControl* iParent; + + /// Editor view + CAknView * iEditorView; + + /// Source image size + const CSystemParameters * iSysPars; + + /// Plug-in info + CPluginInfo * iItem; + + /// Navigation pane text + TBuf<64> iNaviPaneText; + + /// User inputted text + TBuf<256> iText; + + /// Text x position + TInt iX; + /// Text y position + TInt iY; + /// Text scale + TInt iScale; + /// Text scale minimum + TInt iScaleMin; + /// Text scale maximum + TInt iScaleMax; + /// Text angle + TInt iAngle; + /// Text color + TRgb iRgb; + + /// Temp parameters + TInt iTempX; + TInt iTempY; + TInt iTempScale; + TInt iTempAngle; + + TReal iScaleOld; + TReal iPosXOld; + TReal iPosYOld; + + /// Timer for fast key events + CJPTimer * iTimer; + TUint32 iKeyCode; + + /// Pressed key event code + TInt iPressedKeyScanCode; + + /// Number of ticks since timer start + TInt iTickCount; + + /// Multiplier to control the navigation movement speed + TInt iNaviStepMultiplier; + + /// Showing Ok options menu, where some items are dimmed + TBool iDisplayingOkOptionsMenu; + + /// State indicator glyph + CFbsBitmap * iIndicator; + CFbsBitmap * iIndicatorMask; + + /// Ready to render + TBool iReadyToRender; + + /// Parameter + TBuf<256> iParam; + + // Popup controller + CAknInfoPopupNoteController* iPopupController; + // Tooltip texts + HBufC * iTooltipResize; + HBufC * iTooltipMove; + HBufC * iTooltipRotate; + + // Previous pen position. Make touch rotating and resizing possible + TPoint iPointerPosition; + + /// Resource reader + RConeResourceLoader iResLoader; + + // Feedback for screen touch: +#ifdef RD_TACTILE_FEEDBACK + MTouchFeedback* iTouchFeedBack; +#endif /* RD_TACTILE_FEEDBACK */ +//@} + +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/inc/ImageEditorTextPlugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/inc/ImageEditorTextPlugin.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,152 @@ +/* +* 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: +* +*/ + + + +#ifndef IMAGEEDITORTEXTPLUGIN_H +#define IMAGEEDITORTEXTPLUGIN_H + +// INCLUDES +#include "iepb.h" + +// FORWARD DECLARATIONS +class CEditorImage; +class CCoeControl; +class CSystemParameters; + + +/* CLASS: CImageEditorTextPlugin +* +* CImageEditorTextPlugin represents text insertion plug-in for Image Editor +* application. +* +*/ +class CImageEditorTextPlugin : public CImageEditorPluginBase +{ + +public: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - + * @return - + */ + CImageEditorTextPlugin (); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + virtual void ConstructL (); + + /** Destructor + * + * @param - + * @return - + */ + virtual ~CImageEditorTextPlugin (); + + /* SetProperty + * + * @see CPluginBase + */ + virtual TInt SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ); + + /* GetProperty + * + * @see CPluginBase + */ + virtual TInt GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ); + + /** InitPluginL + * + * @see CImageEditorPluginBase + */ + virtual TInt InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ); + + /** ProcessImageL + * + * @see CImageEditorPluginBase + */ + virtual void ProcessImageL (CEditorImage * aImage); + + /** ReleasePlugin + * + * @see CImageEditorPluginBase + */ + virtual void ReleasePlugin (); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +/** @name Members:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Copy constructor, disabled + */ + CImageEditorTextPlugin (const CImageEditorTextPlugin & rhs); + + /** Assignment operator, disabled + */ + CImageEditorTextPlugin & operator= (const CImageEditorTextPlugin & rhs); + +//@} + +/** @name Members:*/ +//@{ + /// Plug-in UI control + CCoeControl * iControl; + /// System parameters + const CSystemParameters * iSysPars; + /// Is landscape enabled, Must be EFalse until text is set + TBool iLandscapeEnabled; +//@} + +}; + + +#endif + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/inc/Text_gen.loc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/inc/Text_gen.loc Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,52 @@ +/* +* 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: +* +*/ + + + +#include +#include "iepb_gen.loc" +#include + +// SOFTKEY TEXTS + +#define qtn_sie_pgn_sk1_options qtn_sie_iepb_softkey_options +#define qtn_sie_pgn_sk2_cancel qtn_sie_iepb_softkey_cancel + +#define qtn_sie_pgn_sk1_ok qtn_sie_iepb_softkey_ok +#define qtn_sie_pgn_sk2_done qtn_sie_iepb_softkey_done + +// MENU OPTIONS + +#define qtn_sie_pgn_menu_cancel qtn_sie_options_cancel_effect + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/inc/text.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/inc/text.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,39 @@ +/* +* 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: +* +*/ + + +#ifndef TEXT_HRH +#define TEXT_HRH + +#include "ImageEditorPluginBase.hrh" +#include "avkon.hrh" + +enum TTextPgnCommandId +{ + ETextPgnMenuCmdMin = EPgnMenuCmdIdBase, + ETextPgnMenuCmdDone, + ETextPgnMenuCmdMove, + ETextPgnMenuCmdResize, + ETextPgnMenuCmdRotate, + ETextPgnMenuCmdColor, + ETextPgnMenuCmdFont, + ETextPgnMenuCmdCancel, + ETextPgnMenuCmdMax +}; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/rom/ImageEditorTextPlugin.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/rom/ImageEditorTextPlugin.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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: +* +*/ + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __TEXTPLUGIN_IBY__ +#define __TEXTPLUGIN_IBY__ + + +// Plugin DLL +file=ABI_DIR\BUILD_DIR\Text.pgn SHARED_LIB_DIR\Text.pgn + +// Resources +data=DATAZ_\resource\apps\Text.mif \resource\apps\Text.mif + +#endif // __TEXTPLUGIN_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/src/ImageEditorTextControl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/src/ImageEditorTextControl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1600 @@ +/* +* 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 text plugin control class. +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef RD_TACTILE_FEEDBACK +#include +#endif /* RD_TACTILE_FEEDBACK */ + +#include "ImageEditorUI.hrh" +#include "ImageEditorPluginBase.hrh" +#include "text.hrh" +#include "PluginInfo.h" +#include "JpTimer.h" +#include "ImageEditorUids.hrh" +#include "ImageEditorUiDefs.h" +#include "SystemParameters.h" + +#include "ImageEditorTextControl.h" +#include "iepb.h" + +// debug log +#include "imageeditordebugutils.h" +_LIT(KTextPluginLogFile,"TextPlugin.log"); + +// resource file name +_LIT (KPgnResourceFile, "text.rsc"); + + +// CONSTANTS +const TInt KWait = 1; + +const TInt KPosParamStep = 8; + +const TInt KScaleParamStep = 10; + +const TInt KDegreeMultiplier = 1000; +const TInt KAngleParamMax = 359000; +const TInt KAngleParam90Deg = 90000; +const TInt KAngleParamDef = 0; +const TInt KAngleParamStep = 2000; +const TInt KTouchScaleMaxStepCount = 20; + +const TInt KMaxColumns = 100; +const TInt KMaxRows = 10; + +const TInt KLogicalFontInUse = EAknLogicalFontTitleFont; + +// RESOURCE INDICES +const TInt KMainTextIndex = 1; +const TInt KMoveTextIndex = 2; +const TInt KResizeTextIndex = 3; +const TInt KRotateTextIndex = 4; + +_LIT(KEmptyString, " "); + +//============================================================================= +CImageEditorTextControl * CImageEditorTextControl::NewL ( + const TRect & aRect, + CCoeControl * aParent + ) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::NewL()"); + + CImageEditorTextControl * self = new (ELeave) CImageEditorTextControl; + CleanupStack::PushL (self); + self->ConstructL (aRect, aParent); + CleanupStack::Pop (); // self + return self; +} + +//============================================================================= +CImageEditorTextControl::CImageEditorTextControl () : +iState (EInsertTextStateFirst), +iTickCount (0), +iNaviStepMultiplier (KDefaultSmallNavigationStepMultiplier), +iDisplayingOkOptionsMenu (EFalse), +iReadyToRender (EFalse), +iResLoader ( * CEikonEnv::Static() ) +{ + +} + +//============================================================================= +CImageEditorTextControl::~CImageEditorTextControl () +{ + delete iTimer; + iTimer = NULL; + delete iIndicator; + iIndicator = NULL; + delete iIndicatorMask; + iIndicatorMask = NULL; + iEditorView = NULL; + iItem = NULL; + iParent = NULL; + iSysPars = NULL; + delete iPopupController; + delete iTooltipResize; + delete iTooltipMove; + delete iTooltipRotate; + iResLoader.Close(); +} + +//============================================================================= +void CImageEditorTextControl::ConstructL ( + const TRect & /*aRect*/, + CCoeControl * aParent + ) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::ConstructL()"); + + // Set parent window + SetContainerWindowL (*aParent); + iParent = aParent; + + // Create resource utility + TFileName resFile; + resFile.Append(KPgnResourcePath); + resFile.Append(KPgnResourceFile); + + 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 ); + + iPopupController = CAknInfoPopupNoteController::NewL(); + + TFileName resourcefile; + resourcefile.Append(KPgnResourcePath); + resourcefile.Append(KPgnResourceFile); + User::LeaveIfError( CompleteWithAppPath( resourcefile ) ); + + // Read tooltip resources + // (RConeResourceLoader selects the language using BaflUtils::NearestLanguageFile) + RConeResourceLoader resLoader ( *CEikonEnv::Static() ); + CleanupClosePushL ( resLoader ); + resLoader.OpenL ( resourcefile ); + + iTooltipResize = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_TEXT_RESIZE); + iTooltipMove = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_TEXT_MOVE); + iTooltipRotate = CEikonEnv::Static()->AllocReadResourceL(R_TOOLTIP_TEXT_ROTATE); + CleanupStack::PopAndDestroy(); // resLoader + +#ifdef RD_TACTILE_FEEDBACK + iTouchFeedBack = MTouchFeedback::Instance(); +#endif /* RD_TACTILE_FEEDBACK */ + + EnableDragEvents(); + + // Activate control + ActivateL(); +} + +//============================================================================= +void CImageEditorTextControl::SetView (CAknView * aView) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::SetView()"); + iEditorView = aView; +} + +//============================================================================= +void CImageEditorTextControl::SetSelectedUiItemL (CPluginInfo * aItem) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::SetSelectedUiItemL()"); + iItem = aItem; + iNaviPaneText.Copy ( KEmptyString ); + iEditorView->HandleCommandL (EImageEditorCmdRender); +} + +//============================================================================= +TKeyResponse CImageEditorTextControl::OfferKeyEventL ( + const TKeyEvent & aKeyEvent, + TEventCode aType + ) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::OfferKeyEventL()"); + + TKeyResponse response = EKeyWasNotConsumed; + + // If busy, do not handle anything + if ( Busy() ) + { + response = EKeyWasConsumed; + } + + // In main state handle the OK Options menu + else if ( aKeyEvent.iCode == EKeyOK && + (iState == EInsertTextStateMain || iState == EInsertTextStateFirst ) ) + { + iDisplayingOkOptionsMenu = ETrue; + iEditorView->HandleCommandL (EImageEditorTryDisplayMenuBar); + response = EKeyWasConsumed; + } + + // We handle only event keys + else if (EEventKey == aType) + { + + switch (aKeyEvent.iCode) + { + + case EKeyDownArrow: + case EKeyUpArrow: + case EKeyRightArrow: + case EKeyLeftArrow: + { + response = EKeyWasConsumed; + break; + } + + case EKeyOK: + { + if (iState == EInsertTextStateMove || + iState == EInsertTextStateRotate || + iState == EInsertTextStateResize) + { + ToMainStateL(); + response = EKeyWasConsumed; + } + break; + } + + case EKeyEnter: + { + if (iState == EInsertTextStateMove || + iState == EInsertTextStateRotate || + iState == EInsertTextStateResize) + { + iPopupController->HideInfoPopupNote(); + ToMainStateL(); + } + else if ( iState == EInsertTextStateMain ) + { + // Show context sensitive menu + iEditorView->HandleCommandL( EImageEditorOpenContextMenu ); + } + response = EKeyWasConsumed; + break; + + } + + case 0x31: // 1 + { + // Rotate only in rotate state + if ( iState == EInsertTextStateRotate ) + { + iAngle -= KAngleParam90Deg; + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + break; + } + + case 0x33: // 3 + { + // Rotate only in rotate state + if ( iState == EInsertTextStateRotate ) + { + iAngle += KAngleParam90Deg; + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + 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 + case 0x2a: // * + case 0x23: // # + { + StorePosAndScaleRelScreen(); + break; + } + + default: + { + break; + } + } + } + + // Key pressed down, mark pressed key + else if (aType == EEventKeyDown) + { + switch (aKeyEvent.iScanCode) + { + case EStdKeyUpArrow: + { + iKeyCode = 1; + response = EKeyWasConsumed; + break; + } + case EStdKeyDownArrow: + { + iKeyCode = 2; + response = EKeyWasConsumed; + break; + } + case EStdKeyLeftArrow: + { + iKeyCode = 3; + response = EKeyWasConsumed; + break; + } + case EStdKeyRightArrow: + { + iKeyCode = 4; + response = EKeyWasConsumed; + break; + } + default: + { + iKeyCode = 0; + break; + } + } + + 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(); + break; + } + default: + { + iKeyCode = 0; + break; + } + } + } + + return response; +} + +//============================================================================= +void CImageEditorTextControl::SizeChanged() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::SizeChanged()"); + +} + +//============================================================================= +TDesC & CImageEditorTextControl::GetParam () +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::GetParam()"); + LOGDES(KTextPluginLogFile, iParam); + return iParam; +} + +//============================================================================= +void CImageEditorTextControl::SetSystemParameters (const CSystemParameters * aPars) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::SetSystemParameters()"); + iSysPars = aPars; +} + +//============================================================================= +void CImageEditorTextControl::SetTextL (const TDesC & aText) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::SetTextL()"); + iText.Copy (aText); +} + +//============================================================================= +void CImageEditorTextControl::HandlePluginCommandL (const TInt aCommand) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::HandlePluginCommandL()"); + + switch (aCommand) + { + case EImageEditorFocusLost: + { + if (iTimer) + { + iTimer->Cancel(); + } + break; + } + case EPgnSoftkeyIdOk: + { + iPopupController->HideInfoPopupNote(); + ToMainStateL(); + break; + } + case EPgnSoftkeyIdCancel: + { + iPopupController->HideInfoPopupNote(); + if (iState == EInsertTextStateMain || + iState == EInsertTextStateFirst) + { + // Cancel plugin + iState = EInsertTextStateMin; + + // When plug-in is cancelled, delete text buffer. + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + } + else + { + // Return to plugin main view + RestoreTempParams(); + StoreParameters(); + ToMainStateL(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + break; + } + case EPgnSoftkeyIdDone: + case ETextPgnMenuCmdDone: + { + iPopupController->HideInfoPopupNote(); + ToMainStateL(); + iState = EInsertTextStateMin; + iEditorView->HandleCommandL (EImageEditorApplyPlugin); + break; + } + case ETextPgnMenuCmdMove: + { + ToMoveStateL(); + break; + } + case ETextPgnMenuCmdResize: + { + ToResizeStateL(); + break; + } + case ETextPgnMenuCmdRotate: + { + ToRotateStateL(); + break; + } + case ETextPgnMenuCmdColor: + { + if ( SDrawUtils::LaunchColorSelectionPopupL (iPreview, + Rect(), + iRgb) ) + { + StoreParameters(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + } + break; + } + case ETextPgnMenuCmdFont: + { + // Not implemented + break; + } + case ETextPgnMenuCmdCancel: + { + iReadyToRender = EFalse; + iState = EInsertTextStateMin; + iEditorView->HandleCommandL (EImageEditorCancelPlugin); + break; + } + case EImageEditorPreGlobalZoomChange: + case EImageEditorPreGlobalPanChange: + { + StorePosAndScaleRelScreen(); + break; + } + case EImageEditorGlobalZoomChanged: + case EImageEditorGlobalPanChanged: + { + RestorePosAndScaleRelScreen(); + ClipPosition(); + StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + + DrawNow(); + break; + } + + case EImageEditorPreScreenModeChange: + { + StorePosAndScaleRelImage(); + break; + } + + case EImageEditorPostScreenModeChange: + { + RestorePosAndScaleRelImage(); + ClipPosition(); + StoreParameters(); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorCmdRender); + DrawNow(); + break; + } + + default: + { + break; + } + } +} + +//============================================================================= +TInt CImageEditorTextControl::GetSoftkeyIndexL() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::GetSoftkeyIndexL()"); + + TInt state = 0; + + if (iState == EInsertTextStateFirst) + { + state = 0; // Options - Cancel + } + else if (iState == EInsertTextStateMove || + iState == EInsertTextStateRotate || + iState == EInsertTextStateResize) + { + state = 1; // Ok - Cancel + } + else + { + state = 2; // Options - Done + } + + return state; + +} + +//============================================================================= +TInt CImageEditorTextControl::GetContextMenuResourceId() +{ +return R_TEXT_CONTEXT_MENUBAR; +} + +//============================================================================= +TBitField CImageEditorTextControl::GetDimmedMenuItems() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::GetDimmedMenuItems()"); + + 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 == ETextPgnMenuCmdCancel ) + { + dimmedMenuItems.SetBit( i ); + } + } + iDisplayingOkOptionsMenu = EFalse; + } + + return dimmedMenuItems; +} + +//============================================================================= +TPtrC CImageEditorTextControl::GetNaviPaneTextL ( + TBool& aLeftNaviPaneScrollButtonVisibile, + TBool& aRightNaviPaneScrollButtonVisible ) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::GetNaviPaneTextL()"); + + aLeftNaviPaneScrollButtonVisibile = EFalse; + aRightNaviPaneScrollButtonVisible = EFalse; + return iNaviPaneText; +} + +//============================================================================= +void CImageEditorTextControl::Draw (const TRect & aRect) const +{ + CPreviewControlBase::DrawPreviewImage (aRect); + + if ( iIndicator && iIndicator->Handle() && + iIndicatorMask && iIndicatorMask->Handle() ) + { + CWindowGc & gc = SystemGc(); + + gc.SetPenStyle (CGraphicsContext::ENullPen); + gc.SetBrushStyle (CGraphicsContext::ENullBrush); + + gc.BitBltMasked ( + ComputeIndicatorPosition(), + iIndicator, + TRect (iIndicator->SizeInPixels()), + iIndicatorMask, + EFalse + ); + + } +} + +//============================================================================= +void CImageEditorTextControl::NaviDown() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::NaviDown()"); + + switch (iState) + { + case EInsertTextStateMove: + { + iY += (KPosParamStep * iNaviStepMultiplier); + if ( iY > iSysPars->VisibleImageRect().iBr.iY ) + { + iY = iSysPars->VisibleImageRect().iBr.iY; + } + break; + } + case EInsertTextStateResize: + { + iScale -= (KScaleParamStep * iNaviStepMultiplier); + if (iScale < iScaleMin) + { + iScale = iScaleMin; + } + break; + } + case EInsertTextStateRotate: + { + iAngle -= (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorTextControl::NaviUp() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::NaviUp()"); + + switch (iState) + { + case EInsertTextStateMove: + { + iY -= (KPosParamStep * iNaviStepMultiplier); + if ( iY < iSysPars->VisibleImageRect().iTl.iY ) + { + iY = iSysPars->VisibleImageRect().iTl.iY; + } + break; + } + case EInsertTextStateResize: + { + iScale += (KScaleParamStep * iNaviStepMultiplier); + if (iScale > iScaleMax) + { + iScale = iScaleMax; + } + break; + } + case EInsertTextStateRotate: + { + iAngle += (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorTextControl::NaviRight() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::NaviRight()"); + + switch (iState) + { + case EInsertTextStateMove: + { + iX += (KPosParamStep * iNaviStepMultiplier); + if ( iX > iSysPars->VisibleImageRect().iBr.iX ) + { + iX = iSysPars->VisibleImageRect().iBr.iX; + } + break; + } + case EInsertTextStateResize: + { + iScale += (KScaleParamStep * iNaviStepMultiplier); + if (iScale > iScaleMax) + { + iScale = iScaleMax; + } + break; + } + case EInsertTextStateRotate: + { + iAngle += (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorTextControl::NaviLeft() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::NaviLeft()"); + + switch (iState) + { + case EInsertTextStateMove: + { + iX -= (KPosParamStep * iNaviStepMultiplier); + if ( iX < iSysPars->VisibleImageRect().iTl.iX ) + { + iX = iSysPars->VisibleImageRect().iTl.iX; + } + break; + } + case EInsertTextStateResize: + { + iScale -= (KScaleParamStep * iNaviStepMultiplier); + if (iScale < iScaleMin) + { + iScale = iScaleMin; + } + break; + } + case EInsertTextStateRotate: + { + iAngle -= (KAngleParamStep * iNaviStepMultiplier) % KAngleParamMax; + break; + } + default: + { + break; + } + } +} + +//============================================================================= +void CImageEditorTextControl::ToMoveStateL() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::ToMoveStateL()"); + + iState = EInsertTextStateMove; + iNaviPaneText.Copy ( iItem->Parameters()[KMoveTextIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_move_super, + EMbmImageeditoruiQgn_indi_imed_move_super_mask); + DrawNow(); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorTextControl::ToResizeStateL() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::ToResizeStateL()"); + + iState = EInsertTextStateResize; + iNaviPaneText.Copy ( iItem->Parameters()[KResizeTextIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_resize_super, + EMbmImageeditoruiQgn_indi_imed_resize_super_mask + ); + DrawNow(); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorTextControl::ToRotateStateL() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::ToRotateStateL()"); + + iState = EInsertTextStateRotate; + iNaviPaneText.Copy ( iItem->Parameters()[KRotateTextIndex] ); + StoreTempParams(); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + LoadIndicatorL ( + EMbmImageeditoruiQgn_indi_imed_rotate_left_super, + EMbmImageeditoruiQgn_indi_imed_rotate_left_super_mask + ); + DrawNow(); + ShowTooltip(); +} + +//============================================================================= +void CImageEditorTextControl::ToMainStateL() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::ToMainStateL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + iState = EInsertTextStateMain; + iNaviPaneText.Copy ( iItem->Parameters()[KMainTextIndex] ); + iEditorView->HandleCommandL (EImageEditorUpdateSoftkeys); + iEditorView->HandleCommandL (EImageEditorUpdateNavipane); + DrawNow(); +} + +//============================================================================= +void CImageEditorTextControl::StoreTempParams() + { + LOG(KTextPluginLogFile, "CImageEditorTextControl::StoreTempParams()"); + + iTempX = iX; + iTempY = iY; + iTempScale = iScale; + iTempAngle = iAngle; + } + +//============================================================================= +void CImageEditorTextControl::RestoreTempParams() + { + LOG(KTextPluginLogFile, "CImageEditorTextControl::RestoreTempParams()"); + + iX = iTempX; + iY = iTempY; + iScale = iTempScale; + iAngle = iTempAngle; + } + +//============================================================================= +void CImageEditorTextControl::GetHelpContext(TCoeHelpContext& aContext) const +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::GetHelpContext()"); + + aContext.iMajor = TUid::Uid(UID_IMAGE_EDITOR); + aContext.iContext = KSIE_HLP_EDIT_TEXT; +} + +//============================================================================= +void CImageEditorTextControl::PrepareL () +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::PrepareL()"); + + // Get current view port + TRect rect = iSysPars->VisibleImageRect(); + + // Set default position + iX = (rect.iTl.iX + rect.iBr.iX) / 2; + iY = (rect.iTl.iY + rect.iBr.iY) / 2; + + // Set default angle + iAngle = KAngleParamDef; + + // Scale to width + iScale = ( rect.Height() - 1 ) / 8; + iScaleMin = ( rect.Height() - 1 ) / 20; + iScaleMax = ( rect.Height() - 1 ) / 3; + + // Set default color to white + iRgb.SetRed (255); + iRgb.SetGreen (255); + iRgb.SetBlue (255); + + // Set position + iParam.Append (_L("x ")); + iParam.AppendNum (iX); + + iParam.Append (_L(" y ")); + iParam.AppendNum (iY); + + // Set angle + iParam.Append (_L(" angle ")); + iParam.AppendNum (iAngle); + + // Create screen font + const CFont * font = AknLayoutUtils::FontFromId(KLogicalFontInUse); + iParam.Append (_L(" font ")); + iParam.AppendNum ((TInt)font); + + // Set maximum text image width and height + LOGFMT (KTextPluginLogFile, "fontwidth %d", font->TextWidthInPixels(_L("W") )); + iParam.Append (_L(" textwidth ")); + iParam.AppendNum ( KMaxColumns * font->TextWidthInPixels(_L("W") )); + iParam.Append (_L(" textheight ")); + iParam.AppendNum ( KMaxRows * font->HeightInPixels() ); + + // Set text + iParam.Append (_L(" text \"")); + iParam.Append (iText); + iParam.Append (_L("\"")); + + // Set scale + iParam.Append (_L(" height ")); + iParam.AppendNum (iScale); + + iReadyToRender = ETrue; + iEditorView->HandleCommandL (EImageEditorCmdRender); + + ToMoveStateL(); +} + +//============================================================================= +void CImageEditorTextControl::LoadIndicatorL ( + TInt aBitmapInd, + TInt aMaskInd + ) +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::LoadIndicatorL()"); + + // Delete old indicator + delete iIndicator; + iIndicator = 0; + delete iIndicatorMask; + iIndicatorMask = 0; + + // Load new indicator + SDrawUtils::GetIndicatorBitmapL ( + iIndicator, + iIndicatorMask, + aBitmapInd, + aMaskInd + ); +} + +//============================================================================= +TPoint CImageEditorTextControl::ComputeIndicatorPosition() const +{ + TRect vprect = iSysPars->VisibleImageRect(); + TRect vpprect = iSysPars->VisibleImageRectPrev(); + + TInt x( 0 ); + TInt y( 0 ); + // check if there is no indicator + if ( !iIndicator ) + { + return TPoint ( x, y ); + } + + TInt s = (iScale * vpprect.Height()) / vprect.Height(); + y = ((iY - vprect.iTl.iY) * vpprect.Height()) / vprect.Height(); + y += vpprect.iTl.iY; + y -= iIndicator->SizeInPixels().iHeight / 4; + y += s / 2; + + // Does not work if multiple lines + TInt tw = AknLayoutUtils::FontFromId(KLogicalFontInUse)->TextWidthInPixels(iText.Left(KMaxColumns)); + TInt th = AknLayoutUtils::FontFromId(KLogicalFontInUse)->HeightInPixels(); + + x = ((iX - vprect.iTl.iX) * vpprect.Width()) / vprect.Width(); + x += vpprect.iTl.iX; + x -= iIndicator->SizeInPixels().iWidth / 2; + x -= (tw * s) / (2 * th); + + return TPoint (x,y); +} + +//============================================================================= +TBool CImageEditorTextControl::IsReadyToRender () const +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::IsReadyToRender()"); + + return iReadyToRender; +} + +//============================================================================= +void CImageEditorTextControl::StoreParameters() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::StoreParameters()"); + + iParam.Copy (_L("x ")); + iParam.AppendNum (iX); + iParam.Append (_L(" y ")); + iParam.AppendNum (iY); + iParam.Append (_L(" angle ")); + iParam.AppendNum (iAngle); + iParam.Append (_L(" red ")); + iParam.AppendNum ( iRgb.Red() ); + iParam.Append (_L(" green ")); + iParam.AppendNum ( iRgb.Green() ); + iParam.Append (_L(" blue ")); + iParam.AppendNum ( iRgb.Blue() ); + iParam.Append (_L(" height ")); + iParam.AppendNum (iScale); +} + +//============================================================================= +void CImageEditorTextControl::TimerCallBack() +{ + LOG(KTextPluginLogFile, "CImageEditorTextControl::TimerCallBack()"); + + if (iTickCount > KDefaultFastKeyTimerMultiplyThresholdInTicks) + { + iNaviStepMultiplier = KDefaultBigNavigationStepMultiplier; + } + else + { + iTickCount++; + } + + if (iKeyCode) + { + + switch (iKeyCode) + { + case 1: + { + NaviUp(); + break; + } + case 2: + { + NaviDown(); + break; + } + case 3: + { + NaviLeft(); + break; + } + case 4: + { + NaviRight(); + break; + } + default: + break; + } + StoreParameters(); + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + iTimer->Call (KWait); + } +} + +//============================================================================= +void CImageEditorTextControl::StorePosAndScaleRelScreen() +{ + + LOG(KTextPluginLogFile, "CImageEditorClipartControl::StorePosAndScaleRelScreen()"); + + TReal relscale = iSysPars->Scale(); + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = virect.iBr.iX - virect.iTl.iX; + TInt viheight = virect.iBr.iY - virect.iTl.iY; + + TRect viprect = iSysPars->VisibleImageRectPrev(); + + TInt vipwidth = viprect.iBr.iX - viprect.iTl.iX; + TInt vipheight = viprect.iBr.iY - viprect.iTl.iY; + + // Scale + if (iScale == iScaleMax) + { + iScaleOld = iScaleMax; + } + else if (iScale == iScaleMin) + { + iScaleOld = iScaleMin; + } + else + { + TInt dimold_pix = (TInt)((iScale / relscale) + 0.5); + if ( viwidth > viheight ) + { + iScaleOld = (TInt)((TReal)(dimold_pix * vipheight) / viheight + 0.5); + } + else + { + iScaleOld = (TInt)((TReal)(dimold_pix * vipwidth) / viwidth + 0.5); + } + } + + + // Position + TInt xCurrent = (TInt)((iX / relscale) + 0.5); + TInt yCurrent = (TInt)((iY / relscale) + 0.5); + iPosXOld = viprect.iTl.iX + (TReal)((xCurrent - virect.iTl.iX) * vipwidth) / viwidth; + iPosYOld = viprect.iTl.iY + (TReal)((yCurrent - virect.iTl.iY) * vipheight) / viheight; + + LOGFMT(KTextPluginLogFile, "\tiPosXOld = %d", iPosXOld); + LOGFMT(KTextPluginLogFile, "\tiPosYOld = %d", iPosYOld); + + iParam.Copy(_L("nop")); +} + +//============================================================================= +void CImageEditorTextControl::RestorePosAndScaleRelScreen() +{ + LOG(KTextPluginLogFile, "CImageEditorClipartControl::RestorePosAndScaleRelScreen()"); + + TReal relscale = iSysPars->Scale(); + + TRect virect = iSysPars->VisibleImageRect(); + virect.iTl.iX = (TInt)((virect.iTl.iX / relscale) + 0.5); + virect.iTl.iY = (TInt)((virect.iTl.iY / relscale) + 0.5); + virect.iBr.iX = (TInt)((virect.iBr.iX / relscale) + 0.5); + virect.iBr.iY = (TInt)((virect.iBr.iY / relscale) + 0.5); + + TInt viwidth = virect.iBr.iX - virect.iTl.iX; + TInt viheight = virect.iBr.iY - virect.iTl.iY; + + TRect viprect = iSysPars->VisibleImageRectPrev(); + TInt vipwidth = viprect.iBr.iX - viprect.iTl.iX; + TInt vipheight = viprect.iBr.iY - viprect.iTl.iY; + + // Scale + if (iScale == iScaleMax) + { + iScale = iScaleOld; + } + else if (iScale == iScaleMin) + { + iScale = iScaleOld; + } + else + { + if ( viwidth > viheight ) + { + iScale = (TInt)((iScaleOld * viheight) / vipheight + 0.5); + } + else + { + iScale = (TInt)((iScaleOld * viwidth) / vipwidth + 0.5); + } + iScale = (TInt)(iScale * relscale + 0.5); + + } + + + // Position + iX = (TInt)(virect.iTl.iX + (TReal)((iPosXOld - viprect.iTl.iX) * viwidth) / vipwidth + 0.5); + iY = (TInt)(virect.iTl.iY + (TReal)((iPosYOld - viprect.iTl.iY) * viheight) / vipheight + 0.5); + +} + + +//============================================================================= +void CImageEditorTextControl::StorePosAndScaleRelImage() +{ + LOG(KTextPluginLogFile, "CImageEditorClipartControl::StorePosAndScaleRelImage()"); + TReal relscale = iSysPars->RelScale(); + iPosXOld = (TInt)((iX / relscale) + 0.5); + iPosYOld = (TInt)((iY / relscale) + 0.5); + iScaleOld = (TInt)(iScale / relscale + 0.5); + iParam.Copy(_L("nop")); +} + +//============================================================================= +void CImageEditorTextControl::RestorePosAndScaleRelImage() +{ + LOG(KTextPluginLogFile, "CImageEditorClipartControl::RestorePosAndScaleRelImage()"); + TReal relscale = iSysPars->RelScale(); + iX = (TInt)(iPosXOld * relscale + 0.5); + iY = (TInt)(iPosYOld * relscale + 0.5); + iScale = (TInt)(iScaleOld * relscale + 0.5); +} + +//============================================================================= +void CImageEditorTextControl::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; + } +} + +//============================================================================= +void CImageEditorTextControl::HandlePointerEventL( + const TPointerEvent &aPointerEvent) + { + if( AknLayoutUtils::PenEnabled() ) + { + TBool render = ETrue; + switch( aPointerEvent.iType ) + { + case TPointerEvent::EButton1Down: + { + if ( iState == EInsertTextStateMove ) + { + iPopupController->HideInfoPopupNote(); + SetTextPosition( aPointerEvent.iPosition ); + } + else if ( iState == EInsertTextStateRotate ) + { + iPopupController->HideInfoPopupNote(); + // Store current position. Rotating is handled in drag-event + // is pen position has changed + iPointerPosition = aPointerEvent.iPosition; + } + else if ( iState == EInsertTextStateResize ) + { + iPopupController->HideInfoPopupNote(); + iPointerPosition = aPointerEvent.iPosition; + } + +#ifdef RD_TACTILE_FEEDBACK + if ( iTouchFeedBack ) + { + iTouchFeedBack->InstantFeedback( ETouchFeedbackBasic ); + RDebug::Printf( "ImageEditor::ImageEditorTextControl: ETouchFeedback" ); + } +#endif /* RD_TACTILE_FEEDBACK */ + + break; + } + case TPointerEvent::EDrag: + { + if ( iState == EInsertTextStateMove ) + { + SetTextPosition( aPointerEvent.iPosition ); + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else if ( iState == EInsertTextStateRotate ) + { + if ( CalculateRotation( iPointerPosition, aPointerEvent.iPosition ) ) + { + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else + { + render = EFalse; + } + } + else if ( iState == EInsertTextStateResize ) + { + if ( CalculateResize( iPointerPosition, aPointerEvent.iPosition ) ) + { + // store current position for next round + iPointerPosition = aPointerEvent.iPosition; + } + else + { + render = EFalse; + } + } + break; + } + case TPointerEvent::EButton1Up: + { + if ( iState == EInsertTextStateMain ) + { + // Show context sensitive menu + iEditorView->HandleCommandL( EImageEditorOpenContextMenu ); + } + else + { + ShowTooltip(); + } + break; + } + + default: + { + break; + } + } + + StoreParameters(); + + if ( render ) + { + TRAP_IGNORE( iEditorView->HandleCommandL (EImageEditorCmdRender) ); + } + + CCoeControl::HandlePointerEventL( aPointerEvent ); + + } + } + +//============================================================================= +void CImageEditorTextControl::SetTextPosition( TPoint aPointedPosition ) + { + + // Get system parameters + TRect visibleImageRect( iSysPars->VisibleImageRect() ); + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + TInt xPosFactorDivider + ( visibleImageRectPrev.iBr.iX - visibleImageRectPrev.iTl.iX ); + TInt yPosFactorDivider + ( visibleImageRectPrev.iBr.iY - visibleImageRectPrev.iTl.iY ); + + // 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 ); + + // Calculate position on visible image + iX = visibleImageRect.iTl.iX + + ( visibleImageRect.iBr.iX - visibleImageRect.iTl.iX ) * + xPositionFactor; + + iY = visibleImageRect.iTl.iY + + ( visibleImageRect.iBr.iY - visibleImageRect.iTl.iY ) * + yPositionFactor; + } + + // Check that not out of bounds + ClipPosition(); + + } + +//============================================================================= +void CImageEditorTextControl::ShowTooltip() + { + iPopupController->HideInfoPopupNote(); + + TPoint iconPosition = ComputeIndicatorPosition(); + TRect iconRect( iconPosition.iX, iconPosition.iY, + iconPosition.iX, iconPosition.iY ); + + if ( iState == EInsertTextStateMove ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVTop, + *iTooltipMove ); + } + // resize + else if ( iState == EInsertTextStateResize ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVTop, + *iTooltipResize ); + } + // rotate + else if ( iState == EInsertTextStateRotate ) + { + SDrawUtils::ShowToolTip( iPopupController, + this, + iconPosition, + EHRightVTop, + *iTooltipRotate ); + } + + } + +//============================================================================= +TBool CImageEditorTextControl::CalculateRotation( TPoint aStartPoint, + TPoint aEndPoint ) + { + TBool angleChanged( EFalse ); + TInt oldAngle = iAngle; + + // Get system parameters + TRect visibleImageRect( iSysPars->VisibleImageRect() ); + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Calculate Text real center point on the screen (physical coordinates) + TReal posFactorX( TReal( iX - visibleImageRect.iTl.iX ) / + visibleImageRect.Width() ); + TInt textCenterX = posFactorX * visibleImageRectPrev.Width() + + visibleImageRectPrev.iTl.iX; + + TReal posFactorY( TReal( iY - visibleImageRect.iTl.iY ) / + visibleImageRect.Height() ); + TInt textCenterY = posFactorY * visibleImageRectPrev.Height() + + visibleImageRectPrev.iTl.iY; + + // Calculate start and end positions of the movement assuming that + // text centre is in origo. + // Note! y-axis is mirrored on screen coordinates compared to standard 2-d + // co-ordinates->mirror y-axis to ease the calculation + TPoint startPos( ( aStartPoint.iX - textCenterX ), + ( textCenterY - aStartPoint.iY ) ); + TPoint endPos( ( aEndPoint.iX - textCenterX ), + ( textCenterY - aEndPoint.iY ) ); + + TReal angleInRadStart; + TReal angleInRadEnd; + + // Calculate start and end angles in radians + TInt err1 = Math::ATan( angleInRadStart, startPos.iY, startPos.iX ); + TInt err2 = Math::ATan( angleInRadEnd, endPos.iY, endPos.iX ); + + if( !err1 && !err2 ) + { + // Calculate change in angle and convert it to degrees + TReal changeInDegrees = + ( angleInRadEnd - angleInRadStart ) * KRadToDeg; + + iAngle -= ( KDegreeMultiplier * TInt( changeInDegrees ) ) + % KAngleParamMax; + } + + if ( iAngle != oldAngle ) + { + angleChanged = ETrue; + } + + return angleChanged; + } + +//============================================================================= +TBool CImageEditorTextControl::CalculateResize( TPoint aStartPoint, + TPoint aEndPoint ) + { + + // Whether bubble is resized in this function or not + TBool textResized( EFalse ); + // Store old scale value + TInt oldScale = iScale; + + // Get system parameters + TRect visibleImageRectPrev( iSysPars->VisibleImageRectPrev() ); + + // Compute change on the screen + TInt deltaX = aEndPoint.iX - aStartPoint.iX; + TInt deltaY = aEndPoint.iY - aStartPoint.iY; + + // Use bigger dimension + TInt maxChangeInPixels; + if ( visibleImageRectPrev.Height() > visibleImageRectPrev.Width() ) + { + maxChangeInPixels = visibleImageRectPrev.Height(); + } + else + { + maxChangeInPixels = visibleImageRectPrev.Width(); + } + + TInt oneStepInPixels = maxChangeInPixels / KTouchScaleMaxStepCount; + TInt scaleStep = ( iScaleMax - iScaleMin ) / KTouchScaleMaxStepCount + 1; + + // Relates to second and fourth corners. Defines how steep/gentle the + // moving angle has to be in order to scale. + TInt slopeAngleFactor = 3; + + // The first quarter (movement towards upper-right corner) + if( ( deltaX > 0 && deltaY <= 0 ) || ( deltaX >= 0 && deltaY < 0 ) ) + { + // use bigger value + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iScale += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iScale += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The second (movement towards lower-right corner) + else if( ( deltaX > 0 && deltaY >= 0 ) || ( deltaX >= 0 && deltaY > 0 ) ) + { + if( deltaX > slopeAngleFactor * deltaY ) + { + iScale += scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + + else if ( slopeAngleFactor * deltaX < deltaY ) + { + iScale -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The third (movement towards lower-left corner) + else if( ( deltaX < 0 && deltaY >= 0 ) || ( deltaX <= 0 && deltaY > 0 ) ) + { + if (Abs( deltaX ) >= Abs( deltaY) ) + { + iScale -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + else + { + iScale -= scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + } + // The fourth (movement towards upper-left corner) + else if( ( deltaX < 0 && deltaY <= 0 ) || ( deltaX <= 0 && deltaY < 0 ) ) + { + if( slopeAngleFactor * Abs( deltaX ) < Abs( deltaY ) ) + { + iScale += scaleStep * ( Abs( deltaY ) / oneStepInPixels ); + } + else if ( Abs( deltaX ) > slopeAngleFactor * Abs( deltaY ) ) + { + iScale -= scaleStep * ( Abs( deltaX ) / oneStepInPixels ); + } + } + + // Check the limits + if (iScale > iScaleMax) + { + iScale = iScaleMax; + textResized = ETrue; + } + if (iScale < iScaleMin) + { + iScale = iScaleMin; + textResized = ETrue; + } + + if ( oldScale != iScale ) + { + textResized = ETrue; + } + + return textResized; + + } + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/plugins/TextPlugin/src/ImageEditorTextPlugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/plugins/TextPlugin/src/ImageEditorTextPlugin.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,274 @@ +/* +* 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: +* Text plugin class. +* +*/ + + + +#include + +#include "ImageEditorTextPlugin.h" +#include "ImageEditorTextControl.h" +#include "ImageEditorPluginBaseDefs.h" +#include "DrawUtils.h" +#include "SystemParameters.h" + +#ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY +#include +#endif + +// CONSTANTS +_LIT (KPgnResourceFile, "text.rsc"); + + +//============================================================================= +EXPORT_C CImageEditorPluginBase * CreateImageEditorPlugin () +{ + CImageEditorTextPlugin * plugin = new (ELeave) CImageEditorTextPlugin; + CleanupStack::PushL(plugin); + plugin->ConstructL(); + CleanupStack::Pop(); // plugin + return plugin; +} + +//============================================================================= +CImageEditorTextPlugin::CImageEditorTextPlugin () : iLandscapeEnabled(EFalse) +{ + +} + +//============================================================================= +void CImageEditorTextPlugin::ConstructL () +{ + CImageEditorPluginBase::ConstructL (KPgnResourcePath, KPgnResourceFile); +} + +//============================================================================= +CImageEditorTextPlugin::~CImageEditorTextPlugin () +{ + ReleasePlugin(); + iSysPars = NULL; +} + +//============================================================================= +TInt CImageEditorTextPlugin::SetProperty ( + TInt aPropertyId, + TDesC & aPropertyValue + ) +{ + + TInt err = KErrNone; + TLex parser; + + // Copy data + switch (aPropertyId) + { + case KCapSystemParameters: + { + parser.Assign (aPropertyValue); + TInt tempval = 0; + parser.Val (tempval); + iSysPars = (const CSystemParameters *)tempval; + err = KErrNone; + break; + } + default: + { + err = CImageEditorPluginBase::SetProperty (aPropertyId, aPropertyValue); + break; + } + } + return err; +} + +//============================================================================= +TInt CImageEditorTextPlugin::GetProperty ( + TInt aPropertyId, + TDes & aPropertyValue + ) +{ + // Clean buffer + aPropertyValue.Zero(); + + // Copy data + switch (aPropertyId) + { + case KCapParamStruct: + { + // Control found + if (iControl) + { + aPropertyValue.Copy ( ((CImageEditorTextControl *)iControl)->GetParam() ); + return KErrNone; + } + + // Control not found, return KErrNotReady + else + { + return KErrNotReady; + } + } + case KCapReadyToRender: + { + TBool readytorender = ETrue; + if (iControl) + { + readytorender = ((CImageEditorTextControl *)iControl)->IsReadyToRender(); + } + aPropertyValue.AppendNum ((TInt)readytorender); + return KErrNone; + } + case KCapIsLandscapeEnabled: + { + aPropertyValue.AppendNum ((TInt)iLandscapeEnabled); + return KErrNone; + } + case KCapIsSlowPlugin: + { + aPropertyValue.AppendNum ((TInt)ETrue); + return KErrNone; + } + default: + { + return CImageEditorPluginBase::GetProperty (aPropertyId, aPropertyValue); + } + } +} + +//============================================================================= +TInt CImageEditorTextPlugin::InitPluginL ( + const TRect & aRect, + CCoeControl * aParent, + CCoeControl *& aPluginControl + ) +{ + // Delete previous control + ReleasePlugin(); + + TInt ret = KErrNone; + + // Get pointer to the parameter descriptor array + TBuf<256> readbuf; + TLex parser; + User::LeaveIfError ( CImageEditorPluginBase::GetProperty (KCapPluginParamNames, readbuf) ); + parser.Assign (readbuf); + TInt tempval = 0; + parser.Val ( tempval ); + CDesCArray * pars = (CDesCArray *)tempval; + + CEikonEnv* env = CEikonEnv::Static(); + +#ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY + // Text input is always insterted in portrait mode. + // Store the original orientation before forcing to portrait. + CAknAppUiBase* appUi = static_cast( env->EikAppUi() ); + CAknAppUiBase::TAppUiOrientation originalOrientation = appUi->Orientation(); + appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationPortrait); +#endif + + TRAPD(err, + + TBuf<256> text; + TBuf<64> prompt; + prompt.Copy ( (*pars)[0] ); + + TInt ok = SDrawUtils::LaunchMultiLineTextQueryDialogL ( text, prompt ); + + // Create new control + if (ok) + { + iControl = CImageEditorTextControl::NewL (aRect, aParent); + aPluginControl = iControl; + + // Set system parameters + ((CImageEditorTextControl*)iControl)->SetSystemParameters (iSysPars); + + // Set the text + ((CImageEditorTextControl*)iControl)->SetTextL ( text ); + + iLandscapeEnabled = ETrue; + + ret = KErrNone; + } + else + { + aPluginControl = 0; + ret = KErrNotSupported; + } + + ) // TRAP + + +#ifdef TEXT_INSERTION_IN_PORTRAIT_ONLY + // Set always back to original orientation, even if leaves + CAknAppUiBase::TAppUiOrientation orientation = appUi->Orientation(); + + if (orientation != originalOrientation) + { + appUi->SetOrientationL(originalOrientation); + + // Send screen device change event to validate screen + TWsEvent event; + + RWsSession& rws = env->WsSession(); + event.SetType( EEventScreenDeviceChanged ); + event.SetTimeNow(); + event.SetHandle( rws.WsHandle() ); + + User::LeaveIfError( rws.SendEventToAllWindowGroups(event) ); + } +#else +#ifdef LANDSCAPE_ONLY + + appUi->SetOrientationL(CAknAppUiBase::EAppUiOrientationLandscape); + + // Send screen device change event to validate screen + TWsEvent event; + + RWsSession& rws = env->WsSession(); + event.SetType( EEventScreenDeviceChanged ); + event.SetTimeNow(); + event.SetHandle( rws.WsHandle() ); + + User::LeaveIfError( rws.SendEventToAllWindowGroups(event) ); + +#endif +#endif + + + if (err) + { + User::Leave(err); + } + + return ret; +} + +//============================================================================= +void CImageEditorTextPlugin::ProcessImageL (CEditorImage * /*aImage*/ ) +{ + +} + +//============================================================================= +void CImageEditorTextPlugin::ReleasePlugin () +{ + delete iControl; + iControl = NULL; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/rom/ImageEditor_resource.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/rom/ImageEditor_resource.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +//Disabled until wk21 +//#undef RD_S60_IMAGE_EDITOR + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IMAGE_EDITOR_RESOURCES_IBY__ +#define __IMAGE_EDITOR_RESOURCES_IBY__ + +data=DATAZ_\private\101ffa91\plugins\BlackWhite.rsc \private\101ffa91\plugins\BlackWhite.rsc +data=DATAZ_\private\101ffa91\plugins\Brightness.rsc \private\101ffa91\plugins\Brightness.rsc +data=DATAZ_\private\101ffa91\plugins\Cartoonize.rsc \private\101ffa91\plugins\Cartoonize.rsc +data=DATAZ_\private\101ffa91\plugins\Clipart.rsc \private\101ffa91\plugins\Clipart.rsc +data=DATAZ_\private\101ffa91\plugins\Bubble.rsc \private\101ffa91\plugins\Bubble.rsc +data=DATAZ_\private\101ffa91\plugins\Contrast.rsc \private\101ffa91\plugins\Contrast.rsc +data=DATAZ_\private\101ffa91\plugins\Crop.rsc \private\101ffa91\plugins\Crop.rsc +data=DATAZ_\private\101ffa91\plugins\Frame.rsc \private\101ffa91\plugins\Frame.rsc +data=DATAZ_\private\101ffa91\plugins\Negative.rsc \private\101ffa91\plugins\Negative.rsc +data=DATAZ_\private\101ffa91\plugins\RedEyeReduction.rsc \private\101ffa91\plugins\RedEyeReduction.rsc +data=DATAZ_\private\101ffa91\plugins\Resize.rsc \private\101ffa91\plugins\Resize.rsc +data=DATAZ_\private\101ffa91\plugins\Rotateleft.rsc \private\101ffa91\plugins\Rotateleft.rsc +data=DATAZ_\private\101ffa91\plugins\Rotateright.rsc \private\101ffa91\plugins\Rotateright.rsc +data=DATAZ_\private\101ffa91\plugins\Sepia.rsc \private\101ffa91\plugins\Sepia.rsc +data=DATAZ_\private\101ffa91\plugins\Sharpness.rsc \private\101ffa91\plugins\Sharpness.rsc +data=DATAZ_\private\101ffa91\plugins\Text.rsc \private\101ffa91\plugins\Text.rsc +#ifdef RD_IE_DRAW_PLUGIN +data=DATAZ_\private\101ffa91\plugins\draw.rsc \private\101ffa91\plugins\draw.rsc +#endif // RD_IE_DRAW_PLUGIN +data=DATAZ_\RESOURCE_FILES_DIR\ImageEditorProviderInternal.rsc RESOURCE_FILES_DIR\ImageEditorProviderInternal.rsc +data=DATAZ_\APP_RESOURCE_DIR\ImageEditorPluginBase.rsc APP_RESOURCE_DIR\ImageEditorPluginBase.rsc +data=DATAZ_\APP_RESOURCE_DIR\ImageEditor.rsc APP_RESOURCE_DIR\ImageEditor.rsc +data=DATAZ_\APP_RESOURCE_DIR\ImageEditorUi.rsc APP_RESOURCE_DIR\ImageEditorUi.rsc + +// sis stub +//data=\epoc32\data\z\private\10003a3f\apps\ImageEditor_reg.rsc private\10003A3F\import\apps\ImageEditor_reg.rsc +//data=ZSYSTEM\install\ImageEditorStub.sis System\Install\ImageEditorStub.sis + +#endif // __IMAGE_EDITOR_RESOURCES_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditor/src/JpTimer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditor/src/JpTimer.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,72 @@ +/* +* 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: +* +*/ + + +#include "JPTimer.h" +#include "MTimerCallBack.h" + + + +CJPTimer* CJPTimer::NewL( MTimerCallBack* aCallBack ) + { + CJPTimer* self = new( ELeave )CJPTimer( aCallBack ); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CJPTimer::CJPTimer( MTimerCallBack* aCallBack ) + : CTimer( EPriorityStandard ) + , iCallBack( aCallBack ) + { + } + + + +void CJPTimer::ConstructL() + { + CTimer::ConstructL(); + CActiveScheduler::Add( this ); + } + + + +CJPTimer::~CJPTimer() + { + Cancel(); + } + + + +void CJPTimer::RunL() + { + iCalling = false; + iCallBack->TimerCallBack(); + } + + + +void CJPTimer::Call( TInt aWait ) + { + if( iCalling ) return; + iCalling = true; + After( aWait ); + } diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/EABI/EngineWrapper.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/EABI/EngineWrapper.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,41 @@ +EXPORTS + _ZN14CEngineWrapper10AddFilterLERK7TDesC16 @ 1 NONAME + _ZN14CEngineWrapper10SetParamsLERK7TDesC16 @ 2 NONAME + _ZN14CEngineWrapper10StoreZoomLEv @ 3 NONAME + _ZN14CEngineWrapper11GetZoomModeEv @ 4 NONAME + _ZN14CEngineWrapper12InitUndoRedoEv @ 5 NONAME + _ZN14CEngineWrapper12RenderAbortLEv @ 6 NONAME + _ZN14CEngineWrapper12RenderBlockLEv @ 7 NONAME + _ZN14CEngineWrapper12RestoreZoomLEv @ 8 NONAME + _ZN14CEngineWrapper13GetSystemParsEv @ 9 NONAME + _ZN14CEngineWrapper14IsImageChangedEv @ 10 NONAME + _ZN14CEngineWrapper14SetScreenSizeLERK5TSize @ 11 NONAME + _ZN14CEngineWrapper15SetJpegCommentLERK6TDesC8 @ 12 NONAME + _ZN14CEngineWrapper16AddUndoRedoStepLEv @ 13 NONAME + _ZN14CEngineWrapper16CreateIclSourceLERK7TDesC16 @ 14 NONAME + _ZN14CEngineWrapper17CreateJpegSourceLERK7TDesC16 @ 15 NONAME + _ZN14CEngineWrapper17CreateJpegTargetLERK7TDesC16iPK5TSize @ 16 NONAME + _ZN14CEngineWrapper19CreateRGB888TargetLEv @ 17 NONAME + _ZN14CEngineWrapper20CreateExifThumbNailLEv @ 18 NONAME + _ZN14CEngineWrapper4NewLEv @ 19 NONAME + _ZN14CEngineWrapper4PanLE10TDirection @ 20 NONAME + _ZN14CEngineWrapper4PanLEii @ 21 NONAME + _ZN14CEngineWrapper5UndoLEv @ 22 NONAME + _ZN14CEngineWrapper5ZoomLE5TZoom @ 23 NONAME + _ZN14CEngineWrapper7CanUndoEv @ 24 NONAME + _ZN14CEngineWrapper7RenderLEPi @ 25 NONAME + _ZN14CEngineWrapper7RotateLE9TRotation @ 26 NONAME + _ZN14CEngineWrapper9SetBitmapEP10CFbsBitmap @ 27 NONAME + _ZN14CEngineWrapperD0Ev @ 28 NONAME + _ZN14CEngineWrapperD1Ev @ 29 NONAME + _ZN14CEngineWrapperD2Ev @ 30 NONAME + _ZNK14CEngineWrapper18GetOutputImageSizeERiS0_ @ 31 NONAME + _ZTI11CExifParser @ 32 NONAME ; ## + _ZTI12CFilterStack @ 33 NONAME ; ## + _ZTI14CEngineWrapper @ 34 NONAME ; ## + _ZTI9CJpegSave @ 35 NONAME ; ## + _ZTV11CExifParser @ 36 NONAME ; ## + _ZTV12CFilterStack @ 37 NONAME ; ## + _ZTV14CEngineWrapper @ 38 NONAME ; ## + _ZTV9CJpegSave @ 39 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/bwins/EngineWrapper.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/bwins/EngineWrapper.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +EXPORTS + ??1CEngineWrapper@@UAE@XZ @ 1 NONAME ; CEngineWrapper::~CEngineWrapper(void) + ?AddFilterL@CEngineWrapper@@QAEXABVTDesC16@@@Z @ 2 NONAME ; void CEngineWrapper::AddFilterL(class TDesC16 const &) + ?AddUndoRedoStepL@CEngineWrapper@@QAEXXZ @ 3 NONAME ; void CEngineWrapper::AddUndoRedoStepL(void) + ?CanUndo@CEngineWrapper@@QAEHXZ @ 4 NONAME ; int CEngineWrapper::CanUndo(void) + ?CreateExifThumbNailL@CEngineWrapper@@QAEXXZ @ 5 NONAME ; void CEngineWrapper::CreateExifThumbNailL(void) + ?CreateIclSourceL@CEngineWrapper@@QAEXABVTDesC16@@@Z @ 6 NONAME ; void CEngineWrapper::CreateIclSourceL(class TDesC16 const &) + ?CreateJpegSourceL@CEngineWrapper@@QAEXABVTDesC16@@@Z @ 7 NONAME ; void CEngineWrapper::CreateJpegSourceL(class TDesC16 const &) + ?CreateJpegTargetL@CEngineWrapper@@QAEXABVTDesC16@@HPBVTSize@@@Z @ 8 NONAME ; void CEngineWrapper::CreateJpegTargetL(class TDesC16 const &, int, class TSize const *) + ?CreateRGB888TargetL@CEngineWrapper@@QAEXXZ @ 9 NONAME ; void CEngineWrapper::CreateRGB888TargetL(void) + ?GetOutputImageSize@CEngineWrapper@@QBEXAAH0@Z @ 10 NONAME ; void CEngineWrapper::GetOutputImageSize(int &, int &) const + ?GetSystemPars@CEngineWrapper@@QAEPAVCSystemParameters@@XZ @ 11 NONAME ; class CSystemParameters * CEngineWrapper::GetSystemPars(void) + ?GetZoomMode@CEngineWrapper@@QAE?AW4TZoomMode@@XZ @ 12 NONAME ; enum TZoomMode CEngineWrapper::GetZoomMode(void) + ?InitUndoRedo@CEngineWrapper@@QAEXXZ @ 13 NONAME ; void CEngineWrapper::InitUndoRedo(void) + ?IsImageChanged@CEngineWrapper@@QAEHXZ @ 14 NONAME ; int CEngineWrapper::IsImageChanged(void) + ?NewL@CEngineWrapper@@SAPAV1@XZ @ 15 NONAME ; class CEngineWrapper * CEngineWrapper::NewL(void) + ?PanL@CEngineWrapper@@QAEXHH@Z @ 16 NONAME ; void CEngineWrapper::PanL(int, int) + ?PanL@CEngineWrapper@@QAEXW4TDirection@@@Z @ 17 NONAME ; void CEngineWrapper::PanL(enum TDirection) + ?RenderAbortL@CEngineWrapper@@QAEXXZ @ 18 NONAME ; void CEngineWrapper::RenderAbortL(void) + ?RenderBlockL@CEngineWrapper@@QAEHXZ @ 19 NONAME ; int CEngineWrapper::RenderBlockL(void) + ?RenderL@CEngineWrapper@@QAEXPAH@Z @ 20 NONAME ; void CEngineWrapper::RenderL(int *) + ?RestoreZoomL@CEngineWrapper@@QAEXXZ @ 21 NONAME ; void CEngineWrapper::RestoreZoomL(void) + ?RotateL@CEngineWrapper@@QAEXW4TRotation@@@Z @ 22 NONAME ; void CEngineWrapper::RotateL(enum TRotation) + ?SetBitmap@CEngineWrapper@@QAEXPAVCFbsBitmap@@@Z @ 23 NONAME ; void CEngineWrapper::SetBitmap(class CFbsBitmap *) + ?SetJpegCommentL@CEngineWrapper@@QAEXABVTDesC8@@@Z @ 24 NONAME ; void CEngineWrapper::SetJpegCommentL(class TDesC8 const &) + ?SetParamsL@CEngineWrapper@@QAEXABVTDesC16@@@Z @ 25 NONAME ; void CEngineWrapper::SetParamsL(class TDesC16 const &) + ?SetScreenSizeL@CEngineWrapper@@QAEXABVTSize@@@Z @ 26 NONAME ; void CEngineWrapper::SetScreenSizeL(class TSize const &) + ?StoreZoomL@CEngineWrapper@@QAEXXZ @ 27 NONAME ; void CEngineWrapper::StoreZoomL(void) + ?UndoL@CEngineWrapper@@QAEXXZ @ 28 NONAME ; void CEngineWrapper::UndoL(void) + ?ZoomL@CEngineWrapper@@QAEXW4TZoom@@@Z @ 29 NONAME ; void CEngineWrapper::ZoomL(enum TZoom) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/group/EngineWrapper.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/group/EngineWrapper.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,92 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../group/definitions.def" + +#define CAPS_UNUSED_ARG(x) + +MACRO UNICODE + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined __VERBOSE_2_ +MACRO VERBOSE_2 +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + + +MACRO EXIF_SUPPORT + + +TARGET EngineWrapper.dll +TARGETTYPE dll +UID 0x1000008d +EPOCALLOWDLLDATA + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE ImageEditorEngineWrapper.cpp +SOURCEPATH ../../src +SOURCE CFilterStack.cpp + +SOURCE CExifParser.cpp +SOURCE JpegSaveFactory.cpp +SOURCE CJpegSave.cpp + + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../group +USERINCLUDE ../../SystemParameters/inc +USERINCLUDE ../../ImageEditorUtils/inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LANG SC + +LIBRARY euser.lib +LIBRARY bafl.lib +LIBRARY cone.lib +LIBRARY estlib.lib +LIBRARY avkon.lib +LIBRARY fbscli.lib +LIBRARY efsrv.lib + +LIBRARY SystemParameters.lib +LIBRARY ImageEditorUtils.lib + +#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +EXPORTUNFROZEN +#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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: +* +*/ + + +#include +#include "../../group/definitions.def" + + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// mmp files +PRJ_MMPFILES +EngineWrapper.mmp + +// test project mmp files +PRJ_TESTMMPFILES + +// project exports +PRJ_EXPORTS + +// ROM description files +../rom/ImageEditorEngineWrapper.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorEngineWrapper.iby) +../rom/ImageEditorFilterBrightness.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterBrightness.iby) +../rom/ImageEditorFilterBubble.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterBubble.iby) +../rom/ImageEditorFilterBuffer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterBuffer.iby) +../rom/ImageEditorFilterCartoon.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterCartoon.iby) +../rom/ImageEditorFilterClipart.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterClipart.iby) +../rom/ImageEditorFilterContrast.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterContrast.iby) +../rom/ImageEditorFilterCrop.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterCrop.iby) +../rom/ImageEditorFilterFrame.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterFrame.iby) +../rom/ImageEditorFilterGrayScale.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterGrayScale.iby) +../rom/ImageEditorFilterJpegSource.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterJpegSource.iby) +../rom/ImageEditorFilterIclSource.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterIclSource.iby) +../rom/ImageEditorFilterJpegTarget.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterJpegTarget.iby) +../rom/ImageEditorFilterNegate.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterNegate.iby) +../rom/ImageEditorFilterRedEye.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterRedEye.iby) +../rom/ImageEditorFilterRotate.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterRotate.iby) +../rom/ImageEditorFilterScale.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterScale.iby) +../rom/ImageEditorFilterSepia.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterSepia.iby) +../rom/ImageEditorFilterSharpness.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterSharpness.iby) +../rom/ImageEditorFilterText.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorFilterText.iby) +../rom/imageeditorfilterdraw.iby CORE_MW_LAYER_IBY_EXPORT_PATH(imageeditorfilterdraw.iby) + +// End of File + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorEngineWrapper.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorEngineWrapper.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __ENGINEWRAPPER_IBY__ +#define __ENGINEWRAPPER_IBY__ + +// Dependencies + + +// DLLs +file=ABI_DIR\BUILD_DIR\EngineWrapper.dll SHARED_LIB_DIR\ENgineWrapper.dll + +// sis stub +//data=ZSYSTEM\install\ImageEditorEngineStub.sis System\Install\ImageEditorEngineStub.sis + +#endif // __ENGINEWRAPPER_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterBrightness.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterBrightness.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERBRIGHTNESS_IBY__ +#define __FILTERBRIGHTNESS_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterBrightness.dll SHARED_LIB_DIR\FilterBrightness.dll + +#endif // __FILTERBRIGHTNESS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterBubble.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterBubble.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERBUBBLE_IBY__ +#define __FILTERBUBBLE_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterBubble.dll SHARED_LIB_DIR\FilterBubble.dll +#endif // __FILTERBUBBLE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterBuffer.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterBuffer.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERBUFFER_IBY__ +#define __FILTERBUFFER_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterBuffer.dll SHARED_LIB_DIR\FilterBuffer.dll + +#endif // __FILTERBUFFER_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterCartoon.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterCartoon.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERCARTOON_IBY__ +#define __FILTERCARTOON_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterCartoon.dll SHARED_LIB_DIR\FilterCartoon.dll +#endif +#endif // __FILTERCARTOON_IBY__ + +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterClipart.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterClipart.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __FILTERCLIPART_IBY__ +#define __FILTERCLIPART_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterClipart.dll SHARED_LIB_DIR\FilterClipart.dll +#endif +#endif // __FILTERCLIPART_IBY__ + +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterContrast.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterContrast.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR +#ifndef __FILTERCONTRAST_IBY__ +#define __FILTERCONTRAST_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterContrast.dll SHARED_LIB_DIR\FilterContrast.dll + +#endif // __FILTERCONTRAST_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterCrop.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterCrop.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERCROP_IBY__ +#define __FILTERCROP_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterCrop.dll SHARED_LIB_DIR\FilterCrop.dll + +#endif // __FILTERCROP_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterFrame.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterFrame.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERFRAME_IBY__ +#define __FILTERFRAME_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterFrame.dll SHARED_LIB_DIR\FilterFrame.dll + +#endif // __FILTERFRAME_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterGrayScale.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterGrayScale.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERGRAYSCALE_IBY__ +#define __FILTERGRAYSCALE_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterGrayScale.dll SHARED_LIB_DIR\FilterGrayScale.dll + +#endif // __FILTERGRAYSCALE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterIclSource.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterIclSource.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERICLSOURCE_IBY__ +#define __FILTERICLSOURCE_IBY__ + +file=ABI_DIR\BUILD_DIR\FilterIclSource.dll SHARED_LIB_DIR\FilterIclSource.dll + +#endif // __FILTERICLSOURCE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterJpegSource.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterJpegSource.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERJPEGSOURCE_IBY__ +#define __FILTERJPEGSOURCE_IBY__ + +file=ABI_DIR\BUILD_DIR\FilterJpegSource.dll SHARED_LIB_DIR\FilterJpegSource.dll + +#endif // __FILTERJPEGSOURCE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterJpegTarget.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterJpegTarget.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERJPEGTARGET_IBY__ +#define __FILTERJPEGTARGET_IBY__ + +file=ABI_DIR\BUILD_DIR\FilterJpegTarget.dll SHARED_LIB_DIR\FilterJpegTarget.dll + +#endif // __FILTERJPEGTARGET_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterNegate.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterNegate.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERNEGATE_IBY__ +#define __FILTERNEGATE_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterNegate.dll SHARED_LIB_DIR\FilterNegate.dll + +#endif // __FILTERNEGATE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterRedEye.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterRedEye.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERREDEYE_IBY__ +#define __FILTERREDEYE_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterRedEye.dll SHARED_LIB_DIR\FilterRedEye.dll + +#endif // __FILTERREDEYE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterRotate.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterRotate.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERROTATE_IBY__ +#define __FILTERROTATE_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterRotate.dll SHARED_LIB_DIR\FilterRotate.dll + +#endif // __FILTERROTATE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterScale.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterScale.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERSCALE_IBY__ +#define __FILTERSCALE_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterScale.dll SHARED_LIB_DIR\FilterScale.dll + +#endif // __FILTERSCALE_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterSepia.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterSepia.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERSEPIA_IBY__ +#define __FILTERSEPIA_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterSepia.dll SHARED_LIB_DIR\FilterSepia.dll + +#endif // __FILTERSEPIA_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterSharpness.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterSharpness.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERSHARPNESS_IBY__ +#define __FILTERSHARPNESS_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterSharpness.dll SHARED_LIB_DIR\FilterSharpness.dll + +#endif // __FILTERSHARPNESS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/ImageEditorFilterText.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/ImageEditorFilterText.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __FILTERTEXT_IBY__ +#define __FILTERTEXT_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\FilterText.dll SHARED_LIB_DIR\FilterText.dll + +#endif // __FILTERTEXT_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/rom/imageeditorfilterdraw.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/rom/imageeditorfilterdraw.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR +#ifdef RD_IE_DRAW_PLUGIN + +#ifndef __FILTERDRAW_IBY__ +#define __FILTERDRAW_IBY__ + +// Filter DLL +file=ABI_DIR\BUILD_DIR\filterdraw.dll SHARED_LIB_DIR\filterdraw.dll + +#endif // __FILTERDRAW_IBY__ +#endif // RD_IE_DRAW_PLUGIN +#endif // RD_S60_IMAGE_EDITOR +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/EngineWrapper/src/ImageEditorEngineWrapper.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/EngineWrapper/src/ImageEditorEngineWrapper.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1968 @@ +/* +* 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: +* +*/ + + + +// INCLUDES +#include +#include +#include +#include + +//#include "ImageEditorPluginBase.hrh" +#include "platform_security_literals.hrh" + +#include "ImageEditorEngineWrapper.h" +#include "CFilterStack.h" +#include "MImageFilter.h" +#include "SystemParameters.h" +#include "ImageEditorError.h" +#include "ImageEditorUtils.h" +#include "EditorVersion.h" + + +#include "CExifParser.h" +#include "TBitmapHandle.h" +#include "MJpegSave.h" +#include "JpegSaveFactory.h" + + +// Debug logger definitions +#include "imageeditordebugutils.h" +_LIT( KEngineWrapperLogFile,"EngineWrapper.log" ); + + +// CONSTANTS + +// Minimum source image x-y value that the engine is able to render +const TInt KObMinSourceDimension = 16; + +// EXIF thumbnail quality +const TInt KThumbnailJpegQuality = 60; // [0,100] +const TInt KThumbnailMaxDimension = 160; + +// Used fixed point resolution for scales +const TInt KScaleBits = 12; + +const TReal KZoomScaleFactor = 0.5; + +// Comment tag to be written to the EXIF data of JPEG file. +_LIT8( KImageEditorExifComment, "Edited with Nokia Image Editor %d.%d.%d" ); + + +// Filter paths +_LIT(KFilterJpegSource, "FilterJpegSource.dll"); +_LIT(KFilterIclSource, "FilterIclSource.dll"); +_LIT(KFilterTarget, "FilterJpegTarget.dll"); +_LIT(KFilterBuffer, "FilterBuffer.dll"); +_LIT(KFilterScale, "FilterScale.dll"); +_LIT(KFilterRotate, "FilterRotate.dll"); + +//============================================================================= +EXPORT_C CEngineWrapper * CEngineWrapper::NewL () +{ + LOG_INIT ( KEngineWrapperLogFile ); + + CEngineWrapper * self = new (ELeave) CEngineWrapper; + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +EXPORT_C CEngineWrapper::~CEngineWrapper () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::~CEngineWrapper"); + Cleanup(); + + delete iExifParser; + iExifParser = NULL; + +} + +//============================================================================= +EXPORT_C void CEngineWrapper::CreateJpegSourceL (const TDesC & aFileName) +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL" ); +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL\taFileName: %S", &aFileName ); +#endif // VERBOSE + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Add JPEG source to engine + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- Add jpeg source" ); + if ( iMainEngine->NumFilters() == 0 ) + { + iMainEngine->AddFilterL ( KFilterJpegSource ); + } + else if ( IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"iclsource" ) ) + { + iMainEngine->RemoveFilter (0); + iMainEngine->AddFilterL (KFilterJpegSource, 0); + } + else if ( !IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"jpegsource" ) ) + { + iMainEngine->AddFilterL (KFilterJpegSource, 0); + } + iCmd.Copy ( _L("file \"")); + iCmd.Append ( aFileName ); + iCmd.Append ( _L("\"")); + LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: Cmd: %S", &aFileName ); + iMainEngine->FunctionL ( 0, iCmd ); + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- Jpeg source added" ); + iMainEngine->FunctionL ( 0, _L("loadimage")); + + // Get source image size + TRect rect = iMainEngine->Filter (0)->Rect(); + iSourceSize = iMainEngine->Filter (0)->ViewPortSize(); + LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source width: %d", iSourceSize.iWidth); + LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source height: %d", iSourceSize.iHeight); + + // Check that the source image is of minimum size + if (iSourceSize.iWidth < KObMinSourceDimension || iSourceSize.iHeight < KObMinSourceDimension) + { + User::Leave (KSIEEOpenFile); + } + + // Initialize crop parameters + iBoundingRect.iTl.iX = 0; + iBoundingRect.iTl.iY = 0; + iBoundingRect.iBr.iX = iSourceSize.iWidth; + iBoundingRect.iBr.iY = iSourceSize.iHeight; + iScale = 1.0; + iMaxScale = 1.0; + iMinScale = (TReal)iScreenSize.iWidth / iSourceSize.iWidth; + iPanX = iSourceSize.iWidth * 0.5; + iPanY = iSourceSize.iHeight * 0.5; + iPanStep = 128.0; + iZoomMode = EZoomNormal; + + // Initialize system parameters + iSysPars->SourceSize() = iSourceSize; + iSysPars->Scale() = 1.0; + + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- Read EXIF data" ); + + // Read EXIF data pointer + iCmd.Copy ( _L("exifdata")); + TUint8 * exifptr = (TUint8 *)iMainEngine->FunctionL ( 0, iCmd ); + + // Read EXIF data length + iCmd.Copy ( _L("exiflength")); + TInt exiflen = (TInt)iMainEngine->FunctionL ( 0, iCmd ); + + // Create and initialize EXIF parser + TPtrC8 exifdata (exifptr, exiflen); + if (iExifParser) + { + delete iExifParser; + iExifParser = NULL; + } + + iExifParser = CExifParser::NewL (); + TRAPD( err, iExifParser->ParseL (exifdata) ); + if (KErrNone == err) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- EXIF data read." ); + } + else + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- FAILED to parse EXIF data. Ignored." ); + } + + +} + +//============================================================================= +EXPORT_C void CEngineWrapper::CreateJpegTargetL ( + const TDesC & aFileName, + const TInt aQuality, + const TSize * aSize + ) +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL" ); +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taFileName: %S", &aFileName ); + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taQuality: %d", aQuality ); + if (aSize) + { + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taSize->iWidth: %d", aSize->iWidth); + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL\taSize->iHeight: %d", aSize->iHeight); + } + else + { + LOG( KEngineWrapperLogFile, "aSize == NULL" ); + } + +#endif // VERBOSE + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + if ( aQuality < 0 || aQuality > 100) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL: Invalid parameter aQuality!" ); + User::Panic (KEnginePanic, KEnginePanicParameter); + } + if ( aSize && ( (aSize->iWidth < 0 || aSize->iHeight < 0) ) ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL: Invalid parameter aSize!" ); + User::Panic (KEnginePanic, KEnginePanicParameter); + } + + // Remove source buffer + iMainEngine->FunctionL (0, _L("fileoutput")); + + // Remove screen buffer + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Remove screen buffer" ); + if ( IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 1)->Type(), (TUint8*)"buffer" ) ) + { + iMainEngine->RemoveFilter(iMainEngine->NumFilters() - 1); + } + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Screen buffer removed" ); + + // Remove jpeg target buffer + if ( IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 1)->Type(), (TUint8*)"jpegtarget" ) ) + { + iMainEngine->RemoveFilter(iMainEngine->NumFilters() - 1); + } + + // Remove scale buffer, if image is not scaled + if ( iSysPars->Scale() == 1.0 ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Remove screen scale filter." ); + if ( IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 1)->Type(), (TUint8*)"scale" ) ) + { + iMainEngine->RemoveFilter(iMainEngine->NumFilters() - 1); + } + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Screen scale filter removed." ); + } + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Add jpeg target filter." ); + iMainEngine->AddFilterL ( KFilterTarget ); + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegTargetL --- Jpeg target filter added." ); + + // If external target size is given, set it to target. + if ( aSize ) + { + iCmd.Format( _L("width %d height %d"), aSize->iWidth, aSize->iHeight ); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd ); + } + + // Set the scaled source size to target + if ( iSysPars->Scale() != 1.0 ) + { + TReal scale = iSysPars->Scale(); + TSize tgtsize = iMainEngine->Filter ( iMainEngine->NumFilters() - 3 )->ViewPortSize(); + tgtsize.iWidth = (TInt)(tgtsize.iWidth * scale + 0.5); + tgtsize.iHeight = (TInt)(tgtsize.iHeight * scale + 0.5); + iCmd.Format( _L("width %d height %d"), tgtsize.iWidth, tgtsize.iHeight); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd ); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 2, _L("nop")); + } + + // Store save file name + iTargetFile.Copy ( aFileName ); + + LOG ( KEngineWrapperLogFile, "CreateJpegTargetL: Sink created" ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::CreateIclSourceL (const TDesC & aFileName) +{ + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL" ); +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL\taFileName: %S", &aFileName ); +#endif // VERBOSE + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Add JPEG source to engine + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL --- Add icl source" ); + if ( iMainEngine->NumFilters() == 0 ) + { + iMainEngine->AddFilterL ( KFilterIclSource ); + } + else if ( IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"jpegsource" ) ) + { + iMainEngine->RemoveFilter(0); + iMainEngine->AddFilterL ( KFilterIclSource, 0); + } + else if ( !IsSameString ( (TUint8*)iMainEngine->Filter(0)->Type(), (TUint8*)"iclsource" ) ) + { + iMainEngine->AddFilterL ( KFilterIclSource, 0); + } + iCmd.Copy (_L("file \"")); + iCmd.Append ( aFileName ); + iCmd.Append (_L("\"")); + LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL: Cmd: %S", &iCmd ); + iMainEngine->FunctionL ( 0, iCmd ); + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL --- Icl source added" ); + iMainEngine->FunctionL ( 0, _L("loadimage")); + + // Get source image size + TRect rect = iMainEngine->Filter (0)->Rect(); + iSourceSize = iMainEngine->Filter (0)->ViewPortSize(); + LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source width: %d", iSourceSize.iWidth); + LOGFMT ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL: source height: %d", iSourceSize.iHeight); + + // Check that the source image is of minimum size + if (iSourceSize.iWidth < KObMinSourceDimension || iSourceSize.iHeight < KObMinSourceDimension) + { + User::Leave (KSIEEOpenFile); + } + + // Initialize crop parameters + iScale = 1.0; + iMaxScale = 1.0; + iMinScale = (TReal)iScreenSize.iWidth / iSourceSize.iWidth; + iPanX = iSourceSize.iWidth * 0.5; + iPanY = iSourceSize.iHeight * 0.5; + iPanStep = 128.0; + iZoomMode = EZoomNormal; + + // Initialize system parameters + iSysPars->SourceSize() = iSourceSize; + iSysPars->Scale() = 1.0; + + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateIclSourceL --- Create EXIF parser" ); + + if (iExifParser) + { + delete iExifParser; + iExifParser = NULL; + } + + iExifParser = CExifParser::NewL (); + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateJpegSourceL --- EXIF parser created." ); + + +} + +//============================================================================= +EXPORT_C void CEngineWrapper::CreateRGB888TargetL () +{ + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL " ); + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "\tiScreenSize.w: %d", iScreenSize.iWidth); + LOGFMT( KEngineWrapperLogFile, "\tiScreenSize.h: %d", iScreenSize.iHeight); +#endif + + // Create source buffer + iMainEngine->FunctionL (0, _L("bufferoutput")); + + // Remove target filter and add screen buffer + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Add buffer target." ); + TInt n = iMainEngine->NumFilters(); + if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*)"jpegtarget") ) + { + iMainEngine->RemoveFilter(n - 1); + iMainEngine->AddFilterL ( KFilterBuffer ); + } + else if ( !IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*)"buffer" ) ) + { + iMainEngine->AddFilterL ( KFilterBuffer ); + } + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Buffer target added." ); + + // Set buffer size + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Set buffer size "); + iCmd.Format( _L("width %d height %d"), iScreenSize.iWidth, iScreenSize.iHeight ); + LOGDES (KEngineWrapperLogFile, iCmd); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd ); + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Buffer size set." ); + + // Set scale buffer before screen buffer + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Add screen buffer scale filter"); + if ( !IsSameString ( (TUint8*)iMainEngine->Filter(iMainEngine->NumFilters() - 2)->Type(), (TUint8*)"scale") ) + { + iMainEngine->AddFilterL ( KFilterScale, iMainEngine->NumFilters() - 1); + } + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 2, iCmd ); + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL --- Screen buffer scale filter added."); + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::CreateRGB888TargetL: Sink created" ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::SetScreenSizeL (const TSize & aSize) +{ + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL" ); +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL\taSize.iWidth: %d", aSize.iWidth ); + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL\taSize.iHeight: %d", aSize.iHeight ); +#endif // VERBOSE + + // SANITY CHECKS + if ( aSize.iWidth < 0 || aSize.iHeight < 0) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetScreenSizeL: Invalid parameter aSize!" ); + User::Panic (KEnginePanic, KEnginePanicParameter); + } + + if ( aSize != iScreenSize ) + { + iScreenSize = aSize; + + // Set buffer size + TInt n = iMainEngine->NumFilters(); + if (n > 2) + { + if ( IsSameString ((TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*) "buffer" ) ) + { + iCmd.Format( _L("width %d height %d"), iScreenSize.iWidth, iScreenSize.iHeight); + iMainEngine->FunctionL ( n - 1, iCmd ); + iMainEngine->FunctionL ( n - 2, _L("nop")); + UpdateCropRectL(); + } + } + } +} + +//============================================================================= +EXPORT_C void CEngineWrapper::AddFilterL (const TDesC & aFilterName) +{ + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::AddFilterL (TDes & aFilterName: %S)", &aFilterName ); + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::AddFilterL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Check whether the filter is found + TFileName filtername; + filtername.Copy (aFilterName); + + /* + // no need for this as AddFilterL will leave if there is an error + if (FileExists (filtername) ) + { + TParse parse; + User::LeaveIfError( parse.Set( aFilterName ,NULL, NULL ) ); + filtername = parse.NameAndExt(); + }; + */ + + TInt n = iMainEngine->NumFilters(); + if (n >= 2) + { + iMainEngine->AddFilterL ( filtername, n - 2 ); + } + LOG ( KEngineWrapperLogFile, "CEngineWrapper::AddFilterL: Filter added" ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::SetParamsL (const TDesC & aParam) +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::SetParamsL " ); + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetParamsL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Initialize error value + TInt n = iMainEngine->NumFilters(); + if ( n > 2 ) + { + LOGDES( KEngineWrapperLogFile, aParam ); + iMainEngine->FunctionL ( n - 3, aParam ); + } + + + if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 3)->Type(), (TUint8*) "rotate" ) ) + { + if (iScale == 1.0) + { + ComputeBoundingRectL(); + } + UpdateCropRectL(); + } + + + LOG( KEngineWrapperLogFile, "CEngineWrapper::SetParamsL: Parameters set " ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::RenderL (TInt* /*aMultiSessionBlockCount*/) +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderL" ); + + // SANITY CHECKS + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + TInt n = iMainEngine->NumFilters(); + for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i) + { + iMainEngine->FunctionL (i, _L("nop")); + TBuf<100> buf; + buf.Copy(TPtrC8 ( (TUint8 *)iMainEngine->Filter(i)->Type() )); + LOGDES (KEngineWrapperLogFile, buf) ; + TRect rect = iMainEngine->Filter(i)->Rect(); + buf.Format( _L("%d %d %d %d"), rect.iTl.iX, rect.iTl.iY, rect.iBr.iX, rect.iBr.iY); + LOGDES (KEngineWrapperLogFile, buf) ; + } + + // Render to buffer target + if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*) "buffer" ) ) + { + iCmd.Copy (_L("getbitmap")); + if ( iRenderScaleBuffer ) + { + iMainEngine->FunctionL ( 0, _L("loadimage")); + iRenderScaleBuffer = EFalse; + for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i) + { + iMainEngine->FunctionL (i, _L("nop")); + } + } + + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL -- Render screen buffer." ); + TUint32 * buffer = (TUint32 *)iMainEngine->FunctionL ( n - 1, iCmd ); + CopyBufferL (buffer); + } + + // Render to JPEG target + else if ( IsSameString ( (TUint8*)iMainEngine->Filter(n - 1)->Type(), (TUint8*)"jpegtarget" ) ) + { + iCmd.Zero(); + + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL: Set EXIF data" ); + + // Update EXIF tags + UpdateExifTagsL(); + + // Update EXIF thumbnail + TPtrC8 savedexifdata = UpdateExifThumbnailL(); + + // Set EXIF data to target + iCmd.Format (_L("exifdata %d exiflen %d"), (TInt)(savedexifdata.Ptr()), savedexifdata.Length()); + + LOG ( KEngineWrapperLogFile, "CEngineWrapper::RenderL: EXIF data set." ); + + + iCmd.Append (_L(" file \"")); + iCmd.Append ( iTargetFile ); + iCmd.Append (_L("\"")); + iMainEngine->FunctionL ( n - 1, iCmd ); + } + + LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderL: Rendered" ); +} + +//============================================================================= +EXPORT_C TInt CEngineWrapper::RenderBlockL() +{ +#ifdef VERBOSE_2 + LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderBlockL" ); + + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlockL\tiBlock: %d", iBlock); + if (iTestBitmap) + { + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlock\tiTestBitmap->DataAddress(): %d", (TInt)iTestBitmap->DataAddress()); + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlock\tiTestBitmap->Handle(): %d", iTestBitmap->Handle()); + } + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::RenderBlockL\tiBuffer: %d", (TInt)iBuffer); +#endif + + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "RenderBlockL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + iCmd.Copy ( _L("store") ); + TInt percentage = iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd ); + if (percentage == 100) + { + iChangeCount = 0; + } + return percentage; +} + +//============================================================================= +EXPORT_C void CEngineWrapper::RenderAbortL() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::RenderAbortL" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "RenderAbort: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + iCmd.Copy ( _L("abort")); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::InitUndoRedo() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::InitUndoRedo" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "InitUndoRedo: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Purge undo stack + iUndoPoints.Reset(); + + // Undo + iPrevChangeCount = 0; + iChangeCount = 0; +} + +//============================================================================= +EXPORT_C void CEngineWrapper::AddUndoRedoStepL() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::AddUndoRedoStepL" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "AddUndoRedoStepL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Store undo point + TInt n = iMainEngine->NumFilters(); + if (n > 2) + { + // Set undo point before target filter + iUndoPoints.Append ( n - 3 ); + } + + iPrevChangeCount = iChangeCount; + iChangeCount++; + + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::AddUndoRedoStepL: iChangeCount = %d", iChangeCount); + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::AddUndoRedoStepL: iPrevChangeCount = %d", iPrevChangeCount); + + // Store rotation and scale + User::LeaveIfError( iScaleUndoBuf.Append ( iSysPars->Scale() ) ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::UndoL() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::UndoL" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "UndoL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + TBool computeBoundingRect = EFalse; + TBool reloadImage = EFalse; + + if (iMainEngine->NumFilters() > 2) + { + TInt m = iUndoPoints.Count(); + TInt undoindex = iUndoPoints[m-1]; + while (iMainEngine->NumFilters() - 3 > undoindex) + { + TInt index = iMainEngine->NumFilters() - 3; + if ( IsSameString ( (TUint8*)iMainEngine->Filter(index)->Type(), (TUint8*) "rotate" ) ) + { + computeBoundingRect = ETrue; + } + else if ( IsSameString ( (TUint8*)iMainEngine->Filter(index)->Type(), (TUint8*) "crop" ) ) + { + reloadImage = ETrue; + } + + iMainEngine->RemoveFilter (index); + } + iUndoPoints.Remove (iUndoPoints.Count() - 1); + } + + iPrevChangeCount = iChangeCount; + iChangeCount--; + + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::UndoL: iChangeCount = %d", iChangeCount); + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::UndoL: iPrevChangeCount = %d", iPrevChangeCount); + + TInt count = iScaleUndoBuf.Count(); + if ( count > 0 ) + { + iSysPars->Scale() = iScaleUndoBuf[count - 1]; + iScaleUndoBuf.Remove (count - 1); + } + + if (reloadImage) + { + iCmd.Format( _L("ulc %d ulr %d lrc %d lrr %d"), 0,0,0,0); + iMainEngine->FunctionL ( 0, iCmd); + iMainEngine->FunctionL ( 0, _L("loadimage")); + for (TInt i = 0; i < iMainEngine->NumFilters(); ++i) + { + iMainEngine->FunctionL (i, _L("nop")); + } + ComputeBoundingRectL(); + } + + if ( iMainEngine->NumFilters() > 3 && computeBoundingRect && iScale == 1.0 ) + { + ComputeBoundingRectL(); + } + else if ( iMainEngine->NumFilters() <= 3 ) + { + iBoundingRect.iTl.iX = 0; + iBoundingRect.iTl.iY = 0; + iBoundingRect.iBr.iX = iSourceSize.iWidth; + iBoundingRect.iBr.iY = iSourceSize.iHeight; + } + UpdateCropRectL(); +} + +//============================================================================= +EXPORT_C TBool CEngineWrapper::CanUndo () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::CanUndo" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "CanUndo: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + if ( iUndoPoints.Count() > 0 ) + { + return ETrue; + } + else + { + return EFalse; + } +} + +//============================================================================= +EXPORT_C TBool CEngineWrapper::IsImageChanged() +{ + LOGFMT2( KEngineWrapperLogFile, "CEngineWrapper::IsImageChanged: iChangeCount = %d, iPrevChangeCount = %d", iChangeCount, iPrevChangeCount ); + + if ( iChangeCount || (iChangeCount == 0 && iPrevChangeCount < 0)) + { + return ETrue; + } + else + { + return EFalse; + } +} + +//============================================================================= +CEngineWrapper::CEngineWrapper () : +iScreenSize (), +iChangeCount(0), +iPrevChangeCount(0) +{ + +} + +//============================================================================= +void CEngineWrapper::ConstructL () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::ConstructL" ); + + // Create new engine + iMainEngine = CFilterStack::NewL(); + + // Set screen size to default + iScreenSize.iWidth = 1; + iScreenSize.iHeight = 1; + + // Create and initialize system parameters + LOG( KEngineWrapperLogFile, "CEngineWrapper: Creating system parameters" ); + iSysPars = new (ELeave) CSystemParameters; +} + +//============================================================================= +TInt CEngineWrapper::FileExists (TDes & aFileName) const +{ + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::FileExists (TDes & aFileName: %S)", &aFileName ); + + TInt result = KErrNone; + + RFs &fs = CEikonEnv::Static()->FsSession(); + + aFileName[0] = 'e'; + if ( !BaflUtils::FileExists (fs, aFileName) ) + { + aFileName[0] = 'c'; + if ( !BaflUtils::FileExists (fs, aFileName) ) + { + aFileName[0] = 'z'; + if ( !BaflUtils::FileExists (fs, aFileName) ) + { + return KErrNotFound; + } + } + } + + if ( !BaflUtils::FileExists (fs, aFileName) ) + { + result = KErrNotFound; + } + + LOGFMT( KEngineWrapperLogFile, "\tresult: %d", result ); + + return result; +} + +//============================================================================= +void CEngineWrapper::Cleanup() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::Cleanup" ); + + // Purge undo / redo information + iUndoPoints.Reset(); + + // Delete filters + for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i) + { + iMainEngine->RemoveFilter(i); + } + + // Delete engine + if (iMainEngine) + { + delete iMainEngine; + iMainEngine = NULL; + } + + // Clear rotation and scale undo buffers + iScaleUndoBuf.Reset(); + + // Delete system parameters + if (iSysPars) + { + delete iSysPars; + iSysPars = NULL; + } + + if (iJpegComment) + { + delete iJpegComment; + iJpegComment = NULL; + } + + // Delete thumbnail buffer + delete[] iThumb; +} + +//============================================================================= +EXPORT_C void CEngineWrapper::StoreZoomL () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::StoreZoom" ); + + iScaleSt = iScale; + iPanXSt = iPanX; + iPanYSt = iPanY; + + iScale = 1.0; + iPanX = iSourceSize.iWidth * 0.5; + iPanY = iSourceSize.iHeight * 0.5; + UpdateCropRectL(); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::RestoreZoomL() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::RestoreZoom" ); + + if (iScale != iScaleSt) + { + iScale = iScaleSt; + iPanX = iPanXSt; + iPanY = iPanYSt; + UpdateCropRectL(); + } +} + +//============================================================================= +EXPORT_C void CEngineWrapper::ZoomL (const TZoom aZoom) + { + LOGFMT( KEngineWrapperLogFile, "CEngineWrapper::ZoomL: %d", (TInt)aZoom); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "ZoomFactor: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + if ( aZoom == EZoomMin ) + { + iScale = 1.0; + iZoomMode = EZoomNormal; + + } + else if ( aZoom == EZoomIn ) + { + + if ( iScale == 1.0 ) + { + ComputeBoundingRectL(); + } + + if ( iZoomMode < ( ENumOfZooms - 1 ) ) + { + // rescale + iScale *= KZoomScaleFactor; + // set next zoom mode + iZoomMode = ( TZoomMode )( ( TInt )iZoomMode + 1 ); + } + } + else + { + if ( iZoomMode > EZoomNormal ) + { + // rescale + iScale *= 1.0 / KZoomScaleFactor; + //set previous zoom mode + iZoomMode = ( TZoomMode )( ( TInt )iZoomMode - 1 ); + } + } + + UpdateCropRectL(); + } + +//============================================================================= +EXPORT_C TZoomMode CEngineWrapper::GetZoomMode() + { + return iZoomMode; + } + +//============================================================================= +EXPORT_C void CEngineWrapper::PanL (const TDirection aDir) +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::PanL" ); + +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "\taDir: %d", (TInt)aDir); +#endif // VERBOSE + + if (iScale == 1.0) + { + return; + } + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "SetPanL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + TInt angle = ComputeRotationL(); + + switch (aDir) + { + case EDirectionUp: + { + if (angle == 0) + { + iPanY -= iPanStep * iScale; + } + else if (angle == 90) + { + iPanX -= iPanStep * iScale; + } + else if (angle == 180) + { + iPanY += iPanStep * iScale; + } + else if (angle == 270) + { + iPanX += iPanStep * iScale; + } + break; + } + case EDirectionDown: + { + if (angle == 0) + { + iPanY += iPanStep * iScale; + } + else if (angle == 90) + { + iPanX += iPanStep * iScale; + } + else if (angle == 180) + { + iPanY -= iPanStep * iScale; + } + else if (angle == 270) + { + iPanX -= iPanStep * iScale; + } + break; + } + case EDirectionLeft: + { + if (angle == 0) + { + iPanX -= iPanStep * iScale; + } + else if (angle == 90) + { + iPanY += iPanStep * iScale; + } + else if (angle == 180) + { + iPanX += iPanStep * iScale; + } + else if (angle == 270) + { + iPanY -= iPanStep * iScale; + } + break; + } + case EDirectionRight: + { + if (angle == 0) + { + iPanX += iPanStep * iScale; + } + else if (angle == 90) + { + iPanY -= iPanStep * iScale; + } + else if (angle == 180) + { + iPanX -= iPanStep * iScale; + } + else if (angle == 270) + { + iPanY += iPanStep * iScale; + } + break; + } + default: + break; + } + UpdateCropRectL(); + +} + +//============================================================================= +EXPORT_C void CEngineWrapper::PanL( TInt aXChange, TInt aYChange ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::Pan" ); + +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "\taXChange: %d, aYChange: %d ", aXChange, aYChange ); +#endif // VERBOSE + + if (iScale == 1.0) + { + return; + } + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "SetPanL: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + TInt angle = ComputeRotationL(); + + if (angle == 0) + { + // X change + iPanX += aXChange*(iScale/iMinScale); + + // Y change + iPanY += aYChange*(iScale/iMinScale); + } + else if (angle == 90) + { + // X change + iPanX += aYChange*(iScale/iMinScale); + + // Y change + iPanY -= aXChange*(iScale/iMinScale); + } + else if (angle == 180) + { + // X change + iPanX -= aXChange*(iScale/iMinScale); + + // Y change + iPanY -= aYChange*(iScale/iMinScale); + } + else if (angle == 270) + { + // X change + iPanX -= aYChange*(iScale/iMinScale); + + // Y change + iPanY += aXChange*(iScale/iMinScale); + } + + UpdateCropRectL(); + +} + +//============================================================================= +EXPORT_C void CEngineWrapper::RotateL (const TRotation aRot) +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::RotateL" ); +#ifdef VERBOSE + LOGFMT( KEngineWrapperLogFile, "\taRot: %d", (TInt)aRot); +#endif // VERBOSE + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "Rotation: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + // Set undo / redo point + AddUndoRedoStepL (); + + // Add rotate filter + AddRotateFilterL(); + + // Set rotation pars + TBuf<128> cmd; + cmd.Copy (_L("angle ")); + + if ( ERotationCounterClockwise == aRot ) + { + cmd.AppendNum (270); + } + else if ( ERotationClockwise == aRot ) + { + cmd.AppendNum (90); + } + else if ( ERotation180 == aRot ) + { + cmd.AppendNum (180); + } + else + { + User::Leave (KErrArgument); + } + SetParamsL (cmd); +} + +//============================================================================= +EXPORT_C CSystemParameters * CEngineWrapper::GetSystemPars () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::GetSystemPars" ); + + ComputeSystemParameters(); + + return iSysPars; +} + +//============================================================================= +void CEngineWrapper::ComputeSystemParameters () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::ComputeSystemParameters" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "GetSystemPars: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } + + MImageFilter * filter = iMainEngine->Filter(iMainEngine->NumFilters() - 3); + TSize size = filter->ViewPortSize(); + iSysPars->ViewPortRect().iTl.iX = 0; + iSysPars->ViewPortRect().iTl.iY = 0; + iSysPars->ViewPortRect().iBr.iX = size.iWidth; + iSysPars->ViewPortRect().iBr.iY = size.iHeight; + + LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iTl.iX: %d", iSysPars->ViewPortRect().iTl.iX ); + LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iTl.iY: %d", iSysPars->ViewPortRect().iTl.iY ); + LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iBr.iX: %d", iSysPars->ViewPortRect().iBr.iX ); + LOGFMT( KEngineWrapperLogFile, "ViewPortRect().iBr.iY: %d", iSysPars->ViewPortRect().iBr.iY ); + + iSysPars->VisibleImageRect() = filter->Rect(); + + LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iTl.iX: %d", iSysPars->VisibleImageRect().iTl.iX ); + LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iTl.iY: %d", iSysPars->VisibleImageRect().iTl.iY ); + LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iBr.iX: %d", iSysPars->VisibleImageRect().iBr.iX ); + LOGFMT( KEngineWrapperLogFile, "VisibleImageRect().iBr.iY: %d", iSysPars->VisibleImageRect().iBr.iY ); + + // Get the relative scale of the topmost filter + iSysPars->RelScale() = filter->Scale(); + + LOGFMT( KEngineWrapperLogFile, "RelScale(): %f", iSysPars->RelScale() ); + + TInt n = iMainEngine->NumFilters(); + if ( n > 3 ) + { + + TRect rect; + + TSize srcsize = iMainEngine->Filter(n - 3)->Rect().Size(); + TSize tgtsize = iMainEngine->Filter(n - 1)->Rect().Size(); + + // Compute aspect ratio of the source + TInt ars = (TReal)(srcsize.iWidth << KScaleBits) / srcsize.iHeight + 0.5; + + // Compute aspect ratio of the target + TInt art = (TReal)(tgtsize.iWidth << KScaleBits) / tgtsize.iHeight + 0.5; + + // Select scale so that aspect ratio is preserved + if ( ars >= art ) + { + TInt scale = (TReal)(tgtsize.iWidth << KScaleBits) / srcsize.iWidth + 0.5; + rect.iTl.iX = 0; + rect.iBr.iX = tgtsize.iWidth; + TInt h = (srcsize.iHeight * scale) >> KScaleBits; + rect.iTl.iY = (TReal)(tgtsize.iHeight - h) / 2 + 0.5; + rect.iBr.iY = (TReal)(tgtsize.iHeight + h) / 2 + 0.5; + } + else + { + TInt scale = (TReal)(tgtsize.iHeight << KScaleBits) / srcsize.iHeight + 0.5; + rect.iTl.iY = 0; + rect.iBr.iY = tgtsize.iHeight; + TInt w = (srcsize.iWidth * scale) >> KScaleBits; + rect.iTl.iX = (TReal)(tgtsize.iWidth - w) / 2 + 0.5; + rect.iBr.iX = (TReal)(tgtsize.iWidth + w) / 2 + 0.5; + } + + iSysPars->VisibleImageRectPrev() = rect; + + LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iTl.iX: %d", iSysPars->VisibleImageRectPrev().iTl.iX ); + LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iTl.iY: %d", iSysPars->VisibleImageRectPrev().iTl.iY ); + LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iBr.iX: %d", iSysPars->VisibleImageRectPrev().iBr.iX ); + LOGFMT( KEngineWrapperLogFile, "VisibleImageRectPrev().iBr.iY: %d", iSysPars->VisibleImageRectPrev().iBr.iY ); + } +} + + + +//============================================================================= +EXPORT_C void CEngineWrapper::GetOutputImageSize ( TInt& /*aWidth*/, TInt& /*aHeight*/ ) const +{ + +} + +//============================================================================= +EXPORT_C void CEngineWrapper::SetJpegCommentL (const TDesC8& /*aComment*/) +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::SetJpegComment" ); + + // Check that the model is found + if ( !iMainEngine ) + { + LOG ( KEngineWrapperLogFile, "SetJpegComment: iMainEngine not created!" ); + User::Panic (KEnginePanic, KEnginePanicAllocation); + } +} + +//============================================================================= +void CEngineWrapper::AddRotateFilterL() +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::AddRotateFilterL()" ); + + // Add filter to engine + AddFilterL (KFilterRotate); +} + +//============================================================================= +TRect CEngineWrapper::ComputeViewPort (const TInt /*aStartInd*/) +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::ComputeViewPort()" ); + return TRect(); +} + +//============================================================================= +TRect CEngineWrapper::ComputeVisibleViewPort (const TRect & /*aViewPort*/) +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::ComputeVisibleViewPort()" ); + return TRect(0,0,0,0); +} + +//============================================================================= +TPoint CEngineWrapper::ComputeNewPanValue (const TRect & /*aVvpOld*/) +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::ComputeNewPanValue()" ); + + return TPoint(); +} + +//============================================================================= +void CEngineWrapper::CopyBufferL (TUint32 * aBuffer) +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::CopyBufferL" ); + + iScreenBitmap->LockHeapLC(); + + TSize size = iScreenBitmap->SizeInPixels(); + TDisplayMode dmode = iScreenBitmap->DisplayMode(); + TInt ws = iScreenBitmap->ScanLineLength (size.iWidth, dmode); + + TUint8 * tpos = (TUint8*)( iScreenBitmap->DataAddress() ); + TUint8 * tp; + + for ( TInt y = 0; y < size.iHeight; y++ ) + { + + tp = tpos; + tpos += ws; + + for ( TInt x = 0; x < size.iWidth; x++ ) + { + TUint32 c = *aBuffer++; + *tp++ = c & 0xFF; + c >>= 8; + *tp++ = c & 0xFF; + c >>= 8; + *tp++ = c & 0xFF; + } + } + + CleanupStack::PopAndDestroy(); // iScreenBitmap->LockHeapLC +} + +//============================================================================= +TBool CEngineWrapper::IsSameString ( + const TUint8 * aString1, + const TUint8 * aString2 + ) +{ + TPtrC8 s1( (TUint8*)aString1 ); + TPtrC8 s2( (TUint8*)aString2); + + if ( s1.Compare( s2 ) == 0 ) + { + return ETrue; + } + else + { + return EFalse; + } +} + +//============================================================================= +void CEngineWrapper::UpdateCropRectL () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateCropRect" ); + + TSize screensize = iScreenSize; + TSize imagesize = iBoundingRect.Size(); + TRect croprect = iBoundingRect; + + if (iScale != 1.0) + { + // check rotation + TInt angle = ComputeRotationL(); + TSize cropsize = imagesize; + TReal sw = 0.0; + TReal sh = 0.0; + if ((angle == 90) || (angle == 270)) + { + cropsize.iWidth = imagesize.iWidth; + cropsize.iHeight = (TReal)(screensize.iWidth * imagesize.iWidth) / screensize.iHeight + 0.5; + TReal ari = (TReal)cropsize.iWidth / cropsize.iHeight; + TReal ars = (TReal)screensize.iWidth / screensize.iHeight; + if (ari >= ars) + { + sw = 0.5 * iScale * cropsize.iWidth; + sh = 0.5 * iScale * cropsize.iHeight; + } + else + { + sh = 0.5 * iScale * cropsize.iHeight; + sw = 0.5 * iScale * cropsize.iWidth; + } + } + else + { + TReal ari = (TReal)cropsize.iWidth / cropsize.iHeight; + TReal ars = (TReal)screensize.iWidth / screensize.iHeight; + if (ari >= ars) + { + sw = 0.5 * iScale * cropsize.iWidth; + sh = 0.5 * iScale * (cropsize.iWidth / ars); + } + else + { + sh = 0.5 * iScale * cropsize.iHeight; + sw = 0.5 * iScale * (cropsize.iHeight * ars); + } + } + + // clip pan + if (iPanX - sw < iBoundingRect.iTl.iX) + { + if (iScale == 1.0) + { + iPanX = (iBoundingRect.iTl.iX + iBoundingRect.iBr.iX) / 2; + } + else + { + iPanX = iBoundingRect.iTl.iX + sw; + } + } + else if (iPanX + sw > iBoundingRect.iBr.iX) + { + if (iScale == 1.0) + { + iPanX = (iBoundingRect.iTl.iX + iBoundingRect.iBr.iX) / 2; + } + else + { + iPanX = iBoundingRect.iBr.iX - sw; + } + } + if (iPanY - sh < iBoundingRect.iTl.iY) + { + if (iScale == 1.0) + { + iPanY = (iBoundingRect.iTl.iY + iBoundingRect.iBr.iY) / 2; + } + else + { + iPanY = iBoundingRect.iTl.iY + sh; + } + } + else if (iPanY + sh > iBoundingRect.iBr.iY) + { + if (iScale == 1.0) + { + iPanY = (iBoundingRect.iTl.iY + iBoundingRect.iBr.iY) / 2; + } + else + { + iPanY = iBoundingRect.iBr.iY - sh; + } + } + + // scale rect + croprect = TRect(iPanX - sw, iPanY - sh, iPanX + sw, iPanY + sh); + if (croprect.iTl.iX < iBoundingRect.iTl.iX) + { + croprect.iTl.iX = iBoundingRect.iTl.iX; + } + if (croprect.iTl.iY < iBoundingRect.iTl.iY) + { + croprect.iTl.iY = iBoundingRect.iTl.iY; + } + if (croprect.iBr.iX > iBoundingRect.iBr.iX) + { + croprect.iBr.iX = iBoundingRect.iBr.iX; + } + if (croprect.iBr.iY > iBoundingRect.iBr.iY) + { + croprect.iBr.iY = iBoundingRect.iBr.iY; + } + + } + + if (croprect != iOldCropRect) + { + // Update crop rectangle + iCmd.Format( _L("ulc %d ulr %d lrc %d lrr %d"), croprect.iTl.iX, croprect.iTl.iY, + croprect.iBr.iX, croprect.iBr.iY); + LOGDES (KEngineWrapperLogFile, iCmd); + iMainEngine->FunctionL ( 0, iCmd ); + iRenderScaleBuffer = ETrue; + iOldCropRect = croprect; + } +} + + +//============================================================================= +TPtrC8 CEngineWrapper::UpdateExifThumbnailL () +{ + LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifThumbnailL" ); + + // Create Jpeg encoder for memory buffer + MJpegSave * encoder = JpegSaveFactory::CreateJpegSaveLC (0,0); + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::0" ); + + // Initialize saving + encoder->StartSaveL (iThumbSize, TPtr8(0,0), 65536, KThumbnailJpegQuality); + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::1" ); + + // Save in blocks + TBitmapHandle bmBlock; + bmBlock.iData = new (ELeave) TUint32 [16 * 8]; + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::2" ); + + for (TInt y = 0; y < iThumbSize.iHeight; y += 8) + { + for (TInt x = 0; x < iThumbSize.iWidth; x += 16) + { + + TInt lastY = y + 8; + if (lastY >= iThumbSize.iHeight) + { + lastY = iThumbSize.iHeight - 1; + } + TInt lastX = x + 16; + if (lastX >= iThumbSize.iWidth) + { + lastX = iThumbSize.iWidth - 1; + } + + TUint32 * pDOS = (TUint32 *)bmBlock.iData; + TUint32 * pSOS = iThumb + y * iThumbSize.iWidth + x; + + for (TInt yy = y; yy < lastY; yy++ ) + { + + TUint32 * pD = pDOS; + pDOS += 16; + + TUint32 * pS = pSOS; + pSOS += iThumbSize.iWidth; + + for (TInt xx = x; xx < lastX; xx++ ) + { + *pD++ = *pS++; + } + } + + + encoder->SaveBlock (bmBlock); + } + } + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::3" ); + + delete (TUint32 *)bmBlock.iData; + bmBlock.iData = NULL; + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::4" ); + + TPtrC8 thumbNail = encoder->Finalize(); + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::5" ); + + TPtrC8 exif = iExifParser->SaveL (thumbNail); + + LOG ( KEngineWrapperLogFile, "UpdateExifThumbnailL::6" ); + + CleanupStack::PopAndDestroy (); // encoder + + return exif; +} + +//============================================================================= +void CEngineWrapper::UpdateExifTagsL() +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL" ); + + // DateTime + LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- DateTime" ); + TBuf8<64> dateTimeBuf; + GetCurrentDateTime ( dateTimeBuf ); + iExifParser->DeleteTag ( CExifParser::EIfd0, 0x0132); + iExifParser->AddTagL ( CExifParser::EIfd0, 0x0132, dateTimeBuf.PtrZ()); + + TInt n = iMainEngine->NumFilters(); + MImageFilter * filter = iMainEngine->Filter(n - 2); + + TInt targetWidth = (TReal)(filter->ViewPortSize().iWidth * iSysPars->Scale()) + 0.5; + TInt targetHeight = (TReal)(filter->ViewPortSize().iHeight * iSysPars->Scale()) + 0.5; + + // ImageWidth - not needed + iExifParser->DeleteTag ( CExifParser::EIfd0, 0x0100); + + // ImageHeight - not needed + iExifParser->DeleteTag ( CExifParser::EIfd0, 0x0101); + + // Orientation + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0112) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- Orientation" ); + iExifParser->AddTagL ( CExifParser::EIfd0, 0x0112, (TUint16)1); + } + + // EXIF version + TUint8 exifVersion [] = "0220"; + if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0x9000) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ExifVersion" ); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9000, TPtrC8 (exifVersion)); + } + + // FlashPixVersion + TUint8 flashPixVersion [] = "0100"; + if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0xA000) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- FlashPixVersion" ); + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA000); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA000, TPtrC8 (flashPixVersion)); + } + + // ComponentsConfiguration + TUint8 exifComponentsConfiguration [4] = {1,2,3,0}; + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ComponentsConfiguration" ); + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0x9101); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9101, TPtrC8(exifComponentsConfiguration, 4)); + + // ColorSpace + LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ColorSpace" ); + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA001); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA001, (TUint16)1); + + // Interoperability index + iExifParser->DeleteTag ( CExifParser::EInteroperability, 0x0001); + + // PixelXResolution + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- PlaneXResolution" ); + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA002); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA002,(TUint32)targetWidth); + + // PixelYResolution + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- PlaneYResolution" ); + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA003); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0xA003, (TUint32)targetHeight); + + // FocalPlaneResolutionUnit + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA210); + + // FocalPlaneXResolution + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA20E); + + // FocalPlaneYResolution + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0xA20F); + + // User Comment + TBuf8<256> comment; + TUint8 KCharCode[8] = {0x41,0x53,0x43,0x49,0x49,0x00,0x00,0x00}; // ASCII char code + comment.Append(TPtrC8(KCharCode, 8)); + comment.AppendFormat(KImageEditorExifComment, my_version_major, my_version_minor, my_version_build); + + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- UserComment" ); + iExifParser->DeleteTag ( CExifParser::ESubIfd, 0x9286); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9286, comment); + + TBuf8<128> make; + TBuf8<128> model; + ImageEditorUtils::GetMakeAndModelL ( make, model ); + + // Make + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x010F) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- Make updated" ); + iExifParser->AddTagL ( CExifParser::EIfd0, 0x010F, make.PtrZ()); + } + + // Model + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0110) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- Model updated" ); + iExifParser->AddTagL ( CExifParser::EIfd0, 0x0110, model.PtrZ()); + } + + // DateTimeOriginal + if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0x9003) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- DateTimeOriginal updated" ); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9003, dateTimeBuf.PtrZ()); + } + + // DateTimeDigitized + if ( !iExifParser->TagExist (CExifParser::ESubIfd, 0x9004) ) + { + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- DateTimeDigitized updated" ); + iExifParser->AddTagL ( CExifParser::ESubIfd, 0x9004, dateTimeBuf.PtrZ()); + } + + // XResolution + LOG ( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- XResolution" ); + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x011A) ) + { + iExifParser->AddTagL ( CExifParser::EIfd0, 0x011A, (TUint32)300, (TUint32)1); + } + + // YResolution + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- YResolution" ); + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x011B) ) + { + iExifParser->AddTagL ( CExifParser::EIfd0, 0x011B, (TUint32)300, (TUint32)1); + } + + // ResolutionUnit + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- ResolutionUnit" ); + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0128) ) + { + iExifParser->AddTagL ( CExifParser::EIfd0, 0x0128, (TUint16)2 ); + } + + // YCbCrPositioning + LOG( KEngineWrapperLogFile, "CEngineWrapper::UpdateExifTagsL() -- YCbCrPositioning" ); + if ( !iExifParser->TagExist (CExifParser::EIfd0, 0x0213) ) + { + iExifParser->AddTagL ( CExifParser::EIfd0, 0x0213, (TUint16)1 ); + } + + +} + +//============================================================================= +void CEngineWrapper::GetCurrentDateTime (TDes8 & aDateTimeBuf) const +{ + // Time in microseconds since 0 AD nominal Gregorian + TTime time; + // year-month-day-hour-minute-second-microsecond + TDateTime dateTime; + + // Get current local time + time.HomeTime(); + + // Convert to fields + dateTime = time.DateTime(); + + // Create descriptors for the components. + // This is needed because the leading zeros + // cannotbe suppressed. + TBuf8<2> month; + TBuf8<2> day; + TBuf8<2> hour; + TBuf8<2> minute; + TBuf8<2> second; + + if( TInt(dateTime.Month()) < 9 ) + { + month.AppendNum( 0 ); + } + month.AppendNum( TInt(dateTime.Month()+1) ); + + if( dateTime.Day() < 9 ) + { + day.AppendNum( 0 ); + } + day.AppendNum( dateTime.Day()+1 ); + + if( dateTime.Hour() < 10 ) + { + hour.AppendNum( 0 ); + } + hour.AppendNum( dateTime.Hour() ); + + if( dateTime.Minute() < 10 ) + { + minute.AppendNum( 0 ); + } + minute.AppendNum( dateTime.Minute() ); + + if( dateTime.Second() < 10 ) + { + second.AppendNum( 0 ); + } + second.AppendNum( dateTime.Second() ); + + // Format the time to the format + // "YYYY:MM:DD HH:MM:SS" + _LIT8(KFormatTxt,"%d:%S:%S %S:%S:%S"); + aDateTimeBuf.Format( + KFormatTxt, + dateTime.Year(), + &month, + &day, + &hour, + &minute, + &second + ); +} + +//============================================================================= +EXPORT_C void CEngineWrapper::SetBitmap (CFbsBitmap * aBitmap) +{ + iScreenBitmap = aBitmap; +} + + +//============================================================================= +EXPORT_C void CEngineWrapper::CreateExifThumbNailL () +{ + LOG( KEngineWrapperLogFile, "CEngineWrapper::CreateExifThumbNailL" ); + +#ifdef EXIF_SUPPORT + + // Delete old thumbnail + delete[] iThumb; + iThumb = NULL; + + // Re-load the zoomed image if needed + if ( iRenderScaleBuffer ) + { + iMainEngine->FunctionL ( 0, _L("loadimage")); + iRenderScaleBuffer = EFalse; + } + for ( TInt i = 0; i < iMainEngine->NumFilters(); ++i) + { + iMainEngine->FunctionL (i, _L("nop")); + } + + TReal scale = 1.0; + TSize imagesize = iMainEngine->Filter(iMainEngine->NumFilters() - 3)->Rect().Size(); + if (imagesize.iWidth > imagesize.iHeight) + { + scale = (TReal)imagesize.iWidth / KThumbnailMaxDimension; + } + else + { + scale = (TReal)imagesize.iHeight / KThumbnailMaxDimension; + } + + // Crete new thumbnail + iThumbSize.iWidth = (TInt)((imagesize.iWidth / scale) + 0.5); + iThumbSize.iHeight = (TInt)((imagesize.iHeight / scale) + 0.5); + + // Just ensure that dimension are never 0 + if (iThumbSize.iWidth == 0) + { + iThumbSize.iWidth = 1; + } + if (iThumbSize.iHeight == 0) + { + iThumbSize.iHeight = 1; + } + + LOGFMT( KEngineWrapperLogFile, "iThumbSize.iWidth = %d", iThumbSize.iWidth); + LOGFMT( KEngineWrapperLogFile, "iThumbSize.iHeight = %d", iThumbSize.iHeight); + + iThumb = new (ELeave) TUint32 [iThumbSize.iWidth * iThumbSize.iHeight]; + + // Set thumbnail size to buffer filter + iCmd.Format( _L("width %d height %d"), iThumbSize.iWidth, iThumbSize.iHeight); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 1, iCmd ); + iMainEngine->FunctionL ( iMainEngine->NumFilters() - 2, _L("nop")); + + // Copy data to the new thumbnail + TUint32 * pBuffer = (TUint32 *)iMainEngine->FunctionL (iMainEngine->NumFilters() - 1, _L("getbitmap")); + Mem::Copy (iThumb, pBuffer, iThumbSize.iWidth * iThumbSize.iHeight * sizeof(TUint32)); + + LOG( KEngineWrapperLogFile, "EXIF thumbnail created!" ); + +#endif +} + + +//============================================================================= +TInt CEngineWrapper::ComputeRotationL () +{ + + TInt angle = 0; + TInt ind = 0; + while ( ind < iMainEngine->NumFilters() ) + { + MImageFilter * filter = iMainEngine->Filter(ind); + char * cmpstr = "rotate"; + TPtrC8 type ( (const TUint8 *)filter->Type() ); + TPtrC8 typecmp ((const TUint8 *)cmpstr); + if ( type == typecmp ) + { + angle += filter->CmdL(_L("getangle")); + } + ind++; + } + angle %= 360; + return angle; +} + + +//============================================================================= +void CEngineWrapper::ComputeBoundingRectL() +{ + MImageFilter * pFilter = iMainEngine->Filter(iMainEngine->NumFilters() - 3); + TReal relscale = pFilter->Scale(); + TRect rect = pFilter->Rect(); + TSize size = iMainEngine->Filter(0)->ViewPortSize(); + rect.iTl.iX = (TInt)((rect.iTl.iX / relscale) + 0.5); + rect.iTl.iY = (TInt)((rect.iTl.iY / relscale) + 0.5); + rect.iBr.iX = (TInt)((rect.iBr.iX / relscale) + 0.5); + rect.iBr.iY = (TInt)((rect.iBr.iY / relscale) + 0.5); + TInt angle = ComputeRotationL(); + + if (angle == 90 || angle == 270) + { + iBoundingRect.iTl.iX = rect.iTl.iY; + iBoundingRect.iTl.iY = rect.iTl.iX; + iBoundingRect.iBr.iX = rect.iBr.iY; + iBoundingRect.iBr.iY = rect.iBr.iX; + } + else + { + iBoundingRect = rect; + } + + size = iBoundingRect.Size(); + iPanX = (iBoundingRect.iTl.iX + iBoundingRect.iBr.iX) / 2; + iPanY = (iBoundingRect.iTl.iY + iBoundingRect.iBr.iY) / 2; +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/EABI/ImageEditorUtils.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/EABI/ImageEditorUtils.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,118 @@ +EXPORTS + _ZN11CObCallback10DoCallbackEi @ 1 NONAME + _ZN11CObCallback4NewLEP17MObCallbackMethod @ 2 NONAME + _ZN11CObCallbackD0Ev @ 3 NONAME + _ZN11CObCallbackD1Ev @ 4 NONAME + _ZN11CObCallbackD2Ev @ 5 NONAME + _ZN11CPluginInfo10ParametersEv @ 6 NONAME + _ZN11CPluginInfo10PluginNameEv @ 7 NONAME + _ZN11CPluginInfo11PluginScopeEv @ 8 NONAME + _ZN11CPluginInfo12InternalizeLER11RReadStream @ 9 NONAME + _ZN11CPluginInfo12PluginUiTypeEv @ 10 NONAME + _ZN11CPluginInfo16PluginFilterTypeEv @ 11 NONAME + _ZN11CPluginInfo17ComparePluginInfoERKS_S1_ @ 12 NONAME + _ZN11CPluginInfo18ComparePluginOrderERKS_S1_ @ 13 NONAME + _ZN11CPluginInfo18PluginDisplayOrderEv @ 14 NONAME + _ZN11CPluginInfo4IconEv @ 15 NONAME + _ZN11CPluginInfo4MaskEv @ 16 NONAME + _ZN11CPluginInfo4NewLEv @ 17 NONAME + _ZN11CPluginInfo4Uid2Ev @ 18 NONAME + _ZN11CPluginInfo4Uid3Ev @ 19 NONAME + _ZN11CPluginInfo5NewLCEv @ 20 NONAME + _ZN11CPluginInfo7MSKCmdsEv @ 21 NONAME + _ZN11CPluginInfo7Sk1CmdsEv @ 22 NONAME + _ZN11CPluginInfo7Sk2CmdsEv @ 23 NONAME + _ZN11CPluginInfo8IconFileEv @ 24 NONAME + _ZN11CPluginInfo8MSKTextsEv @ 25 NONAME + _ZN11CPluginInfo8Sk1TextsEv @ 26 NONAME + _ZN11CPluginInfo8Sk2TextsEv @ 27 NONAME + _ZN11CPluginInfo9MenuItemsEv @ 28 NONAME + _ZN11CPluginInfo9PluginDllEv @ 29 NONAME + _ZN11CPluginInfo9PluginRIDEv @ 30 NONAME + _ZN11CPluginInfoD0Ev @ 31 NONAME + _ZN11CPluginInfoD1Ev @ 32 NONAME + _ZN11CPluginInfoD2Ev @ 33 NONAME + _ZN15CResolutionUtil11InitializeLEv @ 34 NONAME + _ZN15CResolutionUtil12SetLandscapeEi @ 35 NONAME + _ZN15CResolutionUtil13SetClientRectERK5TRect @ 36 NONAME + _ZN15CResolutionUtil13SetFullScreenEi @ 37 NONAME + _ZN15CResolutionUtil13SetScreenRectERK5TRect @ 38 NONAME + _ZN15CResolutionUtil16UpdateScreenModeEv @ 39 NONAME + _ZN15CResolutionUtil4SelfEv @ 40 NONAME + _ZN15CResolutionUtilD0Ev @ 41 NONAME + _ZN15CResolutionUtilD1Ev @ 42 NONAME + _ZN15CResolutionUtilD2Ev @ 43 NONAME + _ZN16ImageEditorUtils16GetMakeAndModelLER5TDes8S1_ @ 44 NONAME + _ZN16ImageEditorUtils17GenerateFilePathLER3RFsRK7TDesC16R6TDes16NS_16TMemorySelectionE @ 45 NONAME + _ZN16ImageEditorUtils17ImageFitsToDriveLER3RFsRK7TDesC16S4_ @ 46 NONAME + _ZN16ImageEditorUtils17ImagesFitToDriveLER3RFsRK12CDesC16ArrayS4_ @ 47 NONAME + _ZN16ImageEditorUtils20AddImageFileToAlbumLERK7TDesC16i @ 48 NONAME + _ZN16ImageEditorUtils20GenerateNewFileNameLER3RFsRK7TDesC16R6TDes164TBufILi256EEPK12CDesC16Array @ 49 NONAME + _ZN16ImageEditorUtils23FindAlbumsForImageFileLER6RArrayIiERK7TDesC16 @ 50 NONAME + _ZN16ImageEditorUtils23NotifyNewMediaDocumentLER3RFsRK12MDesC16Array @ 51 NONAME + _ZN16ImageEditorUtils23NotifyNewMediaDocumentLER3RFsRK7TDesC16 @ 52 NONAME + _ZN16ImageEditorUtils24GenerateNewDocumentNameLER3RFsRK7TDesC16R6TDes16P6RArrayIiEPK12CDesC16ArrayNS_16TMemorySelectionE @ 53 NONAME + _ZN16ImageEditorUtils8CopyFileER3RFsRK7TDesC16S4_i @ 54 NONAME + _ZN8CLogFile10LogNewlineEv @ 55 NONAME + _ZN8CLogFile10StaticLogLERK7TDesC16RK6TDesC8 @ 56 NONAME + _ZN8CLogFile10StaticLogLERK7TDesC16S2_ @ 57 NONAME + _ZN8CLogFile12SetAutoFlushEi @ 58 NONAME + _ZN8CLogFile14SetAutoNewlineEi @ 59 NONAME + _ZN8CLogFile16SetAutoTimeStampEi @ 60 NONAME + _ZN8CLogFile3LogERK6TDesC8 @ 61 NONAME + _ZN8CLogFile3LogERK7TDesC16 @ 62 NONAME + _ZN8CLogFile3LogEh @ 63 NONAME + _ZN8CLogFile3LogEj @ 64 NONAME + _ZN8CLogFile4NewLERK7TDesC16i @ 65 NONAME + _ZN8CLogFile5NewLCERK7TDesC16i @ 66 NONAME + _ZN8CLogFile7LogTimeEv @ 67 NONAME + _ZN8CLogFile8LogBytesERK6TDesC8 @ 68 NONAME + _ZN8CLogFile9StaticLogERK7TDesC16RK6TDesC8 @ 69 NONAME + _ZN8CLogFile9StaticLogERK7TDesC16S2_ @ 70 NONAME + _ZN8CLogFileD0Ev @ 71 NONAME + _ZN8CLogFileD1Ev @ 72 NONAME + _ZN8CLogFileD2Ev @ 73 NONAME + _ZN9TBitField5ResetEv @ 74 NONAME + _ZN9TBitField6SetBitEm @ 75 NONAME + _ZN9TBitFieldC1ERKS_ @ 76 NONAME + _ZN9TBitFieldC1Ev @ 77 NONAME + _ZN9TBitFieldC2ERKS_ @ 78 NONAME + _ZN9TBitFieldC2Ev @ 79 NONAME + _ZN9TBitFieldD1Ev @ 80 NONAME + _ZN9TBitFieldD2Ev @ 81 NONAME + _ZN9TBitFieldaSERKS_ @ 82 NONAME + _ZNK11CPluginInfo10ParametersEv @ 83 NONAME + _ZNK11CPluginInfo10PluginNameEv @ 84 NONAME + _ZNK11CPluginInfo11PluginScopeEv @ 85 NONAME + _ZNK11CPluginInfo12ExternalizeLER12RWriteStream @ 86 NONAME + _ZNK11CPluginInfo12PluginUiTypeEv @ 87 NONAME + _ZNK11CPluginInfo16PluginFilterTypeEv @ 88 NONAME + _ZNK11CPluginInfo18PluginDisplayOrderEv @ 89 NONAME + _ZNK11CPluginInfo4IconEv @ 90 NONAME + _ZNK11CPluginInfo4MaskEv @ 91 NONAME + _ZNK11CPluginInfo4Uid2Ev @ 92 NONAME + _ZNK11CPluginInfo4Uid3Ev @ 93 NONAME + _ZNK11CPluginInfo7MSKCmdsEv @ 94 NONAME + _ZNK11CPluginInfo7Sk1CmdsEv @ 95 NONAME + _ZNK11CPluginInfo7Sk2CmdsEv @ 96 NONAME + _ZNK11CPluginInfo8IconFileEv @ 97 NONAME + _ZNK11CPluginInfo8MSKTextsEv @ 98 NONAME + _ZNK11CPluginInfo8Sk1TextsEv @ 99 NONAME + _ZNK11CPluginInfo8Sk2TextsEv @ 100 NONAME + _ZNK11CPluginInfo9MenuItemsEv @ 101 NONAME + _ZNK11CPluginInfo9PluginDllEv @ 102 NONAME + _ZNK11CPluginInfo9PluginRIDEv @ 103 NONAME + _ZNK15CResolutionUtil10ScreenModeEv @ 104 NONAME + _ZNK15CResolutionUtil12GetLandscapeEv @ 105 NONAME + _ZNK15CResolutionUtil13GetClientRectER5TRect @ 106 NONAME + _ZNK15CResolutionUtil13GetFullScreenEv @ 107 NONAME + _ZNK15CResolutionUtil13GetScreenModeEv @ 108 NONAME + _ZNK15CResolutionUtil13GetScreenRectER5TRect @ 109 NONAME + _ZNK9TBitField6GetBitEm @ 110 NONAME + _ZTI11CObCallback @ 111 NONAME ; ## + _ZTI11CPluginInfo @ 112 NONAME ; ## + _ZTI15CResolutionUtil @ 113 NONAME ; ## + _ZTV11CObCallback @ 114 NONAME ; ## + _ZTV11CPluginInfo @ 115 NONAME ; ## + _ZTV15CResolutionUtil @ 116 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/bwins/ImageEditorUtils.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/bwins/ImageEditorUtils.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,101 @@ +EXPORTS + ??0TBitField@@QAE@ABV0@@Z @ 1 NONAME ; TBitField::TBitField(class TBitField const &) + ??0TBitField@@QAE@XZ @ 2 NONAME ; TBitField::TBitField(void) + ??1CLogFile@@UAE@XZ @ 3 NONAME ; CLogFile::~CLogFile(void) + ??1CObCallback@@UAE@XZ @ 4 NONAME ; CObCallback::~CObCallback(void) + ??1CPluginInfo@@UAE@XZ @ 5 NONAME ; CPluginInfo::~CPluginInfo(void) + ??1CResolutionUtil@@UAE@XZ @ 6 NONAME ; CResolutionUtil::~CResolutionUtil(void) + ??1TBitField@@QAE@XZ @ 7 NONAME ; TBitField::~TBitField(void) + ??4TBitField@@QAEAAV0@ABV0@@Z @ 8 NONAME ; class TBitField & TBitField::operator=(class TBitField const &) + ?AddImageFileToAlbumL@ImageEditorUtils@@SAXABVTDesC16@@H@Z @ 9 NONAME ; void ImageEditorUtils::AddImageFileToAlbumL(class TDesC16 const &, int) + ?ComparePluginInfo@CPluginInfo@@SAHABV1@0@Z @ 10 NONAME ; int CPluginInfo::ComparePluginInfo(class CPluginInfo const &, class CPluginInfo const &) + ?ComparePluginOrder@CPluginInfo@@SAHABV1@0@Z @ 11 NONAME ; int CPluginInfo::ComparePluginOrder(class CPluginInfo const &, class CPluginInfo const &) + ?CopyFile@ImageEditorUtils@@SAHAAVRFs@@ABVTDesC16@@1H@Z @ 12 NONAME ; int ImageEditorUtils::CopyFile(class RFs &, class TDesC16 const &, class TDesC16 const &, int) + ?DoCallback@CObCallback@@QAEXH@Z @ 13 NONAME ; void CObCallback::DoCallback(int) + ?ExternalizeL@CPluginInfo@@QBEXAAVRWriteStream@@@Z @ 14 NONAME ; void CPluginInfo::ExternalizeL(class RWriteStream &) const + ?FindAlbumsForImageFileL@ImageEditorUtils@@SAXAAV?$RArray@H@@ABVTDesC16@@@Z @ 15 NONAME ; void ImageEditorUtils::FindAlbumsForImageFileL(class RArray &, class TDesC16 const &) + ?GenerateFilePathL@ImageEditorUtils@@SAHAAVRFs@@ABVTDesC16@@AAVTDes16@@W4TMemorySelection@1@@Z @ 16 NONAME ; int ImageEditorUtils::GenerateFilePathL(class RFs &, class TDesC16 const &, class TDes16 &, enum ImageEditorUtils::TMemorySelection) + ?GenerateNewDocumentNameL@ImageEditorUtils@@SAHAAVRFs@@ABVTDesC16@@AAVTDes16@@PAV?$RArray@H@@PBVCDesC16Array@@W4TMemorySelection@1@@Z @ 17 NONAME ; int ImageEditorUtils::GenerateNewDocumentNameL(class RFs &, class TDesC16 const &, class TDes16 &, class RArray *, class CDesC16Array const *, enum ImageEditorUtils::TMemorySelection) + ?GenerateNewFileNameL@ImageEditorUtils@@SAHAAVRFs@@ABVTDesC16@@AAVTDes16@@V?$TBuf@$0BAA@@@PBVCDesC16Array@@@Z @ 18 NONAME ; int ImageEditorUtils::GenerateNewFileNameL(class RFs &, class TDesC16 const &, class TDes16 &, class TBuf<256>, class CDesC16Array const *) + ?GetBit@TBitField@@QBEHK@Z @ 19 NONAME ; int TBitField::GetBit(unsigned long) const + ?GetClientRect@CResolutionUtil@@QBEXAAVTRect@@@Z @ 20 NONAME ; void CResolutionUtil::GetClientRect(class TRect &) const + ?GetFullScreen@CResolutionUtil@@QBEHXZ @ 21 NONAME ; int CResolutionUtil::GetFullScreen(void) const + ?GetLandscape@CResolutionUtil@@QBEHXZ @ 22 NONAME ; int CResolutionUtil::GetLandscape(void) const + ?GetMakeAndModelL@ImageEditorUtils@@SAXAAVTDes8@@0@Z @ 23 NONAME ; void ImageEditorUtils::GetMakeAndModelL(class TDes8 &, class TDes8 &) + ?GetScreenMode@CResolutionUtil@@QBEHXZ @ 24 NONAME ; int CResolutionUtil::GetScreenMode(void) const + ?GetScreenRect@CResolutionUtil@@QBEXAAVTRect@@@Z @ 25 NONAME ; void CResolutionUtil::GetScreenRect(class TRect &) const + ?Icon@CPluginInfo@@QAEAAPAVCFbsBitmap@@XZ @ 26 NONAME ; class CFbsBitmap * & CPluginInfo::Icon(void) + ?Icon@CPluginInfo@@QBEPBVCFbsBitmap@@XZ @ 27 NONAME ; class CFbsBitmap const * CPluginInfo::Icon(void) const + ?IconFile@CPluginInfo@@QAEAAPAVHBufC16@@XZ @ 28 NONAME ; class HBufC16 * & CPluginInfo::IconFile(void) + ?IconFile@CPluginInfo@@QBEABVTDesC16@@XZ @ 29 NONAME ; class TDesC16 const & CPluginInfo::IconFile(void) const + ?ImageFitsToDriveL@ImageEditorUtils@@SAHAAVRFs@@ABVTDesC16@@1@Z @ 30 NONAME ; int ImageEditorUtils::ImageFitsToDriveL(class RFs &, class TDesC16 const &, class TDesC16 const &) + ?ImagesFitToDriveL@ImageEditorUtils@@SAHAAVRFs@@ABVCDesC16Array@@1@Z @ 31 NONAME ; int ImageEditorUtils::ImagesFitToDriveL(class RFs &, class CDesC16Array const &, class CDesC16Array const &) + ?InitializeL@CResolutionUtil@@SAPAV1@XZ @ 32 NONAME ; class CResolutionUtil * CResolutionUtil::InitializeL(void) + ?InternalizeL@CPluginInfo@@QAEXAAVRReadStream@@@Z @ 33 NONAME ; void CPluginInfo::InternalizeL(class RReadStream &) + ?Log@CLogFile@@QAEXABVTDesC16@@@Z @ 34 NONAME ; void CLogFile::Log(class TDesC16 const &) + ?Log@CLogFile@@QAEXABVTDesC8@@@Z @ 35 NONAME ; void CLogFile::Log(class TDesC8 const &) + ?Log@CLogFile@@QAEXE@Z @ 36 NONAME ; void CLogFile::Log(unsigned char) + ?Log@CLogFile@@QAEXI@Z @ 37 NONAME ; void CLogFile::Log(unsigned int) + ?LogBytes@CLogFile@@QAEXABVTDesC8@@@Z @ 38 NONAME ; void CLogFile::LogBytes(class TDesC8 const &) + ?LogNewline@CLogFile@@QAEXXZ @ 39 NONAME ; void CLogFile::LogNewline(void) + ?LogTime@CLogFile@@QAEXXZ @ 40 NONAME ; void CLogFile::LogTime(void) + ?MSKCmds@CPluginInfo@@QAEAAV?$CArrayFix@H@@XZ @ 41 NONAME ; class CArrayFix & CPluginInfo::MSKCmds(void) + ?MSKCmds@CPluginInfo@@QBEABV?$CArrayFix@H@@XZ @ 42 NONAME ; class CArrayFix const & CPluginInfo::MSKCmds(void) const + ?MSKTexts@CPluginInfo@@QAEAAVCDesC16Array@@XZ @ 43 NONAME ; class CDesC16Array & CPluginInfo::MSKTexts(void) + ?MSKTexts@CPluginInfo@@QBEABVCDesC16Array@@XZ @ 44 NONAME ; class CDesC16Array const & CPluginInfo::MSKTexts(void) const + ?Mask@CPluginInfo@@QAEAAPAVCFbsBitmap@@XZ @ 45 NONAME ; class CFbsBitmap * & CPluginInfo::Mask(void) + ?Mask@CPluginInfo@@QBEPBVCFbsBitmap@@XZ @ 46 NONAME ; class CFbsBitmap const * CPluginInfo::Mask(void) const + ?MenuItems@CPluginInfo@@QAEAAV?$CArrayFixSeg@USData@CEikMenuPaneItem@@@@XZ @ 47 NONAME ; class CArrayFixSeg & CPluginInfo::MenuItems(void) + ?MenuItems@CPluginInfo@@QBEABV?$CArrayFixSeg@USData@CEikMenuPaneItem@@@@XZ @ 48 NONAME ; class CArrayFixSeg const & CPluginInfo::MenuItems(void) const + ?NewL@CLogFile@@SAPAV1@ABVTDesC16@@H@Z @ 49 NONAME ; class CLogFile * CLogFile::NewL(class TDesC16 const &, int) + ?NewL@CObCallback@@SAPAV1@PAVMObCallbackMethod@@@Z @ 50 NONAME ; class CObCallback * CObCallback::NewL(class MObCallbackMethod *) + ?NewL@CPluginInfo@@SAPAV1@XZ @ 51 NONAME ; class CPluginInfo * CPluginInfo::NewL(void) + ?NewLC@CLogFile@@SAPAV1@ABVTDesC16@@H@Z @ 52 NONAME ; class CLogFile * CLogFile::NewLC(class TDesC16 const &, int) + ?NewLC@CPluginInfo@@SAPAV1@XZ @ 53 NONAME ; class CPluginInfo * CPluginInfo::NewLC(void) + ?NotifyNewMediaDocumentL@ImageEditorUtils@@SAXAAVRFs@@ABVMDesC16Array@@@Z @ 54 NONAME ; void ImageEditorUtils::NotifyNewMediaDocumentL(class RFs &, class MDesC16Array const &) + ?NotifyNewMediaDocumentL@ImageEditorUtils@@SAXAAVRFs@@ABVTDesC16@@@Z @ 55 NONAME ; void ImageEditorUtils::NotifyNewMediaDocumentL(class RFs &, class TDesC16 const &) + ?Parameters@CPluginInfo@@QAEAAVCDesC16Array@@XZ @ 56 NONAME ; class CDesC16Array & CPluginInfo::Parameters(void) + ?Parameters@CPluginInfo@@QBEABVCDesC16Array@@XZ @ 57 NONAME ; class CDesC16Array const & CPluginInfo::Parameters(void) const + ?PluginDisplayOrder@CPluginInfo@@QAEAAHXZ @ 58 NONAME ; int & CPluginInfo::PluginDisplayOrder(void) + ?PluginDisplayOrder@CPluginInfo@@QBEABHXZ @ 59 NONAME ; int const & CPluginInfo::PluginDisplayOrder(void) const + ?PluginDll@CPluginInfo@@QAEAAPAVHBufC16@@XZ @ 60 NONAME ; class HBufC16 * & CPluginInfo::PluginDll(void) + ?PluginDll@CPluginInfo@@QBEABVTDesC16@@XZ @ 61 NONAME ; class TDesC16 const & CPluginInfo::PluginDll(void) const + ?PluginFilterType@CPluginInfo@@QAEAAHXZ @ 62 NONAME ; int & CPluginInfo::PluginFilterType(void) + ?PluginFilterType@CPluginInfo@@QBEABHXZ @ 63 NONAME ; int const & CPluginInfo::PluginFilterType(void) const + ?PluginName@CPluginInfo@@QAEAAPAVHBufC16@@XZ @ 64 NONAME ; class HBufC16 * & CPluginInfo::PluginName(void) + ?PluginName@CPluginInfo@@QBEABVTDesC16@@XZ @ 65 NONAME ; class TDesC16 const & CPluginInfo::PluginName(void) const + ?PluginRID@CPluginInfo@@QAEAAHXZ @ 66 NONAME ; int & CPluginInfo::PluginRID(void) + ?PluginRID@CPluginInfo@@QBEABHXZ @ 67 NONAME ; int const & CPluginInfo::PluginRID(void) const + ?PluginScope@CPluginInfo@@QAEAAHXZ @ 68 NONAME ; int & CPluginInfo::PluginScope(void) + ?PluginScope@CPluginInfo@@QBEABHXZ @ 69 NONAME ; int const & CPluginInfo::PluginScope(void) const + ?PluginUiType@CPluginInfo@@QAEAAHXZ @ 70 NONAME ; int & CPluginInfo::PluginUiType(void) + ?PluginUiType@CPluginInfo@@QBEABHXZ @ 71 NONAME ; int const & CPluginInfo::PluginUiType(void) const + ?Reset@TBitField@@QAEXXZ @ 72 NONAME ; void TBitField::Reset(void) + ?ScreenMode@CResolutionUtil@@QBEHXZ @ 73 NONAME ; int CResolutionUtil::ScreenMode(void) const + ?Self@CResolutionUtil@@SAPAV1@XZ @ 74 NONAME ; class CResolutionUtil * CResolutionUtil::Self(void) + ?SetAutoFlush@CLogFile@@QAEXH@Z @ 75 NONAME ; void CLogFile::SetAutoFlush(int) + ?SetAutoNewline@CLogFile@@QAEXH@Z @ 76 NONAME ; void CLogFile::SetAutoNewline(int) + ?SetAutoTimeStamp@CLogFile@@QAEXH@Z @ 77 NONAME ; void CLogFile::SetAutoTimeStamp(int) + ?SetBit@TBitField@@QAEXK@Z @ 78 NONAME ; void TBitField::SetBit(unsigned long) + ?SetClientRect@CResolutionUtil@@QAEXABVTRect@@@Z @ 79 NONAME ; void CResolutionUtil::SetClientRect(class TRect const &) + ?SetFullScreen@CResolutionUtil@@QAEXH@Z @ 80 NONAME ; void CResolutionUtil::SetFullScreen(int) + ?SetLandscape@CResolutionUtil@@QAEXH@Z @ 81 NONAME ; void CResolutionUtil::SetLandscape(int) + ?SetScreenRect@CResolutionUtil@@QAEXABVTRect@@@Z @ 82 NONAME ; void CResolutionUtil::SetScreenRect(class TRect const &) + ?Sk1Cmds@CPluginInfo@@QAEAAV?$CArrayFix@H@@XZ @ 83 NONAME ; class CArrayFix & CPluginInfo::Sk1Cmds(void) + ?Sk1Cmds@CPluginInfo@@QBEABV?$CArrayFix@H@@XZ @ 84 NONAME ; class CArrayFix const & CPluginInfo::Sk1Cmds(void) const + ?Sk1Texts@CPluginInfo@@QAEAAVCDesC16Array@@XZ @ 85 NONAME ; class CDesC16Array & CPluginInfo::Sk1Texts(void) + ?Sk1Texts@CPluginInfo@@QBEABVCDesC16Array@@XZ @ 86 NONAME ; class CDesC16Array const & CPluginInfo::Sk1Texts(void) const + ?Sk2Cmds@CPluginInfo@@QAEAAV?$CArrayFix@H@@XZ @ 87 NONAME ; class CArrayFix & CPluginInfo::Sk2Cmds(void) + ?Sk2Cmds@CPluginInfo@@QBEABV?$CArrayFix@H@@XZ @ 88 NONAME ; class CArrayFix const & CPluginInfo::Sk2Cmds(void) const + ?Sk2Texts@CPluginInfo@@QAEAAVCDesC16Array@@XZ @ 89 NONAME ; class CDesC16Array & CPluginInfo::Sk2Texts(void) + ?Sk2Texts@CPluginInfo@@QBEABVCDesC16Array@@XZ @ 90 NONAME ; class CDesC16Array const & CPluginInfo::Sk2Texts(void) const + ?StaticLog@CLogFile@@SAXABVTDesC16@@0@Z @ 91 NONAME ; void CLogFile::StaticLog(class TDesC16 const &, class TDesC16 const &) + ?StaticLog@CLogFile@@SAXABVTDesC16@@ABVTDesC8@@@Z @ 92 NONAME ; void CLogFile::StaticLog(class TDesC16 const &, class TDesC8 const &) + ?StaticLogL@CLogFile@@SAXABVTDesC16@@0@Z @ 93 NONAME ; void CLogFile::StaticLogL(class TDesC16 const &, class TDesC16 const &) + ?StaticLogL@CLogFile@@SAXABVTDesC16@@ABVTDesC8@@@Z @ 94 NONAME ; void CLogFile::StaticLogL(class TDesC16 const &, class TDesC8 const &) + ?Uid2@CPluginInfo@@QAEAAVTUid@@XZ @ 95 NONAME ; class TUid & CPluginInfo::Uid2(void) + ?Uid2@CPluginInfo@@QBEABVTUid@@XZ @ 96 NONAME ; class TUid const & CPluginInfo::Uid2(void) const + ?Uid3@CPluginInfo@@QAEAAVTUid@@XZ @ 97 NONAME ; class TUid & CPluginInfo::Uid3(void) + ?Uid3@CPluginInfo@@QBEABVTUid@@XZ @ 98 NONAME ; class TUid const & CPluginInfo::Uid3(void) const + ?UpdateScreenMode@CResolutionUtil@@QAEXXZ @ 99 NONAME ; void CResolutionUtil::UpdateScreenMode(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/group/ImageEditorUtils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/group/ImageEditorUtils.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,81 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +#if defined( __LANDSCAPE_SUPPORT__ ) +MACRO LANDSCAPE_SUPPORT +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +LIBRARY flogger.lib +#endif + + +TARGET ImageEditorUtils.dll +TARGETTYPE dll +UID 0x1000008d + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE BitField.cpp +SOURCE PluginInfo.cpp +SOURCE Callback.cpp +SOURCE ResolutionUtil.cpp +SOURCE ImageEditorUtils.cpp +SOURCE logfile.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +// Default system include paths for middleware layer modules. +APP_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY avkon.lib +LIBRARY euser.lib +LIBRARY cone.lib +LIBRARY bafl.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY hal.lib // for CLogFile +LIBRARY platformenv.lib +LIBRARY sysutil.lib +LIBRARY charconv.lib +LIBRARY Etel3rdParty.lib + +#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +EXPORTUNFROZEN +#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,37 @@ +/* +* 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: +* +*/ + + +#include +#include "../../group/definitions.def" + + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorUtils.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorUtils.iby) + +// mmp files +PRJ_MMPFILES +ImageEditorUtils.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/inc/logfile.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/inc/logfile.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,333 @@ +/* +* 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: +* +*/ + + +#ifndef __LOGFILE_H__ +#define __LOGFILE_H__ + +#include +#include + +// Link with the following libraries: EFSRV.LIB HAL.LIB CHARCONV.LIB + +/* +#define LOG_INIT(name) CLogFile *log = CLogFile::NewL(_L(name), ETrue); + +#define LOG_INIT2(name) CLogFile *log = CLogFile::NewL(_L(name), EFalse); + +#define LOG(event) \ + log->Log(_L(event));\ + log->LogNewline(); + +#define LOGNLN(event) \ + log->Log(_L(event));\ + +#define LOGS(event) \ + log->Log(event);\ + log->LogNewline(); + +#define LOGN(num) \ + TBuf<64> log_num;\ + log_num.AppendNum(num); \ + log->Log(log_num);\ + log->LogNewline(); + +#define LOGF(numf) \ + TBuf<16> log_float;\ + log_float.AppendNum(numf, TRealFormat());\ + log->Log(log_float);\ + log->LogNewline(); + +#define LOGN2(text, num) \ + TBuf<64> log_num;\ + log_num.AppendNum(num);\ + log->Log(_L(text));\ + log->Log(log_num);\ + log->LogNewline(); + +#define LOGF2(text, numf) \ + TBuf<16> log_float;\ + log_float.AppendNum(numf, TRealFormat());\ + log->Log(_L(text));\ + log->Log(log_float);\ + log->LogNewline(); + +#define LOG_END \ + delete log;\ + log = 0; +*/ + + + +/*! + @class CLogFile + + @discussion Class to generate a text file containing logging information + */ +NONSHARABLE_CLASS( CLogFile ) : public CBase + { +public: +/*! + @function NewL + + @discussion Create a CLogFile object + @param aFileName the name of the file to create + @param aInitialiseLog if true, and the log file already exists, previous + contents will be deleted. If false, append to any existing contents + @result a pointer to the created instance of CLogFile + */ + IMPORT_C static CLogFile* NewL(const TDesC& aFileName, TBool aInitialiseLog); + +/*! + @function NewLC + + @discussion Create a CLogFile object + @param aFileName the name of the file to create + @param aInitialiseLog if true, and the log file already exists, previous + contents will be deleted. If false, append to any existing contents + @result a pointer to the created instance of CLogFile + */ + IMPORT_C static CLogFile* NewLC(const TDesC& aFileName, TBool aInitialiseLog); + +/*! + @function ~CLogFile + + @discussion Destroy the object and release all memory objects + */ + IMPORT_C ~CLogFile(); + +/*! + @function Log + + @discussion Append the byte to the log file (if not a printable char, it will be logged as ascii-hex) + @param aByte the byte to log + */ + IMPORT_C void Log(TUint8 aByte); + +/*! + @function Log + + @discussion Append the integer to the log file (logged as ascii-hex) + @param aNumber the integer to log + */ + IMPORT_C void Log(TUint aNumber); + +/*! + @function Log + + @discussion Append text to the log file + @param aText the text to log + */ + IMPORT_C void Log(const TDesC8& aText); + +/*! + @function Log + + @discussion Append text to the log file + @param aText the text to log + */ + IMPORT_C void Log(const TDesC& aText); + +/*! + @function LogTime + + @discussion Append a timestamp to the log file. + Timestamps are in seconds with three decimal places (but resolution is limited to system timer tick period) + */ + IMPORT_C void LogTime(); + +/*! + @function LogBytes + + @discussion Append the bytes to the log file (non-printable bytes will be logged as ascii-hex) + @param aBuffer the bytes to log + */ + IMPORT_C void LogBytes(const TDesC8& aBuffer); + +/*! + @function LogNewline + + @discussion Start a newline in the log file + */ + IMPORT_C void LogNewline(); + +/*! + @function SetAutoFlush + + @discussion Turn AutoFlush on or off. AutoFlush will automatically flush the log file after each write + @param aOn if true turns AutoFlush on + */ + IMPORT_C void SetAutoFlush(TBool aOn); + +/*! + @function SetAutoTimeStamp + + @discussion Turn AutoTimeStamp on or off. AutoTimeStamp will add a timestamp to the start of each new line in the log + @param aOn if true turn AutoTimeStamp on + */ + IMPORT_C void SetAutoTimeStamp(TBool aOn); + +/*! + @function SetAutoNewline + + @discussion Turn AutoNewline on or off. AutoNewline starts a new line after each log operation + @param aOn if true turn AutoNewline on + */ + IMPORT_C void SetAutoNewline(TBool aOn); + +/*! + @function StaticLogL + + @discussion Static option to append text to the log file (leaving version) + @param aFileName the file to append to + @param aText the text to append + */ + IMPORT_C static void StaticLogL(const TDesC& aFileName, const TDesC8& aText); + +/*! + @function StaticLogL + + @discussion Static option to append text to the log file (leaving version) + @param aFileName the file to append to + @param aText the text to append + */ + IMPORT_C static void StaticLogL(const TDesC& aFileName, const TDesC& aText); + +/*! + @function StaticLog + + @discussion Static option to append text to the log file (non-leaving version) + @param aFileName the file to append to + @param aText the text to append + */ + IMPORT_C static void StaticLog(const TDesC& aFileName, const TDesC8& aText); + +/*! + @function StaticLog + + @discussion Static option to append text to the log file (non-leaving version) + @param aFileName the file to append to + @param aText the text to append + */ + IMPORT_C static void StaticLog(const TDesC& aFileName, const TDesC& aText); + + +private: +/*! + @function CLogFile + + @discussion Perform the first phase of two phase construction + */ + CLogFile(); +/*! + @function ConstructL + + @discussion Perform the second phase construction of a CLogFile object + @param aFileName the file to open + @param aInitialiseLog if true, and the log file already exists, previous + contents will be deleted. If false, append to any existing contents + */ + void ConstructL(const TDesC& aFileName, TBool aInitialiseLog); +/*! + @function LogTimeInternal + + @discussion Internal function to log time + */ + void LogTimeInternal(); +/*! + @function LogTextInternal + + @discussion Internal function to log text + @param aText the text to log + */ + void LogTextInternal(const TDesC8& aText); +/*! + @function LogByteInternal + + @discussion internal function to log a byte + @param aByte the byte to log + */ + void LogByteInternal(TUint8 aByte); +/*! + @function LogIntInternal + + @discussion Internal function to log an integer + @param aNumber the integer to log + */ + void LogIntInternal(TUint aNumber); +/*! + @function StartWrite + + @discussion Perform any initial operation before the main log operation + */ + void StartWrite(); + +/*! + @function EndWrite + + @discussion Perform any tidying up operations after the main log operation + */ + void EndWrite(); + +/*! + @function Write + + @discussion Do the actual writing, and associated error checking + @param aText the text to write + */ + void Write(const TDesC8& aText); + +private: +/*! + @var iLogFile handle to the log file + */ + RFile iLogFile; + +/*! + @var iSession file server session + */ + RFs iSession; + +/*! + @var iLogMillisecsPerTick number of millisecs per system timer tick + */ + TInt iLogMillisecsPerTick; + +/*! + @var iAutoFlush flag - AutoFlush on + */ + TBool iAutoFlush; + +/*! + @var iAutoTimestamp flag - AutoTimeStamp on + */ + TBool iAutoTimestamp; + +/*! + @var iAutoNewline flag - AutoNewline on + */ + TBool iAutoNewline; + +/*! + @var iCheckNestDepth internal to check StartWrite and EndWrite have been called correctly + */ + TInt iCheckNestDepth; + + }; + +#endif // __LOGFILE_H__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/inc/logfilePanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/inc/logfilePanics.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifndef __LOGFILE_PAN__ +#define __LOGFILE_PAN__ + +_LIT(KLogFilePanic, "LogFile"); + +enum TLogFilePanics + { + TLogFileWriteFailed = 1 + }; + +#endif // __TESTFRAME_PAN__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/rom/ImageEditorUtils.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/rom/ImageEditorUtils.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __IMAGEEDITORUTILS_IBY__ +#define __IMAGEEDITORUTILS_IBY__ + +file=ABI_DIR\BUILD_DIR\ImageEditorUtils.dll SHARED_LIB_DIR\ImageEditorUtils.dll + +#endif // __IMAGEEDITORUTILS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/src/BitField.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/src/BitField.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,76 @@ +/* +* 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: +* +*/ + + +#include "BitField.h" + +//============================================================================= +EXPORT_C TBitField::TBitField() +{ + Reset(); +} + +//============================================================================= +EXPORT_C TBitField::~TBitField () +{ + +} + +//============================================================================= +EXPORT_C TBitField::TBitField (const TBitField & rhs) +{ + Mem::Copy ( iData, rhs.iData, (KSize >> 3) + 1 ); +} + +//============================================================================= +EXPORT_C TBitField & TBitField::operator= (const TBitField & rhs) +{ + if ( this != &rhs ) + { + Mem::Copy (iData, rhs.iData, (KSize >> 3) + 1); + } + return *this; +} + +//============================================================================= +EXPORT_C void TBitField::Reset () +{ + Mem::FillZ (iData, (KSize >> 3) + 1); +} + +//============================================================================= +EXPORT_C void TBitField::SetBit (const TUint32 aIndex) +{ + if ( aIndex >= KSize) + { + User::Panic (KClassName, 21); + } + iData[aIndex >> 3] |= (0x1 << (aIndex & 0x7)); +} + +//============================================================================= +EXPORT_C TInt TBitField::GetBit (const TUint32 aIndex) const +{ + if ( aIndex >= KSize) + { + User::Panic (KClassName, 21); + } + return ((iData[aIndex >> 3]) >> (aIndex & 0x7) & 0x1); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/src/Callback.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/src/Callback.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,85 @@ +/* +* 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: +* +*/ + + +#include "callback.h" + +//============================================================================= +EXPORT_C CObCallback::~CObCallback() +{ + Cancel(); + iMethod = NULL; +} + +//============================================================================= +EXPORT_C CObCallback * CObCallback::NewL (MObCallbackMethod * aMethod) +{ + CObCallback * self = new (ELeave) CObCallback (aMethod); + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(); + return self; +} + +//============================================================================= +EXPORT_C void CObCallback::DoCallback (TInt aParam) +{ + iParam = aParam; + CompleteRequest(); +} + +//============================================================================= +void CObCallback::ConstructL() +{ + CActiveScheduler::Add (this); +} + +//============================================================================= +CObCallback::CObCallback (MObCallbackMethod * aMethod) : +CActive (EPriorityStandard), +iMethod (aMethod) +{ + +} + +//============================================================================= +void CObCallback::RunL() +{ + if ( iMethod->CallbackMethodL (iParam) ) + { + CompleteRequest(); + } +} + +//============================================================================= +void CObCallback::DoCancel() +{ + +} + +//============================================================================= +void CObCallback::CompleteRequest() +{ + if ( IsActive() ) + { + Cancel(); + } + TRequestStatus * p = &iStatus; + SetActive(); + User::RequestComplete (p, KErrNone); +} diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/src/ImageEditorUtils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/src/ImageEditorUtils.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,626 @@ +/* +* 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: +* +*/ + + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include + +#include "ImageEditorUtils.h" +//#include "ImageEditorUids.hrh" +#include "ImageEditorError.h" +#include "commondefs.h" +#include "imageeditordebugutils.h" + +#include +#include + + +// CONSTANTS +_LIT (KEditedSuffix, "-"); +const TInt KCopyBufferSize = 10000; + + + +//============================================================================= +EXPORT_C void ImageEditorUtils::NotifyNewMediaDocumentL ( + RFs& , + const TDesC& aFileName ) +{ + LOGFMT(KImageEditorLogFile, "ImageEditorUtils::NotifyNewMediaDocumentL( %S )", &aFileName ); +} + +//============================================================================= +EXPORT_C void ImageEditorUtils::NotifyNewMediaDocumentL ( + RFs& , + const MDesCArray& aFileNameArray ) +{ + LOGFMT(KImageEditorLogFile, "ImageEditorUtils::NotifyNewMediaDocumentL: %d files", aFileNameArray.MdcaCount() ); +} + +//============================================================================= + +EXPORT_C TInt ImageEditorUtils::GenerateNewDocumentNameL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + TDes& aTargetFileName, + RArray* /*aMgAlbumIdList*/, + const CDesCArray* aReservedFileNames, + ImageEditorUtils::TMemorySelection aMemoryInUse ) +{ + TInt err = KErrNone; + TPtrC srcFileName = aSourceFileName.Left( 155 ); + LOG(KImageEditorLogFile, "ImageEditorUtils::GenerateNewDocumentNameL" ); + + // Set file name to parser + TParsePtrC fileParse ( srcFileName ); + + // Test filename is already too long + if (fileParse.NameAndExt().Length() > KMaxFileName - 5) + { + err = KSIEEOpenFile; + } + + // Otherwise proceed to generate the filename + else + { + // Find file suffix that is not yet used + TInt val = 1; + TFileName temp; + TMemoryLocation memoryToSaveImage = EMixed; + + switch (aMemoryInUse) + { + case ESelectPhone: + { + memoryToSaveImage = EPhone; + break; + } + case ESelectMmc: + { + memoryToSaveImage = EMmc; + break; + } + case ESelectAutomatic: + default: + { + memoryToSaveImage = EMixed; + break; + } + } + + TFileName driveAndPath; + + if (memoryToSaveImage == EPhone) + { + driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + } + else if (memoryToSaveImage == EMmc) + { + driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + } + else // ESelectAutomatic + { + // By default save images to memory card's images folder. + // If memory card is not present, or is full save to phone memory. + driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + + if ( memoryToSaveImage != EMmc + && ( !BaflUtils::FolderExists (aFsSession, driveAndPath) + || !ImageFitsToDriveL (aFsSession, aSourceFileName, driveAndPath) ) ) + { + driveAndPath.Copy (PathInfo::PhoneMemoryRootPath() ); + driveAndPath.Append ( PathInfo::ImagesPath() ); + } + } + + // Check that the file fits to the selected drive + if ( !ImageFitsToDriveL( aFsSession, aSourceFileName, driveAndPath ) ) + { + err = KSIEENotEnoughDiskSpace; + } + else + { + LOGFMT(KImageEditorLogFile, "ImageEditorUtils: Image will be saved to path: %S", &driveAndPath ); + + // Copy drive and path to temporary file name + temp.Copy( driveAndPath ); + + // Add file name without suffix + TPtrC name = fileParse.Name(); + TInt offset = FindSuffix ( name ); + if (offset == KErrNotFound) + { + temp.Append ( fileParse.Name() ); + } + else + { + temp.Append ( name.Left (offset) ); + } + + temp.Append ( KEditedSuffix ); + temp.AppendNumFixedWidth (val, EDecimal, 3); + temp.Append ( KJpegExtension ); // .jpg + + // Increase edit number until we find a file name that is not used + while ( FileAlreadyExistsL(aFsSession, temp, aReservedFileNames) ) + { + ++val; + temp.Zero(); + temp.Copy ( driveAndPath ); + if (offset == KErrNotFound) + { + temp.Append ( fileParse.Name() ); + } + else + { + temp.Append ( name.Left (offset) ); + } + + temp.Append ( KEditedSuffix ); + if (val < 1000) + { + temp.AppendNumFixedWidth ( val, EDecimal, 3); + } + else + { + temp.AppendNumFixedWidth ( val, EDecimal, 4); + } + + temp.Append ( KJpegExtension ); + } + + // Set document name + aTargetFileName.Copy ( temp ); + } + } + + return err; +} + +//============================================================================= +EXPORT_C TInt ImageEditorUtils::GenerateNewFileNameL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + TDes& aTargetFileName, + TFileName aDrive, + const CDesCArray* aReservedFileNames ) + { + TInt err = KErrNone; + TPtrC srcFileName = aSourceFileName.Left( 155 ); + LOG( KImageEditorLogFile, "ImageEditorUtils::GenerateNewFileNameL" ); + + // Set file name to parser + TParsePtrC fileParse ( srcFileName ); + + // Test filename is already too long + if ( fileParse.NameAndExt().Length() > KMaxFileName - 5 ) + { + err = KSIEEOpenFile; + } + + TFileName driveAndPath ( aDrive ); + driveAndPath.Append( PathInfo::ImagesPath() ); + TBool fitsToDrive = ETrue; + TRAP_IGNORE( fitsToDrive = ImageFitsToDriveL( aFsSession, aSourceFileName, driveAndPath ) ); + // Check that the file fits to the selected drive + if ( KErrNone == err && !fitsToDrive ) + { + err = KSIEENotEnoughDiskSpace; + } + else + { + LOGFMT( KImageEditorLogFile, + "ImageEditorUtils: Image will be saved to path: %S", &driveAndPath ); + + // Copy drive and path to temporary file name + TFileName temp; + TInt val = 1; + temp.Copy( driveAndPath ); + + // Add file name without suffix + TPtrC name = fileParse.Name(); + TInt offset = FindSuffix ( name ); + if ( offset == KErrNotFound ) + { + temp.Append ( fileParse.Name() ); + } + else + { + temp.Append ( name.Left ( offset ) ); + } + + temp.Append ( KEditedSuffix ); + temp.AppendNumFixedWidth ( val, EDecimal, 3 ); + temp.Append ( KJpegExtension ); // .jpg + + // Increase edit number until we find a file name that is not used + while ( FileAlreadyExistsL( aFsSession, temp, aReservedFileNames ) ) + { + ++val; + temp.Zero(); + temp.Copy( driveAndPath ); + if ( offset == KErrNotFound ) + { + temp.Append ( fileParse.Name() ); + } + else + { + temp.Append( name.Left ( offset ) ); + } + + temp.Append( KEditedSuffix ); + + if ( val < 1000 ) + { + temp.AppendNumFixedWidth( val, EDecimal, 3 ); + } + else + { + temp.AppendNumFixedWidth( val, EDecimal, 4 ); + } + + temp.Append ( KJpegExtension ); + } + + // Set document name + aTargetFileName.Copy ( temp ); + } + + return err; + + } + +//============================================================================= +EXPORT_C TInt ImageEditorUtils::GenerateFilePathL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + TDes& aTargetFileName, + ImageEditorUtils::TMemorySelection aMemoryInUse ) +{ + TInt err = KErrNone; + + LOG(KImageEditorLogFile, "ImageEditorUtils::GenerateFilePath" ); + + // Set file name to parser + TParsePtrC fileParse (aSourceFileName); + + TFileName driveAndPath; + + if (aMemoryInUse == ESelectMmc) + { + driveAndPath.Copy( PathInfo::MemoryCardRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + } + else + { + driveAndPath.Copy( PathInfo::PhoneMemoryRootPath() ); + driveAndPath.Append( PathInfo::ImagesPath() ); + } + + // Check that the file fits to the selected drive + if ( KErrNone == err && !ImageEditorUtils::ImageFitsToDriveL( aFsSession, aSourceFileName, driveAndPath ) ) + { + err = KSIEENotEnoughDiskSpace; + } + else + { + LOGFMT(KImageEditorLogFile, "ImageEditorUtils: Image will be saved to path: %S", &driveAndPath ); + + // Copy drive and path to temporary file name + TFileName temp; + temp.Copy( driveAndPath ); + temp.Append( aTargetFileName); + + // Set document name + aTargetFileName.Copy ( temp ); + + if (FileAlreadyExistsL(aFsSession, aTargetFileName, NULL)) + { + err = KSIEEFileExists; + } + } + + + return err; +} + +//============================================================================= +TInt ImageEditorUtils::FindSuffix ( + const TDesC & aName + ) +{ + TInt offset = KErrNotFound; + TInt l = aName.Length(); + + while (l) + { + l--; + + if ( l <= (aName.Length() - 3) && aName[l] == TChar('-') ) + { + offset = l; + break; + } + else if ( aName[l] < 0x30 || aName[l] > 0x39 ) + { + break; + } + + } + + return offset; +} + +//============================================================================= +TBool ImageEditorUtils::FileAlreadyExistsL ( + RFs& aFsSession, + const TDesC& aFileName, + const CDesCArray* aReservedFileNames ) +{ + TBool fileExists = BaflUtils::FileExists( aFsSession, aFileName ); + if (!fileExists) + { + // If the file does not exist on the disk, check that it + // is not included in the list of explicitly reserved files + if (aReservedFileNames) + { + TInt pos; + fileExists = !aReservedFileNames->Find( aFileName, pos, ECmpFolded ); + } + } + return fileExists; +} + +//============================================================================= +EXPORT_C TBool ImageEditorUtils::ImageFitsToDriveL ( + RFs& aFsSession, + const TDesC& aSourceFile, + const TDesC& aTargetPath ) +{ + LOG( KImageEditorLogFile, "ImageEditorUtils::ImageFitsToDriveL" ); + + TBool response = EFalse; + + // Get the current file size and compute an estimate for the new image size + TEntry entry; + User::LeaveIfError( aFsSession.Entry (aSourceFile, entry) ); + TInt size = entry.iSize; + size = (int)(1.25 * size + 0.5); + + // Check whether flash space is below critical + TInt drive; + User::LeaveIfError( RFs::CharToDrive(aTargetPath[0], drive) ); + TRAPD(err, + response = ! SysUtil::DiskSpaceBelowCriticalLevelL (&aFsSession, size, drive); + ); + + // if MMC is not available, return EFalse + if (err) + { + response = EFalse; + } + + LOGFMT2( KImageEditorLogFile, "ImageEditorUtils::ImageFitsToDriveL: drive: %d response: %d", drive, response ); + + return response; +} + +//============================================================================= +EXPORT_C TBool ImageEditorUtils::ImagesFitToDriveL ( + RFs& aFsSession, + const CDesCArray& aSourceFileList, + const CDesCArray& aTargetFileList ) +{ + LOG( KImageEditorLogFile, "ImageEditorUtils::ImagesFitToDriveL" ); + + TBool spacePhone = ETrue; + TBool spaceMmc = ETrue; + + // Get size of the current files and compute an estimate + TInt sizePhone = 0; + TInt sizeMmc = 0; + for( TInt i = 0; i < aSourceFileList.MdcaCount(); i++ ) + { + TEntry entry; + User::LeaveIfError( aFsSession.Entry (aSourceFileList.MdcaPoint(i), entry) ); + + TInt drive; + User::LeaveIfError( RFs::CharToDrive(aTargetFileList.MdcaPoint(i)[0], drive) ); + if (EDriveC == drive) + { + sizePhone += entry.iSize; + } + else if (EDriveE == drive) + { + sizeMmc += entry.iSize; + } + else + { + User::Leave(KErrArgument); + } + } + sizePhone = (int)(1.25 * sizePhone + 0.5); + sizeMmc = (int)(1.25 * sizeMmc + 0.5); + + // First check the space on phone memory + TInt err = KErrNone; + if (sizePhone) + { + TRAP(err, + spacePhone = ! SysUtil::DiskSpaceBelowCriticalLevelL (&aFsSession, sizePhone, EDriveC); + ); + } + + // Check space on memory card + if (sizeMmc) + { + TRAP(err, + spaceMmc = ! SysUtil::DiskSpaceBelowCriticalLevelL (&aFsSession, sizeMmc, EDriveE); + ); + } + + // if MMC is not available, return EFalse + if (err) + { + spaceMmc = EFalse; + } + + LOGFMT( KImageEditorLogFile, "ImageEditorUtils::ImagesFitToDriveL: response: %d", (spacePhone && spaceMmc) ); + + return (spacePhone && spaceMmc); +} + +//============================================================================= + +EXPORT_C void ImageEditorUtils::FindAlbumsForImageFileL ( + RArray& aAlbumIdList, + const TDesC& ) +{ + LOG(KImageEditorLogFile, "ImageEditorUtils::FindAlbumsForImageFileL" ); + aAlbumIdList.Reset(); + LOG(KImageEditorLogFile, "\tAlbums not supported" ); +} + + +//============================================================================= +EXPORT_C void ImageEditorUtils::AddImageFileToAlbumL( + const TDesC& , + TInt ) +{ + LOG(KImageEditorLogFile, "ImageEditorUtils::AddImageFileToAlbumL"); + LOG(KImageEditorLogFile, "\tAlbums not supported" ); +} + +//============================================================================= +EXPORT_C void ImageEditorUtils::GetMakeAndModelL( TDes8& aMake, TDes8& aModel ) +{ + LOG( KImageEditorLogFile, "ImageEditorUtils::GetMakeAndModelL"); + + CTelephony::TPhoneIdV1 phoneId; + + LOGFMT3( KImageEditorLogFile, "ImageEditorUtils::GetMakeAndModelL: make: \"%S\", model: \"%S\", serial number: \"%S\"", &phoneId.iManufacturer, &phoneId.iModel, &phoneId.iSerialNumber); + + // Convert to 8-bit descriptors + // In the emulator SharedData returns empty values. + // In that case substitute with default values. + if( phoneId.iManufacturer.Length() ) + { + HBufC8* make8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( phoneId.iManufacturer ); + aMake = make8->Des(); + delete make8; + } + else + { + _LIT8( KDefaultMake, "Nokia\0" ); + aMake = KDefaultMake(); + } + + if( phoneId.iModel.Length() ) + { + HBufC8* model8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( phoneId.iModel ); + aModel = model8->Des(); + delete model8; + } + else + { + // Empty by default. + aModel = KNullDesC8(); + } + +} + +//============================================================================= +EXPORT_C TInt ImageEditorUtils::CopyFile ( + RFs& aFsSession, + const TDesC& aSourceFileName, + const TDesC& aDestinationFileName, + TBool aOverwriteTarget ) +{ + LOG( KImageEditorLogFile, "ImageEditorUtils::CopyFile"); + + // Check the source file + TEntry fileEntry; + TInt ret = aFsSession.Entry (aSourceFileName, fileEntry); + + // Check the target file + if (KErrNone == ret) + { + if( BaflUtils::FileExists(aFsSession, aDestinationFileName) && !aOverwriteTarget ) + { + ret = KErrAlreadyExists; + } + } + + TRAP( ret, ImageEditorUtils::DoCopyL(aFsSession, aSourceFileName, aDestinationFileName, fileEntry.iSize) ); + + return ret; +} + +//============================================================================= +void ImageEditorUtils::DoCopyL( + RFs& aFsSession, + const TDesC& aSourceFileName, + const TDesC& aDestinationFileName, + TUint aSourceFileSize ) +{ + LOG( KImageEditorLogFile, "ImageEditorUtils::DoCopyL"); + + // Create target file and do copying + RFileWriteStream targetFile; + User::LeaveIfError( targetFile.Replace (aFsSession, aDestinationFileName, EFileShareExclusive) ); + targetFile.PushL(); + + HBufC8* fileBuf = HBufC8::NewLC (KCopyBufferSize); + TPtr8 fileBufPtr( fileBuf->Des() ); + + // Loop thorough the source file in blocks + for (TInt i = 0; i < aSourceFileSize; i += KCopyBufferSize) + { + // read a block + if (aSourceFileSize > (TUint)(i + KCopyBufferSize)) + { + fileBufPtr.Set( fileBuf->Des() ); + User::LeaveIfError( aFsSession.ReadFileSection(aSourceFileName, i, fileBufPtr, KCopyBufferSize) ); + } + else + { + fileBufPtr.Set ( fileBuf->Des() ); + User::LeaveIfError( aFsSession.ReadFileSection(aSourceFileName, i, fileBufPtr, ((TInt)aSourceFileSize - i)) ); + } + + // Write the block to target file + if( fileBufPtr.Length() ) + { + targetFile.WriteL (fileBufPtr, fileBufPtr.Length()); + } + } + + targetFile.CommitL(); + CleanupStack::PopAndDestroy(2); // targetFile, fileBuf +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/src/PluginInfo.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/src/PluginInfo.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,698 @@ +/* +* 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: +* Utils class handling the information about the plugins. +* +*/ + + + +#include + +#include "PluginInfo.h" +#include "EditorVersion.h" + +//============================================================================= +EXPORT_C TInt CPluginInfo::ComparePluginInfo ( + const CPluginInfo & aItem1, + const CPluginInfo & aItem2 + ) +{ + if (aItem1.iPluginRID < aItem2.iPluginRID) + { + return -1; + } + else if (aItem1.iPluginRID > aItem2.iPluginRID) + { + return 1; + } + else + { + return 0; + } +} + +//============================================================================= +EXPORT_C TInt CPluginInfo::ComparePluginOrder( + const CPluginInfo & aItem1, + const CPluginInfo & aItem2 + ) +{ + if (aItem1.iPluginDisplayOrder < aItem2.iPluginDisplayOrder) + { + return -1; + } + else if (aItem1.iPluginDisplayOrder > aItem2.iPluginDisplayOrder) + { + return 1; + } + else + { + return 0; + } +} + +//============================================================================= +EXPORT_C CPluginInfo * CPluginInfo::NewL () +{ + CPluginInfo * self = CPluginInfo::NewLC(); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +EXPORT_C CPluginInfo * CPluginInfo::NewLC () +{ + CPluginInfo * self = new (ELeave) CPluginInfo; + CleanupStack::PushL(self); + self->ConstructL(); + return self; +} + +//============================================================================= +EXPORT_C CPluginInfo::~CPluginInfo () +{ + delete iPluginDllName; + delete iPluginName; + delete iIconFileName; + delete iIcon; + delete iMask; + + if (iParams) + { + iParams->Reset(); + } + delete iParams; + + if (iSk1Cmds) + { + iSk1Cmds->Reset(); + } + delete iSk1Cmds; + + if (iSk1Texts) + { + iSk1Texts->Reset(); + } + delete iSk1Texts; + + if (iSk2Cmds) + { + iSk2Cmds->Reset(); + } + delete iSk2Cmds; + + if (iSk2Texts) + { + iSk2Texts->Reset(); + } + delete iSk2Texts; + + if (iMSKCmds) + { + iMSKCmds->Reset(); + } + delete iMSKCmds; + + if (iMSKTexts) + { + iMSKTexts->Reset(); + } + delete iMSKTexts; + if (iMenuItems) + { + iMenuItems->Reset(); + } + delete iMenuItems; +} + +//============================================================================= +EXPORT_C HBufC *& CPluginInfo::PluginDll () +{ + return iPluginDllName; +} + +//============================================================================= +EXPORT_C const TDesC & CPluginInfo::PluginDll () const +{ + return *iPluginDllName; +} + +//============================================================================= +EXPORT_C TUid & CPluginInfo::Uid2 () +{ + return iUID2; +} + +//============================================================================= +EXPORT_C const TUid & CPluginInfo::Uid2 () const +{ + return iUID2; +} + +//============================================================================= +EXPORT_C TUid & CPluginInfo::Uid3 () +{ + return iUID3; +} + +//============================================================================= +EXPORT_C const TUid & CPluginInfo::Uid3 () const +{ + return iUID3; +} + +//============================================================================= +EXPORT_C TInt & CPluginInfo::PluginUiType() +{ + return iPluginUiType; +} + +//============================================================================= +EXPORT_C const TInt & CPluginInfo::PluginUiType() const +{ + return iPluginUiType; +} + +//============================================================================= +EXPORT_C TInt & CPluginInfo::PluginFilterType() +{ + return iPluginFilterType; +} + +//============================================================================= +EXPORT_C const TInt & CPluginInfo::PluginFilterType() const +{ + return iPluginFilterType; +} + +//============================================================================= +EXPORT_C TInt & CPluginInfo::PluginScope() +{ + return iScope; +} + +//============================================================================= +EXPORT_C const TInt & CPluginInfo::PluginScope() const +{ + return iScope; +} + +//============================================================================= +EXPORT_C TInt & CPluginInfo::PluginDisplayOrder() +{ + return iPluginDisplayOrder; +} + +//============================================================================= +EXPORT_C const TInt & CPluginInfo::PluginDisplayOrder() const +{ + return iPluginDisplayOrder; +} + +//============================================================================= +EXPORT_C TInt & CPluginInfo::PluginRID() +{ + return iPluginRID; +} + +//============================================================================= +EXPORT_C const TInt & CPluginInfo::PluginRID() const +{ + return iPluginRID; +} + +//============================================================================= +EXPORT_C HBufC *& CPluginInfo::PluginName() +{ + return iPluginName; +} + +//============================================================================= +EXPORT_C const TDesC & CPluginInfo::PluginName() const +{ + return *iPluginName; +} +//============================================================================= +EXPORT_C HBufC *& CPluginInfo::IconFile() +{ + return iIconFileName; +} + +//============================================================================= +EXPORT_C const TDesC & CPluginInfo::IconFile() const +{ + return *iIconFileName; +} + +//============================================================================= +EXPORT_C CFbsBitmap *& CPluginInfo::Icon() +{ + return iIcon; +} + +//============================================================================= +EXPORT_C const CFbsBitmap * CPluginInfo::Icon() const +{ + return iIcon; +} + +//============================================================================= +EXPORT_C CFbsBitmap *& CPluginInfo::Mask() +{ + return iMask; +} + +//============================================================================= +EXPORT_C const CFbsBitmap * CPluginInfo::Mask() const +{ + return iMask; +} + +//============================================================================= +EXPORT_C CDesCArray & CPluginInfo::Parameters() +{ + return *iParams; +} + +//============================================================================= +EXPORT_C const CDesCArray & CPluginInfo::Parameters() const +{ + return *iParams; +} + +//============================================================================= +EXPORT_C CArrayFix & CPluginInfo::Sk1Cmds() +{ + return *iSk1Cmds; +} + +//============================================================================= +EXPORT_C const CArrayFix & CPluginInfo::Sk1Cmds() const +{ + return *iSk1Cmds; +} + +//============================================================================= +EXPORT_C CDesCArray & CPluginInfo::Sk1Texts() +{ + return *iSk1Texts; +} + +//============================================================================= +EXPORT_C const CDesCArray & CPluginInfo::Sk1Texts() const +{ + return *iSk1Texts; +} + +//============================================================================= +EXPORT_C CArrayFix & CPluginInfo::Sk2Cmds() +{ + return *iSk2Cmds; +} + +//============================================================================= +EXPORT_C const CArrayFix & CPluginInfo::Sk2Cmds() const +{ + return *iSk2Cmds; +} + +//============================================================================= +EXPORT_C CDesCArray & CPluginInfo::Sk2Texts() +{ + return *iSk2Texts; +} + +//============================================================================= +EXPORT_C const CDesCArray & CPluginInfo::Sk2Texts() const +{ + return *iSk2Texts; +} + +//============================================================================= +EXPORT_C CArrayFix & CPluginInfo::MSKCmds() +{ + return *iMSKCmds; +} + +//============================================================================= +EXPORT_C const CArrayFix & CPluginInfo::MSKCmds() const +{ + return *iMSKCmds; +} + +//============================================================================= +EXPORT_C CDesCArray & CPluginInfo::MSKTexts() +{ + return *iMSKTexts; +} + +//============================================================================= +EXPORT_C const CDesCArray & CPluginInfo::MSKTexts() const +{ + return *iMSKTexts; +} +//============================================================================= +EXPORT_C CMenuItemArray & CPluginInfo::MenuItems() +{ + return *iMenuItems; +} + +//============================================================================= +EXPORT_C const CMenuItemArray & CPluginInfo::MenuItems() const +{ + return *iMenuItems; +} + +//============================================================================= +EXPORT_C void CPluginInfo::ExternalizeL ( RWriteStream& aStream ) const +{ + TInt i = 0; + + // Current UI language + TLanguage lang = User::Language(); + aStream.WriteInt32L (lang); + + // Editor version (from EditorVersion.h) + aStream.WriteInt32L (my_version_major); + aStream.WriteInt32L (my_version_minor); + aStream.WriteInt32L (my_version_build); + + // HBufC * iPluginDllName + if ( iPluginDllName ) + { + TPtr pluginDllNamePtr = iPluginDllName->Des(); + aStream.WriteInt32L (pluginDllNamePtr.Length()); + aStream << pluginDllNamePtr; + } + + // TUid iUID2 + aStream << iUID2; + + // TUid iUID3 + aStream << iUID3; + + // TInt iPluginUiType + aStream.WriteInt32L( iPluginUiType ); + + // TInt iPluginFilterType + aStream.WriteInt32L( iPluginFilterType ); + + // TInt iScope + aStream.WriteInt32L( iScope ); + + //TInt iPluginDisplayOrder + aStream.WriteInt32L( iPluginDisplayOrder ); + + // TInt iPluginRID + aStream.WriteInt32L( iPluginRID ); + + // HBufC * iPluginName + if ( iPluginName ) + { + TPtr pluginNamePtr = iPluginName->Des(); + aStream.WriteInt32L (pluginNamePtr.Length()); + aStream << pluginNamePtr; + } + + // HBufC * iIconFileName + if ( iIconFileName ) + { + TPtr iconFileNamePtr = iIconFileName->Des(); + aStream.WriteInt32L (iconFileNamePtr.Length()); + aStream << iconFileNamePtr; + } + + // CDesCArray * iParams + TInt paramCount = iParams->MdcaCount(); + aStream.WriteInt32L( paramCount ); + for ( i=0; iMdcaPoint(i); + aStream.WriteInt32L( des.Length() ); + aStream << des; + } + + // CArrayFix * iSk1Cmds + TInt sk1CmdCount = iSk1Cmds->Count(); + aStream.WriteInt32L( sk1CmdCount ); + for ( i=0; iAt(i) ); + } + + // CDesCArray * iSk1Texts + TInt sk1TextCount = iSk1Texts->MdcaCount(); + aStream.WriteInt32L( sk1TextCount ); + for ( i=0; iMdcaPoint(i); + aStream.WriteInt32L( des.Length() ); + aStream << des; + } + + // CArrayFix * iSk2Cmds + TInt sk2CmdCount = iSk2Cmds->Count(); + aStream.WriteInt32L( sk2CmdCount ); + for ( i=0; iAt(i) ); + } + + // CDesCArray * iSk2Texts + TInt sk2TextCount = iSk2Texts->MdcaCount(); + aStream.WriteInt32L( sk2TextCount ); + for ( i=0; iMdcaPoint(i); + aStream.WriteInt32L( des.Length() ); + aStream << des; + } + + // CArrayFix * iMSKCmds + TInt mskCmdCount = iMSKCmds->Count(); + aStream.WriteInt32L( mskCmdCount ); + for ( i=0; iAt(i) ); + } + + // CDesCArray * iMSKTexts + TInt mskTextCount = iMSKTexts->MdcaCount(); + aStream.WriteInt32L( mskTextCount ); + for ( i=0; iMdcaPoint(i); + aStream.WriteInt32L( des.Length() ); + aStream << des; + } + + // CMenuItemArray * iMenuItems + TInt menuItemCount = iMenuItems->Count(); + aStream.WriteInt32L( menuItemCount ); + for ( i=0; iAt(i); + + // TInt iCommandId; + aStream.WriteInt32L( item.iCommandId ); + // TInt iCascadeId; + aStream.WriteInt32L( item.iCascadeId ); + // TInt iFlags; + aStream.WriteInt32L( item.iFlags ); + // TBuf iText; + aStream << item.iText; + // TBuf<1> iExtraText; + aStream << item.iText; + } +} + +//============================================================================= +EXPORT_C void CPluginInfo::InternalizeL ( RReadStream& aStream ) +{ + TInt i = 0; + + // Check that the current UI language is the same as stored + // in the ini file. If not, reject the stored information. + TLanguage storedLang = (TLanguage) aStream.ReadInt32L(); + if (storedLang != User::Language()) + { + User::Leave (KErrCorrupt); + } + + // If the editor version has changed, also reject the stored data. + TInt major = aStream.ReadInt32L(); + TInt minor = aStream.ReadInt32L(); + TInt build = aStream.ReadInt32L(); + if (major != my_version_major || + minor != my_version_minor || + build != my_version_build + ) + { + User::Leave (KErrCorrupt); + } + + // HBufC * iPluginDllName + TInt pluginDllNameLength = aStream.ReadInt32L(); + iPluginDllName = HBufC::NewL(pluginDllNameLength); + TPtr pluginDllNamePtr = iPluginDllName->Des(); + aStream >> pluginDllNamePtr; + + // TUid iUID2 + aStream >> iUID2; + + // TUid iUID3 + aStream >> iUID3; + + // TInt iPluginUiType + iPluginUiType = aStream.ReadInt32L(); + + // TInt iPluginFilterType + iPluginFilterType = aStream.ReadInt32L(); + + // TInt iScope + iScope = aStream.ReadInt32L(); + + // TInt iPluginDisplayOrder + iPluginDisplayOrder = aStream.ReadInt32L(); + + // TInt iPluginRID + iPluginRID = aStream.ReadInt32L(); + + // HBufC * iPluginName + TInt pluginNameLength = aStream.ReadInt32L(); + iPluginName = HBufC::NewL(pluginNameLength); + TPtr pluginNamePtr = iPluginName->Des(); + aStream >> pluginNamePtr; + + // HBufC * iIconFileName + TInt iconFileNameLength = aStream.ReadInt32L(); + iIconFileName = HBufC::NewL(iconFileNameLength); + TPtr iconFileNamePtr = iIconFileName->Des(); + aStream >> iconFileNamePtr; + + // CDesCArray * iParams + TInt paramCount = aStream.ReadInt32L(); + for ( i=0; iDes(); + aStream >> paramPtr; + iParams->AppendL( paramPtr ); + CleanupStack::PopAndDestroy( paramBuf ); + } + + // CArrayFix * iSk1Cmds; + TInt sk1CmdCount = aStream.ReadInt32L(); + for ( i=0; iAppendL( cmd ); + } + + // CDesCArray * iSk1Texts; + TInt sk1TextCount = aStream.ReadInt32L(); + for ( i=0; iDes(); + aStream >> sk1TextPtr; + iSk1Texts->AppendL( sk1TextPtr ); + CleanupStack::PopAndDestroy( sk1TextBuf ); + } + + // CArrayFix * iSk2Cmds; + TInt sk2CmdCount = aStream.ReadInt32L(); + for ( i=0; iAppendL( cmd ); + } + + // CDesCArray * iSk2Texts; + TInt sk2TextCount = aStream.ReadInt32L(); + for ( i=0; iDes(); + aStream >> sk2TextPtr; + iSk2Texts->AppendL( sk2TextPtr ); + CleanupStack::PopAndDestroy( sk2TextBuf ); + } + + // CArrayFix * iMSKCmds; + TInt mskCmdCount = aStream.ReadInt32L(); + for ( i=0; iAppendL( cmd ); + } + + // CDesCArray * iMSKTexts; + TInt mskTextCount = aStream.ReadInt32L(); + for ( i=0; iDes(); + aStream >> mskTextPtr; + iMSKTexts->AppendL( mskTextPtr ); + CleanupStack::PopAndDestroy( mskTextBuf ); + } + + // CMenuItemArray * iMenuItems; + TInt menuItemCount = aStream.ReadInt32L(); + for ( i=0; i iText; + aStream >> item.iText; + // TBuf<1> iExtraText; + aStream >> item.iText; + + iMenuItems->AppendL( item ); + } +} + +//============================================================================= +void CPluginInfo::ConstructL() +{ + iParams = new (ELeave) CDesCArraySeg(16); + iSk1Cmds= new (ELeave) CArrayFixSeg(4); + iSk1Texts = new (ELeave) CDesCArraySeg(4); + iSk2Cmds= new (ELeave) CArrayFixSeg(4); + iSk2Texts = new (ELeave) CDesCArraySeg(4); + iMSKCmds= new (ELeave) CArrayFixSeg(4); + iMSKTexts = new (ELeave) CDesCArraySeg(4); + iMenuItems = new (ELeave) CMenuItemArray (8); +} + +//============================================================================= +CPluginInfo::CPluginInfo () +{ + +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/src/ResolutionUtil.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/src/ResolutionUtil.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,534 @@ +/* +* 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: +* Resolution utility class for Image Editor. +* +*/ + + +#include +#include + +#include "ResolutionUtil.h" +#include "imageeditordebugutils.h" +//#include "ImageEditorUids.hrh" + +// CONSTANTS +const TInt KStandardScreenWidth = 176; +const TInt KStandardScreenHeight = 208; + +const TInt KSquareScreenWidth = 208; +const TInt KSquareScreenHeight = 208; + +const TInt KQVGAScreenWidth = 240; +const TInt KQVGAScreenHeight = 320; + +const TInt KDoubleScreenWidth = 352; +const TInt KDoubleScreenHeight = 416; + +const TInt KHVGAScreenWidth = 320; +const TInt KHVGAScreenHeight = 480; + +const TInt KVGAScreenWidth = 480; +const TInt KVGAScreenHeight = 640; + +const TInt KQHDScreenWidth = 360; +const TInt KQHDScreenHeight = 640; + +#define UID_RESOLUTION_UTIL 0x101FFA91 + +// CCoeStatic-derived class is accessible only inside the +// thread, so the UID does not need to be globally unique. +const TUid KUidResolutionUtil = {UID_RESOLUTION_UTIL}; + +_LIT( KComponentName, "CResolutionUtil" ); + + +//============================================================================= +CResolutionUtil::CResolutionUtil( const TUid& aUid ) +: CCoeStatic( aUid ), + iScreenRect(0,0,0,0), + iClientRect(0,0,0,0), + iLandscape(EFalse), + iFullScreen(EFalse) + { + + } + +//============================================================================= +EXPORT_C CResolutionUtil::~CResolutionUtil() +{ + LOG(KImageEditorLogFile, "CResolutionUtil::~CResolutionUtil()"); +} + +//============================================================================= +EXPORT_C CResolutionUtil* CResolutionUtil::Self() +{ + CResolutionUtil* self = static_cast( CCoeEnv::Static (KUidResolutionUtil) ); + __ASSERT_ALWAYS( self, User::Panic(KComponentName,KErrNotFound) ); + return self; +} + +//============================================================================= +EXPORT_C CResolutionUtil* CResolutionUtil::InitializeL() +{ + LOG(KImageEditorLogFile, "CResolutionUtil::InitializeL()"); + + // First check if this already exists + CResolutionUtil* self = static_cast( CCoeEnv::Static (KUidResolutionUtil) ); + + // If not, create new instance + if ( !self ) + { + self = new (ELeave) CResolutionUtil( KUidResolutionUtil ); + LOG(KImageEditorLogFile, "CResolutionUtil::InitializeL(): created new instance"); + } + + return self; +} + +//============================================================================= +EXPORT_C TInt CResolutionUtil::ScreenMode() const + { + + TInt screenMode = EUnknown; + TSize screenSize = iScreenRect.Size(); + + if (!iLandscape) + { + switch (screenSize.iWidth) + { + // Standard + case KStandardScreenWidth: + { + if (screenSize.iHeight == KStandardScreenHeight) + { + if (!iFullScreen) + { + screenMode = EStandard; + } + else + { + screenMode = EStandardFullScreen; + } + } + break; + } + // Square + case KSquareScreenWidth: + { + if (screenSize.iHeight == KSquareScreenHeight) + { + if (!iFullScreen) + { + screenMode = ESquare; + } + else + { + screenMode = ESquareFullScreen; + } + } + break; + } + // QVGA + case KQVGAScreenWidth: + { + if (screenSize.iHeight == KQVGAScreenHeight) + { + if (!iFullScreen) + { + screenMode = EQVGA; + } + else + { + screenMode = EQVGAFullScreen; + } + } + break; + } + // Double + case KDoubleScreenWidth: + { + if (screenSize.iHeight == KDoubleScreenHeight) + { + if (!iFullScreen) + { + screenMode = EDouble; + } + else + { + screenMode = EDoubleFullScreen; + } + } + break; + } + // Unknown + default: + { + screenMode = EUnknown; + break; + } + } + } + else + { + // Landscape iHeight == normal iWidth + switch (screenSize.iHeight) + { + // Standard, landscape + case KStandardScreenWidth: + { + if (screenSize.iWidth == KStandardScreenHeight) + { + if (!iFullScreen) + { + screenMode = EStandardLandscape; + } + else + { + screenMode = EStandardLandscapeFullScreen; + } + } + break; + } + // Square, rotated + case KSquareScreenWidth: + { + if (screenSize.iWidth == KSquareScreenHeight) + { + if (!iFullScreen) + { + screenMode = ESquareRotated; + } + else + { + screenMode = ESquareRotatedFullScreen; + } + } + break; + } + // QVGA, landscape + case KQVGAScreenWidth: + { + if (screenSize.iWidth == KQVGAScreenHeight) + { + if (!iFullScreen) + { + screenMode = EQVGALandscape; + } + else + { + screenMode = EQVGALandscapeFullScreen; + } + } + break; + } + // Double, landscape + case KDoubleScreenWidth: + { + if (screenSize.iWidth == KDoubleScreenHeight) + { + if (!iFullScreen) + { + screenMode = EDoubleLandscape; + } + else + { + screenMode = EDoubleLandscapeFullScreen; + } + } + break; + } + // Unknown + default: + { + screenMode = EUnknown; + break; + } + } + + } + + return screenMode; + } + +//============================================================================= +EXPORT_C TInt CResolutionUtil::GetScreenMode() const + { + TInt screenMode = EUnknown; + TSize screenSize = iScreenRect.Size(); + + // Standard (Portrait) + if ( screenSize.iWidth == KStandardScreenWidth && + screenSize.iHeight == KStandardScreenHeight ) + { + if (!iFullScreen) + { + screenMode = EStandard; + } + else + { + screenMode = EStandardFullScreen; + } + } + // Square (Portrait) + else if ( screenSize.iWidth == KSquareScreenWidth && + screenSize.iHeight == KSquareScreenHeight ) + { + if (!iFullScreen) + { + screenMode = ESquare; + } + else + { + screenMode = ESquareFullScreen; + } + } + // QVGA (Portrait) + else if ( screenSize.iWidth == KQVGAScreenWidth && + screenSize.iHeight == KQVGAScreenHeight ) + { + if (!iFullScreen) + { + screenMode = EQVGA; + } + else + { + screenMode = EQVGAFullScreen; + } + } + // Double (Portrait) + else if ( screenSize.iWidth == KDoubleScreenWidth && + screenSize.iHeight == KDoubleScreenHeight ) + { + if (!iFullScreen) + { + screenMode = EDouble; + } + else + { + screenMode = EDoubleFullScreen; + } + } + // HVGA (Portrait) + else if ( screenSize.iWidth == KHVGAScreenWidth && + screenSize.iHeight == KHVGAScreenHeight ) + { + if (!iFullScreen) + { + screenMode = EHVGA; + } + else + { + screenMode = EHVGAFullScreen; + } + } + // VGA (Portrait) + else if ( screenSize.iWidth == KVGAScreenWidth && + screenSize.iHeight == KVGAScreenHeight ) + { + if (!iFullScreen) + { + screenMode = EVGA; + } + else + { + screenMode = EVGAFullScreen; + } + } + // QHD (Portrait) + else if ( screenSize.iWidth == KQHDScreenWidth && + screenSize.iHeight == KQHDScreenHeight ) + { + if (!iFullScreen) + { + screenMode = EQHD; + } + else + { + screenMode = EQHDFullScreen; + } + } + // Standard (Landscape) + else if ( screenSize.iWidth == KStandardScreenHeight && + screenSize.iHeight == KStandardScreenWidth ) + { + if (!iFullScreen) + { + screenMode = EStandardLandscape; + } + else + { + screenMode = EStandardLandscapeFullScreen; + } + } + // Square (Landscape) + else if ( screenSize.iWidth == KSquareScreenHeight && + screenSize.iHeight == KSquareScreenWidth ) + { + if (!iFullScreen) + { + screenMode = ESquareRotated; + } + else + { + screenMode = ESquareRotatedFullScreen; + } + } + // QVGA (Landscape) + else if ( screenSize.iWidth == KQVGAScreenHeight && + screenSize.iHeight == KQVGAScreenWidth ) + { + if (!iFullScreen) + { + screenMode = EQVGALandscape; + } + else + { + screenMode = EQVGALandscapeFullScreen; + } + } + // Double (Landscape) + else if ( screenSize.iWidth == KDoubleScreenHeight && + screenSize.iHeight == KDoubleScreenWidth ) + { + if (!iFullScreen) + { + screenMode = EDoubleLandscape; + } + else + { + screenMode = EDoubleLandscapeFullScreen; + } + } + // HVGA (Landscape) + else if ( screenSize.iWidth == KHVGAScreenHeight && + screenSize.iHeight == KHVGAScreenWidth ) + { + if (!iFullScreen) + { + screenMode = EHVGALandscape; + } + else + { + screenMode = EHVGALandscapeFullScreen; + } + } + // VGA (Landscape) + else if ( screenSize.iWidth == KVGAScreenHeight && + screenSize.iHeight == KVGAScreenWidth ) + { + if (!iFullScreen) + { + screenMode = EVGALandscape; + } + else + { + screenMode = EVGALandscapeFullScreen; + } + } + // QHD (Landscape) + else if ( screenSize.iWidth == KQHDScreenHeight && + screenSize.iHeight == KQHDScreenWidth ) + { + if (!iFullScreen) + { + screenMode = EQHDLandscape; + } + else + { + screenMode = EQHDLandscapeFullScreen; + } + } + // Unknown + else + { + screenMode = EUnknown; + } + + return screenMode; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::GetClientRect(TRect& aRect) const + { + aRect = iClientRect; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::SetClientRect(const TRect& aRect) + { + iClientRect = aRect; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::GetScreenRect(TRect& aRect) const + { + aRect = iScreenRect; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::SetScreenRect(const TRect& aRect) + { + iScreenRect = aRect; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::SetFullScreen(TBool aFullScreen) + { + iFullScreen = aFullScreen; + } + +//============================================================================= +EXPORT_C TBool CResolutionUtil::GetFullScreen() const + { + return iFullScreen; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::SetLandscape(TBool aLandscape) + { + iLandscape = aLandscape; + } + +//============================================================================= +EXPORT_C TBool CResolutionUtil::GetLandscape() const + { + return iLandscape; + } + +//============================================================================= +EXPORT_C void CResolutionUtil::UpdateScreenMode() + { + LOG(KImageEditorLogFile, "CResolutionUtil::UpdateScreenMode()"); + + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EScreen, iScreenRect); + //iScreenRect.SetRect(0,0,352,416); + + if (iFullScreen) + { + iClientRect = iScreenRect; + } + else + { + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, iClientRect); + } + + LOGFMT2(KImageEditorLogFile, "CResolutionUtil: Screen dimensions: W:%d, H:%d", iScreenRect.Width(), iScreenRect.Height()); + LOGFMT4(KImageEditorLogFile, " ClientRect: iTl.iX:%d, iTl.iY:%d, iBr.iX:%d, iBr.iY:%d", iClientRect.iTl.iX, iClientRect.iTl.iY, iClientRect.iBr.iX, iClientRect.iBr.iY); + LOGFMT2(KImageEditorLogFile, " Full screen: %d, Landscape mode: %d", iFullScreen, iLandscape); + } + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/ImageEditorUtils/src/logfile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/ImageEditorUtils/src/logfile.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,394 @@ +/* +* 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: +* +*/ + + +#include +#include +#include "logfile.h" +#include "logfilePanics.h" + +_LIT8(KCrLf8, "\r\n"); +_LIT(KCrLf, "\r\n"); + +static const TInt KAsciiStart = 0x20; +static const TInt KAsciiEnd = 0x7f; +static const TInt KHexCharLeft = '<'; +static const TInt KHexCharRight = '>'; + +//static const TInt KNumberOfDecimalPlaces = 3; + +EXPORT_C CLogFile* CLogFile::NewL(const TDesC& aFileName, TBool aInitialiseLog) + { + CLogFile* self = NewLC(aFileName, aInitialiseLog); + CleanupStack::Pop(self); + return(self); + } + + +EXPORT_C CLogFile* CLogFile::NewLC(const TDesC& aFileName, TBool aInitialiseLog) + { + CLogFile* self = new (ELeave) CLogFile(); + CleanupStack::PushL(self); + self->ConstructL(aFileName, aInitialiseLog); + return(self); + } + + +CLogFile::CLogFile() + { + // No implementation required + } + + +EXPORT_C CLogFile::~CLogFile() + { + iLogFile.Flush(); + iLogFile.Close(); + iSession.Close(); + } + + +void CLogFile::ConstructL(const TDesC& aFileName, TBool aInitialiseLog) + { + +#ifdef ORIGINAL_TIMESTAMP + TInt period; + User::LeaveIfError(HAL::Get(HALData::ESystemTickPeriod, period)); + + iLogMillisecsPerTick = period / 1000; + + if (iLogMillisecsPerTick == 0) + { + iLogMillisecsPerTick = 1; + } +#endif + + User::LeaveIfError( iSession.Connect() ); + + if (aInitialiseLog) + { + User::LeaveIfError(iLogFile.Replace(iSession, aFileName, EFileShareAny | EFileWrite)); + } + else + { + TInt err = iLogFile.Open(iSession, aFileName, EFileShareAny | EFileWrite); + + switch (err) + { + case KErrNone: // Opened ok, so seek to end of file + { + TInt position = 0; + User::LeaveIfError(iLogFile.Seek(ESeekEnd, position)); + } + break; + + case KErrNotFound: // File doesn't exist, so create it + User::LeaveIfError(iLogFile.Create(iSession, aFileName, EFileShareAny | EFileWrite)); + break; + + default: // Unexepected error + User::Leave(err); + break; + } + } + } + + +EXPORT_C void CLogFile::LogTime() + { + StartWrite(); + LogTimeInternal(); + EndWrite(); + } + + +EXPORT_C void CLogFile::Log(const TDesC8& aText) + { + StartWrite(); + LogTextInternal(aText); + EndWrite(); + } + + +EXPORT_C void CLogFile::Log(const TDesC& aText) + { + StartWrite(); + + // Create character converter + CCnvCharacterSetConverter* characterConverter = CCnvCharacterSetConverter::NewLC(); + CCnvCharacterSetConverter::TAvailability converterAvailability; + converterAvailability = characterConverter->PrepareToConvertToOrFromL(KCharacterSetIdentifierAscii, iSession); + + for (TInt i = 0; i < aText.Length(); i++) + { + if (aText.Mid(i).Find(KCrLf) == 0) + { + LogNewline(); + i++; + } + else if (converterAvailability == CCnvCharacterSetConverter::EAvailable) + { + // Convert character from unicode + TBuf<1> unicodeBuffer; + TBuf8<10> asciiBuffer; + + unicodeBuffer.Append(aText[i]); + TInt status = characterConverter->ConvertFromUnicode(asciiBuffer, unicodeBuffer); + + if (status >= 0) + { + LogTextInternal(asciiBuffer); + } + } + else // character converter not available + { + TBuf8<1> asciiBuffer; + asciiBuffer.Append(static_cast(aText[i])); + LogTextInternal(asciiBuffer); + } + } + + CleanupStack::PopAndDestroy(characterConverter); + EndWrite(); + } + + +EXPORT_C void CLogFile::Log(TUint8 aByte) + { + StartWrite(); + LogByteInternal(aByte); + EndWrite(); + } + + +EXPORT_C void CLogFile::Log(TUint aNumber) + { + StartWrite(); + LogIntInternal(aNumber); + EndWrite(); + } + + +EXPORT_C void CLogFile::LogBytes(const TDesC8& aBuffer) + { + StartWrite(); + + for (TInt i = 0; i < aBuffer.Length(); i++) + { + LogByteInternal(aBuffer[i]); + } + + EndWrite(); + } + + +void CLogFile::LogTimeInternal() + { + TBuf8<50> text; + +#ifdef ORIGINAL_TIMESTAMP + + TInt timeInMillisecs = User::TickCount() * iLogMillisecsPerTick; + TInt secs = timeInMillisecs / 1000; + TInt millisecs = timeInMillisecs % 1000; + text.Num(secs); + text.Append('.'); + Write(text); + text.Num(millisecs); + + while (text.Length() < KNumberOfDecimalPlaces) + { + text.Insert(0, _L8("0")); + } + + text.Append('-'); + Write(text); + +#else + + TTime time; + time.HomeTime(); + TBuf<31> dateString; + _LIT(KDateString4,"%-B%:0%J%:1%T%:2%S%.%*C4%:3%+B "); + time.FormatL(dateString,KDateString4); + text.Append(dateString); + Write(text); + +#endif // ORIGINAL_TIMESTAMP + } + + +void CLogFile::LogTextInternal(const TDesC8& aText) + { + TPtrC8 tail(aText.Ptr(), aText.Length()); + + TInt newLinePosition = tail.Find(KCrLf8); + while (newLinePosition != KErrNotFound) + { + if (newLinePosition > 0) + { + Write(tail.Left(newLinePosition)); + tail.Set(aText.Ptr() + newLinePosition, tail.Length() - newLinePosition); + } + LogNewline(); + tail.Set(aText.Ptr() + KCrLf8.iTypeLength, tail.Length() - KCrLf8.iTypeLength); + + newLinePosition = tail.Find(KCrLf8); + } + + // No more newlines left so print remainder + Write(tail); + + } + + +void CLogFile::LogByteInternal(TUint8 aByte) + { + if ((aByte >= KAsciiStart) && (aByte < KAsciiEnd)) + { + // Display as ASCII char + TBuf8<1> str; + str.Append(aByte); + Write(str); + } + else + { + // Display as hex number + TBuf8<4> str; + str.Append(KHexCharLeft); + str.AppendNum((TUint)aByte, EHex); + str.Append(KHexCharRight); + Write(str); + } + } + + +void CLogFile::LogIntInternal(TUint aNumber) + { + // Display as ASCII char + TBuf8<20> str; + str.Append(KHexCharLeft); + str.AppendNum(aNumber, EHex); + str.Append(KHexCharRight); + Write(str); + } + + +EXPORT_C void CLogFile::LogNewline() + { + Write(KCrLf8); + + if (iAutoTimestamp) + { + LogTimeInternal(); + } + } + + +void CLogFile::StartWrite() + { + ASSERT(iCheckNestDepth == 0); + iCheckNestDepth++; + + if (iAutoNewline) + { + LogNewline(); + } + } + + +void CLogFile::EndWrite() + { + if (iAutoFlush) + { + iLogFile.Flush(); + } + + iCheckNestDepth--; + ASSERT(iCheckNestDepth == 0); + } + +void CLogFile::Write(const TDesC8& aText) + { + + if (iLogFile.Write(aText) != KErrNone) + { + // As the framework may be trapping User::Panic we need to + // produce the panic at a lower level. + RThread().Panic(KLogFilePanic, TLogFileWriteFailed); + } + } + +EXPORT_C void CLogFile::SetAutoFlush(TBool aOn) + { + iAutoFlush = aOn; + } + + +EXPORT_C void CLogFile::SetAutoTimeStamp(TBool aOn) + { + iAutoTimestamp = aOn; + } + + +EXPORT_C void CLogFile::SetAutoNewline(TBool aOn) + { + iAutoNewline = aOn; + } + + +EXPORT_C void CLogFile::StaticLog(const TDesC& aFileName, const TDesC8& aText) + { + // This needs to be inside a TRAP statement. Calling StaticLogL + // from certain places, for example AppUi destructors, + // would result in E32USER-CBase 66 panic. + TRAP_IGNORE( CLogFile::StaticLogL(aFileName,aText) ); + } + + +EXPORT_C void CLogFile::StaticLog(const TDesC& aFileName, const TDesC& aText) + { + // This needs to be inside a TRAP statement. Calling StaticLogL + // from certain places, for example AppUi destructors, + // would result in E32USER-CBase 66 panic. + TRAP_IGNORE( CLogFile::StaticLogL(aFileName,aText) ); + } + + +EXPORT_C void CLogFile::StaticLogL(const TDesC& aFileName, const TDesC8& aText) + { + CLogFile* logFile = NewLC(aFileName, EFalse); + logFile->SetAutoNewline(ETrue); + logFile->SetAutoTimeStamp(ETrue); + logFile->Log(aText); + CleanupStack::PopAndDestroy(logFile); + } + + +EXPORT_C void CLogFile::StaticLogL(const TDesC& aFileName, const TDesC& aText) + { + CLogFile* logFile = NewLC(aFileName, EFalse); + logFile->SetAutoNewline(ETrue); + logFile->SetAutoTimeStamp(ETrue); + logFile->Log(aText); + CleanupStack::PopAndDestroy(logFile); + } + + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/EABI/JpegRotator.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/EABI/JpegRotator.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ +EXPORTS + _ZN12CJpegRotator12RotateImageLER14TRequestStatusRK7TDesC16S4_NS_13TRotationModeEii @ 1 NONAME + _ZN12CJpegRotator4NewLER3RFs @ 2 NONAME + _ZN12CJpegRotator5NewLCER3RFs @ 3 NONAME + _ZN12CJpegRotatorD0Ev @ 4 NONAME + _ZN12CJpegRotatorD1Ev @ 5 NONAME + _ZN12CJpegRotatorD2Ev @ 6 NONAME + _ZTI11CExifParser @ 7 NONAME ; ## + _ZTI12CJpegRotator @ 8 NONAME ; ## + _ZTI16CJpegRotatorImpl @ 9 NONAME ; ## + _ZTI9CJpRotate @ 10 NONAME ; ## + _ZTV11CExifParser @ 11 NONAME ; ## + _ZTV12CJpegRotator @ 12 NONAME ; ## + _ZTV16CJpegRotatorImpl @ 13 NONAME ; ## + _ZTV9CJpRotate @ 14 NONAME ; ## + _ZN12CJpegRotator6CancelEv @ 15 NONAME + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/bwins/JPEGROTATOR.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/bwins/JPEGROTATOR.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + ??1CJpegRotator@@UAE@XZ @ 1 NONAME ; CJpegRotator::~CJpegRotator(void) + ?NewL@CJpegRotator@@SAPAV1@AAVRFs@@@Z @ 2 NONAME ; class CJpegRotator * CJpegRotator::NewL(class RFs &) + ?NewLC@CJpegRotator@@SAPAV1@AAVRFs@@@Z @ 3 NONAME ; class CJpegRotator * CJpegRotator::NewLC(class RFs &) + ?RotateImageL@CJpegRotator@@QAEXAAVTRequestStatus@@ABVTDesC16@@1W4TRotationMode@1@HH@Z @ 4 NONAME ; void CJpegRotator::RotateImageL(class TRequestStatus &, class TDesC16 const &, class TDesC16 const &, enum CJpegRotator::TRotationMode, int, int) + ?Cancel@CJpegRotator@@QAEXXZ @ 5 NONAME ; void CJpegRotator::Cancel(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/group/JpegRotator.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/group/JpegRotator.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,74 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#if defined( __LOG_TIMING__ ) +MACRO LOG_TIMING +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) || defined(__LOG_TIMING__) +LIBRARY flogger.lib +#endif + +TARGET JpegRotator.dll +TARGETTYPE dll +UID 0x1000008d 0xA00002F8 + +VENDORID 0x101FB657 // VID_DEFAULT +CAPABILITY ALL -TCB + +SOURCEPATH ../src +SOURCE JpegRotator.cpp +SOURCE JpegRotatorImpl.cpp +SOURCE CJpRotate.cpp + +SOURCEPATH ../../src +SOURCE CExifParser.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY imageconversion.lib +LIBRARY cone.lib +LIBRARY estlib.lib + +//#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +SOURCEPATH . + + +// End of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,43 @@ +/* +* 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: +* +*/ + + +#include + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../inc/JpegRotator.h /epoc32/include/JpegRotator.h +../rom/ImageEditorJpegRotator.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorJpegRotator.iby) + +// mmp files +PRJ_MMPFILES +JpegRotator.mmp + +// test project mmp files +PRJ_TESTMMPFILES +../internal/tsrc/group/JpegRotatorTest.mmp +../internal/tsrc/group/RotatorTest.mmp + +PRJ_TESTEXPORTS +#if defined (__EXPORT_ROM_DESCRIPTION_FILES__) +../rom/ImageEditorJpegRotator_test.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorJpegRotator_test.iby) +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/inc/CJpRotate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/inc/CJpRotate.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,179 @@ +/* +* 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: +* +*/ + + +// +// Jpeg decoder class + + +#ifndef __CJPROTATE_H__ +#define __CJPROTATE_H__ + +#include +//#include +#include + +class THuffman; + + +class TJpegData + { + public: + TSize iSize; + TSize iBlockSize; + TSize iSizeInBlocks; + }; + + + +class TJpegBasicBlock + { + public: + TUint32 iOffset; + TUint32 iBuf; + TUint8 iBufBits; + TInt16 iDc; + }; + + + +/// Jpeg component information struct +/// one for each color component +class TComponent + { + public: + char iType; + char iXFactor; + char iYFactor; + char iQuantTable; + }; + + +/// save huffman +class TSHuffman + { + public: + TInt8 iLength[ 256 ]; + TInt8 iCode[ 256 ]; + }; + + +class MJpRotateCallBack; + + + + +/// Main Jpeg decode class +class CJpRotate + : public CBase + { + public: + static CJpRotate* NewL( RFs& aFs, RFile* aSaveFile, TInt aSaveBufSize ); + static CJpRotate* NewLC( RFs& aFs, RFile* aSaveFile, TInt aSaveBufSize ); + ~CJpRotate(); + + private: + CJpRotate( RFs& aFs, RFile* aSaveFile, TInt aSaveBufSize ); + void ConstructL(); + + public: + + void SetCallBack( MJpRotateCallBack* aCallBack ); + void RotateL( const TFileName& aFile, TBool aRotate, TBool aFlip, TBool aMirror ); + void RotateL( const TPtrC8& aData, TPtrC8& aTarget, TBool aRotate, TBool aFlip, TBool aMirror ); + void RotateL( const TPtrC8& aData, TBool aRotate, TBool aFlip, TBool aMirror ); + const TJpegData& Info(); + TPtrC8 ExifData(); + void Cancel(); + + private: + void BufFwd( TInt aBits ); + TInt BufBits( TInt aBits ); + TInt Buf16(); + void BufLoad8(); + void DecodeBlockL( TInt aDc ); + void DecodeBlock2L(); + + void WriteHuffmanL( TInt aValue ); + void WriteBits( TUint32 aValue, TInt aNumBits ); + void CreateSaveHuffmanL( TSHuffman* aHuffman, const TUint8* aBits, const TUint8* aVal ); + void ConvertQuants( TUint8* aSrc, TUint8* aTgt ); + void WriteSaveBuffer( const TUint8* aSrc, TInt aBytes ); + void WriteSaveBuffer( TUint8 aValue ); + void WriteSaveBuffer( TUint16 aValue ); + + void SaveBlocks(); + + void FlushSaveBuf(); + + private: + + TUint8* iBuffer; // contains whole jpeg file now + TInt iBufPos; + + TUint32 iBuf; // Huffman bit buffer + TInt iBufBits; // number of bits in bitbuffer + + THuffman* iHuffman[ 4 ]; // huffman lookup tables + TInt iCurrentHuffman; + + TUint8* iQt[ 4 ]; // Quantization tables + TUint8* iCurrentQt; + + TInt iDct[ 64 ]; // DCT coefficients + + TBool iRst; // RST flag, might occur on some jpegs + // now only supports RST after line of blocks + + TBool iCancelled; + + bool iEOF; + + TJpegData iData; + + TComponent iComponent[ 4 ]; + TInt iNumComponents; + + TUint8* iExifData; + TInt iExifDataLength; + + TSHuffman* iSaveHuffman[ 4 ]; + TSHuffman* iCurrentSaveHuffman; + + TUint8* iSaveBuf; + TInt iSaveBufPos; + TInt iSaveBufBitPos; + TUint8 iSaveByte; + + bool iRotate; + bool iFlip; + bool iMirror; + + RArray< TJpegBasicBlock >iBasicBlock; + + RFs& iFs; + RFile& iSaveFile; + TInt iSaveBufSize; + + MJpRotateCallBack* iCallBack; + + bool iOwnBuffer; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/inc/JpegRotator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/inc/JpegRotator.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,225 @@ +/* +* 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: +* +*/ + + +#ifndef JPEGROTATOR_H +#define JPEGROTATOR_H + + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CJpegRotatorImpl; +class RFs; + + +/* CLASS: MJpegRotatorObserver +* +* Observer interface, which can be optionally implemented +* to receive progress information during the image rotation +* (in block mode only). +* +*/ +class MJpegRotatorObserver +{ +public: + + /** + * Informs the caller that one set of image data blocks has been + * processed, so the progress bar should be incremented. + * The size of the progress increment is returned by RotateImageL + * + * @param - + * @param - + */ + virtual void Increment() = 0; +}; + + + +/* CLASS: CJpegRotator +* +* Rotates an image in 90 degrees steps. +* Available rotation modes: +* +* - ERotModeCounterClockwise, +* - ERotModeClockwise, +* - ERotMode90, +* - ERotMode180, +* - ERotMode270 +* +* +* USAGE +* +* Example 1: asynchronous rotate +* +* iJpegRotator = CJpegRotator::NewL( iEikonEnv->FsSession() ); +* +* // Launch wait dialog +* iWaitDialog = new (ELeave) CAknWaitDialog ( +* reinterpret_cast(&iWaitDialog), +* ETrue ); +* iWaitDialog->SetTone( CAknNoteDialog::EConfirmationTone ); +* iWaitDialog->ExecuteLD( R_WAIT_DIALOG ); +* +* // Start waiting active object. Inthis example, we have an dedicated AO +* // to wait for the completion, but of course the caller could itself be the AO. +* delete iWaiter; +* iWaiter = new (ELeave) CJpegRotatorTestWaiter (*this); +* iWaiter->StartWaitL(); +* +* // Start rotate +* iJpegRotator->RotateImageL( (iWaiter->iStatus), iSource, iTarget, CJpegRotator::ERotModeClockwise ); +* ... +* ... +* // When the rotate is finished, (iWaiter->iStatus) will be completed with KErrNone, +* // or an error code, if the rotate failed or was cancelled. +* +* +*/ +class CJpegRotator : public CBase +{ + +public: + +/** @name Typedefs:*/ +//@{ + enum TRotationMode + { + ERotModeCounterClockwise = 0, + ERotModeClockwise = 1, + ERotMode90 = ERotModeCounterClockwise, + ERotMode180 = 2, + ERotMode270 = ERotModeClockwise, + ERotMode0 = 3 + }; +//@} + +/** @name Methods:*/ +//@{ + + /** NewLC factory method, does not pop cleanup stack + * + * @param - aFsSession + * @param - aObserver + * @return pointer to created CJpegRotator object + */ + IMPORT_C static CJpegRotator * NewLC ( RFs & aFsSession ); + + /** NewL factory method, pops cleanup stack + * + * @param - aFsSession + * @param - aObserver + * @return pointer to created CJpegRotator object + */ + IMPORT_C static CJpegRotator * NewL ( RFs & aFsSession ); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C ~CJpegRotator (); + + /** RotateImageL + * + * Rotates the JPEG image, asynchronous one-block version. + * + * Lossless rotate mode is used by default + * + * Starts the rotate. After the rotation is completed, the + * supplied TRequestStatus is completed. + * + * If the rotation fails, the request is completed with the error code, + * KErrNone otherwise. The function may also leave, if the error happens + * during the pre-rotate check phase. + * + * Possible error codes include: + * - KErrArgument if the rotation argument is out of range. + * - KErrNotFound if the source file does not exist. + * - KErrCorrupt if the source image could not be read. + * - KErrNotSupported if the image type can't be handled (not baseline JPEG) + * - KErrPathNotFound if the target path does not exist. + * - KErrAlreadyExists if the target file already exists. + * - Other system-wide error codes. + * + * @param aStatus - + * Reference to the TRequestStatus of an active object, + * which will be completed when the rotation finishes. + * @param aRotationMode - The rotation direction + * @param aSourceFileName - The image to be rotated + * @param aTargetFileName - The target file where the rotated image will be saved + * @param aHandleExifData - Do we update/create the EXIF data in the JPEG image + * @param aForceLossyMode - Use lossy mode instead of lossless mode + * @return - + */ + IMPORT_C void RotateImageL ( + TRequestStatus & aStatus, + const TDesC & aSourceFileName, + const TDesC & aTargetFileName, + CJpegRotator::TRotationMode aRotationMode, + TBool aHandleExifData = ETrue, + TBool aForceLossyMode = EFalse + ); + + /** Cancel + * + * @param - + * @return - + */ + IMPORT_C void Cancel (); + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * @param - + * @return - + */ + CJpegRotator (); + + /** Second phase constructor, may leave + * + * @param - aFsSession + * @return - + */ + void ConstructL ( RFs& aFsSession ); + +//@} + +/** @name Members:*/ +//@{ + + /// Internal representation + CJpegRotatorImpl * iImplementation; + +//@} + +}; + +#endif + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/inc/JpegRotatorImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/inc/JpegRotatorImpl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,279 @@ +/* +* 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: +* +*/ + + +#ifndef JPEGROTATORIMPL_H +#define JPEGROTATORIMPL_H + + +// INCLUDES +#include "JpegRotator.h" +#include "MJpRotateCallBack.h" + +// debug log writer +//#include "imageeditordebugutils.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +class CJpRotate; + +/* CLASS: CJpegRotatorImpl +* +* CJpegRotatorImpl +* Internal representation of CJpegRotator +* +*/ +class CJpegRotatorImpl : public CBase, public MJpRotateCallBack +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanup stack + * + * @param - aFsSession + * @return pointer to created CJpegRotatorImpl object + */ + static CJpegRotatorImpl * NewL (RFs& aFsSession); + + /** Destructor + * + * @param - + * @return - + */ + ~CJpegRotatorImpl (); + + /** PrepareRotateFileL + * + * @param aRotationMode - + * @param aSourceFileName - + * @param aTargetFileName - + * @param aHandleExifData - + * @return - + */ + void PrepareRotateFileL ( + const TDesC& aSourceFileName, + const TDesC& aTargetFileName, + CJpegRotator::TRotationMode aRotationMode, + TBool aHandleExifData + ); + + /** Start asynchronous rotate + * + * @param - aStatus + * @param - aStatus + */ + void StartAsyncRotate (TRequestStatus& aStatus, TBool aForceLossyMode); + + /** Start asynchronous rotate + * + * @param - aStatus + */ + void StartAsyncLosslessRotate (TRequestStatus& aStatus); + + /** Finish asynchronous rotate + * + * @param - aError + * @return - + */ + void FinishAsyncRotate (TInt aError); + + /** IsLosslessRotatePossible + * + * Check if the image dimensions are suitable for the use of + * rajpeg lossless rotate (divisible by 8) + */ + TBool IsLosslessRotatePossible() const; + + + /** Cancel + * + * Set cancel flag. + */ + void Cancel (); + + /** SetExifData + * + * @see MImageEditorExifHandlerObserver + */ + void SetExifData (TUint8* aExifData, TUint aDataSize); + + /** GetThumbnailImageL + * + * @see MImageEditorExifHandlerObserver + */ + void GetThumbnailImageL ( + TUint8*& aThumbnailData, + TUint& aDataSize, + const TSize& aThumbnailResolution + ); + + /** SetJpegCommentL + * + * @see MImageEditorExifHandlerObserver + */ + void SetJpegCommentL (const TDesC8& aComment); + + /** GetOutputImageSize + * + * @see MImageEditorExifHandlerObserver + */ + void GetOutputImageSize ( TInt& aWidth, TInt& aHeight ) const; + + /** JpRotateStatus + * + * @see MJpRotateCallBack + */ + void JpRotateStatus( TInt aCount, TInt aTotal ); + +//@} + +protected: + +/** @name Methods:*/ +//@{ + +//@} + +private: + +/** @name Methods:*/ +//@{ + + /** Default constructor + * + * @param - aFsSession + * @return - + */ + CJpegRotatorImpl (RFs& aFsSession); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** Cleanup + * + * @param - + * @return - + */ + void Cleanup (); + + /** AsyncRotate + * + * @param - + * @return - + */ + static TInt AsyncRotate (TAny* aThis); + + /** AsyncLosslessRotate + * + * @param - + * @return - + */ + static TInt AsyncLosslessRotate (TAny* aThis); + + /** DoRotateL + * + * @param - + * @return - + */ + void DoRotateL (); + + /** DoLosslessRotateL + * + * @param - + * @return - + */ + void DoLosslessRotateL (); + + /** GetSourceImagePropertiesL + * + * @param - + * @return - + */ + void GetSourceImagePropertiesL ( const TDesC& aFileName ); + + /** PostRotate + * + */ + void PostRotate (); + +//@} + +/** @name Members:*/ +//@{ + + /// File Server session handle + RFs& iFsSession; + + /// Source and target files + TFileName iSourceFileName; + TFileName iTargetFileName; + + /// Current rotate mode + TInt iRotationMode; + + /// Rotator + CJpRotate* iRotator; + + /// Do we update EXIF data or not? + TBool iHandleExifData; + + /// Quality factor of the original image + TUint iOriginalJpegQualityFactor; + + /// Size of the source image + TSize iSourceImageSize; + + /// + TRequestStatus * iCallerStatus; + + /// + CAsyncCallBack * iCallBack; + + /// + TCallBack iCb; + + /// Lossless mode + TBool iLosslessMode; + + /// Cancel flag + TBool iCancelled; + +#if defined (LOG_TIMING) + TTime iStartTime; + TTime iSavingStartTime; + TTime iFinishTime; +#endif + + +//@} + +}; + +#endif + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/inc/JpegRotatorPanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/inc/JpegRotatorPanics.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + + +#include + +#ifndef __JPEGROTATOR_PAN__ +#define __JPEGROTATOR_PAN__ + +/// Jpeg Rotator panics +enum TJpegRotatorPanicIds +{ + /// + EJpegRotatorPanic = 0 +}; + +#endif __JPEGROTATOR_PAN__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/inc/MJpRotateCallBack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/inc/MJpRotateCallBack.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifndef __MJPROTATECALLBACK_H__ +#define __MJPROTATECALLBACK_H__ + +class MJpRotateCallBack + { + public: + virtual void JpRotateStatus( TInt aCount, TInt aTotal ) = 0; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/rom/ImageEditorJpegRotator.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/rom/ImageEditorJpegRotator.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef __RD_S60_JPEGROTATOR + +#ifndef __JPEGROTATOR_IBY__ +#define __JPEGROTATOR_IBY__ + +file=ABI_DIR\BUILD_DIR\JpegRotator.dll SHARED_LIB_DIR\JpegRotator.dll + +#endif // __JPEGROTATOR_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/src/CJpRotate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/src/CJpRotate.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1679 @@ +/* +* 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: +* +*/ + + + + + +#include "CJpRotate.h" +#include "MJpRotateCallBack.h" +#include "CExifParser.h" + +const TUint8 KZigZag[] = { + 0,8,1,2,9,16,24,17, + 10,3,4,11,18,25,32,40, + 33,26,19,12,5,6,13,20, + 27,34,41,48,56,49,42,35, + 28,21,14,7,15,22,29,36, + 43,50,57,58,51,44,37,30, + 23,31,38,45,52,59,60,53, + 46,39,47,54,61,62,55,63 + }; + +const TUint8 KReZig[] = { + 0,2,1,5,4,3,9,8, + 7,6,14,13,12,11,10,20, + 19,18,17,16,15,27,26,25, + 24,23,22,21,35,34,33,32, + 31,30,29,28,42,41,40,39, + 38,37,36,48,47,46,45,44, + 43,53,52,51,50,49,57,56, + 55,54,60,59,58,62,61,63 + }; + + + + +/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ +/* IMPORTANT: these are only valid for 8-bit data precision! */ + +const TUint8 bits_dc_luminance[17] = +{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; +const TUint8 val_dc_luminance[] = +{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + +const TUint8 bits_dc_chrominance[17] = +{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; +const TUint8 val_dc_chrominance[] = +{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + +const TUint8 bits_ac_luminance[17] = +{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; +const TUint8 val_ac_luminance[] = +{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa +}; + +const TUint8 bits_ac_chrominance[17] = +{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; + +const TUint8 val_ac_chrominance[] = +{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa +}; + +const TUint8 KExifHeader[] = "Exif"; + +class THuffman + { + public: + TInt8 iLength[ 256 ]; + TUint8 iSymbol[ 256 ]; + TUint8 iSearch[ 65536 ]; + }; + + +CJpRotate* CJpRotate::NewL( RFs& aFs, RFile* aSaveFile, TInt aSaveBufSize ) + { + CJpRotate* self = NewLC( aFs, aSaveFile, aSaveBufSize ); + CleanupStack::Pop( self ); + return self; + } + + +CJpRotate* CJpRotate::NewLC( RFs& aFs, RFile* aSaveFile, TInt aSaveBufSize ) + { + CJpRotate* self = new( ELeave )CJpRotate( aFs, aSaveFile, aSaveBufSize ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +CJpRotate::~CJpRotate() + { + delete iHuffman[ 0 ]; + delete iHuffman[ 1 ]; + delete iHuffman[ 2 ]; + delete iHuffman[ 3 ]; + + delete iSaveHuffman[ 0 ]; + delete iSaveHuffman[ 1 ]; + delete iSaveHuffman[ 2 ]; + delete iSaveHuffman[ 3 ]; + + delete iQt[ 0 ]; + delete iQt[ 1 ]; + delete iQt[ 2 ]; + delete iQt[ 3 ]; + + if( iOwnBuffer ) + { + delete iBuffer; + } + delete iSaveBuf; + iBasicBlock.Reset(); + + if( &iSaveFile != NULL ) + { + iSaveFile.Flush(); + iSaveFile.Close(); + } + } + +CJpRotate::CJpRotate( RFs& aFs, RFile* aSaveFile, TInt aSaveBufSize ) + : iCancelled(EFalse) + , iFs( aFs ) + , iSaveFile( *aSaveFile ) + , iSaveBufSize( aSaveBufSize ) + { + + } + +void CJpRotate::ConstructL() + { + } + + + +void CJpRotate::SetCallBack( MJpRotateCallBack* aCallBack ) + { + iCallBack = aCallBack; + } + +void CJpRotate::Cancel() + { + iCancelled = ETrue; + } + + + +void CJpRotate::RotateL( const TFileName& aFile, TBool aRotate, TBool aFlip, TBool aMirror ) + { + + iCancelled = EFalse; + + if (iBuffer) + { + delete iBuffer; + iBuffer = NULL; + } + + RFile file; + TInt err = file.Open( iFs, aFile, EFileRead | EFileShareReadersOnly ); + if (KErrNone != err) + { + User::LeaveIfError( file.Open( iFs, aFile, EFileRead | EFileShareAny ) ); + } + CleanupClosePushL( file ); + + TInt size; + file.Size( size ); + iOwnBuffer = true; + iBuffer = new( ELeave )TUint8[ size + 2 ]; + TPtr8 ptr( iBuffer, size ); + file.Read( ptr ); + + CleanupStack::PopAndDestroy( 1 ); // file + RotateL( ptr, aRotate, aFlip, aMirror ); + } + + + +void CJpRotate::RotateL( const TPtrC8& aData, TPtrC8& aTarget, TBool aRotate, TBool aFlip, TBool aMirror ) + { + iOwnBuffer = false; + RotateL( aData, aRotate, aFlip, aMirror ); + + aTarget.Set( iSaveBuf, iSaveBufPos ); + } + + + +void CJpRotate::RotateL( const TPtrC8& aData, TBool aRotate, TBool aFlip, TBool aMirror ) + { + + iFlip = aFlip; + iMirror = aMirror; + iRotate = aRotate; + if( iRotate ) + { + if( iFlip ) + { + iFlip = false; + } + else + { + iFlip = true; + } + } + + + iBuffer = (TUint8*)aData.Ptr(); + + iSaveBuf = new( ELeave )TUint8[ iSaveBufSize ]; + //Mem::FillZ( iSaveBuf, iS ); + iSaveByte = 0; + iSaveBufPos = 0; + iSaveBufBitPos = 0; + + // if used again, all variables should be cleared + iBuf = 0; + iBufBits = 0; + + delete iHuffman[ 0 ]; + delete iHuffman[ 1 ]; + delete iHuffman[ 2 ]; + delete iHuffman[ 3 ]; + iHuffman[ 0 ] = 0; + iHuffman[ 1 ] = 0; + iHuffman[ 2 ] = 0; + iHuffman[ 3 ] = 0; + //CreateDefaultHuffmanL(); + + + iQt[ 0 ] = 0; + iQt[ 1 ] = 0; + iQt[ 2 ] = 0; + iQt[ 3 ] = 0; + + + TBool moreChunks = ETrue; + TBool possibleChunk = EFalse; + + while( moreChunks ) + { + if (iCancelled) + { + return; + } + + TUint8 b = iBuffer[ iBufPos++ ]; + if( possibleChunk ) + { + possibleChunk = EFalse; + switch( b ) + { + case 0xd8: // start of image + { + WriteSaveBuffer( (TUint16)0xffd8 ); + break; + } + case 0xe0: // JFIF application segment + { + WriteSaveBuffer( (TUint16)0xffe0 ); + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + WriteSaveBuffer( (TUint16)l ); + WriteSaveBuffer( iBuffer + iBufPos, l-2 ); + iBufPos += l-2; + break; + } + case 0xe1: // APP1 segment, possible EXIF + { + + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; + iBufPos += 2; + l -= 2; + + // Check that there is "Exif" header in the data + const TUint8* pos = &iBuffer[ iBufPos ]; + if (Mem::Compare(pos, 2, &KExifHeader[0], 2 )) + { + iBufPos += l; + break; + } + + iBufPos += 6; + l -= 6; + + iExifData = iBuffer + iBufPos; + iExifDataLength = l; + + CExifParser* p = CExifParser::NewLC(); + + TRAP_IGNORE(p->ParseL( TPtrC8( iExifData, iExifDataLength ) );); + + TPtrC8 thumb( p->ThumbData() ); + TPtrC8 saveThumb( 0,0 ); + TUint8* thumbPtr = 0; + + + if( iRotate ) + { + // + // swap width and height ( if exists ) + // + if( p->TagExist( CExifParser::ESubIfd, 0xa002 ) && + p->TagExist( CExifParser::ESubIfd, 0xa003 ) ) + { + TUint16 width = p->TagValue( CExifParser::ESubIfd, 0xa002 ); + TUint16 height = p->TagValue( CExifParser::ESubIfd, 0xa003 ); + + p->DeleteTag( CExifParser::ESubIfd, 0xa002 ); + p->DeleteTag( CExifParser::ESubIfd, 0xa003 ); + + p->AddTagL( CExifParser::ESubIfd, 0xa002, height ); + p->AddTagL( CExifParser::ESubIfd, 0xa003, width ); + } + } + + // + // Rotate thumbnail ( if exists ) + // + if( thumb.Ptr() ) + { + CJpRotate* r = CJpRotate::NewLC( iFs, NULL, 0x10000 ); + + TPtrC8 target; + r->RotateL( thumb, target, aRotate, aFlip, aMirror ); + + thumbPtr = new( ELeave )TUint8[ target.Length() ]; + Mem::Copy( thumbPtr, target.Ptr(), target.Length() ); + saveThumb.Set( thumbPtr, target.Length() ); + + CleanupStack::PopAndDestroy( r ); + CleanupStack::PushL( thumbPtr ); + } + + + TPtrC8 exif = p->SaveL( saveThumb ); + + WriteSaveBuffer( (TUint16)0xffe1 ); // APP1 segment + + TUint16 l2 = exif.Length() + 6 + 2; // +header+tagsize + WriteSaveBuffer( l2 ); + + // exif header is 6 bytes ( 45 78 69 66 00 00 "Exif.." ) + WriteSaveBuffer( (TUint8)0x45 ); + WriteSaveBuffer( (TUint8)0x78 ); + WriteSaveBuffer( (TUint8)0x69 ); + WriteSaveBuffer( (TUint8)0x66 ); + WriteSaveBuffer( (TUint8)0x00 ); + WriteSaveBuffer( (TUint8)0x00 ); + + WriteSaveBuffer( exif.Ptr(), exif.Length() ); + + if( thumbPtr ) + { + CleanupStack::PopAndDestroy( thumbPtr ); + } + CleanupStack::PopAndDestroy( p ); + + + iBufPos += l; + break; + } + case 0xe2: + case 0xe3: + case 0xe4: + case 0xe5: + case 0xe6: + case 0xe7: + case 0xe8: + case 0xe9: + case 0xea: + case 0xeb: + case 0xec: + case 0xed: + case 0xee: + case 0xef: + { + WriteSaveBuffer( (TUint8)0xff ); + WriteSaveBuffer( (TUint8)b ); + + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + WriteSaveBuffer( (TUint16)l ); + WriteSaveBuffer( iBuffer + iBufPos, l-2 ); + + iBufPos += l-2; + break; + } + case 0xdb: // Quantization table + { + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + + WriteSaveBuffer( (TUint16)0xffdb ); + WriteSaveBuffer( (TUint16)l ); + + TInt nqt = l / 65; + TInt i; + + // one or more quantization table + for( i=0; i> 4; + + if (iQt[n]) + { + delete iQt[ n ]; + iQt[ n ] = NULL; + } + + iQt[ n ] = new( ELeave )TUint8[ 64 ]; + TInt j; + for( j=0; j<64; j++ ) + { + iQt[ n ][ j ] = iBuffer[ iBufPos++ ]; + } + + + TUint8 qt[ 64 ]; + ConvertQuants( iQt[ n ], qt ); + WriteSaveBuffer( qt, 64 ); + } + + + break; + } + case 0xc0: // start of frame ( SOF ) + { + TInt length = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + + WriteSaveBuffer( (TUint16)0xffc0 ); + WriteSaveBuffer( (TUint16)length ); + + // not used: + TUint8 precision = iBuffer[ iBufPos ]; + WriteSaveBuffer( precision ); + iBufPos++; + + // height + TUint16 h = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + iData.iSize.iHeight = h; + + // width + TUint16 w = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + iData.iSize.iWidth = w; + + if( iRotate ) + { + WriteSaveBuffer( w ); + WriteSaveBuffer( h ); + } + else + { + WriteSaveBuffer( h ); + WriteSaveBuffer( w ); + } + + // component data + iNumComponents = iBuffer[ iBufPos++ ]; + WriteSaveBuffer( (TUint8)iNumComponents ); + + TInt i; + for( i=0; i> 4; + iComponent[ comp ].iYFactor = samplingFactor & 15; + iComponent[ comp ].iQuantTable = quantizationTable; + + + comp++; + + + if( iRotate ) + { + samplingFactor = samplingFactor/16 + ( samplingFactor & 15 )*16; + } + + WriteSaveBuffer( comp ); + WriteSaveBuffer( samplingFactor ); + WriteSaveBuffer( quantizationTable ); + } + + TInt xBlocks = 0; + TInt yBlocks = 0; + + for( i=0; i xBlocks ) + { + xBlocks = x; + } + if( y > yBlocks ) + { + yBlocks = y; + } + } + + iData.iBlockSize.iWidth = xBlocks * 8; + iData.iBlockSize.iHeight = yBlocks * 8; + + TSize size = iData.iSize; + size.iWidth /= iData.iBlockSize.iWidth; + size.iHeight /= iData.iBlockSize.iHeight; + + if( iData.iSize.iWidth & ( iData.iBlockSize.iWidth - 1 ) ) + { + size.iWidth++; + } + + if( iData.iSize.iHeight & ( iData.iBlockSize.iHeight - 1 ) ) + { + size.iHeight++; + } + + iData.iSizeInBlocks = size; + + + break; + } + case 0xc1: + { + // Extended sequential Jpeg, not supported + User::Leave( KErrNotSupported ); + break; + }; + case 0xc2: + { + // Progressive DCT jpeg, not supported + User::Leave( KErrNotSupported ); + break; + }; + case 0xc3: + { + // Lossless ( sequential ) Jpeg, not supported + User::Leave( KErrNotSupported ); + break; + }; + + case 0xc5: + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + { + User::Leave( KErrNotSupported ); + break; + }; + case 0xc4: // huffman table + { + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + + + // + // Write default huffman tables + // + WriteSaveBuffer( (TUint16)0xffc4 ); + TUint16 saveLen = 2+1+16+12+1+16+12+1+16+162+1+16+162; + WriteSaveBuffer( saveLen ); + + WriteSaveBuffer( (TUint8)0 ); + WriteSaveBuffer( bits_dc_luminance+1, 16 ); + WriteSaveBuffer( val_dc_luminance, 12 ); + + WriteSaveBuffer( (TUint8)1 ); + WriteSaveBuffer( bits_dc_chrominance+1, 16 ); + WriteSaveBuffer( val_dc_chrominance, 12 ); + + WriteSaveBuffer( (TUint8)16 ); + WriteSaveBuffer( bits_ac_luminance+1, 16 ); + WriteSaveBuffer( val_ac_luminance, 20*8+2 ); + + WriteSaveBuffer( (TUint8)17 ); + WriteSaveBuffer( bits_ac_chrominance+1, 16 ); + WriteSaveBuffer( val_ac_chrominance, 20*8+2 ); + + TInt table = 0; + + TInt n = 0; + + // one or more huffman tables + while( niSymbol[ i ] = v; + n++; + } + + i = ( table & 16 ) / 8 + ( table & 15 ); + + + // Generate huffman lookup tables ( huffSize, table ) + + + TInt l; + TInt p = 0; + for( l=0; l<16; l++ ) + { + for( i=0; iiLength[ p++ ] = l+1; + } + } + + TInt code = 0; + huff->iLength[ p ] = 0; + TInt si = huff->iLength[ 0 ]; + TInt lastP = p; + + TInt hc[ 256 ]; + p = 0; + + while( huff->iLength[ p ] ) + { + while( huff->iLength[ p ] == si ) + { + hc[ p++ ] = code++; + } + code *= 2; + si++; + } + + l = 65536; + for( i=lastP-1; i>=0; i-- ) + { + TInt t = 16 - huff->iLength[ i ]; + TInt k = hc[ i ] * ( 1 << t ); + TInt j; + for( j=k; jiSearch[ j ] = i; + } + l = k; + } + + i = ( table & 16 ) / 8 + ( table & 15 ); + delete iHuffman[ i ]; + iHuffman[ i ] = huff; + } + + break; + } +// + case 0xda: // start of scan ( SOS ) + { + // write restart interval before SOS + /* + WriteSaveBuffer( (TUint16)0xffdd ); + WriteSaveBuffer( (TUint16)0x0004 ); + WriteSaveBuffer( (TUint16)1 ); // reset every (1) macroblock + */ + // SOS now: + WriteSaveBuffer( (TUint16)0xffda ); + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + + WriteSaveBuffer( (TUint16)l ); + + TInt c1 = 0; + TInt c2 = 0; + TInt c3 = 0; + + TInt numComponents = iBuffer[ iBufPos++ ]; + WriteSaveBuffer( (TUint8)3 ); + TInt i; + for( i=0; i> 3 ) << 3; + TInt badBits = iBufBits - goodBits; + iBuf <<= badBits; + iBufBits = goodBits; + } + } + } + + moreChunks = EFalse; + + SaveBlocks(); + + // flush last bits to save buffer + if( iSaveBufBitPos ) + { + WriteBits( 0, 8-iSaveBufBitPos ); + } + + // EOI + + + + //iSaveBuf[ iSaveBufPos++ ] = 0xff; + //iSaveBuf[ iSaveBufPos++ ] = 0xd9; + WriteSaveBuffer( (TUint16)0xffd9 ); + + FlushSaveBuf(); + + + + break; + } + case 0xd9: // end of image ( EOI ) + { + // not really used for anything + // will exit if picture data is read. + break; + } + case 0xdd: // define restart interval + { + //TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; + iBufPos += 2; + //TInt interval = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; + iBufPos += 2; + + break; + } + case 0x00: // escaped 0xff + { + // only comes if file is broken somehow + break; + } + case 0xfe: // jpeg comment + { + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + WriteSaveBuffer( (TUint16)0xfffe ); + WriteSaveBuffer( (TUint16)l ); + WriteSaveBuffer( iBuffer + iBufPos, l-2 ); + iBufPos += l-2; + break; + }; + default: + { + // unknown block + break; + } + } + } + else if( b == 255 ) + { + possibleChunk = ETrue; + } + + } + + } + + + + +void CJpRotate::BufFwd( TInt aBits ) + { + iBuf <<= aBits; + iBufBits -= aBits; + } + + + +TInt CJpRotate::BufBits( TInt aBits ) + { + if( aBits == 0 ) return 0; + while( iBufBits < aBits ) + { + BufLoad8(); + } + TInt val = iBuf >> ( 32-aBits ); + BufFwd( aBits ); + return val; + } + + + +TInt CJpRotate::Buf16() + { + while( iBufBits < 16 ) + { + BufLoad8(); + } + TInt val = iBuf >> ( 32-16 ); + return val; + } + + + +void CJpRotate::BufLoad8() + { + TInt v; + v = iBuffer[ iBufPos++ ]; + if( v == 255 ) + { + v = iBuffer[ iBufPos++ ]; // escaped 0xff ? + if( v == 0 ) + { + v = 255; + } + else if( v == 0xd9 ) // EOI + { + iEOF = true; + v = 0; + } + else + { + // here we have probably discarded a RST0 or similar + v = iBuffer[ iBufPos++ ]; + iRst = ETrue; + } + } + + v <<= ( 24 - iBufBits ); + iBuf |= v; + iBufBits += 8; + } + + + +void CJpRotate::DecodeBlockL( TInt aDc ) + { + + // + // Dummy version of block decode + // only traverses through huffman data + // and collects DC-values + // + TInt16 vals[ 64 ]; + TUint16 bits[ 64 ]; + TUint8 lens[ 64 ]; + + Mem::FillZ( vals, 64*2 ); + Mem::FillZ( bits, 64*2 ); + Mem::FillZ( lens, 64 ); + + //for( TInt i=0; i<64; i++ ) lens[ i ] = 255; + + + THuffman* h = iHuffman[ iCurrentHuffman ]; + + + TInt k; + for( k=0; k<64; k++ ) + { + + TInt v = Buf16(); + TInt index = h->iSearch[ v ]; + TInt symbol = h->iSymbol[ index ]; + BufFwd( h->iLength[ index ] ); + + TInt nullCount = 0; + + if( k>0 ) + { + nullCount = symbol >> 4; + symbol &= 15; + } + + + v = BufBits( symbol ); + + TUint16 currentBits = v; + + if( v < ( 1 << ( symbol-1 ) ) ) + { + v += 1 - ( 1 << symbol ); + } + + + if( k ) + { + if( nullCount==0 && v==0 ) + { + k = 64; + break; + } + else if( nullCount==15 && v==0 ) + { + k += 15; + } + else + { + k += nullCount; + if( k > 63 ) break; + TInt pos = k; + if( iRotate ) pos = KReZig[ pos ]; + lens[ pos ] = symbol; + vals[ pos ] = v; + bits[ pos ] = currentBits; + } + } + else + { + h = iHuffman[ iCurrentHuffman+2 ]; // DC -> AC huffman + + lens[ 0 ] = symbol; + vals[ 0 ] = aDc / iCurrentQt[ 0 ]; + //vals[ 0 ] = aDc; + bits[ 0 ] = currentBits; + } + } + + + + TInt count; + for( count=63; count>=0; count-- ) + { + if( lens[ count ] != 0 ) break; + } + if( count < 0 ) count = 0; + + TInt nullCount = 0; + + // + // Write DC + // + + TInt value = vals[ 0 ]; + bool minus = false; + if( value < 0 ) + { + minus = true; + value = -value; + } + TInt v = value; + TInt vl = 0; + + while( v ) + { + v >>= 1; + vl++; + } + + if( minus ) + { + TInt a = ( 1 << vl ) - 1; + value ^= a; + } + + WriteHuffmanL( vl ); + WriteBits( value, vl ); + + // DC -> AC huffman + if( iCurrentSaveHuffman == iSaveHuffman[ 0 ] ) + { + iCurrentSaveHuffman = iSaveHuffman[ 2 ]; + } + else if( iCurrentSaveHuffman == iSaveHuffman[ 1 ] ) + { + iCurrentSaveHuffman = iSaveHuffman[ 3 ]; + } + // + // Write AC + // + for( k=1; k<=count; k++ ) + { + + if( vals[ k ] == 0 ) + { + nullCount++; + if( nullCount == 16 ) + { + // write nullCount 15 with value 0 + WriteHuffmanL( 15 * 16 ); + nullCount = 0; + } + } + else + { + // write bits & nullCount huffman coded + + TUint8 neg = 0; + TInt p = KZigZag[ k ]; + if( p & 8 && iMirror ) neg = 1; + if( p & 1 && iFlip ) neg ^= 1; + + TUint16 b = bits[ k ]; + TInt l = lens[ k ]; + TInt v = vals[ k ]; + if( neg ) + { + if( v>0 ) + { + b = v ^ ( ( 1 << l ) - 1 ); + } + else + { + b = -v; + } + + } + + WriteHuffmanL( l + nullCount * 16 ); + WriteBits( b,l ); + + nullCount = 0; + } + } + if( count != 63 ) + { + WriteHuffmanL( 0 ); + } + + } + + + +void CJpRotate::DecodeBlock2L() + { + + THuffman* h = iHuffman[ iCurrentHuffman ]; + + TInt k; + + TJpegBasicBlock bl; + bl.iOffset = iBufPos; + bl.iBuf = iBuf; + bl.iBufBits = iBufBits; + + + for( k=0; k<64; k++ ) + { + + TInt v = Buf16(); + TInt index = h->iSearch[ v ]; + TInt symbol = h->iSymbol[ index ]; + BufFwd( h->iLength[ index ] ); + + TInt nullCount = 0; + if( k>0 ) + { + nullCount = symbol >> 4; + symbol &= 15; + } + + v = BufBits( symbol ); + + if( v < ( 1 << ( symbol-1 ) ) ) + { + v += 1 - ( 1 << symbol ); + } + + if( k ) + { + if( nullCount==0 && v==0 ) + { + k = 64; + break; + } + else if( nullCount==15 && v==0 ) + { + k += 15; + } + else + { + k += nullCount; + } + } + else + { + iDct[ 0 ] += v * iCurrentQt[ 0 ]; + h = iHuffman[ iCurrentHuffman+2 ]; + } + + } + + bl.iDc = iDct[ 0 ]; + + User::LeaveIfError(iBasicBlock.Append( bl )); + + //Idct(); + } + + + + +const TJpegData& CJpRotate::Info() + { + return iData; + } + + +TPtrC8 CJpRotate::ExifData() + { + return TPtrC8( iExifData, iExifDataLength ); + } + + + + +void CJpRotate::WriteHuffmanL( TInt aValue ) + { + TInt code = iCurrentSaveHuffman->iCode[ aValue ]; + TInt len = iCurrentSaveHuffman->iLength[ aValue ]; + if( aValue != 0 && len == 0 ) + { + // + // The value which we tried to write doesn't exist in + // the huffman table. Therefore the output would be + // corrupted. Thus the leave. + // actually this should not happen ever. + // + User::Leave( KErrCorrupt ); + } + WriteBits( code, len ); + } + + + +void CJpRotate::WriteBits( TUint32 aValue, TInt aNumBits ) + { + + aValue &= ( ( 1 << aNumBits ) - 1 ); + while( aNumBits > 0 ) + { + TInt bitroom = 8 - iSaveBufBitPos; + //iSaveBuf[ iSaveBufPos ] |= ( ( aValue << ( 24+bitroom-aNumBits ) ) >> 24 ); + iSaveByte |= ( ( aValue << ( 24+bitroom-aNumBits ) ) >> 24 ); + + if( aNumBits < bitroom ) + { + iSaveBufBitPos += aNumBits; + } + else + { + iSaveBufBitPos += bitroom; + } + + if( iSaveBufBitPos == 8 ) + { + + iSaveBufBitPos = 0; + iSaveBuf[ iSaveBufPos ] = iSaveByte; + + if( iSaveByte == 255 ) + { + iSaveBufPos++; + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + iSaveBuf[ iSaveBufPos ] = 0; // 255,0 = 255 ( escaped 255 ) + } + iSaveByte = 0; + iSaveBufPos++; + + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + + } + aNumBits -= bitroom; + } + } + + +void CJpRotate::CreateSaveHuffmanL( TSHuffman* aHuffman, const TUint8* aBits, const TUint8* aVal ) + { + + + TInt huffSize[ 16 ]; + + TUint32 huffCode[ 256 ]; + TInt huffValue[ 256 ]; + TInt huffLength[ 256 ]; + + TInt numSymbols = 0; + TInt i; + + for( i=0; i<16; i++ ) + { + TInt size = aBits[ i+1 ]; + huffSize[ i ] = size; + numSymbols += size; + } + + for( i=0; iiLength[ v ] = huffLength[ i ]; + aHuffman->iCode[ v ] = huffCode[ i ]; + } + + + } + + +void CJpRotate::ConvertQuants( TUint8* aSrc, TUint8* aTgt ) + { + if( ! iRotate ) + { + Mem::Copy( aTgt, aSrc, 64 ); + return; + } + + for( TInt i=0; i<64; i++ ) + { + aTgt[ KReZig[ i ] ] = aSrc[ i ]; + } + } + + + +void CJpRotate::WriteSaveBuffer( const TUint8* aSrc, TInt aBytes ) + { + TInt pos = 0; + while( aBytes ) + { + TInt bytes = aBytes; + if( iSaveBufPos + bytes > iSaveBufSize ) + { + bytes = iSaveBufSize - iSaveBufPos; + } + Mem::Copy( iSaveBuf + iSaveBufPos, aSrc + pos, bytes ); + iSaveBufPos += bytes; + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + aBytes -= bytes; + pos += bytes; + } + } + + +void CJpRotate::WriteSaveBuffer( TUint8 aValue ) + { + iSaveBuf[ iSaveBufPos++ ] = aValue; + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + } + + +void CJpRotate::WriteSaveBuffer( TUint16 aValue ) + { + WriteSaveBuffer( (TUint8) ( aValue / 256 ) ); + WriteSaveBuffer( (TUint8) ( aValue & 255 ) ); + } + + +void CJpRotate::SaveBlocks() + { + TInt yBlocks = iComponent[ 0 ].iXFactor * iComponent[ 0 ].iYFactor; + TInt uBlocks = iComponent[ 1 ].iXFactor * iComponent[ 1 ].iYFactor; + TInt vBlocks = iComponent[ 2 ].iXFactor * iComponent[ 2 ].iYFactor; + + TInt blocks = yBlocks + uBlocks + vBlocks; + TInt blockOffset[ 16 ]; + + TInt x; + TInt y; + + TInt i = 0; + TInt b = 0; + for( TInt comp = 0; comp= n ) v -= n; + //blockOffset[ i++ ] = b + v; + blockOffset[ b+v ] = i++; + } + } + b += c.iXFactor*c.iYFactor; + } + TInt bw = iData.iSizeInBlocks.iWidth; + TInt bh = iData.iSizeInBlocks.iHeight; + + TInt yDc = 0; + TInt uDc = 0; + TInt vDc = 0; + + TInt count = 0; + + TInt blockXAdd; + TInt blockYAdd; + TInt blockPos; + + if( iRotate ) + { + if( iMirror ) + { + if( iFlip ) + { + blockPos = blocks * ( bw * bh - 1 ); + blockXAdd = -blocks * bw; + blockYAdd = blocks * bw * bh - blocks; + } + else + { + blockPos = blocks * bw * ( bh - 1 ); + blockXAdd = -blocks * bw; + blockYAdd = blocks * bw * bh + blocks; + } + } + else + { + if( iFlip ) + { + blockPos = blocks * ( bw - 1 ); + blockXAdd = blocks * bw; + blockYAdd = -blocks * bw * bh - blocks; + } + else + { + blockPos = 0; + blockXAdd = blocks * bw; + blockYAdd = -blocks * ( bw * bh - 1 ); + } + } + TInt t = bw; bw = bh; bh = t; + } + else + { + if( iMirror ) + { + if( iFlip ) + { + blockPos = blocks * ( bw * bh - 1 ); + blockXAdd = -blocks; + blockYAdd = 0; + } + else + { + blockPos = blocks * ( bw-1 ); + blockXAdd = -blocks; + blockYAdd = bw * blocks * 2; + } + } + else + { + if( iFlip ) + { + blockPos = blocks * bw * ( bh-1 ); + blockXAdd = blocks; + blockYAdd = -blocks*bw*2; + } + else + { + blockPos = 0; + blockXAdd = blocks; + blockYAdd = 0; + } + } + } + + TInt numMacroBlocks = bw*bh; + + for( y=0; yJpRotateStatus( count, numMacroBlocks ); + } + + } + blockPos += blockYAdd; + } + + //RDebug::Print( _L("last access block :%d"), mx ); + } + + + +void CJpRotate::FlushSaveBuf() + { + if( &iSaveFile == NULL ) return; // no flushing without file + TPtr8 ptr( iSaveBuf, iSaveBufPos ); + ptr.SetLength( iSaveBufPos ); + iSaveFile.Write( ptr ); + iSaveBufPos = 0; + } diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/src/JpegRotator.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/src/JpegRotator.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,93 @@ +/* +* 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: +* +*/ + + +// INCLUDE FILES +#include "JpegRotator.h" +#include "JpegRotatorImpl.h" + +// CONSTANTS + +// debug log +#include "imageeditordebugutils.h" + +//============================================================================= +EXPORT_C CJpegRotator * CJpegRotator::NewLC (RFs& aFsSession) +{ + CJpegRotator * self = new (ELeave) CJpegRotator (); + CleanupStack::PushL (self); + self->ConstructL (aFsSession); + return self; +} + +//============================================================================= +EXPORT_C CJpegRotator * CJpegRotator::NewL (RFs& aFsSession) +{ + CJpegRotator * self = CJpegRotator::NewLC (aFsSession); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +EXPORT_C CJpegRotator::~CJpegRotator () +{ + LOG( KJpegRotatorLogFile, "CJpegRotator::~CJpegRotator"); + + delete iImplementation; +} + +//============================================================================= +EXPORT_C void CJpegRotator::RotateImageL ( + TRequestStatus & aStatus, + const TDesC & aSourceFileName, + const TDesC & aTargetFileName, + CJpegRotator::TRotationMode aRotationMode, + TBool aHandleExifData, + TBool aForceLossyMode + ) +{ + LOGFMT( KJpegRotatorLogFile, "CJpegRotator::RotateImageL (rotation mode: %d)", aRotationMode ); + LOGFMT( KJpegRotatorLogFile, "\tSource image: %S", &aSourceFileName ); + LOGFMT( KJpegRotatorLogFile, "\tTarget image: %S", &aTargetFileName ); + + iImplementation->PrepareRotateFileL (aSourceFileName, aTargetFileName, aRotationMode, aHandleExifData); + iImplementation->StartAsyncRotate (aStatus, aForceLossyMode); +} + +//============================================================================= +EXPORT_C void CJpegRotator::Cancel () +{ + LOG( KJpegRotatorLogFile, "CJpegRotator::Cancel()"); + + iImplementation->Cancel(); +} + +//============================================================================= +CJpegRotator::CJpegRotator () +{ +} + +//============================================================================= +void CJpegRotator::ConstructL (RFs& aFsSession) +{ + LOG_INIT( KJpegRotatorLogFile ); + + iImplementation = CJpegRotatorImpl::NewL (aFsSession); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegRotator/src/JpegRotatorImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegRotator/src/JpegRotatorImpl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,463 @@ +/* +* 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: +* +*/ + + + +// INCLUDE FILES +#include +#include +#include + +#include "JpegRotatorImpl.h" +#include "JpegRotator.h" +#include "CJpRotate.h" + +// debug log +#include "imageeditordebugutils.h" + +// for timing log. It is separate, because other logging +// would affect performance +#include + +// CONSTANTS +const TInt KDefaultSaveBuffer = 1048576; // 16384 + +//============================================================================= +CJpegRotatorImpl * CJpegRotatorImpl::NewL (RFs& aFsSession) +{ + CJpegRotatorImpl * self = new (ELeave) CJpegRotatorImpl (aFsSession); + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop(); // self + return self; +} + +//============================================================================= +CJpegRotatorImpl::~CJpegRotatorImpl () +{ + + if (iRotator) + { + delete iRotator; + } + + if (iCallBack) + { + iCallBack->Cancel(); + delete iCallBack; + } + +} + +//============================================================================= +void CJpegRotatorImpl::Cleanup () +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::Cleanup"); + + iSourceFileName = KNullDesC(); + iTargetFileName = KNullDesC(); + iRotationMode = CJpegRotator::ERotModeCounterClockwise; + iCallerStatus = NULL; + iSourceImageSize.SetSize(0,0); + iHandleExifData = ETrue; + iCancelled = EFalse; + +#if defined (LOG_TIMING) + iLosslessMode = EFalse; +#endif +} + +//============================================================================= +void CJpegRotatorImpl::Cancel () +{ + if (iRotator) + { + iRotator->Cancel(); + } + + iCancelled = ETrue; +} + +//============================================================================= +void CJpegRotatorImpl::PrepareRotateFileL ( + const TDesC& aSourceFileName, + const TDesC& aTargetFileName, + CJpegRotator::TRotationMode aRotationMode, + TBool aHandleExifData) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::PrepareRotateFileL"); + +#if defined (LOG_TIMING) + iStartTime.UniversalTime(); +#endif + + // Reset old values + Cleanup(); + + // Check that the source file exists + if ( !BaflUtils::FileExists (iFsSession, aSourceFileName) ) + { + User::Leave (KErrNotFound); + } + // Check that the target file does not exist + if ( BaflUtils::FileExists (iFsSession, aTargetFileName) ) + { + User::Leave (KErrAlreadyExists); + } + // Check that the target path exists + TParsePtrC parse (aTargetFileName); + if ( !BaflUtils::FolderExists (iFsSession, parse.DriveAndPath()) ) + { + User::Leave (KErrPathNotFound); + } + + // Check & store the rotate parameter + if ( CJpegRotator::ERotModeCounterClockwise == aRotationMode ) + { + iRotationMode = CJpegRotator::ERotModeCounterClockwise; + } + else if ( CJpegRotator::ERotModeClockwise == aRotationMode ) + { + iRotationMode = CJpegRotator::ERotModeClockwise; + } + else if ( CJpegRotator::ERotMode180 == aRotationMode ) + { + iRotationMode = CJpegRotator::ERotMode180; + } + else + { + User::Leave (KErrArgument); + } + + + // Store the source file name and set target name + iSourceFileName = aSourceFileName; + iTargetFileName = aTargetFileName; + iHandleExifData = aHandleExifData; + + // Store the JPEG quality factor etc. + GetSourceImagePropertiesL ( iSourceFileName ); +} + +//============================================================================= +void CJpegRotatorImpl::StartAsyncRotate (TRequestStatus& aStatus, TBool aForceLossyMode) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::StartAsyncRotate"); + + // Use lossless rotate if possible + if( !aForceLossyMode && IsLosslessRotatePossible() ) + { + StartAsyncLosslessRotate (aStatus); + } + + else + { + aStatus = KRequestPending; + iCallerStatus = &aStatus; + + iCb = TCallBack(CJpegRotatorImpl::AsyncLosslessRotate, this); + + iCallBack = new CAsyncCallBack (iCb, CActive::EPriorityStandard); + + if (iCallBack) + { + iCallBack->CallBack(); + } + else + { + FinishAsyncRotate (KErrNoMemory); + } + + } + +} + +//============================================================================= +void CJpegRotatorImpl::StartAsyncLosslessRotate (TRequestStatus& aStatus) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::StartAsyncLosslessRotate"); + + aStatus = KRequestPending; + iCallerStatus = &aStatus; + + iCb = TCallBack(CJpegRotatorImpl::AsyncLosslessRotate, this); + // Create the callback utility used with the asynchronous version of rotate + iCallBack = new CAsyncCallBack (iCb, CActive::EPriorityStandard); + + if (iCallBack) + { + iCallBack->CallBack(); + } + else + { + FinishAsyncRotate (KErrNoMemory); + } + +} + +//============================================================================= +TInt CJpegRotatorImpl::AsyncRotate (TAny* /*aThis*/) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::AsyncRotate"); + /* + // In the asynchronous version, trap the rest of the functions + // to make sure that the caller's TRequestStatus is always + // completed, also in case of failures. + CJpegRotatorImpl* impl = static_cast(aThis); + + // Rotate-in-one-go, lossy mode + TRAPD (err, impl->DoRotateL()); + if (err == KErrNone) + { + TRAP (err, impl->SaveImageL()) + } + impl->FinishAsyncRotate (err); +*/ + return KErrNotSupported; +} + +//============================================================================= +TInt CJpegRotatorImpl::AsyncLosslessRotate (TAny* aThis) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::AsyncLosslessRotate"); + + // In the asynchronous version, trap the rest of the functions + // to make sure that the caller's TRequestStatus is always + // completed, also in case of failures. + CJpegRotatorImpl* impl = static_cast(aThis); + + // Rotate-in-one-go + TRAPD (err, impl->DoLosslessRotateL()); + + impl->FinishAsyncRotate (err); + + return KErrNone; +} + +//============================================================================= +void CJpegRotatorImpl::FinishAsyncRotate (TInt aError) +{ + LOGFMT( KJpegRotatorLogFile, "CJpegRotatorImpl::FinishAsyncRotate (error: %d)", aError); + + if( !iCancelled ) + { + User::RequestComplete (iCallerStatus, aError); + } + else + { + Cleanup(); + } + + PostRotate(); +} + +//============================================================================= +void CJpegRotatorImpl::DoRotateL () +{ + User::Leave(KErrNotSupported); +} + +//============================================================================= +void CJpegRotatorImpl::DoLosslessRotateL () +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::DoLosslessRotateL"); + + iLosslessMode = ETrue; + +#if defined (LOG_TIMING) + iSavingStartTime.UniversalTime(); +#endif + + // Load JPEG file to source file buffer + + RFile srcfile; + CleanupClosePushL (srcfile); + User::LeaveIfError ( srcfile.Open (iFsSession, iSourceFileName, EFileRead) ); + + TInt sourcebufsize; + User::LeaveIfError ( srcfile.Size(sourcebufsize) ); + TInt targetbufsize = (TInt)(1.2 * sourcebufsize); + + TInt saveBufferSize = KDefaultSaveBuffer; + if (targetbufsize < saveBufferSize) + { + saveBufferSize = targetbufsize; + } + + CleanupStack::PopAndDestroy(); + + RFile trgfile; + User::LeaveIfError ( trgfile.Replace (iFsSession, iTargetFileName, EFileRead) ); + CleanupClosePushL (trgfile); + + CJpRotate* rotator = CJpRotate::NewLC(iFsSession, &trgfile, saveBufferSize); + + rotator->SetCallBack( this ); + + switch ( iRotationMode ) + { + case CJpegRotator::ERotModeCounterClockwise: + { + rotator->RotateL( iSourceFileName, true, false, false ); + break; + } + case CJpegRotator::ERotMode180: + { + rotator->RotateL( iSourceFileName, false, true, true ); + break; + } + case CJpegRotator::ERotModeClockwise: + default: + { + rotator->RotateL( iSourceFileName, true, true, true ); + break; + } + + } + + CleanupStack::PopAndDestroy(2); + + LOG( KJpegRotatorLogFile, "\t...DoLosslessRotateL: Done."); + +} + +//============================================================================= +void CJpegRotatorImpl::JpRotateStatus( TInt /*aCount*/, TInt /*aTotal*/ ) +{ +// LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::JpRotateStatus" ); +// LOGFMT( KJpegRotatorLogFile, " count: %d", aCount ); +// LOGFMT( KJpegRotatorLogFile, " total: %d", aTotal ); +} + + +//============================================================================= +CJpegRotatorImpl::CJpegRotatorImpl (RFs& aFsSession) : +iFsSession (aFsSession), +iRotator (NULL), +iHandleExifData (ETrue) +{ +} + +//============================================================================= +void CJpegRotatorImpl::ConstructL () +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::ConstructL"); + + +} + +//============================================================================= +void CJpegRotatorImpl::GetSourceImagePropertiesL ( const TDesC& /*aFileName*/ ) +{ + /* + // Create a new image decoder + CImageDecoder * decoder = CImageDecoder::FileNewL (iFsSession, aFileName); + CleanupStack::PushL( decoder ); + + // Get reference to frame image data + const CFrameImageData & imageData = decoder->FrameData(); + + // Get JPEG quality factor + iOriginalJpegQualityFactor = KDefaultSavedJpegQuality; + if ( imageData.ImageDataCount() > 0 ) + { + iOriginalJpegQualityFactor = ((const TJpegImageData*)imageData.GetImageData(0))->iQualityFactor; + } + + // Image resolution + const TFrameInfo& frameInfo = decoder->FrameInfo(); + iSourceImageSize = frameInfo.iOverallSizeInPixels; + + CleanupStack::PopAndDestroy( decoder ); + */ +} + +//============================================================================= +void CJpegRotatorImpl::SetJpegCommentL (const TDesC8& /*aComment*/) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::SetJpegCommentL"); + +} + +//============================================================================= +void CJpegRotatorImpl::SetExifData (TUint8* /*aExifData*/, TUint /*aDataSize*/) +{ + LOG( KJpegRotatorLogFile, "CJpegRotatorImpl::SetExifData"); + +} + +//============================================================================= +void CJpegRotatorImpl::PostRotate () +{ +#if defined (LOG_TIMING) +/* + iFinishTime.UniversalTime(); + + TInt64 prepareTime = iSavingStartTime.Int64() - iStartTime.Int64(); + TInt64 savingTime = iFinishTime.Int64() - iSavingStartTime.Int64(); + TInt64 totalTime = iFinishTime.Int64() - iStartTime.Int64(); + + TBuf<128> text1; + if (iLosslessMode) + { + text1 = _L("Rotating from %S to %S. Lossless rotate was used."); + } + else + { + text1 = _L("Rotating from %S to %S. Lossy rotate was used."); + } + + RFileLogger::WriteFormat( + KImageEditorLogDir, + KJpegRotatorTimingLogFile, + EFileLoggingModeAppend, + text1, &iSourceFileName, &iTargetFileName + ); + + RFileLogger::WriteFormat( + KImageEditorLogDir, + KJpegRotatorTimingLogFile, + EFileLoggingModeAppend, + _L("\tTime taken (microseconds): %d"), + totalTime ); + + RFileLogger::WriteFormat( + KImageEditorLogDir, + KJpegRotatorTimingLogFile, + EFileLoggingModeAppend, + _L( "\tprepare phase: %d"), + prepareTime ); + + RFileLogger::WriteFormat( + KImageEditorLogDir, + KJpegRotatorTimingLogFile, + EFileLoggingModeAppend, + _L( "\tsave phase: %d"), + savingTime ); +*/ +#endif +} + +//============================================================================= +TBool CJpegRotatorImpl::IsLosslessRotatePossible() const +{ + return ETrue; +} + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/BWINS/JpegScaler.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/BWINS/JpegScaler.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,6 @@ +EXPORTS + ??1CJpegScaler@@UAE@XZ @ 1 NONAME ; CJpegScaler::~CJpegScaler(void) + ?Cancel@CJpegScaler@@QAEXXZ @ 2 NONAME ; void CJpegScaler::Cancel(void) + ?NewL@CJpegScaler@@SAPAV1@AAVRFs@@@Z @ 3 NONAME ; class CJpegScaler * CJpegScaler::NewL(class RFs &) + ?Scale@CJpegScaler@@QAEXPAVTRequestStatus@@ABV?$TBuf@$0BAA@@@1ABVTSize@@@Z @ 4 NONAME ; void CJpegScaler::Scale(class TRequestStatus *, class TBuf<256> const &, class TBuf<256> const &, class TSize const &) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/EABI/JpegScaler.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/EABI/JpegScaler.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,20 @@ +EXPORTS + _ZN11CJpegScaler4NewLER3RFs @ 1 NONAME + _ZN11CJpegScaler5ScaleEP14TRequestStatusRK4TBufILi256EES5_RK5TSize @ 2 NONAME + _ZN11CJpegScaler6CancelEv @ 3 NONAME + _ZN11CJpegScalerD0Ev @ 4 NONAME + _ZN11CJpegScalerD1Ev @ 5 NONAME + _ZN11CJpegScalerD2Ev @ 6 NONAME + _ZTI10CJpegScale @ 7 NONAME ; ## + _ZTI11CExifParser @ 8 NONAME ; ## + _ZTI11CJpegScaler @ 9 NONAME ; ## + _ZTI15CJpegScalerImpl @ 10 NONAME ; ## + _ZTI5CJpeg @ 11 NONAME ; ## + _ZTI9CJpegSave @ 12 NONAME ; ## + _ZTV10CJpegScale @ 13 NONAME ; ## + _ZTV11CExifParser @ 14 NONAME ; ## + _ZTV11CJpegScaler @ 15 NONAME ; ## + _ZTV15CJpegScalerImpl @ 16 NONAME ; ## + _ZTV5CJpeg @ 17 NONAME ; ## + _ZTV9CJpegSave @ 18 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/group/JpegScaler.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/group/JpegScaler.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,77 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + + +#if defined( __LOG_TIMING__ ) +MACRO LOG_TIMING +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) +MACRO ENABLE_DEBUGLOG +#endif + +#if defined(__IE_GLOBAL_DEBUGLOG__) || defined(__IE_DEBUGLOG__) || defined(__LOG_TIMING__) +LIBRARY flogger.lib +#endif + +TARGET JpegScaler.dll +TARGETTYPE dll +UID 0x1000008d 0xA00002FB + +VENDORID 0x101FB657 // VID_DEFAULT +CAPABILITY ALL -TCB + +SOURCEPATH ../src +SOURCE JpegScaler.cpp +SOURCE JpegScalerImpl.cpp +SOURCE CJpegScale.cpp + +SOURCEPATH ../../src +SOURCE CJpegSave.cpp +SOURCE CExifParser.cpp +SOURCE CJpeg.cpp + +USERINCLUDE . +USERINCLUDE ../inc +USERINCLUDE ../../inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib +LIBRARY imageconversion.lib +LIBRARY cone.lib +LIBRARY estlib.lib + +//#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +EXPORTUNFROZEN +//#endif +NOSTRICTDEF + +SOURCEPATH . + + +// End of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,45 @@ +/* +* 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: +* +*/ + + + +#include +#include "../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../inc/JpegScaler.h /epoc32/include/JpegScaler.h +../rom/ImageEditorJpegScaler.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorJpegScaler.iby) + +// mmp files +PRJ_MMPFILES +JpegScaler.mmp + +// test project mmp files +PRJ_TESTMMPFILES +../internal/tsrc/group/JpegScalerTest.mmp +../internal/tsrc/group/JpegScalerTestServer.mmp + +PRJ_TESTEXPORTS +#if defined (__EXPORT_ROM_DESCRIPTION_FILES__) +../rom/ImageEditorJpegScaler_test.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorJpegScaler_test.iby) +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/inc/CJpegScale.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/inc/CJpegScale.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,64 @@ +/* +* 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: +* +*/ + + +#ifndef __CJPEGSCALE_H__ +#define __CJPEGSCALE_H__ + +#include + +class MJpegScaleCallBack + { + public: + virtual ~MJpegScaleCallBack() {} + virtual void JpegStatusCallBack( TInt aPercentReady ); + }; + + + +class CJpegScale + : public CBase + { + public: + /// Default constructor + /// @param aCallBack status callback, tells conversion status percentage. Not mandatory + CJpegScale( MJpegScaleCallBack* aCallBack = 0 ); + ~CJpegScale(); + public: + + /// Scales jpeg iSourceName to iTargetName + /// target size will be of iTargetScale + /// if iTargetScale = 0 then iTargetSize is used + /// can leave with common error codes + /// Only downscaling supported + void ScaleL(); + + public: + TFileName iSourceName; /// source file name + TFileName iTargetName; /// target file name + TReal iTargetScale; /// target jpeg scale, 1.0 = 1:1 , if 0.0 then iTargetSize used instead + TSize iTargetSize; /// target jpeg size in pixels + TInt iQuality; /// target jpeg quality 0..100 default 95 + + private: + MJpegScaleCallBack* iCallBack; + + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/inc/JpegScaler.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/inc/JpegScaler.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,94 @@ +/* +* 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: +* +*/ + + +#ifndef JPEGSCALER_H +#define JPEGSCALER_H + + +// INCLUDES +#include + +// CONSTANTS + +// FORWARD DECLARATIONS +class CJpegScalerImpl; +class RFs; + +/* CLASS: CJpegScaler +* +* +* USAGE +* +* +* +*/ +class CJpegScaler : public CBase +{ +public: + + /** NewL factory method, pops cleanup stack + * + * @param - aFsSession + * @return pointer to created CJpegScaler object + */ + IMPORT_C static CJpegScaler* NewL(RFs & aFsSession); + + /** Destructor + * + * @param - + * @return - + */ + IMPORT_C ~CJpegScaler(); + + /** Scale + * + * @param aRequestStatus - request status object + * @param aSrcFileName - source file name + * @param aTrgFileName - target file name + * @param aDestinationSize - size of the target file + * @return - + */ + IMPORT_C void Scale(TRequestStatus* aRequestStatus, const TFileName& aSrcFileName, const TFileName& aTrgFileName, const TSize& aDestinationSize); + + /** Cancel + * + * Cancel any outstanding activity + * + * @param - + * @return - + */ + IMPORT_C void Cancel(); + +private: + + CJpegScaler(); + void ConstructL(RFs & aFsSession); + +private: + + CJpegScalerImpl* iImplementation; + +}; + + + +#endif + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/inc/JpegScalerImpl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/inc/JpegScalerImpl.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,129 @@ +/* +* 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: +* +*/ + + +#ifndef JPEGSCALERIMPL_H +#define JPEGSCALERIMPL_H + + +// INCLUDES +#include +#include + +#include "CJpegScale.h" + +// debug log writer +//#include "imageeditordebugutils.h" + +// CONSTANTS + +// FORWARD DECLARATIONS + +/* CLASS: CJpegScalerImpl +* +* CJpegScalerImpl +* Internal representation of CJpegScaler +* +*/ +class CJpegScalerImpl : public CAsyncOneShot//, public MJpegScaleCallBack +{ + +public: + +/** @name Methods:*/ +//@{ + + /** NewL factory method, pops cleanup stack + * + * @param - aFsSession + * @return pointer to created CJpegScalerImpl object + */ + static CJpegScalerImpl * NewL (RFs& aFsSession); + + /** Destructor + * + * @param - + * @return - + */ + ~CJpegScalerImpl (); + + /** RunL + * + * @param - + * @return - + */ + virtual void RunL(); + + /** Scale + * + * @param - + * @return - + */ + void Scale(TRequestStatus* aRequestStatus, const TFileName& aSrcFileName, const TFileName& aTrgFileName, const TSize& aDestinationSize); + +private: + + /** Default constructor + * + * @param - aFsSession + * @return - + */ + CJpegScalerImpl (RFs& aFsSession); + + /** Second phase constructor, may leave + * + * @param - + * @return - + */ + void ConstructL (); + + /** Callback function for CJpegScale + * + * @param - + * @return - + */ + //void JpegStatusCallBack( TInt aPercentReady ); + +private: + + /// File Server session handle + RFs& iFsSession; + + /// Source and target files + TFileName iSourceFileName; + TFileName iTargetFileName; + + /// Scaler + CJpegScale* iScale; + + /// Caller request status + TRequestStatus* iCallerReqStatus; + +#if defined (LOG_TIMING) + TTime iStartTime; + TTime iSavingStartTime; + TTime iFinishTime; +#endif + + +}; + +#endif + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/inc/JpegScalerPanics.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/inc/JpegScalerPanics.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +/* +* 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: +* +*/ + + +#include + +#ifndef __JPEGSCALER_PAN__ +#define __JPEGSCALER_PAN__ + +/// Jpeg Scaler panics +enum TJpegScalerPanicIds +{ + /// + EJpegScalerPanic = 0 +}; + +#endif __JPEGSCALER_PAN__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/rom/ImageEditorJpegScaler.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/rom/ImageEditorJpegScaler.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef __RD_S60_JPEGSCALER + +#ifndef __JPEGSCALER_IBY__ +#define __JPEGSCALER_IBY__ + +file=ABI_DIR\BUILD_DIR\JpegScaler.dll SHARED_LIB_DIR\JpegScaler.dll + +#endif // __JPEGSCALER_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/src/CJpegScale.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/src/CJpegScale.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,374 @@ +/* +* 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: +* +*/ + + +#include "CJpegScale.h" +#include "CJpeg.h" +#include "CJpegSave.h" +#include "CExifParser.h" + + +CJpegScale::CJpegScale( MJpegScaleCallBack* aCallBack ) + : iTargetScale( 0 ) + , iQuality( 95 ) + , iCallBack( aCallBack ) + { + } + + + +CJpegScale::~CJpegScale() + { + } + + + + +void CJpegScale::ScaleL() + { + const TInt KxShift = 14; + const TInt KxMul = ( 1 << KxShift ); + const TInt KxAnd = KxMul - 1; + + CJpeg* source; + CJpegSave* target; + + // file server session + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + // encoded file + RFile targetFile; + User::LeaveIfError( targetFile.Replace( fs, iTargetName, EFileWrite ) ); + CleanupClosePushL( targetFile ); + + // jpeg source + source = CJpeg::NewL(); + CleanupStack::PushL( source ); + + // jpeg target + target = CJpegSave::NewL( &fs, &targetFile ); + CleanupStack::PushL( target ); + + source->OpenL( iSourceName ); + + TJpegData info = source->Info(); + + TInt tw = iTargetSize.iWidth; + TInt th = iTargetSize.iHeight; + + TInt sw = info.iSize.iWidth; + TInt sh = info.iSize.iHeight; + + TInt xscale; + TInt yscale; + + // + // Decide scale or target size + // + if( iTargetScale != 0 ) + { + xscale = (TInt)(iTargetScale * KxMul); + yscale = xscale; + tw = xscale * sw / KxMul; + th = yscale * sh / KxMul; + } + else + { + yscale = KxMul * th / sh; + xscale = KxMul * tw / sw; + } + + if( tw>sw || th>sh ) + { + // no upscaling yet. + User::Leave( KErrNotSupported ); + } + + // + // Hardscale is scaling which is done in jpeg decoder + // possible hardscales are 1:1, 1:2, 1:4 and 1:8 + // hard scaling speeds up things a lot. + // + TInt hardScale = 1; + source->SetScale( EScale1 ); + + if( xscale <= KxMul/8 && yscale <= KxMul/8 ) + { + hardScale = 8; + source->SetScale( EScale8 ); + } + + else if( xscale <= KxMul/4 && yscale <= KxMul/4 ) + { + hardScale = 4; + source->SetScale( EScale4 ); + } + + else if( xscale <= KxMul/2 && yscale <= KxMul/2 ) + { + hardScale = 2; + source->SetScale( EScale2 ); + } + // else hardscale = 1 + + + sw /= hardScale; + sh /= hardScale; + xscale *= hardScale; + yscale *= hardScale; + + + // + // Jpeg store bitmap block + // Jpeg encoder always uses block size of 16x8 pixels + // + TBitmapHandle blk; + blk.iSize = TSize( 16,8 ); + blk.iData = new( ELeave )TUint32[ 16*8 ]; + CleanupStack::PushL( blk.iData ); + + iTargetSize = TSize( tw,th ); + + CExifParser* parser = CExifParser::NewLC(); + parser->ParseL(source->ExifData()); + + // ImageWidth - Not used for JPEG images + if (parser->TagExist(CExifParser::EIfd0, 0x0100)) + { + parser->DeleteTag ( CExifParser::EIfd0, 0x0100); + //iExifParser->AddTagL ( CExifParser::EIfd0, 0x0100, (TUint16)iTargetSize.iWidth); + } + + // ImageHeight - Not used for JPEG images + if (parser->TagExist(CExifParser::EIfd0, 0x0101)) + { + parser->DeleteTag ( CExifParser::EIfd0, 0x0101); + //iExifParser->AddTagL ( CExifParser::EIfd0, 0x0101, (TUint16)iTargetSize.iHeight); + } + + // PixelXResolution + if (parser->TagExist(CExifParser::ESubIfd, 0xA002)) + { + parser->DeleteTag ( CExifParser::ESubIfd, 0xA002); + parser->AddTagL ( CExifParser::ESubIfd, 0xA002,(TUint32)iTargetSize.iWidth); + } + // PixelYResolution + if (parser->TagExist(CExifParser::ESubIfd, 0xA003)) + { + parser->DeleteTag ( CExifParser::ESubIfd, 0xA003); + parser->AddTagL ( CExifParser::ESubIfd, 0xA003, (TUint32)iTargetSize.iHeight); + } + + TPtr8 exif = parser->SaveL(parser->ThumbData()); + + // + // Initialize jpeg encoder + // no exif + // save buffer ~16KB + // use iQuality as quality ( values from 0 to 100 ) + // + target->StartSaveL( iTargetSize, exif, 16000, iQuality ); + + CleanupStack::PopAndDestroy(); // parser + + TInt yStep = 8; // jpeg encoder block height + TInt yPos = 0; // number of encoded lines + + // + // Reserve scaled buffer + // + TInt pixels = tw * ( yStep*2 ); // room for 2 block lines + + TUint32* cr = new( ELeave )TUint32[ pixels ]; + CleanupStack::PushL( cr ); + TUint32* cg = new( ELeave )TUint32[ pixels ]; + CleanupStack::PushL( cg ); + TUint32* cb = new( ELeave )TUint32[ pixels ]; + CleanupStack::PushL( cb ); + TUint32* cm = new( ELeave )TUint32[ pixels ]; + CleanupStack::PushL( cm ); + + // + // Clear scaled buffer + // + Mem::FillZ( cr, pixels * sizeof( TUint32 ) ); + Mem::FillZ( cg, pixels * sizeof( TUint32 ) ); + Mem::FillZ( cb, pixels * sizeof( TUint32 ) ); + Mem::FillZ( cm, pixels * sizeof( TUint32 ) ); + + + TInt srcBlockHeight = info.iBlockSize.iHeight; + + TInt srcY1 = 0; + TInt srcY2 = 0; + TBitmapHandle bm; + bm.iData = 0; + + for( TInt y=0; yJpegStatusCallBack( 100 * y / sh ); + } + // + // Fill source buffer when needed + // + if( srcY2 <= y ) + { + delete bm.iData; + TRect rect( 0,y*hardScale, info.iSize.iWidth, ( y + srcBlockHeight ) * hardScale ); + bm = source->LoadImageL( rect ); + srcY1 = y; + srcY2 = srcY1 + bm.iSize.iHeight; + } + + TUint32* srcRgb = (TUint32*)bm.iData; + srcRgb += (y-srcY1) * bm.iSize.iWidth; + + TInt ty = y * yscale; + TInt y2 = ty & KxAnd; + TInt y1 = KxMul - y2; + ty >>= KxShift; + + TInt oy = ( ty - yPos ) * tw; + TUint32* pr = cr + oy; + TUint32* pg = cg + oy; + TUint32* pb = cb + oy; + TUint32* pm = cm + oy; + + // + // Add pixels to scaled buffer + // + for( TInt x=0; x>= KxShift; + + TUint32 pixel = *srcRgb++; + + TUint32 m1 = x1*y1 / KxMul; + TUint32 m2 = x2*y1 / KxMul; + TUint32 m3 = x1*y2 / KxMul; + TUint32 m4 = x2*y2 / KxMul; + + TInt red = pixel >> 16; + pr[ tx ] += m1 * red; + pr[ tx+1 ] += m2 * red; + pr[ tx+tw ] += m3 * red; + pr[ tx+tw+1 ] += m4 * red; + + TInt green = ( pixel >> 8 ) & 255; + pg[ tx ] += m1 * green; + pg[ tx+1 ] += m2 * green; + pg[ tx+tw ] += m3 * green; + pg[ tx+tw+1 ] += m4 * green; + + TInt blue = pixel & 255; + pb[ tx ] += m1 * blue; + pb[ tx+1 ] += m2 * blue; + pb[ tx+tw ] += m3 * blue; + pb[ tx+tw+1 ] += m4 * blue; + + pm[ tx ] += m1; + pm[ tx+1 ] += m2; + pm[ tx+tw ] += m3; + pm[ tx+tw+1 ] += m4; + } + + + // + // Transfer scaled buffer block-by-block to jpeg encoder + // + if( ty >= yPos + yStep || y == sh-1 ) + { + yPos += yStep; + + TUint32* trgb = (TUint32*)blk.iData; + + for( TInt b=0; bSaveBlock( blk ); + } + + // + // move overflow line to first line in scaled buffer + // + TInt offset = tw * yStep; + for( TInt rx=0; rxFinalizeSave(); + + delete bm.iData; + + CleanupStack::PopAndDestroy( 4 ); // cm,cb,cg,cr + CleanupStack::PopAndDestroy( blk.iData ); + CleanupStack::PopAndDestroy( target ); + CleanupStack::PopAndDestroy( source ); + CleanupStack::PopAndDestroy( 2 ); // file, fs + + if( iCallBack ) + { + iCallBack->JpegStatusCallBack( 100 ); + } + + } diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/src/JpegScaler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/src/JpegScaler.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,57 @@ +/* +* 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: +* +*/ + + +#include "JpegScaler.h" +#include "JpegScalerImpl.h" + +EXPORT_C CJpegScaler* CJpegScaler::NewL(RFs & aFsSession) +{ + CJpegScaler* scaler = new(ELeave) CJpegScaler(); + CleanupStack::PushL(scaler); + scaler->ConstructL(aFsSession); + CleanupStack::Pop(); + return scaler; +} + +EXPORT_C CJpegScaler::~CJpegScaler() +{ + delete iImplementation; +} + +EXPORT_C void CJpegScaler::Scale(TRequestStatus* aRequestStatus, const TFileName& aSrcFileName, const TFileName& aTrgFileName, const TSize& aDestinationSize) +{ + iImplementation->Scale(aRequestStatus, aSrcFileName, aTrgFileName, aDestinationSize); +} + +EXPORT_C void CJpegScaler::Cancel() +{ + iImplementation->Cancel(); +} + +CJpegScaler::CJpegScaler() +{ + +} + +void CJpegScaler::ConstructL(RFs & aFsSession) +{ + iImplementation = CJpegScalerImpl::NewL(aFsSession); +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/JpegScaler/src/JpegScalerImpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/JpegScaler/src/JpegScalerImpl.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,75 @@ +/* +* 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: +* +*/ + + +#include "JpegScalerImpl.h" +#include "CJpegScale.h" + +CJpegScalerImpl* CJpegScalerImpl::NewL(RFs & aFsSession) +{ + CJpegScalerImpl* impl = new(ELeave) CJpegScalerImpl(aFsSession); + CleanupStack::PushL(impl); + impl->ConstructL(); + CleanupStack::Pop(); + return impl; +} + +CJpegScalerImpl::~CJpegScalerImpl() +{ + Cancel(); + delete iScale; +} + +void CJpegScalerImpl::Scale(TRequestStatus* aRequestStatus, const TFileName& aSrcFileName, const TFileName& aTrgFileName, const TSize& aDestinationSize) +{ + iScale->iSourceName = aSrcFileName; + iScale->iTargetName = aTrgFileName; + iScale->iTargetSize = aDestinationSize; + iCallerReqStatus = aRequestStatus; + *iCallerReqStatus = KRequestPending; + Call(); +} + +CJpegScalerImpl::CJpegScalerImpl(RFs& aFsSession) +: CAsyncOneShot(EPriorityStandard), iFsSession(aFsSession) +{ + +} + +void CJpegScalerImpl::ConstructL() +{ + iScale = new(ELeave) CJpegScale(); +} + +void CJpegScalerImpl::RunL() +{ + TInt err = KErrNone; + if (iStatus == KErrNone) + { + TRAP(err,iScale->ScaleL()); + } + else + { + err = iStatus.Int(); + } + User::RequestComplete(iCallerReqStatus,err); +} + + + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/SystemParameters/EABI/SystemParameters.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/SystemParameters/EABI/SystemParameters.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,19 @@ +EXPORTS + _ZN17CSystemParameters10SourceSizeEv @ 1 NONAME + _ZN17CSystemParameters12ViewPortRectEv @ 2 NONAME + _ZN17CSystemParameters16VisibleImageRectEv @ 3 NONAME + _ZN17CSystemParameters20VisibleImageRectPrevEv @ 4 NONAME + _ZN17CSystemParameters5ScaleEv @ 5 NONAME + _ZN17CSystemParametersD0Ev @ 6 NONAME + _ZN17CSystemParametersD1Ev @ 7 NONAME + _ZN17CSystemParametersD2Ev @ 8 NONAME + _ZNK17CSystemParameters10SourceSizeEv @ 9 NONAME + _ZNK17CSystemParameters12ViewPortRectEv @ 10 NONAME + _ZNK17CSystemParameters16VisibleImageRectEv @ 11 NONAME + _ZNK17CSystemParameters20VisibleImageRectPrevEv @ 12 NONAME + _ZNK17CSystemParameters5ScaleEv @ 13 NONAME + _ZTI17CSystemParameters @ 14 NONAME ; ## + _ZTV17CSystemParameters @ 15 NONAME ; ## + _ZN17CSystemParameters8RelScaleEv @ 16 NONAME + _ZNK17CSystemParameters8RelScaleEv @ 17 NONAME + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/SystemParameters/bwins/SystemParameters.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/SystemParameters/bwins/SystemParameters.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,15 @@ +EXPORTS + ??1CSystemParameters@@UAE@XZ @ 1 NONAME ; CSystemParameters::~CSystemParameters(void) + ?RelScale@CSystemParameters@@QAEAANXZ @ 2 NONAME ; double & CSystemParameters::RelScale(void) + ?RelScale@CSystemParameters@@QBEABNXZ @ 3 NONAME ; double const & CSystemParameters::RelScale(void) const + ?Scale@CSystemParameters@@QAEAANXZ @ 4 NONAME ; double & CSystemParameters::Scale(void) + ?Scale@CSystemParameters@@QBEABNXZ @ 5 NONAME ; double const & CSystemParameters::Scale(void) const + ?SourceSize@CSystemParameters@@QAEAAVTSize@@XZ @ 6 NONAME ; class TSize & CSystemParameters::SourceSize(void) + ?SourceSize@CSystemParameters@@QBEABVTSize@@XZ @ 7 NONAME ; class TSize const & CSystemParameters::SourceSize(void) const + ?ViewPortRect@CSystemParameters@@QAEAAVTRect@@XZ @ 8 NONAME ; class TRect & CSystemParameters::ViewPortRect(void) + ?ViewPortRect@CSystemParameters@@QBEABVTRect@@XZ @ 9 NONAME ; class TRect const & CSystemParameters::ViewPortRect(void) const + ?VisibleImageRect@CSystemParameters@@QAEAAVTRect@@XZ @ 10 NONAME ; class TRect & CSystemParameters::VisibleImageRect(void) + ?VisibleImageRect@CSystemParameters@@QBEABVTRect@@XZ @ 11 NONAME ; class TRect const & CSystemParameters::VisibleImageRect(void) const + ?VisibleImageRectPrev@CSystemParameters@@QAEAAVTRect@@XZ @ 12 NONAME ; class TRect & CSystemParameters::VisibleImageRectPrev(void) + ?VisibleImageRectPrev@CSystemParameters@@QBEABVTRect@@XZ @ 13 NONAME ; class TRect const & CSystemParameters::VisibleImageRectPrev(void) const + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/SystemParameters/group/SystemParameters.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/SystemParameters/group/SystemParameters.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,56 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../group/definitions.def" + + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET SystemParameters.dll +TARGETTYPE dll +UID 0x1000008d + +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../src +SOURCE SystemParameters.cpp + +USERINCLUDE . +USERINCLUDE ../inc + +LANG SC + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib + +#if defined( __EXPORT_UNFROZEN_FRAMEWORK__ ) +EXPORTUNFROZEN +#endif +NOSTRICTDEF + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/SystemParameters/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/SystemParameters/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,40 @@ +/* +* 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: +* +*/ + + +#include +#include "../../group/definitions.def" + + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS +../rom/ImageEditorSystemParameters.iby CORE_MW_LAYER_IBY_EXPORT_PATH(ImageEditorSystemParameters.iby) + +// mmp files +PRJ_MMPFILES +SystemParameters.mmp + +// test project mmp files +PRJ_TESTMMPFILES + +// End of File + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/SystemParameters/rom/ImageEditorSystemParameters.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/SystemParameters/rom/ImageEditorSystemParameters.iby Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* +*/ + + +#ifdef RD_S60_IMAGE_EDITOR + +#ifndef __SYSTEMPARAMETERS_IBY__ +#define __SYSTEMPARAMETERS_IBY__ + +file=ABI_DIR\BUILD_DIR\SystemParameters.dll SHARED_LIB_DIR\SystemParameters.dll + +#endif // __SYSTEMPARAMETERS_IBY__ +#endif +// End of File \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/SystemParameters/src/SystemParameters.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/SystemParameters/src/SystemParameters.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,101 @@ +/* +* 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: +* +*/ + + +#include "SystemParameters.h" + + +//============================================================================= +EXPORT_C CSystemParameters::~CSystemParameters() +{ + +} + +//============================================================================= +EXPORT_C TSize & CSystemParameters::SourceSize() +{ + return iSourceSize; +} + +//============================================================================= +EXPORT_C const TSize & CSystemParameters::SourceSize() const +{ + return iSourceSize; +} + +//============================================================================= +EXPORT_C TRect & CSystemParameters::ViewPortRect() +{ + return iViewPortRect; +} + +//============================================================================= +EXPORT_C const TRect & CSystemParameters::ViewPortRect() const +{ + return iViewPortRect; +} + +//============================================================================= +EXPORT_C TRect & CSystemParameters::VisibleImageRect() +{ + return iVisibleImageRect; +} + +//============================================================================= +EXPORT_C const TRect & CSystemParameters::VisibleImageRect() const +{ + return iVisibleImageRect; +} + +//============================================================================= +EXPORT_C TRect & CSystemParameters::VisibleImageRectPrev() +{ + return iVisibleImageRectPrev; +} + +//============================================================================= +EXPORT_C const TRect & CSystemParameters::VisibleImageRectPrev() const +{ + return iVisibleImageRectPrev; +} + +//============================================================================= +EXPORT_C TReal & CSystemParameters::Scale() +{ + return iScale; +} + +//============================================================================= +EXPORT_C const TReal & CSystemParameters::Scale() const +{ + return iScale; +} + +//============================================================================= +EXPORT_C TReal & CSystemParameters::RelScale() +{ + return iRelScale; +} + +//============================================================================= +EXPORT_C const TReal & CSystemParameters::RelScale() const +{ + return iRelScale; +} + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/data/ImageEditorEngine.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/data/ImageEditorEngine.pkg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,57 @@ +; +; 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: +; +; Languages +&EN + +; Header +#{"Image Editor Engine"}, (0x1000008d), 1, 0, 0, TYPE=SA +; Uid from ImageEditorUtils + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Engine dll's +; ----------- +""-"z:\sys\bin\ImageEditorUtils.dll" +;""-"z:\sys\bin\JpegRotator.dll" +;""-"z:\sys\bin\JpegScaler.dll" +""-"z:\sys\bin\SystemParameters.dll" +""-"z:\sys\bin\EngineWrapper.dll" + +; Filters +; ------- +""-"z:\sys\bin\FilterBrightness.dll" +""-"z:\sys\bin\FilterBubble.dll" +""-"z:\sys\bin\FilterBuffer.dll" +""-"z:\sys\bin\FilterCartoon.dll" +""-"z:\sys\bin\FilterClipart.dll" +""-"z:\sys\bin\FilterContrast.dll" +""-"z:\sys\bin\FilterCrop.dll" +""-"z:\sys\bin\FilterFrame.dll" +""-"z:\sys\bin\FilterGrayScale.dll" +""-"z:\sys\bin\FilterIclSource.dll" +""-"z:\sys\bin\FilterJpegSource.dll" +""-"z:\sys\bin\FilterJpegTarget.dll" +""-"z:\sys\bin\FilterNegate.dll" +""-"z:\sys\bin\FilterRedEye.dll" +""-"z:\sys\bin\FilterRotate.dll" +""-"z:\sys\bin\FilterScale.dll" +""-"z:\sys\bin\FilterSepia.dll" +""-"z:\sys\bin\FilterSharpness.dll" +""-"z:\sys\bin\FilterText.dll" diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/data/ImageEditorEngine_stub.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/data/ImageEditorEngine_stub.pkg Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +; +; 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: +; +; Languages +&EN + +; Header +#{"Image Editor Engine"}, (0x1000008d), 1, 0, 0, TYPE=SA +; Uid from ImageEditorUtils + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +;Engine dll's +; ----------- +""-"z:\sys\bin\ImageEditorUtils.dll" +;""-"z:\sys\bin\JpegRotator.dll" +;""-"z:\sys\bin\JpegScaler.dll" +""-"z:\sys\bin\SystemParameters.dll" +""-"z:\sys\bin\EngineWrapper.dll" + +; Filters +; ------- +""-"z:\sys\bin\FilterBrightness.dll" +""-"z:\sys\bin\FilterBubble.dll" +""-"z:\sys\bin\FilterBuffer.dll" +""-"z:\sys\bin\FilterBubble.dll" +""-"z:\sys\bin\FilterCartoon.dll" +""-"z:\sys\bin\FilterClipart.dll" +""-"z:\sys\bin\FilterContrast.dll" +""-"z:\sys\bin\FilterCrop.dll" +""-"z:\sys\bin\FilterFrame.dll" +""-"z:\sys\bin\FilterGrayScale.dll" +""-"z:\sys\bin\FilterIclSource.dll" +""-"z:\sys\bin\FilterJpegSource.dll" +""-"z:\sys\bin\FilterJpegTarget.dll" +""-"z:\sys\bin\FilterNegate.dll" +""-"z:\sys\bin\FilterRedEye.dll" +""-"z:\sys\bin\FilterRotate.dll" +""-"z:\sys\bin\FilterScale.dll" +""-"z:\sys\bin\FilterSepia.dll" +""-"z:\sys\bin\FilterSharpness.dll" +""-"z:\sys\bin\FilterText.dll" diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/data/buildsis.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/data/buildsis.bat Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,18 @@ +rem +rem Copyright (c) 2010 Ixonos Plc. +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of the "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - Initial contribution +rem +rem Contributors: +rem Ixonos Plc +rem +rem Description: +rem + +makesis -s ImageEditorEngine.pkg ImageEditorEngineStub.sis \ No newline at end of file diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBrightness/BWINS/FilterBrightness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBrightness/BWINS/FilterBrightness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterBrightness@@SAHXZ @ 1 NONAME ; int CFilterBrightness::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBrightness/EABI/FilterBrightness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBrightness/EABI/FilterBrightness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN17CFilterBrightness6CreateEv @ 1 NONAME + _ZTI17CFilterBrightness @ 2 NONAME ; ## + _ZTV17CFilterBrightness @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBrightness/group/FilterBrightness.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBrightness/group/FilterBrightness.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterBrightness.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterBrightness.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBrightness/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBrightness/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterBrightness.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBrightness/inc/CFilterBrightness.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBrightness/inc/CFilterBrightness.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,57 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterBrightness_H__ +#define __CFilterBrightness_H__ + +#include +#include "MImageFilter.h" + +class CFilterBrightness + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterBrightness(); + + private: + static CFilterBrightness* NewL(); + CFilterBrightness(); + virtual void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + TInt iBrightness; + TInt iAdjR; + TInt iAdjG; + TInt iAdjB; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBrightness/src/CFilterBrightness.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBrightness/src/CFilterBrightness.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,191 @@ +/* +* 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: +* +*/ + + +#include +#include "CFilterBrightness.h" + +const TInt KBrightnessScale = 80; + +EXPORT_C TInt CFilterBrightness::Create() + { + CFilterBrightness* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterBrightness* CFilterBrightness::NewL() + { + CFilterBrightness* self = new( ELeave )CFilterBrightness(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterBrightness::~CFilterBrightness() + { + } + + + +CFilterBrightness::CFilterBrightness() + { + + } + + + +void CFilterBrightness::ConstructL() + { + + } + + + +TRect CFilterBrightness::Rect() + { + return iChild->Rect(); + } + +TReal CFilterBrightness::Scale() + { + return iChild->Scale(); + } + +TSize CFilterBrightness::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterBrightness::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + for (TInt i = 0; i < pB->iDataLength; ++i) + { + TUint32 c = *pD; + + TInt r = c & 0xFF0000; + r += iAdjR; + if (r > 0xFF0000) + { + r = 0xFF0000; + } + else if (r < 0) + { + r = 0; + } + + TInt g = c & 0xFF00; + g += iAdjG; + if (g > 0xFF00) + { + g = 0xFF00; + } + else if (g < 0) + { + g = 0; + } + + TInt b = c & 0xFF; + b += iAdjB; + if (b > 0xFF) + { + b = 0xFF; + } + if (b < 0) + { + b = 0; + } + *pD++ = 0 | r | g | b; + } + return pB; +} + + + +void CFilterBrightness::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterBrightness::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterBrightness::CmdL( const TDesC16& aCmd ) +{ + + TLex lex (aCmd); + + // Get brightness parameter [-100,100] + while ( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + + if ( token.Compare( _L("brightness") ) == 0) + { + TInt bpar = 0; + lex.Inc(); + lex.Val (bpar); + if (bpar < - 100) + { + bpar = -100; + } + else if (bpar > 100) + { + bpar = 100; + } + + iBrightness = ((bpar * KBrightnessScale) / 100); + iAdjR = iBrightness << 16; + iAdjG = iBrightness << 8; + iAdjB = iBrightness; + } + } + return 0; +} + +const char* CFilterBrightness::Type() + { + return "brightness"; + } + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBubble/BWINS/FilterBubble.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBubble/BWINS/FilterBubble.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterBubble@@SAHXZ @ 1 NONAME ; int CFilterBubble::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBubble/EABI/FilterBubble.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBubble/EABI/FilterBubble.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN13CFilterBubble6CreateEv @ 1 NONAME + _ZTI13CFilterBubble @ 2 NONAME ; ## + _ZTV13CFilterBubble @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBubble/Inc/CFilterBubble.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBubble/Inc/CFilterBubble.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERBUBBLE_H__ +#define __CFILTERBUBBLE_H__ + +#include +#include "MImageFilter.h" +#include + +class CFilterBubble + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterBubble(); + + private: + static CFilterBubble* NewL(); + CFilterBubble(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // New methods + void CFilterBubble::LoadImageL(); + + private: // Data + + TUint32 * iData; + TSize iSize; + TFileName iFileName; + TInt iBubble; + TInt iMask; + + TPoint iPosition; + TPoint iCorrectPosition; + TInt iZoom; + TInt iAngle; + TPoint iScale; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBubble/Src/CFilterBubble.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBubble/Src/CFilterBubble.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,325 @@ +/* +* 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: +* +*/ + + +#include "CFilterBubble.h" + +#include + +const TInt KScaleBits = 12; +const TInt KCoordBits = 8; + +EXPORT_C TInt CFilterBubble::Create() + { + CFilterBubble* ptr = NULL; + TRAPD( error, ptr = NewL() ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterBubble* CFilterBubble::NewL() + { + CFilterBubble* self = new( ELeave )CFilterBubble(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterBubble::~CFilterBubble() + { + delete[] iData; + } + + + +CFilterBubble::CFilterBubble() + { + + } + + + +void CFilterBubble::ConstructL() + { + iScale.iX = 1 << 8; + iScale.iY = 0; + iZoom = 1000; + iAngle = 0; + } + + + +TRect CFilterBubble::Rect() + { + return iChild->Rect(); + } + +TReal CFilterBubble::Scale() + { + return iChild->Scale(); + } + +TSize CFilterBubble::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterBubble::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + + for (TInt i = pB->iRect.iTl.iY; i < pB->iRect.iBr.iY; ++i) + { + for (TInt j = pB->iRect.iTl.iX; j < pB->iRect.iBr.iX; ++j, ++pD) + { + + TUint32 c = *pD; + + TPoint pos = iCorrectPosition + TPoint (j << KCoordBits, i << KCoordBits); + TInt x = ( pos.iX * iScale.iX + pos.iY * iScale.iY ) >> ( KScaleBits + KCoordBits ); + TInt y = ( pos.iY * iScale.iX - pos.iX * iScale.iY ) >> ( KScaleBits + KCoordBits ); + + if ( (x >= 0) && (y >= 0) && (x < iSize.iWidth) && (y < iSize.iHeight) ) + { + + TUint32 c2 = iData[ x + y * iSize.iWidth ]; + TInt ca = c2 >> 24; + + if ( ca == 255 ) + { + *pD = c2 & 0xffffff; + } + else + { + TInt cc1 = (c2 & 0xff00ff) * ca + (c & 0xff00ff) * (255 - ca); + TInt cc2 = (c2 & 0xff00) * ca + (c & 0xff00) * (255 - ca); + *pD = (( cc1 >> 8) & 0xff00ff) + ((cc2 >> 8) & 0xff00); + } + } + } + } + return pB; +} + + +void CFilterBubble::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + +void CFilterBubble::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterBubble::CmdL( const TDesC16& aCmd ) + { + + TLex lex( aCmd ); + + while( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("file") ) == 0 ) + { + TPtrC namec = lex.NextToken(); + TPtrC name( namec.Ptr()+1, namec.Length()-2 ); + iFileName.Copy (name); + } + else if( token.Compare( _L("load") ) == 0 ) + { + LoadImageL(); + } + else if( token.Compare( _L("bubble") ) == 0 ) + { + lex.Inc(); + lex.Val( iBubble ); + } + else if( token.Compare( _L("mask") ) == 0 ) + { + lex.Inc(); + lex.Val( iMask ); + } + else if( token.Compare( _L("x") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iPosition.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("y") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iPosition.iY = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("width") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + TInt width = (TInt)((param / relscale) + 0.5); + iZoom = (width * 1000) / iSize.iWidth; + } + else if( token.Compare( _L("height") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + TInt height = (TInt)((param / relscale) + 0.5); + iZoom = (height * 1000) / iSize.iHeight; + } + else if( token.Compare( _L("zoom") ) == 0 ) + { + lex.Inc(); + lex.Val( iZoom ); + } + else if( token.Compare( _L("angle") ) == 0 ) + { + lex.Inc(); + lex.Val( iAngle ); + } + } + + TReal relscale = iChild->Scale(); + TInt scaledx = (TInt)(iPosition.iX * relscale + 0.5); + TInt scaledy = (TInt)(iPosition.iY * relscale + 0.5); + TInt scaledz = (TInt)(iZoom * relscale + 0.5); + + TReal zoom = 0.001 * scaledz; + TReal angle = 0.001 * iAngle; + TReal rad = KPi * angle / 180.0; + TReal r; + TReal res; + + Math::Cos( r, rad ); + r *= 1 << KScaleBits; + //r /= zoom; + Math::Round( res, r, 0 ); + iScale.iX = (TInt)res; + + Math::Sin( r, rad ); + r *= 1 << KScaleBits; + //r /= zoom; + Math::Round( res, r, 0 ); + iScale.iY = (TInt)res; + + // helpers + TPoint mid( iSize.iWidth/2, iSize.iHeight/2 ); + TPoint sca( (TInt)(zoom * iScale.iX), (TInt)(zoom * iScale.iY) ); + TInt xo = ( mid.iX * sca.iX - mid.iY * sca.iY ) >> ( KScaleBits - KCoordBits ); + TInt yo = ( mid.iY * sca.iX + mid.iX * sca.iY ) >> ( KScaleBits - KCoordBits ); + + // + // iCorrectPosition is bubble mid position corrected with + // rotation ( otherwise rotation would be around topleft corner ) + // + iCorrectPosition = TPoint( xo,yo ) - TPoint( scaledx << KCoordBits, scaledy << KCoordBits ); + + // + // with iScale screen coordinates are translated to texture coordinates + // + iScale.iX = (TInt)(1.0 / zoom * iScale.iX); + iScale.iY = (TInt)(1.0 / zoom * iScale.iY); + + return 0; + } + + + +void CFilterBubble::LoadImageL () + { + + // create and load bubble + CFbsBitmap * bubble = new (ELeave) CFbsBitmap; + CleanupStack::PushL(bubble); + User::LeaveIfError ( bubble->Load (iFileName, iBubble) ); + + // create and load mask + CFbsBitmap * mask = new (ELeave) CFbsBitmap; + CleanupStack::PushL(mask); + User::LeaveIfError ( mask->Load (iFileName, iMask) ); + + // bubble size + iSize = bubble->SizeInPixels(); + + // create new buffer + delete[] iData; + iData = new (ELeave) TUint32 [iSize.iWidth * iSize.iHeight]; + + // copy bubble data + bubble->LockHeapLC(); + + TInt wsc = bubble->ScanLineLength (iSize.iWidth, bubble->DisplayMode()); + TInt wsm = mask->ScanLineLength (iSize.iWidth, mask->DisplayMode()); + TUint8 * pcos = (TUint8 *)bubble->DataAddress(); + TUint8 * pmos = (TUint8 *)mask->DataAddress(); + + for ( TInt i = 0, k = 0; i < iSize.iHeight; ++i ) + { + + TUint8 * pc = pcos; + pcos += wsc; + + TUint8 * pm = pmos; + pmos += wsm; + + for ( TInt j = 0; j < iSize.iWidth; ++j ) + { + iData[k++] = (TUint32)(*pc | (*(pc + 1) << 8) | (*(pc + 2) << 16) | (*pm++ << 24)); + pc += 3; + } + } + + CleanupStack::PopAndDestroy(3); // LockHeapLC(), mask, bubble + +} + + + +const char* CFilterBubble::Type() + { + return "bubble"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBubble/group/FilterBubble.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBubble/group/FilterBubble.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterBubble.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterBubble.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBubble/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBubble/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterBubble.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/BWINS/FilterBuffer.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/BWINS/FilterBuffer.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterBuffer@@SAHXZ @ 1 NONAME ; int CFilterBuffer::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/EABI/FilterBuffer.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/EABI/FilterBuffer.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN13CFilterBuffer6CreateEv @ 1 NONAME + _ZTI13CFilterBuffer @ 2 NONAME ; ## + _ZTV13CFilterBuffer @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/group/FilterBuffer.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/group/FilterBuffer.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterBuffer.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterBuffer.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,36 @@ +/* +* 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 +* +* Contributors: +* +* Description: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterBuffer.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/inc/CFilterBuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/inc/CFilterBuffer.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERBUFFER_H__ +#define __CFILTERBUFFER_H__ + +#include +#include "MImageFilter.h" +#include + +class CFilterBuffer + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterBuffer(); + + private: + static CFilterBuffer* NewL(); + CFilterBuffer(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + + TUint32* iBuffer; + TSize iSize; + TRect iRect; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/inc/FilterBuffer.lnt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/inc/FilterBuffer.lnt Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,8 @@ +// Lint options for FilterBuffer component + +// Include paths +-i..\inc +-i..\..\Common\inc + +// Source files to be inspected +..\src\CFilterBuffer.cpp diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterBuffer/src/CFilterBuffer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterBuffer/src/CFilterBuffer.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,272 @@ +/* +* 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: +* +*/ + + +#include "CFilterBuffer.h" + +EXPORT_C TInt CFilterBuffer::Create() + { + CFilterBuffer* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterBuffer* CFilterBuffer::NewL() + { + CFilterBuffer* self = new( ELeave )CFilterBuffer(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterBuffer::~CFilterBuffer() + { + delete iBuffer; + } + + + +CFilterBuffer::CFilterBuffer() + { + + } + + + +void CFilterBuffer::ConstructL() + { + + } + + + +TRect CFilterBuffer::Rect() + { + return iRect; + } + +TReal CFilterBuffer::Scale() + { + return iChild->Scale(); + } + +TSize CFilterBuffer::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + + +TBlock * CFilterBuffer::GetBlockL ( const TRect & aRect ) +{ + + if ( !aRect.Intersects(iRect) ) + { + return NULL; + } + + TRect rect = aRect; + rect.Intersection(iRect); + + TBlock * pB = new (ELeave) TBlock (rect); + + TUint32 * pS = iBuffer + rect.iTl.iY * iSize.iWidth + rect.iTl.iX; + TUint32 * pD = pB->iData; + + for (TInt i = rect.iTl.iY; i < rect.iBr.iY; ++i) + { + Mem::Copy(pD, pS, pB->iWidth * sizeof(TUint32)); + pD += pB->iWidth; + pS += iSize.iWidth; + } + return pB; +} + + + +void CFilterBuffer::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + +void CFilterBuffer::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterBuffer::CmdL( const TDesC16& aCmd ) +{ + + TSize oldSize = iSize; + + TInt rv = 0; + + TLex lex (aCmd); + + while ( !lex.Eos() ) + { + TPtrC token = lex.NextToken(); + + if( token.Compare( _L("width") ) == 0 ) + { + lex.Inc(); + lex.Val( iSize.iWidth ); + } + else if( token.Compare( _L("height") ) == 0 ) + { + lex.Inc(); + lex.Val( iSize.iHeight ); + } + else if( token.Compare( _L("getbitmap") ) == 0 ) + { + + Mem::FillZ(iBuffer, iSize.iWidth * iSize.iHeight * sizeof(TUint32)); + + TPoint tl (0,0); + TPoint br (16,16); + + while ( tl.iY < iRect.iBr.iY ) + { + + tl.iX = 0; + br.iX = 16; + + while ( tl.iX < iRect.iBr.iX ) + { + if (br.iX >= iSize.iWidth) br.iX = iSize.iWidth; + if (br.iY >= iSize.iHeight) br.iY = iSize.iHeight; + + TBlock * pB = iChild->GetBlockL(TRect (tl,br) ); + + if (pB) + { + TUint32 * ps = pB->iData; + TUint32 * pd = iBuffer + tl.iY * iSize.iWidth + tl.iX; + + for (TInt i = 0; i < pB->iHeight; ++i ) + { + Mem::Copy (pd, ps, pB->iWidth * sizeof (TUint32)); + ps += pB->iWidth; + pd += iSize.iWidth; + } + delete pB; + pB = NULL; + } + else + { + TUint32 * pd = iBuffer + tl.iY * iSize.iWidth + tl.iX; + TInt datalength = (br.iX - tl.iX) * sizeof (TUint32); + for (TInt i = tl.iY; i < br.iY; ++i ) + { + Mem::FillZ (pd, datalength); + pd += iSize.iWidth; + } + } + + tl.iX += 16; + br.iX += 16; + } + + tl.iY += 16; + br.iY += 16; + + } +/* + CFbsBitmap * bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + User::LeaveIfError(bitmap->Create(iSize, EColor16M)); + TBitmapUtil bm (bitmap); + bm.Begin(TPoint(0,0)); + TUint8 * pDOS = (TUint8 *)bitmap->DataAddress(); + TUint32 * pS = iBuffer; + TInt ws = CFbsBitmap::ScanLineLength(iSize.iWidth, EColor16M); + for (TInt i = 0; i < iSize.iHeight; ++i) + { + TUint8 * pD = pDOS; + pDOS += ws; + for (TInt j = 0; j < iSize.iWidth; ++j) + { + TUint32 c = *pS++; + *pD++ = c & 0xFF; + c >>= 8; + *pD++ = c & 0xFF; + c >>= 8; + *pD++ = c & 0xFF; + } + } + bm.End(); + TFileName filename; + filename.Copy (_L("c:\\data\\images\\test_")); + filename.AppendNum((TInt)iBuffer); + filename.Append(_L(".mbm")); + bitmap->Save(filename); + + CleanupStack::PopAndDestroy(); // bitmap +*/ + + rv = (TInt)iBuffer; + } + + if( iSize != oldSize ) + { + if( iSize.iWidth > 0 && iSize.iHeight > 0 ) + { + delete[] iBuffer; + iBuffer = NULL; + iBuffer = new (ELeave) TUint32 [iSize.iWidth * iSize.iHeight]; + } + oldSize = iSize; + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = iSize.iWidth; + iRect.iBr.iY = iSize.iHeight; + } + + + } + + return rv; + +} + + + +const char* CFilterBuffer::Type() + { + return "buffer"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCartoon/BWINS/FilterCartoon.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCartoon/BWINS/FilterCartoon.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterCartoon@@SAHXZ @ 1 NONAME ; int CFilterCartoon::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCartoon/EABI/FilterCartoon.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCartoon/EABI/FilterCartoon.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,9 @@ +EXPORTS + _ZN14CFilterCartoon6CreateEv @ 1 NONAME + _ZTI11COTreeQuant @ 2 NONAME ; ## + _ZTI14CFilterCartoon @ 3 NONAME ; ## + _ZTI5CNode @ 4 NONAME ; ## + _ZTV11COTreeQuant @ 5 NONAME ; ## + _ZTV14CFilterCartoon @ 6 NONAME ; ## + _ZTV5CNode @ 7 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCartoon/Inc/CFilterCartoon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCartoon/Inc/CFilterCartoon.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,121 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterCartoon_H__ +#define __CFilterCartoon_H__ + +#include +#include "MImageFilter.h" + +typedef RArray RPalette; + +// Class: Octree node +//============================================================================= +class CNode : public CBase +{ + +public: + + CNode(); + virtual ~CNode(); + +public: + /// If ETrue, has no leaves + TBool iIsLeaf; + /// Number of pixels represented by this leaf + TInt iPixels; + /// Sum of red components + TInt iRedSum; + /// Sum of green components + TInt iGreenSum; + /// Sum of blue components + TInt iBlueSum; + /// Children + CNode * iChild[8]; + /// Next reducible node + CNode * iNext; +}; + +// Class: Octree +//============================================================================= +class COTreeQuant : public CBase +{ + +public: + + COTreeQuant(); + virtual ~COTreeQuant(); + + void AddColorL (TUint32 aRgb); + TInt GetColorCount() const; + void GetColorTable (); + void ReduceTree (); + +public: + + /// Amount of leaves + TInt iLeaves; + /// Tree struct + CNode * iTree; + /// Reducible nodes + CNode * iReducibleNodes[9]; + /// Palette + RPalette iPalette; + +private: + + void DoAddColorL (CNode ** aNode, TUint32 aRgb, TInt aLevel); + void GetPaletteColors (const CNode & aNode); + +}; + +// Class: Cartoon filter +//============================================================================= +class CFilterCartoon + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterCartoon(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent ( MImageFilter * aParent ); + virtual void SetChild ( MImageFilter * aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: + static CFilterCartoon* NewL(); + CFilterCartoon(); + void ConstructL(); + void CreateOctreePaletteL(); + + private: // data + + TInt* i16BitIndLut; + TUint32* iRGB; + TInt iCount; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCartoon/Src/CFilterCartoon.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCartoon/Src/CFilterCartoon.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,462 @@ +/* +* 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: +* +*/ + + +#include +#include "CFilterCartoon.h" + +const TInt KMaxColors = 10; +const TInt KColorBits = 8; + +const TUint8 ByteMask[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01}; + +/* +* +* CLASS: CFilterCartoon +* +*/ + +//============================================================================= +EXPORT_C TInt CFilterCartoon::Create() + { + CFilterCartoon* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + +//============================================================================= +CFilterCartoon* CFilterCartoon::NewL() + { + CFilterCartoon* self = new( ELeave )CFilterCartoon(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//============================================================================= +CFilterCartoon::~CFilterCartoon() +{ + delete[] i16BitIndLut; + delete[] iRGB; +} + +//============================================================================= +CFilterCartoon::CFilterCartoon() + { + + } + +//============================================================================= +void CFilterCartoon::ConstructL() + { + + } + +//============================================================================= +TRect CFilterCartoon::Rect() + { + return iChild->Rect(); + } + +//============================================================================= +TReal CFilterCartoon::Scale() + { + return iChild->Scale(); + } + +//============================================================================= +TSize CFilterCartoon::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +//============================================================================= +TBlock * CFilterCartoon::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) + { + return NULL; + } + + TUint32 * pD = pB->iData; + TUint32 c = 0; + TUint32 r,g,b; + for (TInt i = pB->iDataLength; i != 0 ; --i) + { + c = *pD; + b = c & 0xFF; + c >>= 8; + g = c & 0xFF; + c >>= 8; + r = c & 0xFF; + c = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); + *pD++ = iRGB[i16BitIndLut[c]]; + + } + return pB; +} + + +//============================================================================= +void CFilterCartoon::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + +//============================================================================= +void CFilterCartoon::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + +//============================================================================= +TInt CFilterCartoon::CmdL( const TDesC16& aCmd ) +{ + + TLex lex (aCmd); + + while ( !lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("quantcolors") ) == 0 ) + { + CreateOctreePaletteL(); + } + } + return 0; +} + +//============================================================================= +const char* CFilterCartoon::Type() + { + return "cartoon"; + } + +//============================================================================= +void CFilterCartoon::CreateOctreePaletteL() +{ + + // Create new quantizer + COTreeQuant * quant = new (ELeave) COTreeQuant; + CleanupStack::PushL( quant ); + + // Octree quantize colors + TRect rect = iChild->Rect(); + TBlock * pB = iChild->GetBlockL(rect); + TUint32 * pD = pB->iData; + TInt i; + for (i = 0; i < pB->iDataLength; ++i, pD++) + { + quant->AddColorL (*pD); + while ( quant->iLeaves > KMaxColors ) + { + quant->ReduceTree (); + } + } + + delete pB; + pB = NULL; + + // Create palette + quant->GetColorTable(); + + // Get new iCount + iCount = quant->iPalette.Count(); + + // Create 16 bit indexing array + delete[] i16BitIndLut; + i16BitIndLut = NULL; + i16BitIndLut = new (ELeave) TInt [65536]; + + delete[] iRGB; + iRGB = NULL; + iRGB = new (ELeave) TUint32 [iCount]; + + + // Enumerate indexing array + for (i = 0; i < 65536; ++i) + { + TUint32 c = i; + TUint32 b = c & 0x1F; + c >>= 5; + TUint32 g = c & 0x3F; + c >>= 6; + TUint32 r = c & 0x1F; + + TInt md = 99999999; + + for (TInt j = 0; j < iCount; ++j) + { + c = quant->iPalette[j]; + TUint32 bb = c & 0xFF; + bb >>= 3; + + c >>= 8; + TUint32 gg = c & 0xFF; + gg >>= 2; + + c >>= 8; + TUint32 rr = c & 0xFF; + rr >>= 3; + + TInt d = (b-bb) * (b-bb) + (g-gg) * (g-gg) + (r-rr) * (r-rr); + if (d < md) + { + md = d; + i16BitIndLut[i] = j; + } + else if (d == md) + { +/* + // compute i in 24 bit coordinates + c = i; + b = (c & 0x1F) << 3; + c >>= 5; + g = (c & 0x3F) << 2; + c >>= 6; + r = (c & 0x1F) << 3; + + // compute distance of old min to i + c = iRGB[i16BitIndLut[i]]; + bb = (c & 0xFF); + c >>= 8; + gg = (c & 0xFF); + c >>= 8; + rr = (c & 0xFF); + d = (b-bb) * (b-bb) + (g-gg) * (g-gg) + (r-rr) * (r-rr); + + // compute distance of the new min to i + c = iRGB[j]; + bb = (c & 0xFF); + c >>= 8; + gg = (c & 0xFF); + c >>= 8; + rr = (c & 0xFF); + TInt d2 = (b-bb) * (b-bb) + (g-gg) * (g-gg) + (r-rr) * (r-rr); + + if (d2 < d) + { + i16BitIndLut[i] = j; + } +*/ + } + } + + } + + for (TInt j = 0; j < iCount; ++j) + { + iRGB[j] = quant->iPalette[j]; + } + + CleanupStack::PopAndDestroy( quant ); +} + + +/* +* +* CLASS: CNode +* +*/ + +//============================================================================= +CNode::CNode() +{ + +} + +//============================================================================= +CNode::~CNode() +{ + for (TInt i = 0; i < 8; i++) + { + delete iChild[i]; + iChild[i] = NULL; + } + iNext = NULL; +} + +/* +* +* CLASS: COTreeQuant +* +*/ + +//============================================================================= +COTreeQuant::COTreeQuant() +{ + +} + +//============================================================================= +COTreeQuant::~COTreeQuant() +{ + delete iTree; + iTree = NULL; + Mem::FillZ(iReducibleNodes, 9 * sizeof(CNode *)); + iPalette.Reset(); +} + +//============================================================================= +void COTreeQuant::AddColorL (TUint32 aRgb) +{ + DoAddColorL (&iTree, aRgb, 0); +} + +//============================================================================= +void COTreeQuant::ReduceTree () +{ + + // Find the deepest level with at least 1 reducible node + TInt i=0; + for (i = KColorBits - 1; (i > 0) && (!iReducibleNodes[i]); i--) {}; + + // Reduce most recent node at level i + CNode * pNode = iReducibleNodes[i]; + iReducibleNodes[i] = pNode->iNext; + + TInt reds = 0; + TInt greens = 0; + TInt blues = 0; + TInt children = 0; + + for ( i = 0; i < 8; i++) + { + if ( pNode->iChild[i] ) + { + reds += pNode->iChild[i]->iRedSum; + greens += pNode->iChild[i]->iGreenSum; + blues += pNode->iChild[i]->iBlueSum; + pNode->iPixels += pNode->iChild[i]->iPixels; + delete pNode->iChild[i]; + pNode->iChild[i] = NULL; + children++; + } + } + + pNode->iIsLeaf = ETrue; + pNode->iRedSum = reds; + pNode->iGreenSum = greens; + pNode->iBlueSum = blues; + iLeaves -= (children - 1); +} + +//============================================================================= +void COTreeQuant::GetColorTable () +{ + GetPaletteColors ( *iTree ); +} + +//============================================================================= +TInt COTreeQuant::GetColorCount() const +{ + return iLeaves; +} + +//============================================================================= +void COTreeQuant::DoAddColorL (CNode ** apNode, TUint32 aRgb, TInt aLevel) +{ + + // If node does not exist, create new + if (!*apNode) + { + *apNode = new (ELeave) CNode; + + (*apNode)->iIsLeaf = (aLevel == KColorBits) ? ETrue : EFalse; + if ((*apNode)->iIsLeaf) + { + iLeaves++; + } + else + { + (*apNode)->iNext = iReducibleNodes[aLevel]; + iReducibleNodes[aLevel] = *apNode; + } + } + + TUint32 c = aRgb; + TUint8 b = (TUint8)(c & 0xFF); + c >>= 8; + TUint8 g = (TUint8)(c & 0xFF); + c >>= 8; + TUint8 r = (TUint8)(c & 0xFF); + + // Update colors if leaf + if ( (*apNode)->iIsLeaf ) + { + (*apNode)->iPixels++; + (*apNode)->iRedSum += r; + (*apNode)->iGreenSum += g; + (*apNode)->iBlueSum += b; + } + + // Recurse deeper if not a leaf + else + { + + TInt shift = 7 - aLevel; + TInt index = (((r & ByteMask[aLevel]) >> shift) << 2) | + (((g & ByteMask[aLevel]) >> shift) << 1) | + ((b & ByteMask[aLevel]) >> shift); + + DoAddColorL (&((*apNode)->iChild[index]), aRgb, aLevel + 1); + } + +} + +//============================================================================= +void COTreeQuant::GetPaletteColors ( const CNode & aNode ) +{ + if ( aNode.iIsLeaf ) + { + TUint8 r = (TUint8) (aNode.iRedSum / aNode.iPixels); + TUint8 g = (TUint8) (aNode.iGreenSum / aNode.iPixels); + TUint8 b = (TUint8) (aNode.iBlueSum / aNode.iPixels); + iPalette.Append ( ((r << 16) | (g << 8) | b) ); + } + else + { + for (TInt i = 0; i < 8; i++) + { + if ( aNode.iChild[i] ) + { + GetPaletteColors ( *aNode.iChild[i] ); + } + } + } +} + + +/* +* +* ENTRY POINT +* +*/ +//============================================================================= +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCartoon/group/FilterCartoon.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCartoon/group/FilterCartoon.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterCartoon.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterCartoon.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCartoon/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCartoon/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterCartoon.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterClipart/BWINS/FilterClipart.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterClipart/BWINS/FilterClipart.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterClipart@@SAHXZ @ 1 NONAME ; int CFilterClipart::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterClipart/EABI/FilterClipart.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterClipart/EABI/FilterClipart.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN14CFilterClipart6CreateEv @ 1 NONAME + _ZTI14CFilterClipart @ 2 NONAME ; ## + _ZTV14CFilterClipart @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterClipart/Inc/CFilterClipart.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterClipart/Inc/CFilterClipart.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,69 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERCLIPART_H__ +#define __CFILTERCLIPART_H__ + +#include +#include "MImageFilter.h" +#include + +class CFilterClipart + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterClipart(); + + private: + static CFilterClipart* NewL(); + CFilterClipart(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // New methods + void CFilterClipart::LoadImageL(); + + private: // Data + + TUint32 * iData; + TSize iSize; + TFileName iFileName; + TInt iClipart; + TInt iMask; + + TPoint iPosition; + TPoint iCorrectPosition; + TInt iZoom; + TInt iAngle; + TPoint iScale; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterClipart/Src/CFilterClipart.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterClipart/Src/CFilterClipart.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,325 @@ +/* +* 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: +* +*/ + + +#include "CFilterClipart.h" + +#include + +const TInt KScaleBits = 12; +const TInt KCoordBits = 8; + +EXPORT_C TInt CFilterClipart::Create() + { + CFilterClipart* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterClipart* CFilterClipart::NewL() + { + CFilterClipart* self = new( ELeave )CFilterClipart(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterClipart::~CFilterClipart() + { + delete[] iData; + } + + + +CFilterClipart::CFilterClipart() + { + + } + + + +void CFilterClipart::ConstructL() + { + iScale.iX = 1 << 8; + iScale.iY = 0; + iZoom = 1000; + iAngle = 0; + } + + + +TRect CFilterClipart::Rect() + { + return iChild->Rect(); + } + +TReal CFilterClipart::Scale() + { + return iChild->Scale(); + } + +TSize CFilterClipart::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterClipart::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + + for (TInt i = pB->iRect.iTl.iY; i < pB->iRect.iBr.iY; ++i) + { + for (TInt j = pB->iRect.iTl.iX; j < pB->iRect.iBr.iX; ++j, ++pD) + { + + TUint32 c = *pD; + + TPoint pos = iCorrectPosition + TPoint (j << KCoordBits, i << KCoordBits); + TInt x = ( pos.iX * iScale.iX + pos.iY * iScale.iY ) >> ( KScaleBits + KCoordBits ); + TInt y = ( pos.iY * iScale.iX - pos.iX * iScale.iY ) >> ( KScaleBits + KCoordBits ); + + if ( (x >= 0) && (y >= 0) && (x < iSize.iWidth) && (y < iSize.iHeight) ) + { + + TUint32 c2 = iData[ x + y * iSize.iWidth ]; + TInt ca = c2 >> 24; + + if ( ca == 255 ) + { + *pD = c2 & 0xffffff; + } + else + { + TInt cc1 = (c2 & 0xff00ff) * ca + (c & 0xff00ff) * (255 - ca); + TInt cc2 = (c2 & 0xff00) * ca + (c & 0xff00) * (255 - ca); + *pD = (( cc1 >> 8) & 0xff00ff) + ((cc2 >> 8) & 0xff00); + } + } + } + } + return pB; +} + + +void CFilterClipart::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + +void CFilterClipart::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterClipart::CmdL( const TDesC16& aCmd ) + { + + TLex lex( aCmd ); + + while( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("file") ) == 0 ) + { + TPtrC namec = lex.NextToken(); + TPtrC name( namec.Ptr()+1, namec.Length()-2 ); + iFileName.Copy (name); + } + else if( token.Compare( _L("load") ) == 0 ) + { + LoadImageL(); + } + else if( token.Compare( _L("clipart") ) == 0 ) + { + lex.Inc(); + lex.Val( iClipart ); + } + else if( token.Compare( _L("mask") ) == 0 ) + { + lex.Inc(); + lex.Val( iMask ); + } + else if( token.Compare( _L("x") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iPosition.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("y") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iPosition.iY = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("width") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + TInt width = (TInt)((param / relscale) + 0.5); + iZoom = (width * 1000) / iSize.iWidth; + } + else if( token.Compare( _L("height") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + TInt height = (TInt)((param / relscale) + 0.5); + iZoom = (height * 1000) / iSize.iHeight; + } + else if( token.Compare( _L("zoom") ) == 0 ) + { + lex.Inc(); + lex.Val( iZoom ); + } + else if( token.Compare( _L("angle") ) == 0 ) + { + lex.Inc(); + lex.Val( iAngle ); + } + } + + TReal relscale = iChild->Scale(); + TInt scaledx = (TInt)(iPosition.iX * relscale + 0.5); + TInt scaledy = (TInt)(iPosition.iY * relscale + 0.5); + TInt scaledz = (TInt)(iZoom * relscale + 0.5); + + TReal zoom = 0.001 * scaledz; + TReal angle = 0.001 * iAngle; + TReal rad = KPi * angle / 180.0; + TReal r; + TReal res; + + Math::Cos( r, rad ); + r *= 1 << KScaleBits; + //r /= zoom; + Math::Round( res, r, 0 ); + iScale.iX = (TInt)res; + + Math::Sin( r, rad ); + r *= 1 << KScaleBits; + //r /= zoom; + Math::Round( res, r, 0 ); + iScale.iY = (TInt)res; + + // helpers + TPoint mid( iSize.iWidth/2, iSize.iHeight/2 ); + TPoint sca( (TInt)(zoom * iScale.iX), (TInt)(zoom * iScale.iY) ); + TInt xo = ( mid.iX * sca.iX - mid.iY * sca.iY ) >> ( KScaleBits - KCoordBits ); + TInt yo = ( mid.iY * sca.iX + mid.iX * sca.iY ) >> ( KScaleBits - KCoordBits ); + + // + // iCorrectPosition is clipart mid position corrected with + // rotation ( otherwise rotation would be around topleft corner ) + // + iCorrectPosition = TPoint( xo,yo ) - TPoint( scaledx << KCoordBits, scaledy << KCoordBits ); + + // + // with iScale screen coordinates are translated to texture coordinates + // + iScale.iX = (TInt)(1.0 / zoom * iScale.iX); + iScale.iY = (TInt)(1.0 / zoom * iScale.iY); + + return 0; + } + + + +void CFilterClipart::LoadImageL () + { + + // create and load clipart + CFbsBitmap * clipart = new (ELeave) CFbsBitmap; + CleanupStack::PushL(clipart); + User::LeaveIfError ( clipart->Load (iFileName, iClipart) ); + + // create and load mask + CFbsBitmap * mask = new (ELeave) CFbsBitmap; + CleanupStack::PushL(mask); + User::LeaveIfError ( mask->Load (iFileName, iMask) ); + + // clipart size + iSize = clipart->SizeInPixels(); + + // create new buffer + delete[] iData; + iData = new (ELeave) TUint32 [iSize.iWidth * iSize.iHeight]; + + // copy clipart data + clipart->LockHeapLC(); + + TInt wsc = clipart->ScanLineLength (iSize.iWidth, clipart->DisplayMode()); + TInt wsm = mask->ScanLineLength (iSize.iWidth, mask->DisplayMode()); + TUint8 * pcos = (TUint8 *)clipart->DataAddress(); + TUint8 * pmos = (TUint8 *)mask->DataAddress(); + + for ( TInt i = 0, k = 0; i < iSize.iHeight; ++i ) + { + + TUint8 * pc = pcos; + pcos += wsc; + + TUint8 * pm = pmos; + pmos += wsm; + + for ( TInt j = 0; j < iSize.iWidth; ++j ) + { + iData[k++] = (TUint32)(*pc | (*(pc + 1) << 8) | (*(pc + 2) << 16) | (*pm++ << 24)); + pc += 3; + } + } + + CleanupStack::PopAndDestroy(3); // LockHeapLC(), mask, clipart + +} + + + +const char* CFilterClipart::Type() + { + return "clipart"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterClipart/group/FilterClipart.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterClipart/group/FilterClipart.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterClipart.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterClipart.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterClipart/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterClipart/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterClipart.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterContrast/BWINS/FilterContrast.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterContrast/BWINS/FilterContrast.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterContrast@@SAHXZ @ 1 NONAME ; int CFilterContrast::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterContrast/EABI/FilterContrast.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterContrast/EABI/FilterContrast.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN15CFilterContrast6CreateEv @ 1 NONAME + _ZTI15CFilterContrast @ 2 NONAME ; ## + _ZTV15CFilterContrast @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterContrast/Inc/CFilterContrast.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterContrast/Inc/CFilterContrast.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterContrast_H__ +#define __CFilterContrast_H__ + +#include +#include "MImageFilter.h" + +class CFilterContrast + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterContrast(); + + private: + static CFilterContrast* NewL(); + CFilterContrast(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: + void ComputeContrastStretchL(); + + private: // Data + + TUint8 iLUT[256]; + TInt iContrast; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterContrast/Src/CFilterContrast.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterContrast/Src/CFilterContrast.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,195 @@ +/* +* 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: +* +*/ + + +#include +#include "CFilterContrast.h" + +EXPORT_C TInt CFilterContrast::Create() + { + CFilterContrast* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterContrast* CFilterContrast::NewL() + { + CFilterContrast* self = new( ELeave )CFilterContrast(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterContrast::~CFilterContrast() + { + } + + + +CFilterContrast::CFilterContrast() + { + + } + + + +void CFilterContrast::ConstructL() + { + ComputeContrastStretchL(); + } + + + +TRect CFilterContrast::Rect() + { + return iChild->Rect(); + } + +TReal CFilterContrast::Scale() + { + return iChild->Scale(); + } + +TSize CFilterContrast::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + + +TBlock * CFilterContrast::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + for (TInt i = 0; i < pB->iDataLength; ++i) + { + TUint32 c = *pD; + TUint8 b = iLUT[c & 0xFF]; + c >>= 8; + TUint8 g = iLUT[c & 0xFF]; + c >>= 8; + TUint8 r = iLUT[c & 0xFF]; + *pD++ = 0 | b | (g << 8) | (r << 16); + } + return pB; +} + + + +void CFilterContrast::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterContrast::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterContrast::CmdL( const TDesC16& aCmd ) +{ + + TLex lex (aCmd); + + while ( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + + if ( token.Compare( _L("contrast") ) == 0) + { + + lex.Inc(); + lex.Val (iContrast); + + // Check parameter + if ( iContrast < -100) + { + iContrast = -100; + } + else if ( iContrast > 100) + { + iContrast = 100; + } + ComputeContrastStretchL(); + } + } + return 0; +} + +const char* CFilterContrast::Type() + { + return "contrast"; + } + +void CFilterContrast::ComputeContrastStretchL() + { + // Compute luminance histogram, if not computed + if ( iContrast >= 0 ) + { + TInt val_low = (iContrast * 127) / 100; + TInt val_high = 255 - val_low; + TInt range = val_high - val_low + 1; + + TInt i = 0; + for ( ; i <= val_low; i++) + { + iLUT[i] = 0; + } + for ( ; i < val_high; ++i) + { + iLUT[i] = (TUint8)(((i - val_low) * 255) / range); + } + for ( ; i <= 255; i++) + { + iLUT[i] = 255; + } + } + else + { + + TInt val_low = (-iContrast * 127) / 100; + TInt val_high = 255 - val_low; + TInt range = val_high - val_low + 1; + + for ( TInt i = 0; i <= 255; i++ ) + { + iLUT[i] = (TUint8)(val_low + (i * range) / 255); + } + } + } + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterContrast/group/FilterContrast.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterContrast/group/FilterContrast.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterContrast.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterContrast.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterContrast/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterContrast/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterContrast.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCrop/BWINS/FilterCrop.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCrop/BWINS/FilterCrop.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterCrop@@SAHXZ @ 1 NONAME ; int CFilterCrop::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCrop/EABI/FilterCrop.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCrop/EABI/FilterCrop.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN11CFilterCrop6CreateEv @ 1 NONAME + _ZTI11CFilterCrop @ 2 NONAME ; ## + _ZTV11CFilterCrop @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCrop/Inc/CFilterCrop.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCrop/Inc/CFilterCrop.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,54 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERCROP_H__ +#define __CFILTERCROP_H__ + +#include +#include "MImageFilter.h" + +class CFilterCrop + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterCrop(); + + private: + static CFilterCrop* NewL(); + CFilterCrop(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + TRect iRect; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCrop/Src/CFilterCrop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCrop/Src/CFilterCrop.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,179 @@ +/* +* 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: +* +*/ + + +#include "CFilterCrop.h" + +EXPORT_C TInt CFilterCrop::Create() + { + CFilterCrop* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterCrop* CFilterCrop::NewL() + { + CFilterCrop* self = new( ELeave )CFilterCrop(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterCrop::~CFilterCrop() + { + } + + + +CFilterCrop::CFilterCrop() + { + + } + + + +void CFilterCrop::ConstructL() + { + + } + + + +TRect CFilterCrop::Rect() + { + + if ( iRect == TRect(0,0,0,0) ) + { + return iChild->Rect(); + } + else + { + TReal relscale = iChild->Scale(); + TRect rect; + rect.iTl.iX = (TInt)(iRect.iTl.iX * relscale + 0.5); + rect.iTl.iY = (TInt)(iRect.iTl.iY * relscale + 0.5); + rect.iBr.iX = (TInt)(iRect.iBr.iX * relscale + 0.5); + rect.iBr.iY = (TInt)(iRect.iBr.iY * relscale + 0.5); + rect.Intersection( iChild->Rect() ); + return rect; + } + } + +TReal CFilterCrop::Scale() + { + return iChild->Scale(); + } + +TSize CFilterCrop::ViewPortSize() + { + if (iRect == TRect(0,0,0,0)) + { + return iChild->ViewPortSize(); + } + else + { + return iRect.Size(); + } + } + +TBlock * CFilterCrop::GetBlockL ( const TRect & aRect ) + { + return iChild->GetBlockL (aRect); + } + + +void CFilterCrop::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterCrop::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterCrop::CmdL( const TDesC16& aCmd ) + { + TLex lex( aCmd ); + + while( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("x1") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iRect.iTl.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("y1") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iRect.iTl.iY = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("x2") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iRect.iBr.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("y2") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iRect.iBr.iY = (TInt)((param / relscale) + 0.5); + } + } + return 0; + } + + + +const char* CFilterCrop::Type() + { + return "crop"; + } + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCrop/group/FilterCrop.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCrop/group/FilterCrop.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterCrop.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterCrop.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterCrop/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterCrop/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterCrop.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/BWINS/filterdraw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/BWINS/filterdraw.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterDraw@@SAHXZ @ 1 NONAME ; int CFilterDraw::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/EABI/filterdraw.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/EABI/filterdraw.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN11CFilterDraw6CreateEv @ 1 NONAME + _ZTI11CFilterDraw @ 2 NONAME ; ## + _ZTV11CFilterDraw @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/Inc/cfilterdraw.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/Inc/cfilterdraw.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,71 @@ +/* +* 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: +* Filter for Draw UI plugin. +* +*/ + + +#ifndef __CFILTER_DRAW_H_ +#define __CFILTER_DRAW_H_ + +#include +#include "MImageFilter.h" +#include "drawpath.h" + +/** + * CFilterDraw + * + * @lib internal(filterdraw.dll) + * @since S60 5.0 + */ +class CFilterDraw: public CBase, public MImageFilter + { + public: // C'tor & destructor + IMPORT_C static TInt Create(); + ~CFilterDraw(); + + private: // called from Create() + static CFilterDraw* NewL(); + CFilterDraw(); + + public: // From MImageFilter + TRect Rect(); + TReal Scale(); + TSize ViewPortSize(); + TBlock* GetBlockL ( const TRect& aRect ); + void SetParent( MImageFilter* aParent ); + void SetChild( MImageFilter* aChild ); + TInt CmdL( const TDesC16& aCmd ); + const char* Type(); + void LoadFrameL(); + + private: // implementation + void RDrawPath2PointArray( const RDrawPath& aPath, + CArrayFix*& aArrayPtr ) const; + void RealToViewedFactories(TReal& aWidth, TReal& aHeight); + + private: // Data + /// Data is ready to be rendered + TBool iReadyToRender; + /// Data buffer + TUint32* iData; + /// Drawed lines + RArray iPaths; + /// Bitmap size + TSize iBitmapSize; + }; + +#endif // __CFILTER_DRAW_H_ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/Inc/drawpath.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/Inc/drawpath.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,83 @@ +/* +* 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: +* Container for draw path. +* +*/ + + +#ifndef T_DRAWPATH_H +#define T_DRAWPATH_H + + +#include +#include +#include + +/** + * Container for draw path + * + * @lib internal(filterdraw.dll) + * @since S60 5.0 + */ +class RDrawPath : public RArray + { +public: + + RDrawPath(); + +public: + /** + * Color. + * + * @since S60 5.0 + * @return Path color + */ + TRgb Color(){return iColor;}; + + /** + * SetColor. (defalt KRgbRed) + * + * @since S60 5.0 + * @param aRgb Path color + */ + void SetColor(TRgb aRgb){iColor=aRgb;}; + + /** + * Size. + * + * @since S60 5.0 + * @return Path size + */ + TSize Size(){return iSize;}; + + /** + * SetSize. + * + * @since S60 5.0 + * @param aSize Path size + */ + void SetSize(TSize aSize){iSize=aSize;}; + +private: // data + + /** + * Path color + */ + TRgb iColor; + TSize iSize; + }; + +#endif // T_DRAWPATH_H diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/Src/cfilterdraw.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/Src/cfilterdraw.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,425 @@ +/* +* 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); +// --------------------------------------------------------------------------- +// Create +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CFilterDraw::Create() + { + CFilterDraw* ptr = NULL; + TRAP_IGNORE( ptr = NewL() ); + return (TInt)((MImageFilter*)ptr); + } + +// --------------------------------------------------------------------------- +// NewL +// --------------------------------------------------------------------------- +// +CFilterDraw* CFilterDraw::NewL() + { + return new( ELeave )CFilterDraw(); + } + +// --------------------------------------------------------------------------- +// ~CFilterDraw +// --------------------------------------------------------------------------- +// +CFilterDraw::~CFilterDraw() + { + delete[] iData; + iReadyToRender = EFalse; + // Close all paths + for( TInt i(0); iRect(); + } + +// --------------------------------------------------------------------------- +// Scale +// --------------------------------------------------------------------------- +// +TReal CFilterDraw::Scale() + { + ASSERT(iChild); + return iChild->Scale(); + } + +// --------------------------------------------------------------------------- +// ViewPortSize +// --------------------------------------------------------------------------- +// +TSize CFilterDraw::ViewPortSize() + { + ASSERT(iChild); + return iChild->ViewPortSize(); + } + +// --------------------------------------------------------------------------- +// GetBlockL +// --------------------------------------------------------------------------- +// +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 + + 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); + + TUint32 color = iData[ width*viewY + viewX ]; + if( (color & 0xff000000) ) + { + *pD = color; + } + + *pD++; + } + } + } + return pB; + } + +// --------------------------------------------------------------------------- +// SetParent +// --------------------------------------------------------------------------- +// +void CFilterDraw::SetParent( MImageFilter* aParent ) + { + ASSERT(aParent); + iParent = aParent; + } + +// --------------------------------------------------------------------------- +// SetChild +// --------------------------------------------------------------------------- +// +void CFilterDraw::SetChild( MImageFilter* aChild ) + { + ASSERT(aChild); + iChild = aChild; + } + +// --------------------------------------------------------------------------- +// CmdL +// --------------------------------------------------------------------------- +// +TInt CFilterDraw::CmdL( const TDesC16& aCmd ) + { + ASSERT(iChild); + 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() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("x") ) == 0 ) + { + iReadyToRender = EFalse; + TReal relscale = Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + // Coordinates on data bitmap + position.iX = (TReal(param) / relscale) / realToViewedFactorWidth + 0.5; + } + 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()) + { + RDrawPath 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) ); + } + } + else if( token.Compare( _L("color") ) == 0 ) + { + TUint32 color(0); + lex.Inc(); + 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 ) + { + TInt size(0); + 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()) + { + 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() + ); + + RDrawPath newPath; + User::LeaveIfError( iPaths.Append( newPath ) ); + } + else if( token.Compare( _L("done") ) == 0 ) + { + LoadFrameL(); + iReadyToRender = ETrue; + } + } + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// Type +// --------------------------------------------------------------------------- +// +const char* CFilterDraw::Type() + { + return "frame"; + } + +// --------------------------------------------------------------------------- +// LoadFrameL +// --------------------------------------------------------------------------- +// +void CFilterDraw::LoadFrameL() + { + RDebug::Print(_L("CFilterDraw::LoadFrameL w:%d h:%d"), + iBitmapSize.iWidth, + iBitmapSize.iHeight); + + // 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) ); + + CFbsBitmapDevice* maskDevice = CFbsBitmapDevice::NewL( mask ); + CleanupStack::PushL( maskDevice ); + + 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 graphics context + 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); + bitmapContext->SetPenColor(path.Color()); + bitmapContext->SetPenSize(path.Size()); + maskContext->SetPenSize(path.Size()); + + 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 ); + + 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; + } + } + } + bm.End(); + maskbm.End(); + // bitmapContext, bitmapDevice, maskContext, maskDevice, mask, bitmap + 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 ) ); + } + } + } + +// --------------------------------------------------------------------------- +// 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); + } + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/Src/drawpath.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/Src/drawpath.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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: +* Container for draw path. +* +*/ + +#include "drawpath.h" + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// RDrawPath +// --------------------------------------------------------------------------- +// +RDrawPath::RDrawPath():iColor(KRgbWhite) + { + } + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +filterdraw.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterDraw/group/filterdraw.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterDraw/group/filterdraw.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* Filter for draw plugin UI (draw.pgn). +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET filterdraw.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE cfilterdraw.cpp +SOURCE drawpath.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY gdi.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterFrame/BWINS/FilterFrame.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterFrame/BWINS/FilterFrame.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterFrame@@SAHXZ @ 1 NONAME ; int CFilterFrame::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterFrame/EABI/FilterFrame.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterFrame/EABI/FilterFrame.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN12CFilterFrame6CreateEv @ 1 NONAME + _ZTI12CFilterFrame @ 2 NONAME ; ## + _ZTV12CFilterFrame @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterFrame/Inc/CFilterFrame.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterFrame/Inc/CFilterFrame.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,75 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterFrame_H__ +#define __CFilterFrame_H__ + +#include +#include "MImageFilter.h" + +class CFbsBitmap; + +class CFilterFrame + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterFrame(); + + private: + static CFilterFrame* NewL(); + CFilterFrame(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + virtual void LoadFrameL(); + + private: // Data + + /// Frame buffer + TUint32 * iData; + /// File name + TFileName iFile; + /// Frame index + TInt iFrameInd; + /// Mask index + TInt iMaskInd; + /// Frame size + TSize iSize; + /// Frame scale + TPoint iScale; + /// Frame row offset + TInt iWsFrame; + /// Mask row offset + TInt iWsMask; + + TRect iOrigRect; + TPoint iOffset; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterFrame/Src/CFilterFrame.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterFrame/Src/CFilterFrame.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,257 @@ +/* +* 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: +* +*/ + + +#include +#include +#include "CFilterFrame.h" + +const TInt KScaleBits = 12; + +EXPORT_C TInt CFilterFrame::Create() + { + CFilterFrame* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterFrame* CFilterFrame::NewL() + { + CFilterFrame* self = new( ELeave )CFilterFrame(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterFrame::~CFilterFrame() + { + delete[] iData; + } + + + +CFilterFrame::CFilterFrame() + { + + } + + + +void CFilterFrame::ConstructL() + { + + } + + + +TRect CFilterFrame::Rect() + { + return iChild->Rect(); + } + +TReal CFilterFrame::Scale() + { + return iChild->Scale(); + } + +TSize CFilterFrame::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterFrame::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + + for (TInt i = pB->iRect.iTl.iY; i < pB->iRect.iBr.iY; ++i) + { + + TInt y = ((i - iOffset.iY) * iScale.iY) >> KScaleBits; + + for (TInt j = pB->iRect.iTl.iX; j < pB->iRect.iBr.iX; ++j, ++pD) + { + + TInt x = ((j - iOffset.iX) * iScale.iX) >> KScaleBits; + + if ( x >= 0 && x < iSize.iWidth && y >= 0 && y < iSize.iHeight ) + { + TUint32 pixel = *pD; + TUint32 frame = iData[y * iSize.iWidth + x]; + TUint8 alpha = (TUint8)(iData[y * iSize.iWidth + x] >> 24); + + if (alpha == 255) + { + *pD = frame; + } + else + { + TInt cc1 = (frame & 0xff00ff) * alpha + (pixel & 0xff00ff) * (255 - alpha); + TInt cc2 = (frame & 0xff00) * alpha + (pixel & 0xff00) * (255 - alpha); + *pD = (( cc1 >> 8 ) & 0xff00ff) + ((cc2 >> 8) & 0xff00); + } + } + } + } + return pB; +} + + + +void CFilterFrame::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterFrame::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterFrame::CmdL( const TDesC16& aCmd ) +{ + TLex lex (aCmd); + + // Handle parameters + while ( !lex.Eos() ) + { + TPtrC token = lex.NextToken(); + + if ( token.Compare( _L("file") ) == 0 ) + { + TPtrC namec = lex.NextToken(); + TPtrC name (namec.Ptr() + 1, namec.Length() - 2); + iFile.Copy (name); + } + else if( token.Compare( _L("frame") ) == 0 ) + { + lex.Inc (); + lex.Val( iFrameInd ); + } + else if( token.Compare( _L("mask") ) == 0 ) + { + lex.Inc(); + lex.Val( iMaskInd ); + } + else if( token.Compare( _L("load") ) == 0 ) + { + LoadFrameL(); + iOrigRect = iChild->Rect(); + TReal relscale = iChild->Scale(); + iOrigRect.iTl.iX = (TInt)((iOrigRect.iTl.iX / relscale) + 0.5); + iOrigRect.iTl.iY = (TInt)((iOrigRect.iTl.iY / relscale) + 0.5); + iOrigRect.iBr.iX = (TInt)((iOrigRect.iBr.iX / relscale) + 0.5); + iOrigRect.iBr.iY = (TInt)((iOrigRect.iBr.iY / relscale) + 0.5); + } + } + + TReal relscale = iChild->Scale(); + TRect rect = iChild->Rect(); + rect.iTl.iX = (TInt)((rect.iTl.iX / relscale) + 0.5); + rect.iTl.iY = (TInt)((rect.iTl.iY / relscale) + 0.5); + rect.iBr.iX = (TInt)((rect.iBr.iX / relscale) + 0.5); + rect.iBr.iY = (TInt)((rect.iBr.iY / relscale) + 0.5); + + TRect framerect; + framerect.iTl.iX = ((rect.iTl.iX - iOrigRect.iTl.iX) * (iSize.iWidth - 1)) / iOrigRect.Width(); + framerect.iTl.iY = ((rect.iTl.iY - iOrigRect.iTl.iY) * (iSize.iHeight - 1)) / iOrigRect.Height(); + framerect.iBr.iX = ((rect.iBr.iX - iOrigRect.iTl.iX) * (iSize.iWidth - 1)) / iOrigRect.Width(); + framerect.iBr.iY = ((rect.iBr.iY - iOrigRect.iTl.iY) * (iSize.iHeight - 1)) / iOrigRect.Height(); + + rect = iChild->Rect(); + iScale.iX = (framerect.Width() << KScaleBits) / rect.Width(); + iScale.iY = (framerect.Height() << KScaleBits) / rect.Height(); + + iOffset.iX = (TInt)(iOrigRect.iTl.iX * relscale + 0.5); + iOffset.iY = (TInt)(iOrigRect.iTl.iY * relscale + 0.5); + + return 0; +} + +const char* CFilterFrame::Type() + { + return "frame"; + } + +void CFilterFrame::LoadFrameL() +{ + + CFbsBitmap * frame = new (ELeave) CFbsBitmap; + CleanupStack::PushL (frame); + User::LeaveIfError ( frame->Load (iFile, iFrameInd) ); + + CFbsBitmap * mask = new (ELeave) CFbsBitmap; + CleanupStack::PushL (mask); + User::LeaveIfError ( mask->Load (iFile, iMaskInd) ); + + // Get frame size + iSize = frame->SizeInPixels(); + + // Create frame buffer + delete iData; + iData = NULL; + iData = new (ELeave) TUint32 [iSize.iWidth * iSize.iHeight]; + + // Copy frame data + frame->LockHeapLC(); + + TInt wsf = frame->ScanLineLength (iSize.iWidth, frame->DisplayMode()); + TInt wsm = mask->ScanLineLength (iSize.iWidth, mask->DisplayMode()); + + TUint8 * pfos = (TUint8 *)frame->DataAddress(); + TUint8 * pmos = (TUint8 *)mask->DataAddress(); + for ( TInt i = 0, k = 0; i < iSize.iHeight; ++i ) + { + TUint8 * pd = pfos; + pfos += wsf; + + TUint8 * pm = pmos; + pmos += wsm; + + for ( TInt j = 0; j < iSize.iWidth; ++j ) + { + iData[k++] = (TUint32)(*pd | (*(pd + 1) << 8) | (*(pd + 2) << 16) | (*pm++ << 24)); + pd += 3; + } + } + + CleanupStack::PopAndDestroy(3); // LockHeapLC, mask, frame +} + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterFrame/group/FilterFrame.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterFrame/group/FilterFrame.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterFrame.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterFrame.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterFrame/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterFrame/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterFrame.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterGrayScale/BWINS/FilterGrayScale.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterGrayScale/BWINS/FilterGrayScale.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterGrayScale@@SAHXZ @ 1 NONAME ; int CFilterGrayScale::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterGrayScale/EABI/FilterGrayScale.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterGrayScale/EABI/FilterGrayScale.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN16CFilterGrayScale6CreateEv @ 1 NONAME + _ZTI16CFilterGrayScale @ 2 NONAME ; ## + _ZTV16CFilterGrayScale @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterGrayScale/Inc/CFilterGrayScale.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterGrayScale/Inc/CFilterGrayScale.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,54 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterGrayScale_H__ +#define __CFilterGrayScale_H__ + +#include +#include "MImageFilter.h" + +class CFilterGrayScale + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterGrayScale(); + + private: + static CFilterGrayScale* NewL(); + CFilterGrayScale(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterGrayScale/Src/CFilterGrayScale.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterGrayScale/Src/CFilterGrayScale.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,135 @@ +/* +* 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: +* +*/ + + +#include "CFilterGrayScale.h" + + + +EXPORT_C TInt CFilterGrayScale::Create() + { + CFilterGrayScale* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterGrayScale* CFilterGrayScale::NewL() + { + CFilterGrayScale* self = new( ELeave )CFilterGrayScale(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterGrayScale::~CFilterGrayScale() + { + } + + + +CFilterGrayScale::CFilterGrayScale() + { + + } + + + +void CFilterGrayScale::ConstructL() + { + + } + + + +TRect CFilterGrayScale::Rect() + { + return iChild->Rect(); + } + +TReal CFilterGrayScale::Scale() + { + return iChild->Scale(); + } + +TSize CFilterGrayScale::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterGrayScale::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + for (TInt i = 0; i < pB->iDataLength; ++i) + { + TUint32 c = *pD; + TUint32 b = c & 0xFF; + c >>= 8; + TUint32 g = c & 0xFF; + c >>= 8; + TUint32 r = c & 0xFF; + TUint32 y = (306 * r + 587 * g + 117 * b) >> 10; + *pD++ = (y | (y << 8) | (y << 16)); + } + return pB; +} + + +void CFilterGrayScale::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterGrayScale::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterGrayScale::CmdL( const TDesC16& /*aCmd*/ ) + { + return 0; + } + + + +const char* CFilterGrayScale::Type() + { + return "grayscale"; + } + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterGrayScale/group/FilterGrayScale.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterGrayScale/group/FilterGrayScale.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterGrayScale.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterGrayScale.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterGrayScale/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterGrayScale/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterGrayScale.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterIclSource/BWINS/FilterIclSource.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterIclSource/BWINS/FilterIclSource.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterIclSource@@SAHXZ @ 1 NONAME ; int CFilterIclSource::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterIclSource/EABI/FilterIclSource.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterIclSource/EABI/FilterIclSource.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN16CFilterIclSource6CreateEv @ 1 NONAME + _ZTI12CImageLoader @ 2 NONAME ; ## + _ZTI16CFilterIclSource @ 3 NONAME ; ## + _ZTV12CImageLoader @ 4 NONAME ; ## + _ZTV16CFilterIclSource @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterIclSource/Inc/CFilterIclSource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterIclSource/Inc/CFilterIclSource.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,141 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERICLSOURCE_H__ +#define __CFILTERICLSOURCE_H__ + +#include +#include "MImageFilter.h" + +class CFbsBitmap; +class CImageDecoder; + +// Loader observer +//============================================================================= +class TBlockEntry +{ +public: + inline ~TBlockEntry() + { + delete[] iData; + } +public: + TRect iRect; + TUint32 * iData; +}; + + +// Loader observer +//============================================================================= +class MLoaderObserver +{ +public: + virtual void OperationReady (const TInt aError) = 0; +}; + + +// CActive derived loader class +//============================================================================= +class CImageLoader : public CActive +{ + +public: + CImageLoader (MLoaderObserver * aObserver); + virtual ~CImageLoader(); + void LoadBitmapL (TDesC & aFileName, CFbsBitmap * iBitmap); + +protected: + virtual void RunL(); + virtual void DoCancel(); + +private: + CFbsBitmap * iBitmap; + CImageDecoder * iDecoder; + MLoaderObserver * iObserver; +}; + + +// ICL source filter +//============================================================================= +class CFilterIclSource + : public CBase + , public MImageFilter + , public MLoaderObserver + { + +public: + + IMPORT_C static TInt Create(); + virtual ~CFilterIclSource(); + +public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + +public: // MLoaderObserver + virtual void OperationReady (const TInt aError); + +protected: + + +private: + static CFilterIclSource* NewL(); + CFilterIclSource(); + void ConstructL(); + void LoadRectL(); + +private: // Data + + enum TOutputState + { + EDirect, + EBuffer, + } iOutputState; + + TRect iRect; + TRect iScaledRect; + CFbsBitmap * iBitmap; + TInt iWStep; + CImageLoader * iLoader; + + // destination size + TSize iDestSize; + // destination buffer + TUint32 * iDestBuffer; + // relative scale + TReal iRelScale; + + TBlockEntry ** iBlockBuffer; + TSize iSize; + TSize iSizeInBlocks; + TUint32 iLastBlock; + TInt * iIndexMap; + TInt iOldestBlock; + TInt iBlockBufferSize; + TFileName iFileName; +}; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterIclSource/Src/CFilterIclSource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterIclSource/Src/CFilterIclSource.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,633 @@ +/* +* 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: +* +*/ + + +#include +#include +#include +#include +#include + +#include "CFilterIclSource.h" + +const TInt KScaleBits = 12; +const TInt KBlockSize = 16; +const TInt KDestBufferMaxDim = 352; + +//============================================================================= +EXPORT_C TInt CFilterIclSource::Create() +{ + CFilterIclSource * ptr = NULL; + TRAPD (error, ptr = NewL(); ); + if (error != KErrNone) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); +} + +//============================================================================= +CFilterIclSource* CFilterIclSource::NewL() +{ + CFilterIclSource * self = new (ELeave) CFilterIclSource(); + CleanupStack::PushL (self); + self->ConstructL(); + CleanupStack::Pop (self); + return self; +} + +//============================================================================= +CFilterIclSource::~CFilterIclSource() +{ + delete iBitmap; + delete[] iDestBuffer; + if (iLoader) + { + iLoader->Cancel(); + } + delete iLoader; + delete[] iIndexMap; + for (TInt i = 0; i < iBlockBufferSize; ++i) + { + delete iBlockBuffer[i]; + iBlockBuffer[i] = NULL; + } + delete[] iBlockBuffer; + iBlockBuffer = NULL; +} + +//============================================================================= +CFilterIclSource::CFilterIclSource() +{ + +} + +//============================================================================= +void CFilterIclSource::ConstructL() +{ + +} + +//============================================================================= +TRect CFilterIclSource::Rect() +{ + if (iOutputState == EDirect) + { + return iRect; + } + else + { + return iScaledRect; + } +} + +//============================================================================= +TReal CFilterIclSource::Scale() +{ + if (iOutputState == EDirect) + { + return 1.0; + } + else + { + return iRelScale; + } +} + +//============================================================================= +TSize CFilterIclSource::ViewPortSize() +{ + return iSize; +} + +//============================================================================= +TBlock * CFilterIclSource::GetBlockL ( const TRect & aRect ) +{ + if (iOutputState == EBuffer) + { + if ( !aRect.Intersects(iScaledRect) ) + { + return NULL; + } + TRect rect = aRect; + rect.Intersection(iScaledRect); + + TBlock * pB = new (ELeave) TBlock (rect); + + TUint32 * pS = iDestBuffer + (rect.iTl.iY - iScaledRect.iTl.iY) * iDestSize.iWidth + + (rect.iTl.iX - iScaledRect.iTl.iX); + TUint32 * pD = pB->iData; + + for (TInt i = rect.iTl.iY; i < rect.iBr.iY; ++i) + { + Mem::Copy(pD, pS, pB->iWidth * sizeof(TUint32)); + pD += pB->iWidth; + pS += iDestSize.iWidth; + } + return pB; + } + else + { + + if (!aRect.Intersects(iRect)) + { + return NULL; + } + + // Clip rectangle to image + TRect rect = aRect; + rect.Intersection(iRect); + + // Create block for pixel data + TBlock * pB = new (ELeave) TBlock; + pB->iRect = rect; + pB->iWidth = (pB->iRect.iBr.iX - pB->iRect.iTl.iX); + pB->iHeight = (pB->iRect.iBr.iY - pB->iRect.iTl.iY); + pB->iDataLength = pB->iWidth * pB->iHeight; + pB->iData = new (ELeave) TUint32 [pB->iDataLength]; + + // Store pixel data to block + TBitmapUtil bm (iBitmap); + bm.Begin(TPoint(0,0)); + + TUint8 * psos = (TUint8*)(iBitmap->DataAddress()); + psos += pB->iRect.iTl.iY * iWStep + pB->iRect.iTl.iX * 3; + TUint32 * pd = pB->iData; + for (TInt i = rect.iTl.iY; i < rect.iBr.iY; ++i) + { + + TUint8 * ps = psos; + psos += iWStep; + + for (TInt j = rect.iTl.iX; j < rect.iBr.iX; ++j) + { + TUint8 b = *ps++; + TUint8 g = *ps++; + TUint8 r = *ps++; + *pd++ = (r << 16) | (g << 8) | b; + } + } + + bm.End(); + + return pB; + } +} + +//============================================================================= +void CFilterIclSource::SetParent (MImageFilter * aParent) +{ + iParent = aParent; +} + +//============================================================================= +void CFilterIclSource::SetChild (MImageFilter * aChild) +{ + iChild = aChild; +} + +//============================================================================= +TInt CFilterIclSource::CmdL (const TDesC16 & aCmd) +{ + + TLex lex (aCmd); + + while ( !lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if (token.Compare( _L("file") ) == 0) + { + + iFileName.Zero(); + + // Find the start of the string + while (!lex.Eos()) + { + if (lex.Get() == '"') break; + } + + // Get the text data + while (!lex.Eos()) + { + TChar c= lex.Get(); + if (c == '"') + { + break; + } + else + { + iFileName.Append(c); + } + } + + if (iBitmap) + { + delete iBitmap; + iBitmap = NULL; + } + + if(iLoader) + { + delete iLoader; + iLoader = NULL; + } + + iSize.iWidth = 0; + iSize.iHeight = 0; + + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = 0; + iRect.iBr.iY = 0; + + iWStep = 0; + } + else if( token.Compare( _L("loadimage") ) == 0 ) + { + + if ( !iBitmap ) + { + // Delete old bitmap and create new + iBitmap = new (ELeave) CFbsBitmap; + + // Create new loader and start loading image + if (iLoader) + { + delete iLoader; + iLoader = NULL; + } + + iLoader = new (ELeave) CImageLoader (this); + iLoader->LoadBitmapL (iFileName, iBitmap); + + // Wait here until loading is finished + CActiveScheduler::Start(); + + // Delete loader, not needed anymore + delete iLoader; + iLoader = NULL; + + // Get image size + iSize = iBitmap->SizeInPixels(); + + // Update region of interest + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = iSize.iWidth; + iRect.iBr.iY = iSize.iHeight; + + // Compute row offset in bytes + iWStep = CFbsBitmap::ScanLineLength(iSize.iWidth, EColor16M); + + // Initialize block buffer size to 2 x row size in blocks + iBlockBufferSize = iSize.iWidth / KBlockSize; + if (iSize.iWidth % KBlockSize > 0) + { + iBlockBufferSize++; + } + iBlockBufferSize *= 2; + + // Compute image size in 16 x 16 blocks + iSizeInBlocks.iWidth = iSize.iHeight / KBlockSize; + if (iSize.iHeight % KBlockSize > 0) + { + iSizeInBlocks.iWidth++; + } + iSizeInBlocks.iHeight = iSize.iHeight / KBlockSize; + if (iSizeInBlocks.iHeight % KBlockSize > 0) + { + iSizeInBlocks.iHeight++; + } + + // Crate new block buffer, init to zero + iBlockBuffer = new (ELeave) TBlockEntry * [iBlockBufferSize]; + Mem::FillZ (iBlockBuffer, iBlockBufferSize * sizeof(TBlockEntry *)); + + // Reset oldest block index to zero + iOldestBlock = 0; + + // Create index map, init to -1 + TInt blocks = iSizeInBlocks.iWidth * iSizeInBlocks.iHeight; + delete[] iIndexMap; + iIndexMap = NULL; + iIndexMap = new (ELeave) TInt [blocks]; + for (TInt i = 0; i < blocks; ++i) iIndexMap[i] = -1; + + } + + + iOutputState = EBuffer; + + // set crop rectangle to full image size + if (iRect.Size() == TSize(0,0)) + { + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = iSize.iWidth; + iRect.iBr.iY = iSize.iHeight; + } + + // load rectangle + LoadRectL(); + } + else if( token.Compare( _L("ulc") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iTl.iX ); + } + else if( token.Compare( _L("ulr") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iTl.iY ); + } + else if( token.Compare( _L("lrc") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iBr.iX ); + } + else if( token.Compare( _L("lrr") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iBr.iY ); + } + else if( token.Compare( _L("fileoutput") ) == 0 ) + { + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = iSize.iWidth; + iRect.iBr.iY = iSize.iHeight; + iOutputState = EDirect; + } + else if( token.Compare( _L("bufferoutput") ) == 0 ) + { + iOutputState = EBuffer; + } + } + return 0; +} + +//============================================================================= +const char * CFilterIclSource::Type() +{ + return "iclsource"; +} + +//============================================================================= +void CFilterIclSource::OperationReady (const TInt /* aError */) +{ + CActiveScheduler::Stop(); +} + +//============================================================================= +void CFilterIclSource::LoadRectL() + { + + // compute destination buffer size + TInt width = iRect.iBr.iX - iRect.iTl.iX; + TInt height = iRect.iBr.iY - iRect.iTl.iY; + + if (width >= height) + { + TReal scale = (TReal)KDestBufferMaxDim / width; + iDestSize.iWidth = KDestBufferMaxDim; + iDestSize.iHeight = (TInt)(height * scale + 0.5); + } + else + { + TReal scale = (TReal)KDestBufferMaxDim / height; + iDestSize.iHeight = KDestBufferMaxDim; + iDestSize.iWidth = (TInt)(width * scale + 0.5); + } + + // create new destination buffer + delete[] iDestBuffer; + iDestBuffer = new (ELeave) TUint32 [iDestSize.iWidth * iDestSize.iHeight]; + + // scale buffer + + TBitmapUtil bmtl (iBitmap); + bmtl.Begin(TPoint(0,0)); + + TInt scale = (height << KScaleBits) / iDestSize.iHeight; + TUint32 * pD = iDestBuffer; + TUint8 * pS = (TUint8 *)iBitmap->DataAddress() + + iRect.iTl.iY * iWStep + iRect.iTl.iX * 3; + + for (TInt i = 0; i < iDestSize.iHeight; ++i) + { + TInt y = (i * scale) >> KScaleBits; + + for (TInt j = 0; j < iDestSize.iWidth; ++j) + { + TInt x = (j * scale) >> KScaleBits; + TUint8 * pSS = pS + y * iWStep + x * 3; + TUint32 c = (*(pSS + 2) << 16) | (*(pSS + 1) << 8) | *pSS; + *pD++ = c; + } + } + + bmtl.End(); + + iRelScale = (TReal)(iDestSize.iHeight) / (TReal) height; + + iScaledRect.iTl.iX = (TInt)(iRect.iTl.iX * iRelScale + 0.5); + iScaledRect.iTl.iY = (TInt)(iRect.iTl.iY * iRelScale + 0.5); + iScaledRect.iBr.iX = (TInt)(iRect.iBr.iX * iRelScale + 0.5); + iScaledRect.iBr.iY = (TInt)(iRect.iBr.iY * iRelScale + 0.5); + + // check that iScaledRect is inside buffer + TInt tmp = iScaledRect.iBr.iX - iScaledRect.iTl.iX - iDestSize.iWidth; + if ( tmp > 0 ) + { + iScaledRect.iBr.iX -= tmp; + } + + tmp = iScaledRect.iBr.iY - iScaledRect.iTl.iY - iDestSize.iHeight; + if (tmp > 0 ) + { + iScaledRect.iBr.iY -= tmp; + } + +/* + CFbsBitmap * bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + User::LeaveIfError(bitmap->Create(iDestSize, EColor16M)); + TBitmapUtil bm (bitmap); + bm.Begin(TPoint(0,0)); + TUint8 * pDOS = (TUint8 *)bitmap->DataAddress(); + TUint32 * ps = iDestBuffer; + TInt ws = CFbsBitmap::ScanLineLength(iDestSize.iWidth, EColor16M); + for (TInt ii = 0; ii < iDestSize.iHeight; ++ii) + { + TUint8 * pD = pDOS; + pDOS += ws; + for (TInt j = 0; j < iDestSize.iWidth; ++j) + { + TUint32 c = *ps++; + *pD++ = c & 0xFF; + c >>= 8; + *pD++ = c & 0xFF; + c >>= 8; + *pD++ = c & 0xFF; + } + } + bm.End(); + + TFileName filename; + filename.Copy (_L("c:\\nokia\\images\\sf_")); + filename.AppendNum((TInt)iDestBuffer); + filename.Append(_L(".mbm")); + bitmap->Save(filename); + + CleanupStack::PopAndDestroy(); // bitmap +*/ + } + + + + + + + +//============================================================================= +CImageLoader::CImageLoader(MLoaderObserver * aObserver) : +CActive (EPriorityStandard), +iObserver (aObserver) +{ + CActiveScheduler::Add (this); +} + +//============================================================================= +CImageLoader::~CImageLoader() +{ + if (iDecoder) + { + iDecoder->Cancel(); + } + delete iDecoder; +} + +//============================================================================= +void CImageLoader::LoadBitmapL (TDesC & aFileName, CFbsBitmap * iBitmap) +{ + + // Delete old decoder + if (iDecoder) + { + iDecoder->Cancel(); + } + delete iDecoder; + iDecoder = NULL; + + //Get the MIME type of the file to be decoded: + TBuf8 mimeType; + + RFs vFs; + User::LeaveIfError(vFs.Connect()); + CleanupClosePushL(vFs); + + TRAPD( getMimeErr, CImageDecoder::GetMimeTypeFileL( + vFs, + aFileName, + mimeType ) ); + if ( getMimeErr != KErrNone ) { } + + CleanupStack::PopAndDestroy(); // vFs + + // If MIME type contains "jpeg", then it would make sense to check + // for HW Codec possibility + TUid implementationUid = KNullUid; // default value that can be used + + TInt vStartIndLocation = mimeType.Find( _L8( "jpeg" ) ); + if( vStartIndLocation != KErrNotFound ) + { + RUidDataArray implArray; + const TUid properties[] = { KUidHwCodec }; + + // Request existing plugins with the desired properties + TRAPD( getIntErr, CImageDecoder::GetInterfaceImplementationsL( + properties, + 1, + implArray ) ); + + if ( implArray.Count() != 0 && getIntErr == KErrNone ) + { + // use the first HW codec from the list + implementationUid = implArray[0]; + // HW Codec found + } + } + + // if HW codec not found implementationUid == KNullUid -> + // ICL selects proper codec + TRAPD( decErr, iDecoder = CImageDecoder::FileNewL( + vFs, + aFileName, + CImageDecoder::EOptionNone, + KNullUid, + KNullUid, + implementationUid ) ); + if ( decErr != KErrNone ) + { + User::Leave( decErr ); + } + + // Create new bitmap + User::LeaveIfError ( iBitmap->Create (iDecoder->FrameInfo().iOverallSizeInPixels, EColor16M)); + + // Start decoding + iDecoder->Convert (&iStatus, *iBitmap); + + if (iStatus != KRequestPending) + { + User::Leave(iStatus.Int()); + } + + SetActive(); + +} + +//============================================================================= +void CImageLoader::RunL() +{ + if (iStatus.Int() == KRequestPending) + { + iDecoder->ContinueConvert (&iStatus); + } + else + { + iObserver->OperationReady ( iStatus.Int() ); + } +} + +//============================================================================= +void CImageLoader::DoCancel() +{ + if (iDecoder) + { + iDecoder->Cancel(); + } +} + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterIclSource/group/FilterIclSource.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterIclSource/group/FilterIclSource.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,60 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterIclSource.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterIclSource.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY imageconversion.lib +LIBRARY eikcore.lib +LIBRARY cone.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterIclSource/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterIclSource/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterIclSource.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/BWINS/FilterJpegSource.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/BWINS/FilterJpegSource.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterJpegSource@@SAHXZ @ 1 NONAME ; int CFilterJpegSource::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/EABI/FilterJpegSource.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/EABI/FilterJpegSource.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN17CFilterJpegSource6CreateEv @ 1 NONAME + _ZTI17CFilterJpegSource @ 2 NONAME ; ## + _ZTI5CJpeg @ 3 NONAME ; ## + _ZTV17CFilterJpegSource @ 4 NONAME ; ## + _ZTV5CJpeg @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/Inc/CFilterJpegSource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/Inc/CFilterJpegSource.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,108 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERJPEGSOURCE_H__ +#define __CFILTERJPEGSOURCE_H__ + +#include +#include "MImageFilter.h" +#include "TBitmapHandle.h" + + +class MJpegLoad; + +class TBlockEntry + { + public: + inline ~TBlockEntry() + { + delete iBitmap.iData; + } + public: + TRect iRect; + TBitmapHandle iBitmap; + }; + + + +class CFilterJpegSource + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterJpegSource(); + + private: + static CFilterJpegSource* NewL(); + CFilterJpegSource(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + void LoadRectL(); + + private: // Data + + enum TOutputState + { + EDirect, + EBuffer, + } iOutputState; + + /// decoder instance + MJpegLoad * iJpeg; + // file name + TFileName iFileName; + // macroblock size + TSize iBlockSize; + // image size in macroblocks + TSize iSizeInBlocks; + // image rectangle + TRect iRect; + // scaled visible image rectangle + TRect iScaledRect; + // image size + TSize iFullSize; + + // destination size + TSize iDestSize; + // destination buffer + TUint32 * iDestBuffer; + // relative scale + TReal iRelScale; + + TBlockEntry ** iBlockBuffer; + TInt iXAnd; + TInt iYAnd; + TUint32 iLastBlock; + TInt * iIndexMap; + TInt iOldestBlock; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/Inc/JpegLoadFactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/Inc/JpegLoadFactory.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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: +* +*/ + + +#ifndef __JPEGLOADFACTORY_H__ +#define __JPEGLOADFACTORY_H__ + +class MJpegLoad; + +class JpegLoadFactory + { + public: + static MJpegLoad* CreateJpegLoadL(); + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/Src/CFilterJpegSource.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/Src/CFilterJpegSource.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,532 @@ +/* +* 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: +* +*/ + + +#include +#include "CFilterJpegSource.h" +#include "JpegLoadFactory.h" +#include "MJpegLoad.h" + +const TInt KBlockBufferSize = 256; // should be enough for every picture... +const TInt KScaleBits = 12; +const TInt KDestBufferMaxDim = 352; + +//============================================================================= +EXPORT_C TInt CFilterJpegSource::Create() + { + CFilterJpegSource* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + +//============================================================================= +CFilterJpegSource* CFilterJpegSource::NewL() + { + CFilterJpegSource* self = new( ELeave )CFilterJpegSource(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//============================================================================= +CFilterJpegSource::~CFilterJpegSource() +{ + delete iJpeg; + delete iDestBuffer; + delete[] iIndexMap; + if ( iBlockBuffer ) + { + for (TInt i = 0; i < KBlockBufferSize; ++i) + { + delete iBlockBuffer[i]; + iBlockBuffer[i] = NULL; + } + } + delete[] iBlockBuffer; + iBlockBuffer = NULL; +} + +//============================================================================= +CFilterJpegSource::CFilterJpegSource() + { + + } + +//============================================================================= +void CFilterJpegSource::ConstructL() + { + + } + +//============================================================================= +TRect CFilterJpegSource::Rect() +{ + if (iOutputState == EDirect) + { + return iRect; + } + else + { + return iScaledRect; + } +} + +//============================================================================= +TReal CFilterJpegSource::Scale() +{ + if (iOutputState == EDirect) + { + return 1.0; + } + else + { + return iRelScale; + } +} + +//============================================================================= +TSize CFilterJpegSource::ViewPortSize() +{ + return iFullSize; +} + +//============================================================================= +TBlock * CFilterJpegSource::GetBlockL ( const TRect & aRect ) +{ + if (iOutputState == EBuffer) + { + if ( !aRect.Intersects(iScaledRect) ) + { + return NULL; + } + TRect rect = aRect; + rect.Intersection(iScaledRect); + + TBlock * pB = new (ELeave) TBlock (rect); + + TUint32 * pS = iDestBuffer + (rect.iTl.iY - iScaledRect.iTl.iY) * iDestSize.iWidth + + (rect.iTl.iX - iScaledRect.iTl.iX); + TUint32 * pD = pB->iData; + + for (TInt i = rect.iTl.iY; i < rect.iBr.iY; ++i) + { + Mem::Copy(pD, pS, pB->iWidth * sizeof(TUint32)); + pD += pB->iWidth; + pS += iDestSize.iWidth; + } + return pB; + } + else + { + + if (!aRect.Intersects(iRect)) + { + return NULL; + } + + // Clip rectangle to image + TRect rect = aRect; + rect.Intersection(iRect); + + // Compute region of interest in blocks + TRect blockRect = rect; + blockRect.iTl.iX /= iBlockSize.iWidth; + blockRect.iTl.iY /= iBlockSize.iHeight; + blockRect.iBr.iX /= iBlockSize.iWidth; + blockRect.iBr.iY /= iBlockSize.iHeight; + + if (blockRect.iBr.iX < iSizeInBlocks.iWidth) + { + blockRect.iBr.iX++; + } + if (blockRect.iBr.iY < iSizeInBlocks.iHeight) + { + blockRect.iBr.iY++; + } + + // Create block for pixel data + TBlock * pB = new (ELeave) TBlock; + CleanupStack::PushL(pB); + pB->iRect = blockRect; + pB->iRect.iTl.iX *= iBlockSize.iWidth; + pB->iRect.iTl.iY *= iBlockSize.iHeight; + pB->iRect.iBr.iX *= iBlockSize.iWidth; + pB->iRect.iBr.iX += iBlockSize.iWidth; + pB->iRect.iBr.iY *= iBlockSize.iHeight; + pB->iRect.iBr.iY += iBlockSize.iHeight; + pB->iWidth = (pB->iRect.iBr.iX - pB->iRect.iTl.iX); + pB->iHeight = (pB->iRect.iBr.iY - pB->iRect.iTl.iY); + pB->iDataLength = pB->iWidth * pB->iHeight; + pB->iData = new (ELeave) TUint32 [pB->iDataLength]; + + // Read all blocks in region of interest + for (TInt i = blockRect.iTl.iY; i < blockRect.iBr.iY; ++i) + { + + for (TInt j = blockRect.iTl.iX; j < blockRect.iBr.iX; ++j) + { + + // Get block index + TInt index = i * iSizeInBlocks.iWidth + j; + + // If not found, load new block, add to cache and update index table + if ( iIndexMap[index] < 0 ) + { + + // Load block + TBlockEntry * e = new (ELeave) TBlockEntry; + CleanupStack::PushL(e); + e->iRect = TRect ( TPoint (j * iBlockSize.iWidth, i * iBlockSize.iHeight), iBlockSize); + e->iBitmap = iJpeg->LoadBlockL (TPoint(j,i)); + + // Remove index of the oldest block from the map + if (iBlockBuffer [iOldestBlock]) + { + TPoint blockPos = iBlockBuffer[iOldestBlock]->iRect.iTl; + blockPos.iX /= iBlockSize.iWidth; + blockPos.iY /= iBlockSize.iHeight; + iIndexMap[blockPos.iY * iSizeInBlocks.iWidth + blockPos.iX] = -1; + + // Delete oldest block + delete iBlockBuffer [iOldestBlock]; + iBlockBuffer [iOldestBlock] = NULL; + } + + // Insert new block to buffer and update map + iBlockBuffer[iOldestBlock] = e; + iIndexMap[index] = iOldestBlock; + CleanupStack::Pop(e); + + // Update old block index + iOldestBlock++; + if (iOldestBlock >= KBlockBufferSize) iOldestBlock = 0; + + } + + // Store pixel data to block + TUint32 * pS = (TUint32*)( iBlockBuffer[ iIndexMap[index] ]->iBitmap.iData ); + TUint32 * pD = + pB->iData + + (i - blockRect.iTl.iY) * iBlockSize.iHeight * pB->iWidth + + (j - blockRect.iTl.iX) * iBlockSize.iWidth; + for (TInt ib = 0; ib < iBlockSize.iHeight; ++ib) + { + Mem::Copy (pD, pS, iBlockSize.iWidth * sizeof(TUint32)); + pS += iBlockSize.iWidth; + pD += pB->iWidth; + } + } + } + CleanupStack::Pop( pB ); + return pB; + } +} + + +//============================================================================= +void CFilterJpegSource::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + +//============================================================================= +void CFilterJpegSource::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + +//============================================================================= +TInt CFilterJpegSource::CmdL( const TDesC16& aCmd ) + { + + TLex lex( aCmd ); + + while( ! lex.Eos() ) + { + + TPtrC token = lex.NextToken(); + if( token.Compare( _L("file") ) == 0 ) + { + iFileName.Zero(); + + // Find the start of the string + while (!lex.Eos()) + { + if (lex.Get() == '"') break; + } + + // Get the text data + while (!lex.Eos()) + { + TChar c= lex.Get(); + if (c == '"') + { + break; + } + else + { + iFileName.Append(c); + } + } + } + else if( token.Compare( _L("loadimage") ) == 0 ) + { + + delete iJpeg; + iJpeg = 0; + iJpeg = JpegLoadFactory::CreateJpegLoadL(); + + // open + iJpeg->OpenL( iFileName ); + iJpeg->ScanRandomL(); + + const TJpegData & d = iJpeg->Info(); + + // set crop rectangle to full image size + if (iRect.Size() == TSize(0,0)) + { + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = d.iSize.iWidth; + iRect.iBr.iY = d.iSize.iHeight; + } + iFullSize = d.iSize; + + // set macroblock parameters + iBlockSize = d.iBlockSize; + iSizeInBlocks = d.iSizeInBlocks; + + iOutputState = EBuffer; + + if ( iBlockBuffer ) + { + for (TInt i = 0; i < KBlockBufferSize; ++i) + { + delete iBlockBuffer[i]; + iBlockBuffer[i] = NULL; + } + } + delete[] iBlockBuffer; + iBlockBuffer = NULL; + iBlockBuffer = new (ELeave) TBlockEntry * [KBlockBufferSize]; + TInt i; + for (i = 0; i < KBlockBufferSize; ++i) iBlockBuffer[i] = NULL; + + iSizeInBlocks = d.iSizeInBlocks; + TInt blocks = iSizeInBlocks.iWidth * iSizeInBlocks.iHeight; + delete[] iIndexMap; + iIndexMap = NULL; + iIndexMap = new (ELeave) TInt [blocks]; + for (i = 0; i < blocks; ++i) iIndexMap[i] = -1; + + iOldestBlock = 0; + + + // load rectangle + LoadRectL(); + } + else if( token.Compare( _L("exifdata") ) == 0 ) + { + return (TInt)(iJpeg->ExifData().Ptr()); + } + else if( token.Compare( _L("ulc") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iTl.iX ); + } + else if( token.Compare( _L("ulr") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iTl.iY ); + } + else if( token.Compare( _L("lrc") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iBr.iX ); + } + else if( token.Compare( _L("lrr") ) == 0 ) + { + lex.Inc(); + lex.Val( iRect.iBr.iY ); + } + else if( token.Compare( _L("fileoutput") ) == 0 ) + { + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = iFullSize.iWidth; + iRect.iBr.iY = iFullSize.iHeight; + iOutputState = EDirect; + } + else if( token.Compare( _L("bufferoutput") ) == 0 ) + { + iOutputState = EBuffer; + } + else if( token.Compare( _L("exiflength") ) == 0 ) + { + return iJpeg->ExifData().Length(); + } + } + return 0; + } + +//============================================================================= +const char* CFilterJpegSource::Type() + { + return "jpegsource"; + } + +//============================================================================= +void CFilterJpegSource::LoadRectL() + { + + // compute destination buffer size + TInt width = iRect.iBr.iX - iRect.iTl.iX; + TInt height = iRect.iBr.iY - iRect.iTl.iY; + + if (width >= height) + { + TReal scale = (TReal)KDestBufferMaxDim / width; + iDestSize.iWidth = KDestBufferMaxDim; + iDestSize.iHeight = (TInt)(height * scale + 0.5); + } + else + { + TReal scale = (TReal)KDestBufferMaxDim / height; + iDestSize.iHeight = KDestBufferMaxDim; + iDestSize.iWidth = (TInt)(width * scale + 0.5); + } + + // create new destination buffer + delete[] iDestBuffer; + iDestBuffer = new (ELeave) TUint32 [iDestSize.iWidth * iDestSize.iHeight]; + + // compute scale + TJpegScale scale = EScale1; + while ((width /= 2) > iDestSize.iWidth) + { + if (scale == EScale1) + { + scale= EScale2; + } + else if (scale == EScale2) + { + scale= EScale4; + } + else if (scale == EScale4) + { + scale= EScale8; + } + } + + // load scaled rectangle + TBitmapHandle loadbitmap; + TRect loadrect = iRect; + iJpeg->SetScale(scale); + loadbitmap = iJpeg->LoadImageL(loadrect); + + // scale buffer + TInt sc = (TInt) ((TReal)(height << KScaleBits) / iDestSize.iHeight + 0.5); + TInt ws = (loadrect.iBr.iX - loadrect.iTl.iX) >> (TInt)scale; + + TUint32 * pD = iDestBuffer; + TUint32 * pS = (TUint32 *)loadbitmap.iData + + ((iRect.iTl.iY - loadrect.iTl.iY) >> (TInt)scale) * ws + + ((iRect.iTl.iX - loadrect.iTl.iX) >> (TInt)scale); + + for (TInt i = 0; i < iDestSize.iHeight; ++i) + { + TInt y = (i * sc) >> KScaleBits; + y >>= (TInt)scale; + for (TInt j = 0; j < iDestSize.iWidth; ++j) + { + TInt x = (j * sc) >> KScaleBits; + x >>= (TInt)scale; + *pD++ = *(pS + y * ws + x); + } + } + + delete loadbitmap.iData; + + iRelScale = (TReal)(iDestSize.iHeight) / (TReal)height; + + iScaledRect.iTl.iX = (TInt)(iRelScale * iRect.iTl.iX + 0.5); + iScaledRect.iTl.iY = (TInt)(iRelScale * iRect.iTl.iY + 0.5); + iScaledRect.iBr.iX = (TInt)(iRelScale * iRect.iBr.iX + 0.5); + iScaledRect.iBr.iY = (TInt)(iRelScale * iRect.iBr.iY + 0.5); + + // check that iScaledRect is inside buffer + TInt tmp = iScaledRect.iBr.iX - iScaledRect.iTl.iX - iDestSize.iWidth; + if ( tmp > 0 ) + { + iScaledRect.iBr.iX -= tmp; + } + + tmp = iScaledRect.iBr.iY - iScaledRect.iTl.iY - iDestSize.iHeight; + if (tmp > 0 ) + { + iScaledRect.iBr.iY -= tmp; + } + + +// CFbsBitmap * bitmap = new (ELeave) CFbsBitmap; +// CleanupStack::PushL(bitmap); +// User::LeaveIfError(bitmap->Create(iDestSize, EColor16M)); +// TBitmapUtil bm (bitmap); +// bm.Begin(TPoint(0,0)); +// TUint8 * pDOS = (TUint8 *)bitmap->DataAddress(); +// pS = iDestBuffer; +// ws = CFbsBitmap::ScanLineLength(iDestSize.iWidth, EColor16M); +// for (TInt ii = 0; ii < iDestSize.iHeight; ++ii) +// { +// TUint8 * pD = pDOS; +// pDOS += ws; +// for (TInt j = 0; j < iDestSize.iWidth; ++j) +// { +// TUint32 c = *pS++; +// *pD++ = c & 0xFF; +// c >>= 8; +// *pD++ = c & 0xFF; +// c >>= 8; +// *pD++ = c & 0xFF; +// } +// } +// bm.End(); +// TFileName filename; +// filename.Copy (_L("c:\\nokia\\images\\sf_")); +// filename.AppendNum((TInt)iDestBuffer); +// filename.Append(_L(".mbm")); +// bitmap->Save(filename); +// +// CleanupStack::PopAndDestroy(); // bitmap + + + } + + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/Src/JpegLoadFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/Src/JpegLoadFactory.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,28 @@ +/* +* 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: +* +*/ + + +#include "JpegLoadFactory.h" +#include "CJpeg.h" + +MJpegLoad* JpegLoadFactory::CreateJpegLoadL() + { + return CJpeg::NewL(); + } + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/group/FilterJpegSource.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/group/FilterJpegSource.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,65 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterJpegSource.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterJpegSource.cpp +SOURCE JpegLoadFactory.cpp + +SOURCEPATH ../../../Src +SOURCE CJpeg.cpp + + + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +EXPORTUNFROZEN + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegSource/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegSource/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterJpegSource.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegTarget/BWINS/FilterJpegTarget.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegTarget/BWINS/FilterJpegTarget.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterJpegTarget@@SAHXZ @ 1 NONAME ; int CFilterJpegTarget::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegTarget/EABI/FilterJpegTarget.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegTarget/EABI/FilterJpegTarget.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,7 @@ +EXPORTS + _ZN17CFilterJpegTarget6CreateEv @ 1 NONAME + _ZTI17CFilterJpegTarget @ 2 NONAME ; ## + _ZTI9CJpegSave @ 3 NONAME ; ## + _ZTV17CFilterJpegTarget @ 4 NONAME ; ## + _ZTV9CJpegSave @ 5 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegTarget/Inc/CFilterJpegTarget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegTarget/Inc/CFilterJpegTarget.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,71 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERJPEGTARGET_H__ +#define __CFILTERJPEGTARGET_H__ + +#include +#include "MImageFilter.h" +#include "TBitmapHandle.h" + +class MJpegSave; + +class CFilterJpegTarget + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterJpegTarget(); + + private: + static CFilterJpegTarget* NewL(); + CFilterJpegTarget(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + + TRect iRect; + TSize iSize; + + MJpegSave* iJpegSave; + + TBitmapHandle iBm; + TInt iBlockWidth; + TInt iBlockHeight; + TInt iBlockY; + TFileName iFileName; + + RFs iFs; + RFile iFile; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegTarget/Src/CFilterJpegTarget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegTarget/Src/CFilterJpegTarget.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,310 @@ +/* +* 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: +* +*/ + + +#include +#include "CFilterJpegTarget.h" +#include "MJpegSave.h" +#include "JpegSaveFactory.h" + +const TInt KSaveBufferLength = 0x40000; // 256 kilobytes + +EXPORT_C TInt CFilterJpegTarget::Create() + { + CFilterJpegTarget* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterJpegTarget* CFilterJpegTarget::NewL() + { + CFilterJpegTarget* self = new( ELeave )CFilterJpegTarget(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterJpegTarget::~CFilterJpegTarget() + { + delete iJpegSave; + iFile.Close(); + iFs.Close(); + } + + + +CFilterJpegTarget::CFilterJpegTarget() + { + } + + + +void CFilterJpegTarget::ConstructL() + { + User::LeaveIfError( iFs.Connect() ); + } + + + +TRect CFilterJpegTarget::Rect() + { + TRect rect; + + rect.iTl.iX = 0; + rect.iTl.iY = 0; + rect.iBr.iX = iSize.iWidth; + rect.iBr.iY = iSize.iHeight; + + return rect; + } + +TReal CFilterJpegTarget::Scale() + { + return iChild->Scale(); + } + +TSize CFilterJpegTarget::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterJpegTarget::GetBlockL ( const TRect & /*aRect*/ ) +{ + return NULL; +} + +void CFilterJpegTarget::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterJpegTarget::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterJpegTarget::CmdL( const TDesC16& aCmd ) + { + + TInt exifData = 0; + TInt exifLength = 0; + + TLex lex( aCmd ); + while( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("width") ) == 0 ) + { + lex.Inc(); + lex.Val( iSize.iWidth ); + } + else if( token.Compare( _L("height") ) == 0 ) + { + lex.Inc(); + lex.Val( iSize.iHeight ); + } + else if( token.Compare( _L("exifdata") ) == 0 ) + { + lex.Inc(); + lex.Val( exifData ); + } + else if( token.Compare( _L("exiflen") ) == 0 ) + { + lex.Inc(); + lex.Val( exifLength ); + } + else if( token.Compare( _L("file") ) == 0 ) + { + // + // Starts saving, gets filename in parenthesis: file "file.jpg" + // !! lexer cuts with space in filename + // + + if ( iSize.iWidth == 0 || iSize.iHeight == 0 ) + { + iRect = iChild->Rect(); + iSize.iWidth = iRect.iBr.iX - iRect.iTl.iX; + iSize.iHeight = iRect.iBr.iY - iRect.iTl.iY; + } + else + { + iRect.iTl.iX = 0; + iRect.iTl.iY = 0; + iRect.iBr.iX = iSize.iWidth; + iRect.iBr.iY = iSize.iHeight; + } + + TPtrC filec = lex.NextToken(); + TPtrC file( filec.Ptr()+1, filec.Length()-2 ); + iFileName.Copy( file ); + iFile.Replace( iFs, iFileName, EFileWrite | EFileShareAny ); + + iJpegSave = JpegSaveFactory::CreateJpegSaveL( &iFs, &iFile ); + + TPtr8 exifPtr( (TUint8*)exifData, exifLength ); + exifPtr.SetLength( exifLength ); + + iJpegSave->StartSaveL( iSize, exifPtr, KSaveBufferLength, 90 ); + + iBm.iData = new( ELeave )TUint32[ 128 ]; + iBm.iSize = TSize (16,8); + iBm.iDrawRect = iBm.iSize; + iBm.iType = E16MColor; + + + iBlockWidth = 16; + iBlockHeight = 8; + iBlockY = 0; + } + else if( token.Compare( _L("store") ) == 0 ) + { + + TInt height = iRect.iBr.iY - iRect.iTl.iY; + TInt progress = (iBlockY * 100) / height; + if( iBlockY >= height) + { + iJpegSave->FinalizeSave(); + delete iBm.iData; + progress = 100; + iFile.Close(); + } + else + { + TPoint tl (iRect.iTl.iX, iBlockY + iRect.iTl.iY); + TPoint br = tl + TPoint (iBlockWidth, iBlockHeight); + + while ( tl.iX < iRect.iBr.iX ) + { + // Get block + TBlock * pB = iChild->GetBlockL ( TRect(tl, br) ); + + if (pB) + { + TUint32 * ps = + pB->iData + + (tl.iY - pB->iRect.iTl.iY) * pB->iWidth + + (tl.iX - pB->iRect.iTl.iX); + TUint32 * pd = (TUint32*)iBm.iData; + TInt datalength = iBlockWidth * sizeof(TUint32); + for (TInt i = 0; i < iBlockHeight; ++i) + { + Mem::Copy (pd, ps, datalength); + ps += pB->iWidth; + pd += iBlockWidth; + } + + delete pB; + pB = NULL; + + } + else + { + Mem::FillZ ((TUint8 *)iBm.iData, iBlockWidth * iBlockHeight * sizeof(TUint32)); + } +/* + CFbsBitmap * bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL(bitmap); + TSize blocksize (iBm.iSize); + User::LeaveIfError(bitmap->Create(blocksize, EColor16M)); + TBitmapUtil bm (bitmap); + bm.Begin(TPoint(0,0)); + TUint8 * pDOS = (TUint8 *)bitmap->DataAddress(); + TUint32 * pS = (TUint32 *)iBm.iData; + TInt ws = CFbsBitmap::ScanLineLength(blocksize.iWidth, EColor16M); + for (TInt ii = 0; ii < blocksize.iHeight; ++ii) + { + TUint8 * pD = pDOS; + pDOS += ws; + for (TInt j = 0; j < blocksize.iWidth; ++j) + { + TUint32 c = *pS++; + *pD++ = c & 0xFF; + c >>= 8; + *pD++ = c & 0xFF; + c >>= 8; + *pD++ = c & 0xFF; + } + } + bm.End(); + TFileName filename; + filename.Copy (_L("c:\\nokia\\images\\sf_")); + filename.AppendNum(tl.iY); + filename.Append(_L("_")); + filename.AppendNum(tl.iX); + filename.Append(_L(".mbm")); + bitmap->Save(filename); + + CleanupStack::PopAndDestroy(); // bitmap +*/ + + iJpegSave->SaveBlock( iBm ); + + + tl.iX += iBlockWidth; + br.iX += iBlockWidth; + + } + iBlockY += iBlockHeight; + + } + return progress; + } + + else if( token.Compare( _L("abort") ) == 0 ) + { + if (iBm.iData) + { + delete iBm.iData; + iBm.iData = NULL; + } + + iFile.Close(); + } + } + + return 0; + } + + + +const char* CFilterJpegTarget::Type() + { + return "jpegtarget"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegTarget/group/FilterJpegTarget.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegTarget/group/FilterJpegTarget.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,61 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterJpegTarget.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterJpegTarget.cpp + +SOURCEPATH ../../../Src +SOURCE CJpegSave.cpp +SOURCE JpegSaveFactory.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterJpegTarget/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterJpegTarget/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterJpegTarget.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterNegate/BWINS/FilterNegate.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterNegate/BWINS/FilterNegate.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterNegate@@SAHXZ @ 1 NONAME ; int CFilterNegate::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterNegate/EABI/FilterNegate.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterNegate/EABI/FilterNegate.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN13CFilterNegate6CreateEv @ 1 NONAME + _ZTI13CFilterNegate @ 2 NONAME ; ## + _ZTV13CFilterNegate @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterNegate/Inc/CFilterNegate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterNegate/Inc/CFilterNegate.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,53 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERNEGATE_H__ +#define __CFILTERNEGATE_H__ + +#include +#include "MImageFilter.h" + +class CFilterNegate + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterNegate(); + + private: + static CFilterNegate* NewL(); + CFilterNegate(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterNegate/Src/CFilterNegate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterNegate/Src/CFilterNegate.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,129 @@ +/* +* 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: +* +*/ + + +#include "CFilterNegate.h" + + + +EXPORT_C TInt CFilterNegate::Create() + { + CFilterNegate* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterNegate* CFilterNegate::NewL() + { + CFilterNegate* self = new( ELeave )CFilterNegate(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterNegate::~CFilterNegate() + { + } + + + +CFilterNegate::CFilterNegate() + { + + } + + + +void CFilterNegate::ConstructL() + { + + } + + + +TRect CFilterNegate::Rect() + { + return iChild->Rect(); + } + +TReal CFilterNegate::Scale() + { + return iChild->Scale(); + } + +TSize CFilterNegate::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + + +TBlock * CFilterNegate::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + for (TInt i = 0; i < pB->iDataLength; ++i) + { + pB->iData[i] ^= 0xFFFFFF; + } + return pB; +} + + +void CFilterNegate::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterNegate::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterNegate::CmdL( const TDesC16& /*aCmd*/ ) + { + return 0; + } + + + +const char* CFilterNegate::Type() + { + return "negate"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterNegate/group/FilterNegate.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterNegate/group/FilterNegate.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterNegate.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterNegate.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterNegate/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterNegate/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterNegate.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRedEye/BWINS/FilterRedEye.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRedEye/BWINS/FilterRedEye.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterRedEye@@SAHXZ @ 1 NONAME ; int CFilterRedEye::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRedEye/EABI/FilterRedEye.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRedEye/EABI/FilterRedEye.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN13CFilterRedEye6CreateEv @ 1 NONAME + _ZTI13CFilterRedEye @ 2 NONAME ; ## + _ZTV13CFilterRedEye @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRedEye/Inc/CFilterRedEye.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRedEye/Inc/CFilterRedEye.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterRedEye_H__ +#define __CFilterRedEye_H__ + +#include +#include "MImageFilter.h" + +class CFilterRedEye + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterRedEye(); + + private: + static CFilterRedEye* NewL(); + CFilterRedEye(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + TUint8 Hue ( TUint32 aPixel ) const; + TUint8 Saturation ( TUint32 aPixel ) const; + + + TRect iRedEyeRect; + TRect iRedEyeRectSc; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRedEye/Src/CFilterRedEye.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRedEye/Src/CFilterRedEye.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,306 @@ +/* +* 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: +* +*/ + + +#include "CFilterRedEye.h" + + +const TInt KHueRedLimitLow = 15; +const TInt KHueRedLimitHigh = 245; +const TInt KSatLimitLow = 80; + +//============================================================================= +EXPORT_C TInt CFilterRedEye::Create() + { + CFilterRedEye * ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + +//============================================================================= +CFilterRedEye* CFilterRedEye::NewL() + { + CFilterRedEye* self = new( ELeave )CFilterRedEye(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +//============================================================================= +CFilterRedEye::~CFilterRedEye() + { + } + + +//============================================================================= +CFilterRedEye::CFilterRedEye() + { + + } + +//============================================================================= +void CFilterRedEye::ConstructL() + { + + } + +//============================================================================= +TRect CFilterRedEye::Rect() + { + return iChild->Rect(); + } + +//============================================================================= +TReal CFilterRedEye::Scale() + { + return iChild->Scale(); + } + +//============================================================================= +TSize CFilterRedEye::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +//============================================================================= +TBlock * CFilterRedEye::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL(aRect); + if (!pB) return NULL; + if ( iRedEyeRectSc.Intersects (aRect) ) + { + TUint32 * pD = pB->iData; + TInt column = 0; + TInt rows = 0; + for (TInt i = 0; i < pB->iDataLength; ++i, ++pD) + { + TUint8 hue = Hue (*pD); + TUint8 sat = Saturation (*pD); + if ( ((hue < KHueRedLimitLow) || (hue > KHueRedLimitHigh)) && (sat > KSatLimitLow) ) + { + // Check if the pixel is inside the intersection of + // the requested block and the red eye rect + if (aRect.iTl.iX + column >= iRedEyeRectSc.iTl.iX && + aRect.iTl.iY + rows >= iRedEyeRectSc.iTl.iY && + aRect.iTl.iX + column < iRedEyeRectSc.iBr.iX && + aRect.iTl.iY + rows < iRedEyeRectSc.iBr.iY) + { + // Check if the pixel is inside the cirle that fits + // into the red eye rect (assuming it is square). + TInt r = static_cast ( (TReal)(iRedEyeRectSc.iBr.iX - iRedEyeRectSc.iTl.iX) / 2 + 0.5); + TInt a = (iRedEyeRectSc.iTl.iX + r) - (aRect.iTl.iX + column); + TInt b = (iRedEyeRectSc.iTl.iY + r) - (aRect.iTl.iY + rows); + if ( (a*a + b*b) <= r*r ) + { + TUint32 c = *pD; + TUint8 cb = (TUint8)(c & 0xFF); + c >>= 8; + TUint8 cg = (TUint8)(c & 0xFF); + c >>= 8; + TUint8 cr = (TUint8)(c & 0xFF); + TUint8 y = (TUint8)((306 * cr + 587 * cg + 117 * cb) >> 10); + *pD = (y | (y << 8) | (y << 16)); + } + } + } + + ++column; + if (column >= pB->iWidth) + { + column = 0; + ++rows; + } + } + } + return pB; +} + + +//============================================================================= +void CFilterRedEye::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + +//============================================================================= +void CFilterRedEye::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + +//============================================================================= +TInt CFilterRedEye::CmdL( const TDesC16& aCmd ) + { + + TLex lex (aCmd); + + while ( !lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("ulc") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc(); + lex.Val( param ); + iRedEyeRect.iTl.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("ulr") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc(); + lex.Val( param ); + iRedEyeRect.iTl.iY = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("lrc") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc(); + lex.Val( param ); + iRedEyeRect.iBr.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("lrr") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc(); + lex.Val( param ); + iRedEyeRect.iBr.iY = (TInt)((param / relscale) + 0.5); + } + } + + TReal relscale = iChild->Scale(); + iRedEyeRectSc.iTl.iX = (TInt)(iRedEyeRect.iTl.iX * relscale + 0.5); + iRedEyeRectSc.iTl.iY = (TInt)(iRedEyeRect.iTl.iY * relscale + 0.5); + iRedEyeRectSc.iBr.iX = (TInt)(iRedEyeRect.iBr.iX * relscale + 0.5); + iRedEyeRectSc.iBr.iY = (TInt)(iRedEyeRect.iBr.iY * relscale + 0.5); + + return 0; + + } + +//============================================================================= +const char* CFilterRedEye::Type() + { + return "negate"; + } + +//============================================================================= +TUint8 CFilterRedEye::Hue ( TUint32 aPixel ) const +{ + + TUint8 g = (TUint8)(aPixel & 0xFF); + aPixel >>= 8; + TUint8 b = (TUint8)(aPixel & 0xFF); + aPixel >>= 8; + TUint8 r = (TUint8)(aPixel & 0xFF); + + const TInt t1 = (1 << 10); + const TInt t3 = (3 << 10); + const TInt t5 = (5 << 10); + const TInt t6 = (6 << 10); + + TInt h = 0; + TInt v = ( r > g ) ? ( (r > b) ? (r) : (b) ) : ( (g > b) ? (g) : (b) ); + TInt m = ( r < g ) ? ( (r < b) ? (r) : (b) ) : ( (g < b) ? (g) : (b) ); + + if (v != m) + { + + TInt vm = v - m; + + if (r == v) + { + TInt g2 = ((v - g) << 10) / vm; + TInt b2 = ((v - b) << 10) / vm; + h = (g == m) ? (t5 + b2) : (t1 - g2); + } + + else if (g == v) + { + TInt r2 = ((v - r) << 10) / vm; + TInt b2 = ((v - b) << 10) / vm; + h = (b == m) ? (t1 + r2) : (t3 - b2); + } + + else + { + TInt r2 = ((v - r) << 10) / vm; + TInt g2 = ((v - g) << 10) / vm; + h = (r == m) ? (t3 + g2) : (t5 - r2); + } + + h *= 255; + h /= t6; + } + + return (TUint8)h; +} + +//============================================================================= +TUint8 CFilterRedEye::Saturation ( TUint32 aPixel ) const +{ + TUint8 g = (TUint8)(aPixel & 0xFF); + aPixel >>= 8; + TUint8 b = (TUint8)(aPixel & 0xFF); + aPixel >>= 8; + TUint8 r = (TUint8)(aPixel & 0xFF); + + TInt v = ( r > g ) ? ( (r > b) ? (r) : (b) ) : ( (g > b) ? (g) : (b) ); + TInt m = ( r < g ) ? ( (r < b) ? (r) : (b) ) : ( (g < b) ? (g) : (b) ); + TInt l = ((m + v) >> 1); + TInt s = 0; + + if (l > 0) + { + s = v - m; + + if (s > 0) { + + s *= 255; + + if (l <= 127) + { + s /= (v + m); + } + else + { + s /= (512 - v - m); + } + } + } + else { + s = 0; + } + return (TUint8)s; +} + +//============================================================================= +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRedEye/group/FilterRedEye.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRedEye/group/FilterRedEye.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterRedEye.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterRedEye.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRedEye/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRedEye/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterRedEye.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRotate/BWINS/FilterRotate.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRotate/BWINS/FilterRotate.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterRotate@@SAHXZ @ 1 NONAME ; int CFilterRotate::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRotate/EABI/FilterRotate.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRotate/EABI/FilterRotate.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN13CFilterRotate6CreateEv @ 1 NONAME + _ZTI13CFilterRotate @ 2 NONAME ; ## + _ZTV13CFilterRotate @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRotate/Inc/CFilterRotate.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRotate/Inc/CFilterRotate.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,64 @@ +/* +* 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: +* +*/ + + +#ifndef CFILTERROTATE_H +#define CFILTERROTATE_H + +#include +#include "MImageFilter.h" + +class CFilterRotate + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterRotate(); + + private: + static CFilterRotate* NewL(); + CFilterRotate(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + enum TRotation + { + ERotationMin = 0, // invalid + ERotation0, + ERotation90, + ERotation180, + ERotation270, + ERotationMax // invalid + } iRotation; + + TSize iVpSize; + }; + +#endif // CFILTERROTATE_H diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRotate/Src/CFilterRotate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRotate/Src/CFilterRotate.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,331 @@ +/* +* 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: +* +*/ + + +#include +#include +#include "CFilterRotate.h" + + +EXPORT_C TInt CFilterRotate::Create() + { + CFilterRotate* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterRotate* CFilterRotate::NewL() + { + CFilterRotate* self = new( ELeave )CFilterRotate(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterRotate::~CFilterRotate() + { + } + + + +CFilterRotate::CFilterRotate() + { + + } + + + +void CFilterRotate::ConstructL() + { + + } + + + +TRect CFilterRotate::Rect() +{ + if ( (ERotation90 == iRotation) || (ERotation270 == iRotation)) + { + TRect r = iChild->Rect(); + // swap x and y coordinates + r.iTl.iX ^= r.iTl.iY; + r.iTl.iY ^= r.iTl.iX; + r.iTl.iX ^= r.iTl.iY; + + r.iBr.iX ^= r.iBr.iY; + r.iBr.iY ^= r.iBr.iX; + r.iBr.iX ^= r.iBr.iY; + + return r; + } + else + { + return iChild->Rect(); + } +} + +TReal CFilterRotate::Scale() +{ + return iChild->Scale(); +} + +TSize CFilterRotate::ViewPortSize() +{ + TSize size = iChild->ViewPortSize(); + + if ( (ERotation90 == iRotation) || (ERotation270 == iRotation)) + { + size.iWidth ^= size.iHeight; + size.iHeight ^= size.iWidth; + size.iWidth ^= size.iHeight; + return size; + } + else + { + return size; + } +} + +TBlock * CFilterRotate::GetBlockL ( const TRect & aRect ) +{ + + + if (iRotation == ERotation90) + { + + TRect cr = iChild->Rect(); + + // Load block + TRect rr; + rr.iTl.iX = aRect.iTl.iY; + rr.iTl.iY = cr.iTl.iY + cr.iBr.iY - aRect.iBr.iX; + rr.iBr.iX = aRect.iBr.iY; + rr.iBr.iY = cr.iTl.iY + cr.iBr.iY - aRect.iTl.iX; + TBlock * pS = iChild->GetBlockL(rr); + if (!pS) + { + return NULL; + } + + // Create new block + rr.iTl.iX = cr.iTl.iY + cr.iBr.iY - pS->iRect.iBr.iY; + rr.iTl.iY = pS->iRect.iTl.iX; + rr.iBr.iX = cr.iTl.iY + cr.iBr.iY - pS->iRect.iTl.iY; + rr.iBr.iY = pS->iRect.iBr.iX; + TBlock * pD = new (ELeave) TBlock (rr); + + // Rotate data to new block + TUint32 * ps = pS->iData; + TUint32 * pddos = pD->iData + pD->iWidth - 1; + for (TInt i = 0; i < pS->iHeight; ++i) + { + TUint32 * pdd = pddos; + pddos--; + for (TInt j = 0; j < pS->iWidth; ++j) + { + *pdd = *ps++; + pdd += pD->iWidth; + } + } + delete pS; + pS = NULL; + + return pD; + + } + else if (iRotation == ERotation180) + { + TRect cr = iChild->Rect(); + TRect rr; + rr.iTl.iX = cr.iTl.iX + cr.iBr.iX - aRect.iBr.iX; + rr.iTl.iY = cr.iTl.iY + cr.iBr.iY - aRect.iBr.iY; + rr.iBr.iX = cr.iTl.iX + cr.iBr.iX - aRect.iTl.iX; + rr.iBr.iY = cr.iTl.iY + cr.iBr.iY - aRect.iTl.iY; + + // Load block + TBlock * pS = iChild->GetBlockL(rr); + + if (!pS) + { + return NULL; + } + + // Create new block + rr.iTl.iX = cr.iTl.iX + cr.iBr.iX - pS->iRect.iBr.iX; + rr.iTl.iY = cr.iTl.iY + cr.iBr.iY - pS->iRect.iBr.iY; + rr.iBr.iX = cr.iTl.iX + cr.iBr.iX - pS->iRect.iTl.iX; + rr.iBr.iY = cr.iTl.iY + cr.iBr.iY - pS->iRect.iTl.iY; + TBlock * pD = new (ELeave) TBlock (rr); + + // Rotate data to new block + TUint32 * ps = pS->iData; + TUint32 * pd = pD->iData + pD->iDataLength - 1; + for (TInt i = 0; i < pS->iDataLength; ++i) + { + *pd-- = *ps++; + } + delete pS; + pS = NULL; + + return pD; + } + else if (iRotation == ERotation270) + { + TRect cr = iChild->Rect(); + + // Load block + TRect rr; + rr.iTl.iX = cr.iTl.iX + cr.iBr.iX - aRect.iBr.iY; + rr.iTl.iY = aRect.iTl.iX; + rr.iBr.iX = cr.iTl.iX + cr.iBr.iX - aRect.iTl.iY; + rr.iBr.iY = aRect.iBr.iX; + TBlock * pS = iChild->GetBlockL(rr); + if (!pS) + { + return NULL; + } + + // Create new block + rr.iTl.iX = pS->iRect.iTl.iY; + rr.iTl.iY = cr.iTl.iX + cr.iBr.iX - pS->iRect.iBr.iX; + rr.iBr.iX = pS->iRect.iBr.iY; + rr.iBr.iY = cr.iTl.iX + cr.iBr.iX - pS->iRect.iTl.iX; + TBlock * pD = new (ELeave) TBlock (rr); + + // Rotate data to new block + TUint32 * ps = pS->iData; + TUint32 * pddos = pD->iData + (pD->iHeight - 1) * pD->iWidth; + for (TInt i = 0; i < pS->iHeight; ++i) + { + TUint32 * pdd = pddos; + pddos++; + for (TInt j = 0; j < pS->iWidth; ++j) + { + *pdd = *ps++; + pdd -= pD->iWidth; + } + } + delete pS; + pS = NULL; + + return pD; + } + else + { + return iChild->GetBlockL (aRect); + } +} + + +void CFilterRotate::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + +void CFilterRotate::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterRotate::CmdL( const TDesC16& aCmd ) +{ + + TLex lex (aCmd); + + // Get rotation parameter + while ( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if ( token.Compare( _L("angle") ) == 0) + { + TInt angle = 0; + lex.Inc(); + lex.Val (angle); + if (angle == 0) + { + iRotation = ERotation0; + } + else if (angle == 90 || angle == -270) + { + iRotation = ERotation90; + } + else if (angle == 180 || angle == -180) + { + iRotation = ERotation180; + } + else if (angle == 270 || angle == -90) + { + iRotation = ERotation270; + } + else + { + iRotation = ERotationMin; + } + } + else if ( token.Compare( _L("rotateccw") ) == 0) + { + iRotation = ERotation270; + } + else if ( token.Compare( _L("rotatecw") ) == 0) + { + iRotation = ERotation90; + } + else if ( token.Compare( _L("getangle") ) == 0) + { + TInt angle = 0; + if (iRotation == ERotation90) + { + angle = 90; + } + else if (iRotation == ERotation180) + { + angle = 180; + } + else if (iRotation == ERotation270) + { + angle = 270; + } + return angle; + } + } + return 0; +} + +const char* CFilterRotate::Type() + { + return "rotate"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRotate/group/FilterRotate.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRotate/group/FilterRotate.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,58 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterRotate.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterRotate.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterRotate/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterRotate/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterRotate.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterScale/BWINS/FilterScale.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterScale/BWINS/FilterScale.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterScale@@SAHXZ @ 1 NONAME ; int CFilterScale::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterScale/EABI/FilterScale.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterScale/EABI/FilterScale.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN12CFilterScale6CreateEv @ 1 NONAME + _ZTI12CFilterScale @ 2 NONAME ; ## + _ZTV12CFilterScale @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterScale/Inc/CFilterScale.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterScale/Inc/CFilterScale.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,61 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterScale_H__ +#define __CFilterScale_H__ + +#include +#include "MImageFilter.h" +#include + +class CFilterScale + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterScale(); + + private: + static CFilterScale* NewL(); + CFilterScale(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + TPoint iPosition; + TInt iZoom; + TInt iScale; + TPoint iOrigo; + TRect iRect; + TReal iRelScale; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterScale/Src/CFilterScale.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterScale/Src/CFilterScale.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,242 @@ +/* +* 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: +* +*/ + + +#include "CFilterScale.h" +#include + +const TInt KScaleBits = 12; + +EXPORT_C TInt CFilterScale::Create() + { + CFilterScale* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterScale* CFilterScale::NewL() + { + CFilterScale* self = new( ELeave )CFilterScale(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterScale::~CFilterScale() + { + } + + + +CFilterScale::CFilterScale() + { + iScale = (1 << KScaleBits); + iRelScale = 1.0; + } + + + +void CFilterScale::ConstructL() + { + + } + + + +TRect CFilterScale::Rect() + { + if ( iRect == TRect(0,0,0,0) ) + { + return iChild->Rect(); + } + else + { + return iRect; + } + } + +TReal CFilterScale::Scale() + { + return iRelScale; + } + + +TSize CFilterScale::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + +TBlock * CFilterScale::GetBlockL ( const TRect & aRect ) +{ + // Get the block to be scaled + TRect rect; + rect.iTl.iX = iOrigo.iX + (((aRect.iTl.iX * iScale) >> KScaleBits)); + rect.iTl.iY = iOrigo.iY + (((aRect.iTl.iY * iScale) >> KScaleBits)); + rect.iBr.iX = iOrigo.iX + (((aRect.iBr.iX * iScale) >> KScaleBits)) + 1; + rect.iBr.iY = iOrigo.iY + (((aRect.iBr.iY * iScale) >> KScaleBits)) + 1; + + TBlock * pSource = iChild->GetBlockL(rect); + if (!pSource) return NULL; + + // Create the scaled block + TBlock * pDest = new (ELeave) TBlock (aRect); + TUint32 * pD = pDest->iData; + + rect = iChild->Rect(); + + for (TInt i = aRect.iTl.iY; i < aRect.iBr.iY; ++i) + { + + TInt y = iOrigo.iY + ((i * iScale) >> KScaleBits); + if ((y < rect.iTl.iY) || (y >= rect.iBr.iY)) + { + pD += pDest->iWidth; + continue; + } + + for (TInt j = aRect.iTl.iX; j < aRect.iBr.iX; ++j, ++pD) + { + + TInt x = iOrigo.iX + ((j * iScale) >> KScaleBits); + if ((x < rect.iTl.iX) || (x >= rect.iBr.iX)) + { + continue; + } + + if ( (x >= pSource->iRect.iTl.iX) && (x < pSource->iRect.iBr.iX) && + (y >= pSource->iRect.iTl.iY) && (y < pSource->iRect.iBr.iY) ) + { + *pD = *(pSource->iData + (y - pSource->iRect.iTl.iY) * pSource->iWidth + (x - pSource->iRect.iTl.iX)); + } + } + } + + delete pSource; + pSource = NULL; + + // Return scaled block + return pDest; +} + + + +void CFilterScale::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + +void CFilterScale::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterScale::CmdL( const TDesC16& aCmd ) + { + + TLex lex( aCmd ); + + while( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("zoom") ) == 0 ) + { + lex.Inc(); + lex.Val( iZoom ); + } + else if( token.Compare( _L("x") ) == 0 ) + { + lex.Inc(); + lex.Val( iPosition.iX ); + } + else if( token.Compare( _L("y") ) == 0 ) + { + lex.Inc(); + lex.Val( iPosition.iY ); + } + } + + // Get source and target sizes + TRect rect = iChild->Rect(); + TSize srcsize; + srcsize.iWidth = rect.iBr.iX - rect.iTl.iX; + srcsize.iHeight = rect.iBr.iY - rect.iTl.iY; + + rect = iParent->Rect(); + TSize tgtsize; + tgtsize.iWidth = rect.iBr.iX - rect.iTl.iX; + tgtsize.iHeight = rect.iBr.iY - rect.iTl.iY; + + // Compute aspect ratio of the source + TInt ars = (srcsize.iWidth << KScaleBits) / srcsize.iHeight; + + // Compute aspect ratio of the target + TInt art = (tgtsize.iWidth << KScaleBits) / tgtsize.iHeight; + + // Select scale so that aspect ratio is preserved + if ( ars >= art ) + { + iScale = (srcsize.iWidth << KScaleBits) / tgtsize.iWidth; + iRelScale = (TReal)tgtsize.iWidth / (TReal)srcsize.iWidth; + iOrigo.iX = iChild->Rect().iTl.iX; + TInt h = (srcsize.iWidth << KScaleBits) / art; + iOrigo.iY = iChild->Rect().iTl.iY + (srcsize.iHeight - h) / 2; + } + else + { + iScale = (srcsize.iHeight << KScaleBits) / tgtsize.iHeight; + iRelScale = (TReal)tgtsize.iHeight / (TReal)srcsize.iHeight; + iOrigo.iY = iChild->Rect().iTl.iY; + TInt w = (srcsize.iHeight * art) >> KScaleBits; + iOrigo.iX = iChild->Rect().iTl.iX + (srcsize.iWidth - w) / 2 ; + } + + rect = iChild->Rect(); + iRect.iTl.iX = ((rect.iTl.iX * iScale) >> KScaleBits); + iRect.iTl.iY = ((rect.iTl.iY * iScale) >> KScaleBits); + iRect.iBr.iX = ((rect.iBr.iX * iScale) >> KScaleBits); + iRect.iBr.iY = ((rect.iBr.iY * iScale) >> KScaleBits); + return 0; + } + + + +const char* CFilterScale::Type() + { + return "scale"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterScale/group/FilterScale.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterScale/group/FilterScale.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterScale.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterScale.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterScale/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterScale/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterScale.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSepia/BWINS/FilterSepia.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSepia/BWINS/FilterSepia.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterSepia@@SAHXZ @ 1 NONAME ; int CFilterSepia::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSepia/EABI/FilterSepia.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSepia/EABI/FilterSepia.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN12CFilterSepia6CreateEv @ 1 NONAME + _ZTI12CFilterSepia @ 2 NONAME ; ## + _ZTV12CFilterSepia @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSepia/Inc/CFilterSepia.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSepia/Inc/CFilterSepia.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,54 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERNEGATE_H__ +#define __CFILTERNEGATE_H__ + +#include +#include "MImageFilter.h" + +class CFilterSepia + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterSepia(); + + private: + static CFilterSepia* NewL(); + CFilterSepia(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSepia/Src/CFilterSepia.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSepia/Src/CFilterSepia.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,179 @@ +/* +* 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: +* +*/ + + +#include "CFilterSepia.h" + +// Sepia in RGB +const TInt rs = 112; +const TInt gs = 66; +const TInt bs = 20; + +// Helper variables +const TInt kr = 45808 * rs - 38446 * gs - 7362 * bs + 32768; +const TInt kg = - 19496 * rs + 26952 * gs - 3750 * bs + 32768; +const TInt kb = - 19608 * rs - 38184 * gs + 57792* bs + 32768; + +EXPORT_C TInt CFilterSepia::Create() + { + CFilterSepia* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterSepia* CFilterSepia::NewL() + { + CFilterSepia* self = new( ELeave )CFilterSepia(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterSepia::~CFilterSepia() + { + } + + + +CFilterSepia::CFilterSepia() + { + + } + + + +void CFilterSepia::ConstructL() + { + + } + + + +TRect CFilterSepia::Rect() + { + return iChild->Rect(); + } + +TReal CFilterSepia::Scale() + { + return iChild->Scale(); + } + +TSize CFilterSepia::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + + +TBlock * CFilterSepia::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + + for (TInt i = 0; i < pB->iDataLength; ++i) + { + TUint32 c = *pD; + + // Get RGB values + TInt b = c & 0xFF; + c >>= 8; + TInt g = c & 0xFF; + c >>= 8; + TInt r = c & 0xFF; + + + TInt alpha = 19668 * r + 38442 * g + 7450 * b; + r = (alpha + kr) >> 16; + if (r < 0) + { + r = 0; + } + else if (r > 255) + { + r = 255; + } + g = (alpha + kg) >> 16; + if (g < 0) + { + g = 0; + } + else if (g > 255) + { + g = 255; + } + b = (alpha + kb) >> 16; + if (b < 0) + { + b = 0; + } + else if (b > 255) + { + b = 255; + } + + *pD++ = b | (g << 8) | (r << 16); + } + + return pB; +} + + +void CFilterSepia::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterSepia::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterSepia::CmdL( const TDesC16& /*aCmd*/ ) + { + return 0; + } + + + +const char* CFilterSepia::Type() + { + return "sepia"; + } + + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSepia/group/FilterSepia.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSepia/group/FilterSepia.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterSepia.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterSepia.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSepia/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSepia/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterSepia.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSharpness/BWINS/FilterSharpness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSharpness/BWINS/FilterSharpness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterSharpness@@SAHXZ @ 1 NONAME ; int CFilterSharpness::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSharpness/EABI/FilterSharpness.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSharpness/EABI/FilterSharpness.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN16CFilterSharpness6CreateEv @ 1 NONAME + _ZTI16CFilterSharpness @ 2 NONAME ; ## + _ZTV16CFilterSharpness @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSharpness/Inc/CFilterSharpness.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSharpness/Inc/CFilterSharpness.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,75 @@ +/* +* 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: +* +*/ + + +#ifndef __CFilterSharpness_H__ +#define __CFilterSharpness_H__ + +#include +#include "MImageFilter.h" + +class CFilterSharpness + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterSharpness(); + + private: + static CFilterSharpness* NewL(); + CFilterSharpness(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // Data + + MImageFilter* iParent; + MImageFilter* iChild; + + TInt iSharpness; + + TInt iN; + TInt iN2; + TInt iHN; + TBool iSharpen; + + // Row caches + TUint8 * ipRCR; + TUint8 * ipRCG; + TUint8 * ipRCB; + + // Column caches + TUint8 * ipCCR; + TUint8 * ipCCG; + TUint8 * ipCCB; + + // Division LUT + TUint8 * iDivLUT; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSharpness/Src/CFilterSharpness.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSharpness/Src/CFilterSharpness.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,639 @@ +/* +* 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: +* +*/ + + +#include "CFilterSharpness.h" + +EXPORT_C TInt CFilterSharpness::Create() + { + CFilterSharpness* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterSharpness* CFilterSharpness::NewL() + { + CFilterSharpness* self = new( ELeave )CFilterSharpness(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterSharpness::~CFilterSharpness() + { + delete[] ipRCR; + delete[] ipRCG; + delete[] ipRCB; + delete[] ipCCR; + delete[] ipCCG; + delete[] ipCCB; + delete[] iDivLUT; + } + + + +CFilterSharpness::CFilterSharpness() + { + + } + + + +void CFilterSharpness::ConstructL() + { + } + + + +TRect CFilterSharpness::Rect() + { + return iChild->Rect(); + } + +TReal CFilterSharpness::Scale() + { + return iChild->Scale(); + } + +TSize CFilterSharpness::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + + +TBlock * CFilterSharpness::GetBlockL ( const TRect & aRect ) +{ + + if (iN == 1) + { + return iChild->GetBlockL(aRect); + } + + // Read the block needed to create sharpened block aRect + TRect rect = aRect; + rect.iTl.iX -= iHN; + rect.iTl.iY -= iHN; + rect.iBr.iX += iHN; + rect.iBr.iY += iHN; + TBlock * pS = iChild->GetBlockL(rect); + if (!pS) return NULL; + + // Create resulting sharpened block + TBlock * pB = new (ELeave) TBlock (aRect); + TUint32 * pd = pB->iData; + + TInt i = aRect.iTl.iY; // pixel index y + TInt j = aRect.iTl.iX; // pixel index x + + TInt sumR = 0; + TInt sumG = 0; + TInt sumB = 0; + TInt rowsumR = 0; + TInt rowsumG = 0; + TInt rowsumB = 0; + + TInt irc = 0; // row cache index + TInt icc = 0; // column cache index + + + // NW corner of the block => initialize row cache + for (TInt ii = -iHN; ii <= iHN; ++ii) + { + + TInt y = i + ii; + if (y < pS->iRect.iTl.iY) + { + y = pS->iRect.iTl.iY; + } + else if (y >= pS->iRect.iBr.iY) + { + y = pS->iRect.iBr.iY - 1; + } + TInt offset = (y - pS->iRect.iTl.iY) * pS->iWidth - pS->iRect.iTl.iX; + + for (TInt jj = -iHN; jj <= iHN; ++jj) + { + + TInt x = j + jj; + if (x < pS->iRect.iTl.iX) + { + x = pS->iRect.iTl.iX; + } + else if (x >= pS->iRect.iBr.iX) + { + x = pS->iRect.iBr.iX - 1; + } + + TUint32 cc = *(pS->iData + offset + x); + rowsumB += cc & 0xFF; + ipRCB[irc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + rowsumG += cc & 0xFF; + ipRCG[irc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + rowsumR += cc & 0xFF; + ipRCR[irc] = (TUint8)(cc & 0xFF); + + irc++; + if (irc >= iN2) irc = 0; + + + } + } + + if ( iSharpen ) + { + TUint32 c = *(pS->iData + (i - pS->iRect.iTl.iY) * pS->iWidth + (j - pS->iRect.iTl.iX)); + + // Get pixel from the previous filter + TInt bb = c & 0xFF; + bb += (bb - iDivLUT[rowsumB]); + if (bb < 0) + { + bb = 0; + } + else if (bb > 255) + { + bb = 255; + } + + c >>= 8; + TInt gg = c & 0xFF; + gg += (gg - iDivLUT[rowsumG]); + if (gg < 0) + { + gg = 0; + } + else if (gg > 255) + { + gg = 255; + } + + c >>= 8; + TInt rr = c & 0xFF; + rr += (rr - iDivLUT[rowsumR]); + if (rr < 0) + { + rr = 0; + } + else if (rr > 255) + { + rr = 255; + } + *pd++ = (rr << 16) | (gg << 8) | bb; + } + else + { + *pd++ = ( (iDivLUT[rowsumR] << 16) | (iDivLUT[rowsumG] << 8) | iDivLUT[rowsumB] ); + } + + + // Initialize column sum + sumB = rowsumB; + sumG = rowsumG; + sumR = rowsumR; + + // Update column cache + for (TInt iii = 0; iii < iN; ++iii) + { + for (TInt jjj = 0; jjj < iN; ++jjj) + { + ipCCR[iii * iN + jjj] = ipRCR[jjj * iN + iii]; + ipCCG[iii * iN + jjj] = ipRCG[jjj * iN + iii]; + ipCCB[iii * iN + jjj] = ipRCB[jjj * iN + iii]; + } + } + + + // Filter the rest of the first row + for ( j++ ; j < aRect.iBr.iX; ++j) + { + + TInt x = j + iHN; + if (x < pS->iRect.iTl.iX) + { + x = pS->iRect.iTl.iX; + } + else if (x >= pS->iRect.iBr.iX) + { + x = pS->iRect.iBr.iX - 1; + } + TInt offset = x - pS->iRect.iTl.iX - pS->iRect.iTl.iY * pS->iWidth; + + for (TInt ii = -iHN; ii <= iHN; ++ii) + { + + TInt y = i + ii; + if (y < pS->iRect.iTl.iY) + { + y = pS->iRect.iTl.iY; + } + else if (y >= pS->iRect.iBr.iY) + { + y = pS->iRect.iBr.iY - 1; + } + + TUint32 cc = *(pS->iData + y * pS->iWidth + offset); + sumB -= ipCCB[icc]; + sumB += cc & 0xFF; + ipCCB[icc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + sumG -= ipCCG[icc]; + sumG += cc & 0xFF; + ipCCG[icc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + sumR -= ipCCR[icc]; + sumR += cc & 0xFF; + ipCCR[icc] = (TUint8)(cc & 0xFF); + + icc++; + if (icc >= iN2) icc = 0; + + } + + if ( iSharpen ) + { + TUint32 c = *(pS->iData + (i - pS->iRect.iTl.iY) * pS->iWidth + (j - pS->iRect.iTl.iX)); + + // Get pixel from the previous filter + TInt bb = c & 0xFF; + bb += (bb - iDivLUT[sumB]); + if (bb < 0) + { + bb = 0; + } + else if (bb > 255) + { + bb = 255; + } + + c >>= 8; + TInt gg = c & 0xFF; + gg += (gg - iDivLUT[sumG]); + if (gg < 0) + { + gg = 0; + } + else if (gg > 255) + { + gg = 255; + } + + c >>= 8; + TInt rr = c & 0xFF; + rr += (rr - iDivLUT[sumR]); + if (rr < 0) + { + rr = 0; + } + else if (rr > 255) + { + rr = 255; + } + *pd++ = (rr << 16) | (gg << 8) | bb; + } + else + { + *pd++ = ( (iDivLUT[sumR] << 16) | (iDivLUT[sumG] << 8) | iDivLUT[sumB] ); + } + + } + + + // Filter the rest of the block + for ( i++; i < aRect.iBr.iY; ++i) + { + + j = aRect.iTl.iX; + icc = 0; + + // New row, add new row to row cache and remove old row, update column cache + TInt y = i + iHN; + if (y < pS->iRect.iTl.iY) + { + y = pS->iRect.iTl.iY; + } + else if (y >= pS->iRect.iBr.iY) + { + y = pS->iRect.iBr.iY - 1; + } + TInt offset = (y - pS->iRect.iTl.iY) * pS->iWidth - pS->iRect.iTl.iX; + + for (TInt jj = -iHN; jj <= iHN; ++jj) + { + + TInt x = j + jj; + if (x < pS->iRect.iTl.iX) + { + x = pS->iRect.iTl.iX; + } + else if (x >= pS->iRect.iBr.iX) + { + x = pS->iRect.iBr.iX - 1; + } + + TUint32 cc = *(pS->iData + offset + x); + rowsumB -= ipRCB[irc]; + rowsumB += cc & 0xFF; + ipRCB[irc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + rowsumG -= ipRCG[irc]; + rowsumG += cc & 0xFF; + ipRCG[irc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + rowsumR -= ipRCR[irc]; + rowsumR += cc & 0xFF; + ipRCR[irc] = (TUint8)(cc & 0xFF); + + irc++; + if (irc >= iN2) irc = 0; + + } + + if ( iSharpen ) + { + TUint32 c = *(pS->iData + (i - pS->iRect.iTl.iY) * pS->iWidth + (j - pS->iRect.iTl.iX)); + + // Get pixel from the previous filter + TInt bb = c & 0xFF; + bb += (bb - iDivLUT[rowsumB]); + if (bb < 0) + { + bb = 0; + } + else if (bb > 255) + { + bb = 255; + } + + c >>= 8; + TInt gg = c & 0xFF; + gg += (gg - iDivLUT[rowsumG]); + if (gg < 0) + { + gg = 0; + } + else if (gg > 255) + { + gg = 255; + } + + c >>= 8; + TInt rr = c & 0xFF; + rr += (rr - iDivLUT[rowsumR]); + if (rr < 0) + { + rr = 0; + } + else if (rr > 255) + { + rr = 255; + } + *pd++ = (rr << 16) | (gg << 8) | bb; + } + else + { + *pd++ = ( (iDivLUT[rowsumR] << 16) | (iDivLUT[rowsumG] << 8) | iDivLUT[rowsumB] ); + } + + sumR = rowsumR; + sumG = rowsumG; + sumB = rowsumB; + + // Update column cache + for (TInt iii = 0; iii < iN; ++iii) + { + for (TInt jjj = 0; jjj < iN; ++jjj) + { + ipCCR[iii * iN + jjj] = ipRCR[jjj * iN + iii]; + ipCCG[iii * iN + jjj] = ipRCG[jjj * iN + iii]; + ipCCB[iii * iN + jjj] = ipRCB[jjj * iN + iii]; + } + } + + // Filter the rest of the row + for ( j++; j < aRect.iBr.iX; ++j) + { + + TInt x = j + iHN; + if (x < pS->iRect.iTl.iX) + { + x = pS->iRect.iTl.iX; + } + else if (x >= pS->iRect.iBr.iX) + { + x = pS->iRect.iBr.iX - 1; + } + TInt offset = x - pS->iRect.iTl.iX - pS->iRect.iTl.iY * pS->iWidth; + + for (TInt ii = -iHN; ii <= iHN; ++ii) + { + + TInt y = i + ii; + if (y < pS->iRect.iTl.iY) + { + y = pS->iRect.iTl.iY; + } + else if (y >= pS->iRect.iBr.iY) + { + y = pS->iRect.iBr.iY - 1; + } + + TUint32 cc = *(pS->iData + y * pS->iWidth + offset); + sumB -= ipCCB[icc]; + sumB += cc & 0xFF; + ipCCB[icc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + sumG -= ipCCG[icc]; + sumG += cc & 0xFF; + ipCCG[icc] = (TUint8)(cc & 0xFF); + + cc >>= 8; + sumR -= ipCCR[icc]; + sumR += cc & 0xFF; + ipCCR[icc] = (TUint8)(cc & 0xFF); + + icc++; + if (icc >= iN2) icc = 0; + + } + + if ( iSharpen ) + { + TUint32 c = *(pS->iData + (i - pS->iRect.iTl.iY) * pS->iWidth + (j - pS->iRect.iTl.iX)); + + // Get pixel from the previous filter + TInt bb = c & 0xFF; + bb += (bb - iDivLUT[sumB]); + if (bb < 0) + { + bb = 0; + } + else if (bb > 255) + { + bb = 255; + } + + c >>= 8; + TInt gg = c & 0xFF; + gg += (gg - iDivLUT[sumG]); + if (gg < 0) + { + gg = 0; + } + else if (gg > 255) + { + gg = 255; + } + + c >>= 8; + TInt rr = c & 0xFF; + rr += (rr - iDivLUT[sumR]); + if (rr < 0) + { + rr = 0; + } + else if (rr > 255) + { + rr = 255; + } + *pd++ = (rr << 16) | (gg << 8) | bb; + } + else + { + *pd++ = ( (iDivLUT[sumR] << 16) | (iDivLUT[sumG] << 8) | iDivLUT[sumB] ); + } + } + } + + delete pS; + pS = NULL; + return pB; +} + +void CFilterSharpness::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + +void CFilterSharpness::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterSharpness::CmdL( const TDesC16 & aCmd ) +{ + TLex lex (aCmd); + + // Get sharpness [-100,100] + while ( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + + if ( token.Compare( _L("sharpness") ) == 0) + { + lex.Inc(); + lex.Val (iSharpness); + } + } + if (iSharpness < -100) + { + iSharpness = -100; + + } + else if (iSharpness > 100) + { + iSharpness = 100; + } + + if (iSharpness < 0) + { + iN = (-iSharpness / 10) + 1; + iSharpen = ETrue; + } + else + { + iN = (iSharpness / 10) + 1; + iSharpen = EFalse; + } + if ( iN % 2 == 0 ) + { + iN++; + } + iN2 = iN * iN; + iHN = (iN >> 1); + + // Create row caches for new filter size + delete[] ipRCR; + ipRCR = new (ELeave) TUint8 [iN2]; + delete[] ipRCG; + ipRCG = new (ELeave) TUint8 [iN2]; + delete[] ipRCB; + ipRCB = new (ELeave) TUint8 [iN2]; + + // Create column caches for new filter size + delete[] ipCCR; + ipCCR = new (ELeave) TUint8 [iN2]; + delete[] ipCCG; + ipCCG = new (ELeave) TUint8 [iN2]; + delete[] ipCCB; + ipCCB = new (ELeave) TUint8 [iN2]; + + // Create and compute division LUT + delete[] iDivLUT; + TInt maxbins = iN2 * 255 + 1; + iDivLUT = new (ELeave) TUint8 [maxbins]; + for (TInt i = 0; i < maxbins; ++i) + { + iDivLUT[i] = (TUint8)(i / iN2); + } + + + return 0; +} + +const char* CFilterSharpness::Type() +{ + return "sharpness"; +} + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSharpness/group/FilterSharpness.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSharpness/group/FilterSharpness.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,59 @@ +/* +* 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: +* +*/ + + +/// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterSharpness.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterSharpness.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterSharpness/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterSharpness/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterSharpness.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterText/BWINS/FilterText.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterText/BWINS/FilterText.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,3 @@ +EXPORTS + ?Create@CFilterText@@SAHXZ @ 1 NONAME ; int CFilterText::Create(void) + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterText/EABI/FilterText.DEF --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterText/EABI/FilterText.DEF Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,5 @@ +EXPORTS + _ZN11CFilterText6CreateEv @ 1 NONAME + _ZTI11CFilterText @ 2 NONAME ; ## + _ZTV11CFilterText @ 3 NONAME ; ## + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterText/group/FilterText.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterText/group/FilterText.mmp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +// To get the MW_LAYER_SYSTEMINCLUDE-definition +#include + + +#include "../../../group/definitions.def" + +#if defined( __VERBOSE__ ) +MACRO VERBOSE +#endif + +TARGET FilterText.dll +TARGETTYPE dll +UID 0x1000008d 0 + +TARGETPATH SHARED_LIB_DIR +VENDORID VID_DEFAULT +CAPABILITY CAP_GENERAL_DLL + +SOURCEPATH ../Src +SOURCE CFilterText.cpp + +SOURCEPATH ../../../src +SOURCE CFbsBitmapHack.cpp + +USERINCLUDE ../Inc +USERINCLUDE ../../../Inc + +// Default system include paths for middleware layer modules. +MW_LAYER_SYSTEMINCLUDE + + +LANG SC + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY fbscli.lib +LIBRARY bitgdi.lib +LIBRARY gdi.lib +LIBRARY cone.lib +LIBRARY eikcore.lib +LIBRARY bafl.lib +LIBRARY avkon.lib + +OPTION ARMCC -O3 -Otime + +#if defined(__EXPORT_UNFROZEN_PLUGINS__) +EXPORTUNFROZEN +#endif +NOSTRICTDEF diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterText/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterText/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "../../../group/definitions.def" + +// project platforms +PRJ_PLATFORMS +DEFAULT + +// project exports +PRJ_EXPORTS + +// mmp files +PRJ_MMPFILES +FilterText.mmp + +// test project mmp files +PRJ_TESTMMPFILES diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterText/inc/CFilterText.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterText/inc/CFilterText.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,77 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERTEXT_H__ +#define __CFILTERTEXT_H__ + +#include +#include "MImageFilter.h" + +class CFont; + +class CFilterText + : public CBase + , public MImageFilter + { + public: + IMPORT_C static TInt Create(); + virtual ~CFilterText(); + + private: + static CFilterText* NewL(); + CFilterText(); + void ConstructL(); + + public: // MImageFilter + virtual TRect Rect(); + virtual TReal Scale(); + virtual TSize ViewPortSize(); + virtual TBlock * GetBlockL ( const TRect & aRect ); + virtual void SetParent( MImageFilter* aParent ); + virtual void SetChild( MImageFilter* aChild ); + virtual TInt CmdL( const TDesC16& aCmd ); + virtual const char* Type(); + + private: // new methods + + void CreateBitmapL ( const TSize & aSize ); + void CreateTextL ( const TDesC16 & aText ); + + + private: // Data + + TUint32* iData; + TRect iRect; + TSize iTextSize; + TSize iSize; + TUint32 iColor; + const CFont * iFont; + + TPoint iPosition; + TPoint iCorrectPosition; + TInt iZoom; + TInt iAngle; + TPoint iScale; + + + + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/filters/FilterText/src/CFilterText.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/filters/FilterText/src/CFilterText.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,465 @@ +/* +* 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: +* +*/ + + + +#include "CFilterText.h" +#include +#include +#include +#include +#include +#include "CFbsBitmapHack.h" + +const TInt KScaleBits = 12; +const TInt KCoordBits = 8; + +EXPORT_C TInt CFilterText::Create() + { + CFilterText* ptr = NULL; + TRAPD( error, ptr = NewL(); ); + if( error != KErrNone ) + { + ptr = NULL; + } + return (TInt)((MImageFilter*)ptr); + } + + + +CFilterText* CFilterText::NewL() + { + CFilterText* self = new( ELeave )CFilterText(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterText::~CFilterText() + { + delete[] iData; + iFont = NULL; + } + + + +CFilterText::CFilterText() + { + + } + + + +void CFilterText::ConstructL() + { + iScale.iX = 1 << 8; + iScale.iY = 0; + iZoom = 1000; + iAngle = 0; + iColor = 0xFFFFFF; + } + + + +TRect CFilterText::Rect() + { + return iChild->Rect(); + } + +TReal CFilterText::Scale() + { + return iChild->Scale(); + } + +TSize CFilterText::ViewPortSize() +{ + return iChild->ViewPortSize(); +} + + +TBlock * CFilterText::GetBlockL ( const TRect & aRect ) +{ + TBlock * pB = iChild->GetBlockL (aRect); + if (!pB) return NULL; + TUint32 * pD = pB->iData; + for (TInt i = pB->iRect.iTl.iY; i < pB->iRect.iBr.iY; ++i) + { + for (TInt j = pB->iRect.iTl.iX; j < pB->iRect.iBr.iX; ++j, ++pD) + { + + TUint32 c = *pD; + + TPoint pos = iCorrectPosition + TPoint (j << KCoordBits, i << KCoordBits); + TInt x = (pos.iX * iScale.iX + pos.iY * iScale.iY) >> (KScaleBits + KCoordBits); + TInt y = (pos.iY * iScale.iX - pos.iX * iScale.iY) >> (KScaleBits + KCoordBits); + + if ( (x >= 0) && (y >= 0) && (x < iSize.iWidth) && (y < iSize.iHeight) ) + { + TUint32 c2 = iData [x + y * iSize.iWidth]; + TInt ca = c2 >> 24; + c2 &= iColor; + if( ca == 255 ) + { + *pD = c2 & 0xffffff; + } + else + { + TInt cc1 = ( c2 & 0xff00ff ) * ca + ( c & 0xff00ff ) * ( 255-ca ); + TInt cc2 = ( c2 & 0xff00 ) * ca + ( c & 0xff00 ) * ( 255-ca ); + *pD = ( ( cc1 >> 8 ) & 0xff00ff ) + ( ( cc2 >> 8 ) & 0xff00 ); + } + } + } + } + return pB; +} + + +void CFilterText::SetParent( MImageFilter* aParent ) + { + iParent = aParent; + } + + + + +void CFilterText::SetChild( MImageFilter* aChild ) + { + iChild = aChild; + } + + + +TInt CFilterText::CmdL( const TDesC16& aCmd ) + { + TLex lex( aCmd ); + + TInt red = iColor >> 16; + TInt green = ( iColor >> 8 ) & 255; + TInt blue = iColor & 255; + + while( ! lex.Eos() ) + { + TPtrC token = lex.NextToken(); + if( token.Compare( _L("x") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iPosition.iX = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("y") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + iPosition.iY = (TInt)((param / relscale) + 0.5); + } + else if( token.Compare( _L("zoom") ) == 0 ) + { + lex.Inc(); + lex.Val( iZoom ); + } + else if( token.Compare( _L("angle") ) == 0 ) + { + lex.Inc(); + lex.Val( iAngle ); + } + else if( token.Compare( _L("width") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + TInt width = (TInt)((param / relscale) + 0.5); + iZoom = (width * 1000) / iSize.iWidth; + } + else if( token.Compare( _L("height") ) == 0 ) + { + TReal relscale = iChild->Scale(); + TInt param = 0; + lex.Inc (); + lex.Val (param); + TInt height = (TInt)((param / relscale) + 0.5); + iZoom = (height * 1000) / iSize.iHeight; + } + else if( token.Compare( _L("red") ) == 0 ) + { + lex.Inc(); + lex.Val( red ); + } + else if( token.Compare( _L("green") ) == 0 ) + { + lex.Inc(); + lex.Val( green ); + } + else if( token.Compare( _L("blue") ) == 0 ) + { + lex.Inc(); + lex.Val( blue ); + } + else if( token.Compare( _L("textwidth") ) == 0 ) + { + lex.Inc(); + lex.Val( iTextSize.iWidth ); + } + else if( token.Compare( _L("textheight") ) == 0 ) + { + lex.Inc(); + lex.Val( iTextSize.iHeight ); + } + else if( token.Compare( _L("font") ) == 0 ) + { + TInt point = 0; + lex.Inc(); + lex.Val( point ); + iFont = (const CFont *)point; + } + + else if( token.Compare( _L("text") ) == 0 ) + { + + // Extract text data + HBufC * text = HBufC::NewLC(255); + TPtr txtptr = text->Des(); + + // Find the start of the string + while (!lex.Eos()) + { + if (lex.Get() == '"') break; + } + + // Get the text data + while (!lex.Eos()) + { + TChar c= lex.Get(); + if (c == '"') + { + break; + } + else + { + txtptr.Append(c); + } + } + if (iFont) + { + CreateTextL( txtptr ); + + } + CleanupStack::PopAndDestroy(); // text + } + + iColor = ( red << 16 ) + ( green << 8 ) + blue; + } + + TReal relscale = iChild->Scale(); + TInt scaledx = (TInt)(iPosition.iX * relscale + 0.5); + TInt scaledy = (TInt)(iPosition.iY * relscale + 0.5); + TInt scaledz = (TInt)(iZoom * relscale + 0.5); + + TReal zoom = 0.001 * scaledz; + TReal angle = 0.001 * iAngle; + TReal rad = KPi * angle / 180.0; + TReal r; + TReal res; + + + Math::Cos( r, rad ); + r *= 1 << KScaleBits; + //r /= zoom; + Math::Round( res, r, 0 ); + iScale.iX = (TInt)res; + + Math::Sin( r, rad ); + r *= 1 << KScaleBits; + Math::Round( res, r, 0 ); + iScale.iY = (TInt)res; + + // helpers + TPoint mid( iSize.iWidth/2, iSize.iHeight/2 ); + TPoint sca( (TInt)(zoom * iScale.iX), (TInt)(zoom * iScale.iY) ); + TInt xo = ( mid.iX * sca.iX - mid.iY * sca.iY ) >> ( KScaleBits - KCoordBits ); + TInt yo = ( mid.iY * sca.iX + mid.iX * sca.iY ) >> ( KScaleBits - KCoordBits ); + + // iCorrectPosition is clipart mid position corrected with + // rotation ( otherwise rotation would be around topleft corner ) + iCorrectPosition = TPoint( xo,yo ) - TPoint( scaledx << KCoordBits, scaledy << KCoordBits ); + + // with iScale screen coordinates are translated to texture coordinates + iScale.iX = (TInt)(1.0 / zoom * iScale.iX); + iScale.iY = (TInt)(1.0 / zoom * iScale.iY); + return 0; + } + + + +const char* CFilterText::Type() + { + return "text"; + } + + +void CFilterText::CreateBitmapL( const TSize& aSize ) + { + delete iData; + iData = NULL; + iData = new( ELeave )TUint32[ aSize.iWidth * aSize.iHeight ]; + Mem::FillZ( iData, aSize.iWidth * aSize.iHeight * sizeof( TUint32 ) ); + iRect = aSize; + iSize = aSize; + } + + + + +void CFilterText::CreateTextL ( const TDesC16 & aText ) + { + CArrayFix* lines = new(ELeave) CArrayFixFlat(5); + CleanupStack::PushL (lines); + + + HBufC* visualText = AknBidiTextUtils::ConvertToVisualAndWrapToArrayL + ( aText, + iTextSize.iWidth, + *iFont, + *lines ); + CleanupStack::PushL(visualText); + + + TInt width = 0; + for (TInt i = 0; i < lines->Count(); ++i) + { + if (width < iFont->TextWidthInPixels ((*lines)[i])) + { + width = iFont->TextWidthInPixels ((*lines)[i]); + } + + } + + + TInt fh = iFont->HeightInPixels() + 4; + TInt height = fh * lines->Count(); + + // Create a bitmap big enough to hold the text + CFbsBitmap bitmap; + iSize.SetSize ( width + 4, height + 4); + User::LeaveIfError ( bitmap.Create ( iSize, EColor4K ) ); + + // Create bitmap device and context + CFbsBitmapDevice * bitmapDevice = CFbsBitmapDevice::NewL (&bitmap); + CleanupStack::PushL (bitmapDevice); + + // Create bitmap graphics context + CFbsBitGc * bitmapContext = 0; + User::LeaveIfError (bitmapDevice->CreateContext (bitmapContext)); + CleanupStack::PushL (bitmapContext) ; + + // Set parameters for the context + bitmapContext->UseFont( iFont ); + bitmapContext->SetBrushColor( 0 ); + bitmapContext->SetPenColor (KRgbWhite); + bitmapContext->Clear(); + + // Render lines + for (TInt i = 0; i < lines->Count(); i++) + { + TInt xoffset = (bitmap.SizeInPixels().iWidth - iFont->TextWidthInPixels ((*lines)[i])) >> 1; + + TInt yoffset = iFont->HeightInPixels() * (i+1) + 2; + bitmapContext->DrawText ((*lines)[i], TPoint (xoffset, yoffset)); + } + + + // Create memory buffer to hold rendered image data + delete[] iData; + iData = NULL; + iData = new (ELeave) TUint32 [iSize.iWidth * iSize.iHeight]; + Mem::FillZ (iData, iSize.iWidth * iSize.iHeight * sizeof (TUint32)); + + // Copy data to buffer and create borders + CFbsBitmapHack bm2; + bm2.Duplicate( bitmap.Handle() ); + bm2.DoLock(); + + TInt ws = bm2.ScanLineLength(iSize.iWidth, bm2.DisplayMode()) / 2; + TUint16 * spos = (TUint16*)(bm2.DataAddress()) + ws + 1; + TUint32 * tp = iData + iSize.iWidth + 1; + + for (TInt y = 1; y < iSize.iHeight - 1; y++ ) + { + + TUint16 * sp = spos; + spos += ws; + + for (TInt x = 1; x < iSize.iWidth - 1; x++ ) + { + + TUint16 c0 = sp[ 0 ]; + TUint16 c1 = sp[ -1 ]; + TUint16 c2 = sp[ 1 ]; + TUint16 c3 = sp[ -ws ]; + TUint16 c4 = sp[ ws ]; + TUint16 c5 = sp[ -1 - ws ]; + TUint16 c6 = sp[ 1 - ws ]; + TUint16 c7 = sp[ -1 + ws ]; + TUint16 c8 = sp[ 1 + ws ]; + sp++; + + TUint32 c = 0; + if (c0) + { + c = iColor; + } + TInt a = 0; + if (c0) a++; + if (c1) a++; + if (c2) a++; + if (c3) a++; + if (c4) a++; + a *= 2; + if (c5) a++; + if (c6) a++; + if (c7) a++; + if (c8) a++; + a *= 80; + if (a > 255) a = 255; + a <<= 24; + *tp++ = a + c; + } + tp += 2; + } + bm2.DoUnlock(); + + bitmapContext->DiscardFont(); + CleanupStack::PopAndDestroy(4); // bitmapContext, bitmapDevice, lines, visaul text + bitmap.Reset(); + + } + +#if !defined(EKA2) +GLDEF_C TInt E32Dll( TDllReason ) + { + return KErrNone; + } +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,73 @@ +/* +* 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: +* +*/ + + +#include "definitions.def" + +/// Filter projects +PRJ_MMPFILES +#include "../filters/FilterBrightness/group/bld.inf" +#include "../filters/FilterBubble/group/bld.inf" +#include "../filters/FilterBuffer/group/bld.inf" +#include "../filters/FilterCartoon/group/bld.inf" +#include "../filters/FilterClipart/group/bld.inf" +#include "../filters/FilterContrast/group/bld.inf" +#include "../filters/FilterCrop/group/bld.inf" +#include "../filters/FilterFrame/group/bld.inf" +#include "../filters/FilterGrayScale/group/bld.inf" +#include "../filters/FilterIclSource/group/bld.inf" +#include "../filters/FilterJpegSource/group/bld.inf" +#include "../filters/FilterJpegTarget/group/bld.inf" +#include "../filters/FilterNegate/group/bld.inf" +#include "../filters/FilterRedEye/group/bld.inf" +#include "../filters/FilterRotate/group/bld.inf" +#include "../filters/FilterScale/group/bld.inf" +#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" + + +// GONZALES engine components +#include "../SystemParameters/group/bld.inf" +#include "../EngineWrapper/group/bld.inf" + +// JpegRotator +//#include "../JpegRotator/group/bld.inf" + + +// JpegScaler +//#include "../JpegScaler/group/bld.inf" + + +// Exported files +PRJ_EXPORTS + +// sis stub + + +PRJ_TESTMMPFILES +// #include "../internal/tsrc/group/bld.inf" + +// End of File + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/group/definitions.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/group/definitions.def Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +// +// After modifying this file, reallyclean and build the whole project! +// + +// Do not require frozen DEF files for framework modules +// (i.e. all modules except plugins). +// Instead specify 'exportunfrozen' in MMP files +//#define __EXPORT_UNFROZEN_FRAMEWORK__ + +// Same as above, but for the plugin modules. +//#define __EXPORT_UNFROZEN_PLUGINS__ + +// Platform security flag +//#define __PLATFORM_SECURITY__ +//#ifdef __PLATFORM_SECURITY__ +//#include "..\inc\platform_security_defs.hrh" +//#endif + +// Enable logging facility in all modules. +// Enabling logs will do the both of the following: +// +// 1) Write the the logging information to RDebug::Print() +// (in UDEB builds only) +// 2) Write the log to file using RFileLogger (both in UDEB and UREL) +// Create the folder C:\Logs\ImageEditor to enable the file logging. +#define __IE_GLOBAL_DEBUGLOG__ + +// Verbosity level of the debuglog output +//#define __VERBOSE__ +//#define __VERBOSE_2__ + +// Export the ROM description (.iby) files to epoc32\rom\include. +// Not needed if we are not creating rom image. +//#define __EXPORT_ROM_DESCRIPTION_FILES__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/CExifParser.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/CExifParser.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,149 @@ +/* +* 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: +* +*/ + + +#ifndef __CEXIFPARSER_H__ +#define __CEXIFPARSER_H__ + +#include + + + +class TExifEntry + { + public: + inline TExifEntry() + { + iIfd = 0; + iTag = 0; + iType = 0; + iCount = 0; + iData = NULL; + } + + inline ~TExifEntry() + { + delete iData; + } + public: + TUint8 iIfd; + TUint16 iTag; + TUint8 iType; + TUint32 iCount; + TUint8* iData; + }; + + +class TParseStack + { + public: + inline TParseStack( TUint32 aPosition, TUint8 aIfd ) + : iPosition( aPosition ) + , iIfd( aIfd ) + { + } + public: + TUint32 iPosition; + TUint8 iIfd; + }; + + + +class CExifParser + : public CBase + { + public: + enum EIfd + { + EIfd0 = 0, + EIfd1, + ESubIfd, + EInteroperability + }; + + public: + static CExifParser* NewL(); + static CExifParser* NewLC(); + ~CExifParser(); + + private: + CExifParser(); + void ConstructL(); + + public: + void ParseL( const TPtrC8& aData ); + TBool TagExist( TInt aIfd, TUint16 aTag ); + void DeleteTag( TInt aIfd, TUint16 aTag ); + TUint32 TagValue( TInt aIfd, TUint16 aTag ); + + void AddTagL( TInt aIfd, TUint16 aTag, TInt32 aValue ); + void AddTagL( TInt aIfd, TUint16 aTag, TUint32 aValue ); + void AddTagL( TInt aIfd, TUint16 aTag, TUint16 aValue ); + void AddTagL( TInt aIfd, TUint16 aTag, TUint8 aValue ); + void AddTagL( TInt aIfd, TUint16 aTag, TPtrC8 aData ); + void AddTagL( TInt aIfd, TUint16 aTag, const TUint8* aValue ); + void AddTagL( TInt aIfd, TUint16 aTag, TUint32 aNominator, TUint32 aDenominator ); + + TPtrC8 ThumbData(); + TPtr8 SaveL( const TPtrC8& aThumbData ); + + + private: // new methods + TUint32 Get8(); + TUint32 Get16(); + TUint32 Get32(); + TUint32 Get8( const TUint8* aData ); + TUint32 Get16( const TUint8* aData ); + TUint32 Get32( const TUint8* aData ); + void ParseIfdL( TUint8 aIfd ); + TInt FindTag( TInt aIfd, TUint16 aTag ); + void StoreEntry( TInt aIndex ); + + void Put8( TUint8 aData ); + void Put16( TUint16 aData ); + void Put32( TUint32 aData ); + + TUint32 StoreData( TUint8* aData, TInt aCount ); + + TInt IfdCount( TInt aType ); + + void AddTagL( TInt aIfd, TUint16 aTag, TInt aType, TUint8* aData, TInt aDataLen ); + + + + private: + TPtrC8 iData; + TInt iPosition; + TBool iIntelByteOrder; + + RArray< TParseStack >iParseStack; + RPointerArray< TExifEntry >iEntry; + + TUint8* iSaveBuf; // used to store tags + TInt iSaveBufPos; + + TUint8* iSaveDataBuf; // used to store tag data + TInt iSaveDataBufPos; + + RArray< TUint32 >iDataEntry; // list of tag data pointers + + TUint8* iThumbData; + TInt iThumbLen; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/CFbsBitmapHack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/CFbsBitmapHack.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* +*/ + + +#ifndef __CFBSBITMAPHACK_H__ +#define __CFBSBITMAPHACK_H__ + +#include +#include + +class CFbsBitmapHack + : public CFbsBitmap + { + public: + void DoLock(); + void DoUnlock(); + }; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/CFilterStack.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/CFilterStack.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,72 @@ +/* +* 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: +* +*/ + + +#ifndef __CFILTERSTACK_H__ +#define __CFILTERSTACK_H__ + +#include +#include "MImageFilter.h" + + +class TFilter + { + public: + inline ~TFilter() + { + delete iFilter; + iLibrary.Close(); + } + MImageFilter* iFilter; + RLibrary iLibrary; + }; + +class CFilterStack + : public CBase + { + public: + static CFilterStack* NewL(); + ~CFilterStack(); + + private: + CFilterStack(); + void ConstructL(); + + public: + MImageFilter* Filter( TInt aPosition ); + + void AddFilterL( const TDesC& aName ); + void AddFilterL( const TDesC& aName, TInt aPosition ); + void AddFilterL( const TFilter * aFilter ); + void AddFilterL( const TFilter * aFilter, const TInt aPosition ); + + void RemoveFilter( TInt aPosition ); + void RemoveFilter ( TInt aPosition, TFilter *& aFilter ); + + TInt FunctionL( TInt aPosition, const TDesC& aCmd ); + TInt NumFilters(); + + private: + void InitStack(); + + private: + RPointerArray< TFilter >iStack; + }; + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/CJpeg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/CJpeg.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,269 @@ +/* +* 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: +* +*/ + + +// +// Jpeg decoder class + +#ifndef __CJPEG_H__ +#define __CJPEG_H__ + +#include +#include +#include "TBitmapHandle.h" +#include "MJpegLoad.h" + +class THuffman; + + + + +/// Main Jpeg decode class +class CJpeg + : public CBase + , public MJpegLoad + { + + public: + static CJpeg* NewL(); + static CJpeg* NewLC(); + ~CJpeg(); + + private: + CJpeg(); + void ConstructL(); + + public: // MJpegLoad + + void OpenL( const TFileName& aFile ); + void OpenL( const TPtr8& aData ); + + void SetScale( TJpegScale aScale ); + TBitmapHandle LoadImageL( TRect& aRect ); + + void ScanRandomL(); // scans file, creates random access tables + TBitmapHandle LoadBlockL( const TPoint& aBlock ); + + const TJpegData& Info(); + TPtrC8 ExifData(); + + public: + + void EnableRgvConv(); + void DisableRgbConv(); + + private: + inline void BufFwd( TInt aBits ); + inline TInt BufBits( TInt aBits ); + inline TInt Buf16(); + inline void BufLoad8(); + void DecodeBlock(); + void DecodeBlock2(); + void DecodeBlock3(); + void Idct(); + void IdctHalf(); + void CreateHuffmanL( THuffman* aHuffman, const TUint8* aBits, const TUint8* aVal ); + void CreateDefaultHuffmanL(); + void PrepareLoadBlockL(); // must be called before first LoadBlock() + + // + // Scale load functions: + // + void DecRgb1_1L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ); + void DecRgb1_2L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ); + void DecRgb1_4L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ); + void DecRgb1_8L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ); + + // + // Yuv -> Rgb functions + // + + // YUV420 + static void Yuv2Rgb22_11_11( TAny* aPtr ); + + // YUV422 + static void Yuv2Rgb21_11_11( TAny* aPtr ); + + // Any other YUV format + static void Yuv2RgbFree( TAny* aPtr ); + + private: + + /// Jpeg component information struct + /// one for each color component + class TComponent + { + public: + char iType; + char iXFactor; + char iYFactor; + char iQuantTable; + char iID; + }; + + /// Current jpeg block search / use struct + /// will change to type where the actual huffman data is also contained + class TJpegBlock + { + public: + TUint32 iOffset; + TUint32 iBuf; + TInt iBufBits; + TInt iY; + TInt iU; + TInt iV; + }; + + class TYuvConv + { + public: + TUint32* iRgb; + TSize iBlkSize; + TInt iRgbWidth; + TInt iBlkPixels; + }; + + TUint8* iBuffer; // contains whole jpeg file now + TInt iBufPos; + + TUint32 iBuf; // Huffman bit buffer + TInt iBufBits; // number of bits in bitbuffer + + THuffman* iHuffman[ 4 ]; // huffman lookup tables + TInt iCurrentHuffman; + + TUint8* iQt[ 4 ]; // Quantization tables + TUint8* iCurrentQt; + + TInt iDct[ 64 ]; // DCT coefficients + TInt iBlk[ 64 ]; // IDCT result + + TBool iRst; // RST flag, might occur on some jpegs + + bool iEOF; + + TJpegData iData; + + TComponent iComponent[ 4 ]; + TInt iNumComponents; + + //RArray< TJpegBlock >iBlock; + TJpegBlock* iBlock; + TInt iNumBlocks; + + TUint8* iExifData; + TInt iExifDataLength; + + // LoadBlock variables: + TBitmapHandle iBm; // rgb block bitmap + TInt iBlkPixels; // number of pixels in rgb block + + TUint8* iC[ 3 ]; // Y,U,V buffer + + TInt iYxa; + TInt iYya; + TInt iUxa; + TInt iUya; + TInt iVxa; + TInt iVya; + + bool iRgbConv; + + //RFs iFs; + //RFile iDebug; + + TYuvConv iYuvConv; + void (*iYuv2rgbFunc)(TAny*); + + + TInt iImageDataStart; + bool iRandomScanned; + bool iLoadBlockPrepared; + + TJpegScale iScale; + + TInt iResetInterval; + + + }; + + +inline void CJpeg::BufFwd( TInt aBits ) + { + iBuf <<= aBits; + iBufBits -= aBits; + } + + + +inline TInt CJpeg::BufBits( TInt aBits ) + { + if( aBits == 0 ) return 0; + while( iBufBits < aBits ) + { + BufLoad8(); + } + TInt val = iBuf >> ( 32-aBits ); + BufFwd( aBits ); + return val; + } + + + +inline TInt CJpeg::Buf16() + { + while( iBufBits < 16 ) + { + BufLoad8(); + } + TInt val = iBuf >> ( 32-16 ); + return val; + } + + + +inline void CJpeg::BufLoad8() + { + TInt v; + v = iBuffer[ iBufPos++ ]; + if( v == 255 ) + { + v = iBuffer[ iBufPos++ ]; // escaped 0xff ? + if( v == 0 ) + { + v = 255; + } + else + { + //RDebug::Print( _L("Discard %x - position=%d bits=%d"), v, iBufPos, iBufBits ); + // here we have probably discarded a RST0..7 + iRst = ETrue; // inform decoder of reset + iBufBits = 255; // decoder doesn't need any more real data until next mcu + return; + } + } + + v <<= ( 24 - iBufBits ); + iBuf |= v; + iBufBits += 8; + } + + + + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/CJpegSave.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/CJpegSave.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,99 @@ +/* +* 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: +* +*/ + + +// +// Jpeg encoder class + + +#ifndef __CJPEGSAVE_H__ +#define __CJPEGSAVE_H__ + +#include +#include + +#include "TBitmapHandle.h" +#include "MJpegSave.h" + +class CFbsBitmap; +class TSHuffman; + +class CJpegSave + : public CBase + , public MJpegSave + { + public: + static CJpegSave* NewL( RFs* aFs, RFile* aFile ); + static CJpegSave* NewLC( RFs* aFs, RFile* aFile ); + ~CJpegSave(); + + private: + CJpegSave( RFs* aFs, RFile* aFile ); + void ConstructL(); + + public: // MJpegSave + //void SaveL( const CFbsBitmap* aBitmap, const TDesC16& aFileName ); + void StartSaveL( const TSize& aSize, TPtr8 aExif, TInt aSaveBufferSize, TInt aQuality ); + void SaveBlock( const TBitmapHandle& aBitmap ); + void FinalizeSave(); + TPtrC8 Finalize(); + + private: + void WriteHuffman( TInt aValue ); + void CreateHuffmanL( TSHuffman* aHuffman, const TUint8* aBits, const TUint8* aVal ); + void WriteBits( TUint32 aValue, TInt aNumBits ); + TInt WriteDct( TInt* aDct, TSHuffman* aDc, TSHuffman* aAc ); + void Dct( TInt* aSource, TInt* aTarget ); + void Rgb2Yuv( TUint32* aRgb, TInt aWidth, TInt* aY, TInt* aU, TInt* aV ); + void MakeTables( TInt aQuality, TUint8* aY, TUint8* aUV ); + + void WriteSaveBuffer( const TUint8* aSrc, TInt aBytes ); + void WriteSaveBuffer( TUint8 aValue ); + void WriteSaveBuffer( TUint16 aValue ); + void FlushSaveBuf(); + + private: + + RFs* iFs; + RFile* iSaveFile; + TInt iSaveBufSize; + TUint8* iSaveBuf; + TInt iSaveBufPos; + TInt iSaveBufBitPos; + TUint8 iSaveByte; +/* + TUint8* iBuffer; + TInt iBufPos; + TInt iBufBitPos; +*/ + TSHuffman* iHuffman[ 4 ]; + TSHuffman* iCurrentHuffman; + TUint8* iCurrentQuant; + + TInt iDctMul[ 64 ][ 64 ]; + + TInt iDy; + TInt iDu; + TInt iDv; + + TUint8 iYQuant[ 64 ]; + TUint8 iUVQuant[ 64 ]; + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/JpegSaveFactory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/JpegSaveFactory.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#ifndef __JPEGSAVEFACTORY_H__ +#define __JPEGSAVEFACTORY_H__ + +#include + +class MJpegSave; + +class JpegSaveFactory + { + public: + static MJpegSave* CreateJpegSaveL( RFs* aFs, RFile* aFile ); + static MJpegSave* CreateJpegSaveLC( RFs* aFs, RFile* aFile ); + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/MImageFilter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/MImageFilter.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,68 @@ +/* +* 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: +* +*/ + + +#ifndef __MIMAGEFILTER_H__ +#define __MIMAGEFILTER_H__ + +#include + +class TBlock +{ +public: + + TBlock() {}; + + TBlock (const TRect & aRect) + { + iRect = aRect; + iWidth = aRect.iBr.iX - aRect.iTl.iX; + iHeight = aRect.iBr.iY - aRect.iTl.iY; + iDataLength = iWidth * iHeight; + iData = new (ELeave) TUint32 [iDataLength]; + Mem::FillZ(iData, iDataLength * sizeof(TUint32)); + }; + ~TBlock() {delete[] iData;}; +public: + TRect iRect; + TInt iWidth; + TInt iHeight; + TInt iDataLength; + TUint32 * iData; + +protected: + +}; + +class MImageFilter + { + public: + virtual ~MImageFilter() {} + virtual TRect Rect() = 0; + virtual TReal Scale() = 0; + virtual TSize ViewPortSize() = 0; + virtual TBlock * GetBlockL ( const TRect & aRect ) = 0; + virtual void SetParent( MImageFilter* aParent ) = 0; + virtual void SetChild( MImageFilter* aChild ) = 0; + virtual TInt CmdL( const TDesC16& aCmd ) = 0; + virtual const char* Type() = 0; + MImageFilter* iParent; + MImageFilter* iChild; + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/MJpegLoad.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/MJpegLoad.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,94 @@ +/* +* 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: +* +*/ + + +#ifndef __MJPEGLOAD_H__ +#define __MJPEGLOAD_H__ + +#include +#include "TBitmapHandle.h" + + +class TJpegData + { + public: + TSize iSize; + TSize iBlockSize; + TSize iSizeInBlocks; + }; + + + +/// Jpeg scale factor, used by SetScale() +/// scales are 1:1, 1:2, 1:4 and 1:8 +enum TJpegScale + { + EScale1 = 0, + EScale2 = 1, + EScale4 = 2, + EScale8 = 3 + }; + + +/// Jpeg loader interface +class MJpegLoad + { + public: + virtual ~MJpegLoad() {} + + /// Opens jpeg file for decoding + /// @param aFile full filename of jpeg + virtual void OpenL( const TFileName& aFile ) = 0; + + /// Opens jpeg file for decoding + /// @param aData descriptor of jpeg file data + virtual void OpenL( const TPtr8& aData ) = 0; + + /// Sets load scale + /// @param aScale scale factor to use + virtual void SetScale( TJpegScale aScale ) = 0; + + /// Loads image or partial image + /// for normal image load, use Info().iSize + /// @param aRect rectangle in pixels to load. + /// Returns real decoded size which is + /// macroblock size dependent + /// @return TBitmapHandle loaded image. + virtual TBitmapHandle LoadImageL( TRect& aRect ) = 0; + + /// Scans the jpeg file for random access load + /// must be called before LoadBlock() + virtual void ScanRandomL() = 0; + + /// Decodes one macroblock from jpeg + /// @param aBlock x&y coordinates of macroblock to decode + /// @return block bitmap in 32bit RGB ( 0RGB ) format + virtual TBitmapHandle LoadBlockL( const TPoint& aBlock ) = 0; + + /// Gives info about jpeg + /// Can only be called after OpenL + /// return jpeg information struct + virtual const TJpegData& Info() = 0; + + /// Gives Exif data chunk if any + virtual TPtrC8 ExifData() = 0; + + + }; + +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/MJpegSave.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/MJpegSave.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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: +* +*/ + + +#ifndef __MJPEGSAVE_H__ +#define __MJPEGSAVE_H__ + +#include + +class MJpegSave + { + public: + virtual ~MJpegSave() {} + + /// Starts jpeg save + /// @param aSize size of jpeg file + /// @param aExif descriptor containing exif data + /// @param aSaveBufferSize save buffer size in bytes + /// @param aQuality quality factor 0..100 + virtual void StartSaveL( const TSize& aSize, TPtr8 aExif, TInt aSaveBufferSize, TInt aQuality ) = 0; + + /// Saves one macroblock + /// at the moment macroblocks are 8x8 pixels + /// @param aBitmap 8x8 pixels RGB bitmap 32bits per pixel ( 0RGB ) + virtual void SaveBlock( const TBitmapHandle& aBitmap ) = 0; + + /// Finalizes the save to file + virtual void FinalizeSave() = 0; + + /// Finalizes the save to buffer + /// @return TPtrC8 save buffer descriptor + virtual TPtrC8 Finalize() = 0; + }; +#endif diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/TBitmapHandle.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/TBitmapHandle.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,96 @@ +/* +* 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: +* +*/ + + +#ifndef __TBITMAPHANDLE_H__ +#define __TBITMAPHANDLE_H__ + +#include + +enum EBmpType + { + EUnknownColor = -1, + E4KColor = 0, + E256Gray, + E256Palette, + E64KColor, + E16MColor, + E64Bit + }; + +#define DEFAULTCOLOR E4KColor + +/// \brief Bitmap handle. +/// +/// All bitmaps should be described with this type. +/// Used by MGc and MSystem interfaces +/// MGc uses E4KColor, E256Gray and E256Palette bitmaps +class TBitmapHandle + { + public: + /// Default constructor + /// fills in default values for bitmap + inline TBitmapHandle() + { + iType = DEFAULTCOLOR; + iData = NULL; + iSize = TSize( 0, 0 ); + iDrawRect = TRect( TPoint( 0,0 ), iSize ); + } + + /// Constructor + /// @param aType bitmap color format + /// @param aData bitmap pixel data + /// @param aSize bitmap size + /// @param aDrawRect rectangle inside bitmap to draw from / to + inline TBitmapHandle( EBmpType aType, TAny* aData, const TSize& aSize, const TRect& aDrawRect ) + { + iType = aType; + iData = aData; + iSize = aSize; + iDrawRect = aDrawRect; + } + inline ~TBitmapHandle() + { + //delete iData; + } + + public: + /// Bitmap color format + /// Can be + /// E4KColor + /// E256Gray + /// E256Palette + /// E64KColor + /// E16MColor + /// E64Bit + EBmpType iType; + + /// Bitmap pixel data + TAny* iData; + + /// Bitmap size + TSize iSize; + + /// Bitmap draw area + /// MGc uses this area to draw from / to bitmap + TRect iDrawRect; + + }; + +#endif //__TBITMAPHANDLE_H__ diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/platform_security_defs.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/platform_security_defs.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#ifndef PLATFORM_SECURITY_DEFS_HRH +#define PLATFORM_SECURITY_DEFS_HRH + +#define VID_DEFAULT 0x101FB657 +#define CAP_GENERAL_DLL ALL -TCB +#define CAP_APPLICATION NetworkServices LocalServices Location ReadUserData \ + WriteUserData ReadDeviceData WriteDeviceData SwEvent UserEnvironment +#define CAP_ECOM_PLUGIN ALL -TCB +#define APP_BITMAP_DIR resource/apps +#define APP_RESOURCE_DIR resource/apps +#define SHARED_LIB_DIR sys/bin + +#endif // PLATFORM_SECURITY_DEFS_HRH + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/platform_security_literals.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/platform_security_literals.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,38 @@ +/* +* 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: +* +*/ + + +#ifndef PLATFORM_SECURITY_LITERALS_HRH +#define PLATFORM_SECURITY_LITERALS_HRH + +#include "../group/definitions.def" + +#if defined (__OEM_SDK__) + +#include + +#else + +_LIT(KDC_APP_BITMAP_DIR,"\\resource\\apps\\"); +_LIT(KDC_APP_RESOURCE_DIR,"\\resource\\apps\\"); + +#endif //__OEM_SDK__ + +#endif // PLATFORM_SECURITY_LITERALS_HRH + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/inc/platform_security_strings.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/inc/platform_security_strings.hrh Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,39 @@ +/* +* 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: +* +*/ + + +#ifndef PLATFORM_SECURITY_STRINGS_HRH +#define PLATFORM_SECURITY_STRINGS_HRH + +#include "../group/definitions.def" + +#if defined (__OEM_SDK__) + +#include + +#else + +#define APP_BITMAP_DIR "\\resource\\apps" +#define APP_RESOURCE_DIR "\\resource\\apps" + + +#endif //__OEM_SDK__ + +#endif // PLATFORM_SECURITY_LITERALS_HRH + +// End of File diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/src/CExifParser.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/src/CExifParser.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1122 @@ +/* +* 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: +* +*/ + + +#include "CExifParser.h" +#include // for debug + + + +enum TExifType + { + EByte = 1, + EAscii, + EShort, + ELong, + ERational, + EUndefined = 7, + ESLong = 9, + ESRational + }; + + + +const char* KTypeName[] = + { + "Byte", + "Ascii", + "Short", + "Long", + "Rational", + "Undefined", + "SLong", + "SRational" + }; + + + +const char KTypeLength[] = + { + 0, + 1, + 1, + 2, + 4, + 8, + 0, + 1, + 0, + 4, + 8 + }; + + + + + + + +CExifParser* CExifParser::NewL() + { + CExifParser* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + + + +CExifParser* CExifParser::NewLC() + { + CExifParser* self = new( ELeave )CExifParser(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + + +CExifParser::~CExifParser() + { + iEntry.ResetAndDestroy(); + iParseStack.Reset(); + + delete[] iSaveBuf; + delete[] iSaveDataBuf; + + iThumbData = NULL; + } + + + +CExifParser::CExifParser() + { + + } + + + +void CExifParser::ConstructL() + { + iIntelByteOrder = true; + } + + + +void CExifParser::ParseL( const TPtrC8& aData ) + { + if( aData.Length() < (8+2+12) ) return; // header + 1 tag length + + iData.Set( aData ); + iThumbData = 0; + iThumbLen = 0; + + if( iData[ 0 ] == 0x49 && iData[ 1 ] == 0x49 ) + { + // intel byte order + iIntelByteOrder = ETrue; + //RDebug::Print( _L("Intel byte order selected") ); + } + else + { + //RDebug::Print( _L("Motorola byte order selected") ); + } + + iPosition = 2; + TUint16 v = Get16(); + if( v != 0x002a ) + { + // must be 2a 00 in EXIF + User::Leave( KErrNotSupported ); + } + + iPosition = 4; + iParseStack.Append( TParseStack( Get32(), EIfd0 ) ); + + while( iParseStack.Count() ) + { + iPosition = iParseStack[ 0 ].iPosition; + TUint8 currentIfd = iParseStack[ 0 ].iIfd; + iParseStack.Remove( 0 ); + TInt i; + TInt c = Get16(); + for( i=0; i= 0 ) return ETrue; + return EFalse; + } + + + +void CExifParser::DeleteTag( TInt aIfd, TUint16 aTag ) + { + TInt i = FindTag( aIfd, aTag ); + if( i >= 0 ) + { + delete iEntry[ i ]; + iEntry.Remove( i ); + } + } + + + +TUint32 CExifParser::TagValue( TInt aIfd, TUint16 aTag ) + { + TInt value = 0; + TInt n = FindTag( aIfd, aTag ); + if( n<0 ) return 0; + TExifEntry* e = iEntry[ n ]; + TUint8* valData = e->iData; + switch( e->iType ) + { + case EByte: + { + value = Get8( valData ); + break; + } + case EAscii: + { + /* + TBuf< 256 >str; + str.Copy( _L("value:") ); + const TUint8* p = valData; + while( *p != 0 ) + { + str.Append( *p ); + p++; + } + */ + // not supported + value = 0; + break; + } + case EShort: + { + value = Get16( valData ); + ////RDebug::Print( _L("value:%d"), value ); + break; + } + case ELong: + { + value = Get32( valData ); + ////RDebug::Print( _L("value:%d"), value ); + break; + } + case ERational: + { + TInt nominator = Get32( valData ); + TInt denominator = Get32( valData+4 ); + ////RDebug::Print( _L("value:%d/%d"), nominator, denominator ); + if( denominator != 0 ) + { + value = nominator / denominator; + } + else + { + value = 0; + } + break; + } + case EUndefined: + { + + break; + } + case ESLong: + { + TUint32 val = Get32( valData ); + value = *(TInt*)(&val); + ////RDebug::Print( _L("value:%d"), svalue ); + + break; + } + case ESRational: + { + TUint32 uval = Get32( valData ); + TInt nominator = *(TInt*)(&uval); + uval = Get32( valData+4 ); + TInt denominator = *(TInt*)(&uval); + + if( denominator != 0 ) + { + value = nominator / denominator; + } + else + { + value = 0; + } + ////RDebug::Print( _L("value:%d/%d"), nominator, denominator ); + break; + } + default: + { + break; + } + } + + return value; + } + +TPtrC8 CExifParser::ThumbData() + { + return TPtrC8( iThumbData, iThumbLen ); + } + + +TPtr8 CExifParser::SaveL( const TPtrC8& aThumbData ) + { + iIntelByteOrder = true; + // + // Exif data cannot take more than 64KBytes + // + if (iSaveBuf) + { + delete[] iSaveBuf; + iSaveBuf = NULL; + } + + iSaveBuf = new( ELeave )TUint8[ 0x10000 ]; + iSaveBufPos = 0; + + if (iSaveDataBuf) + { + delete[] iSaveDataBuf; + iSaveDataBuf = NULL; + } + + iSaveDataBuf = new( ELeave )TUint8[ 0x10000 ]; + iSaveDataBufPos = 0; + + // + // header + // + Put8( 0x49 ); + Put8( 0x49 ); + Put8( 0x2a ); + Put8( 0x00 ); + Put32( 8 ); + + // + // Remove IFD0 SubIfd tag, will be regenerated + // + DeleteTag( EIfd0, 0x8769 ); + + // + // Save IFD0 + // + Put16( IfdCount( EIfd0 ) + 1 ); + TInt c = iEntry.Count(); + TInt i; + for( i=0; iiIfd == EIfd0 ) + { + StoreEntry( i ); + } + } + + // + // Save link to SubIfd ( this is a tag ) + // + TExifEntry* tagsub = new( ELeave )TExifEntry; + CleanupStack::PushL(tagsub); + tagsub->iTag = 0x8769; + tagsub->iIfd = EIfd0; + tagsub->iType = ELong; + tagsub->iCount = 1; + tagsub->iData = new( ELeave )TUint8[ 4 ]; + TUint8* dat = tagsub->iData; + TUint32 offset = iSaveBufPos + 12 + 4; // just after IFD1 link + if( iIntelByteOrder ) + { + dat[ 0 ] = offset & 255; offset >>= 8; + dat[ 1 ] = offset & 255; offset >>= 8; + dat[ 2 ] = offset & 255; offset >>= 8; + dat[ 3 ] = offset & 255; + } + else + { + dat[ 3 ] = offset & 255; offset >>= 8; + dat[ 2 ] = offset & 255; offset >>= 8; + dat[ 1 ] = offset & 255; offset >>= 8; + dat[ 0 ] = offset & 255; + } + iEntry.Append( tagsub ); + CleanupStack::Pop(); + StoreEntry( iEntry.Count()-1 ); + + // + // Save link to IFD1 ( not a tag, just pointer ) + // + TInt IFD1LinkPos = iSaveBufPos; + Put32( 0 ); + + // + // Remove Interoperability tag, will be regenerated + // + DeleteTag( ESubIfd, 0xa005 ); + c = iEntry.Count(); + + // + // Save SubIfd + // + Put16( IfdCount( ESubIfd ) ); + //RDebug::Print( _L(" SUBIFD count %x"), IfdCount( ESubIfd ) ); + for( i=0; iiIfd == ESubIfd ) + { + //RDebug::Print( _L(" SUBIFD %x"), e->iTag ); + StoreEntry( i ); + } + } +/* + TExifEntry* tagint = new( ELeave )TExifEntry; + tagint->iTag = 0xa005; + tagint->iIfd = ESubIfd; + tagint->iType = ELong; + tagint->iCount = 1; + tagint->iData = new( ELeave )TUint8[ 4 ]; + TUint8* dat2 = tagint->iData; + TUint32 offset2 = iSaveBufPos + 12 + 4; // just after IFD link + if( iIntelByteOrder ) + { + dat2[ 0 ] = offset2 & 255; offset2 >>= 8; + dat2[ 1 ] = offset2 & 255; offset2 >>= 8; + dat2[ 2 ] = offset2 & 255; offset2 >>= 8; + dat2[ 3 ] = offset2 & 255; + } + else + { + dat2[ 3 ] = offset2 & 255; offset2 >>= 8; + dat2[ 2 ] = offset2 & 255; offset2 >>= 8; + dat2[ 1 ] = offset2 & 255; offset2 >>= 8; + dat2[ 0 ] = offset2 & 255; + } + iEntry.Append( tagint ); + StoreEntry( iEntry.Count()-1 ); +*/ + Put32( 0 ); // IFD link + +/* + // + // Save Interoperability + // + Put16( IfdCount( EInteroperability ) ); + c = iEntry.Count(); + for( i=0; iiIfd == EInteroperability ) + { + StoreEntry( i ); + } + } + Put32( 0 ); // IFD link +*/ + // + // Save IFD1 ( thumbnail ) if new thumbnail given + // + if( aThumbData.Ptr() ) + { + TUint32 temp = iSaveBufPos; + iSaveBufPos = IFD1LinkPos; + Put32( temp ); + iSaveBufPos = temp; + } + + // + // Remove old thumbnail tags + // + c = iEntry.Count(); + i = 0; + while( i < iEntry.Count() ) + { + TExifEntry* e = iEntry[ i ]; + if( e->iIfd == EIfd1 ) + { + delete e; + iEntry.Remove( i ); + } + else + { + i++; + } + } + + // + // Add newe thumbnail tags ( if thumbnail given ) + // + TInt thumbData = 0; + if( aThumbData.Ptr() ) + { + AddTagL( EIfd1, 0x0103, (TUint16)6 ); // thumbnail = jpeg + + // thumbnail X-resolution 180/1 + AddTagL( EIfd1, 0x011a, (TUint32)180, (TUint32)1 ); + + // thumbnail Y-resolution 180/1 + AddTagL( EIfd1, 0x011b, (TUint32)180, (TUint32)1 ); + + // thumbnail resolution unit = inch + AddTagL( EIfd1, 0x0128, (TUint16)2 ); + + AddTagL( EIfd1, 0x0201, (TUint32)0 ); // thumb offset + AddTagL( EIfd1, 0x0202, (TUint32)aThumbData.Length() ); // thumb length + + + Put16( IfdCount( EIfd1 ) ); + c = iEntry.Count(); + for( i=0; iiIfd == EIfd1 ) + { + StoreEntry( i ); + } + } + + + thumbData = iSaveBufPos - 12 - 4; // tag 0x0201 data position + + Put32( 0 ); // IFD link + } + + // + // Copy tag data to same buffer with tags + // + Mem::Copy( iSaveBuf + iSaveBufPos, iSaveDataBuf, iSaveDataBufPos ); + TInt totalLength = iSaveBufPos + iSaveDataBufPos; + + // + // Copy thumbnail data to same buffer + // + if( thumbData ) + { + TInt temp = iSaveBufPos; + iSaveBufPos = thumbData; + Put32( totalLength ); + iSaveBufPos = temp; + + Mem::Copy( iSaveBuf + totalLength, aThumbData.Ptr(), aThumbData.Length() ); + totalLength += aThumbData.Length(); + } + // + // update data pointers + // + if( iSaveBufPos & 1 ) iSaveBufPos++; // data must be in even address + TInt doffset = iSaveBufPos; + c = iDataEntry.Count(); + for( i=0; i> 8 ) + ( ( offset & 0xff000000 ) >> 24 ); + + RDebug::Print( _L("Pos %d, Tag %x, type %d, count %d, offset %d, ifd %d"), iPosition-14, tag, type, count, offset, aIfd ); + + const TUint8* valData = NULL; + + TInt bytes = KTypeLength[ type ] * count; + + if( bytes > 4 ) + { + valData = &iData[ offset ]; + } + else + { + if( iIntelByteOrder ) + { + valData = (const TUint8*)(&offset); + } + else + { + // offset already reversed + // must use reversed offset + valData = (const TUint8*)(&revOffset); + } + } + + + TExifEntry* entry = new( ELeave )TExifEntry; + CleanupStack::PushL(entry); + entry->iIfd = aIfd; + entry->iTag = tag; + entry->iType = type; + entry->iCount = count; + + TUint32 value = 0; + + entry->iData = new( ELeave )TUint8[ bytes ]; + if( iIntelByteOrder ) + { + Mem::Copy( entry->iData, valData, bytes ); + switch( type ) + { + case EByte: + { + value = Get8( valData ); + break; + } + case EShort: + { + value = Get16( valData ); + break; + } + case ELong: + case ESLong: + { + value = Get32( valData ); + break; + } + default: + break; + } + } + else + { + + switch( type ) + { + case EByte: + { + value = Get8( valData ); + entry->iData[ 0 ] = value; + break; + } + case EAscii: + { + Mem::Copy( entry->iData, valData, bytes ); + //RDebug::Print( str ); + break; + } + case EShort: + { + entry->iData[ 1 ] = Get8( valData ); + entry->iData[ 0 ] = Get8( valData+1 ); + value = Get16( valData ); + break; + } + case ELong: + case ESLong: + { + entry->iData[ 3 ] = Get8( valData ); + entry->iData[ 2 ] = Get8( valData+1 ); + entry->iData[ 1 ] = Get8( valData+2 ); + entry->iData[ 0 ] = Get8( valData+3 ); + value = Get32( valData ); + break; + } + case ERational: + case ESRational: + { + entry->iData[ 3 ] = Get8( valData ); + entry->iData[ 2 ] = Get8( valData+1 ); + entry->iData[ 1 ] = Get8( valData+2 ); + entry->iData[ 0 ] = Get8( valData+3 ); + + entry->iData[ 7 ] = Get8( valData+4 ); + entry->iData[ 6 ] = Get8( valData+5 ); + entry->iData[ 5 ] = Get8( valData+6 ); + entry->iData[ 4 ] = Get8( valData+7 ); + break; + } + case EUndefined: + default: + { + Mem::Copy( entry->iData, valData, bytes ); + break; + } + } + } + //RDebug::Print( _L("value=%d"), value ); + + iEntry.Append( entry ); + CleanupStack::Pop(); + + + if( tag == 0x927c ) + { + //RDebug::Print( _L(" --MakerNote") ); + } + + if( tag == 0x8769 ) + { + iParseStack.Append( TParseStack( value, ESubIfd ) ); + //RDebug::Print( _L(" --SubIfd %d, %d"), value, iPosition ); + } + + if( tag == 0xa005 ) + { + iParseStack.Append( TParseStack( value, EInteroperability ) ); + //RDebug::Print( _L(" --Interoperability, %d, %d"), value, iPosition ); + } + + if( aIfd == EIfd1 ) + { + if( tag == 0x0201 ) + { + iThumbData = ((TUint8*)iData.Ptr()) + value; + } + if( tag == 0x0202 ) + { + iThumbLen = value; + } + } + } + + + +TInt CExifParser::FindTag( TInt aIfd, TUint16 aTag ) + { + TInt i; + TInt c = iEntry.Count(); + for( i=0; iiIfd == aIfd ) + { + if( iEntry[ i ]->iTag == aTag ) return i; + } + } + return -1; + } + + + +void CExifParser::StoreEntry( TInt aIndex ) + { + TExifEntry* e = iEntry[ aIndex ]; + + TUint32 count = e->iCount; + TUint32 data = 0; + TInt bytes = KTypeLength[ e->iType ] * count; + TUint8* d = e->iData; + + bool realData = false; + + if( bytes <= 4 ) + { + // store data to offset + TInt i; + TInt shift = 0; + for( i=0; iiTag ); + Put16( e->iType ); + Put32( count ); + if( realData ) + { + iDataEntry.Append( iSaveBufPos ); + } + Put32( data ); + } + + + +void CExifParser::Put8( TUint8 aData ) + { + iSaveBuf[ iSaveBufPos++ ] = aData; + } + + + +void CExifParser::Put16( TUint16 aData ) + { + Put8( aData & 255 ); + Put8( aData / 256 ); + /* + if( iIntelByteOrder ) + { + Put8( aData & 255 ); + Put8( aData / 256 ); + } + else + { + Put8( aData / 256 ); + Put8( aData & 255 ); + } + */ + } + + + +void CExifParser::Put32( TUint32 aData ) + { + Put16( aData & 65535 ); + Put16( aData / 65536 ); + /* + if( iIntelByteOrder ) + { + Put16( aData & 65535 ); + Put16( aData / 65536 ); + } + else + { + Put16( aData / 65536 ); + Put16( aData & 65535 ); + } + */ + } + + +TUint32 CExifParser::StoreData( TUint8* aData, TInt aCount ) + { + if( iSaveDataBufPos & 1 ) iSaveDataBufPos++; // must be even offset + TUint32 pos = iSaveDataBufPos; + TInt i; + for( i=0; iiIfd == aIfd ) + { + count++; + } + } + return count; + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TInt32 aValue ) + { + TUint32 uvalue = *( TUint32* )( &aValue ); + + TUint8* data = new( ELeave )TUint8[ 4 ]; + CleanupStack::PushL(data); + if( iIntelByteOrder ) + { + data[ 0 ] = uvalue & 255; + data[ 1 ] = ( uvalue >> 8 ) & 255; + data[ 2 ] = ( uvalue >> 16 ) & 255; + data[ 3 ] = ( uvalue >> 24 ) & 255; + } + else + { + data[ 3 ] = uvalue & 255; + data[ 2 ] = ( uvalue >> 8 ) & 255; + data[ 1 ] = ( uvalue >> 16 ) & 255; + data[ 0 ] = ( uvalue >> 24 ) & 255; + } + AddTagL( aIfd, aTag, ESLong, data, 4 ); + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TUint32 aValue ) + { + TUint8* data = new( ELeave )TUint8[ 4 ]; + CleanupStack::PushL(data); + if( iIntelByteOrder ) + { + data[ 0 ] = aValue & 255; + data[ 1 ] = ( aValue >> 8 ) & 255; + data[ 2 ] = ( aValue >> 16 ) & 255; + data[ 3 ] = ( aValue >> 24 ) & 255; + } + else + { + data[ 3 ] = aValue & 255; + data[ 2 ] = ( aValue >> 8 ) & 255; + data[ 1 ] = ( aValue >> 16 ) & 255; + data[ 0 ] = ( aValue >> 24 ) & 255; + } + AddTagL( aIfd, aTag, ELong, data, 4 ); + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TUint16 aValue ) + { + TUint8* data = new( ELeave )TUint8[ 2 ]; + CleanupStack::PushL(data); + if( iIntelByteOrder ) + { + data[ 0 ] = aValue & 255; + data[ 1 ] = aValue / 256; + } + else + { + data[ 1 ] = aValue & 255; + data[ 0 ] = aValue / 256; + } + AddTagL( aIfd, aTag, EShort, data, 2 ); + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TUint8 aValue ) + { + TUint8* data = new( ELeave )TUint8[ 1 ]; + CleanupStack::PushL(data); + *data = aValue; + AddTagL( aIfd, aTag, EByte, data, 1 ); + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TPtrC8 aData ) + { + TUint8* data = new( ELeave )TUint8[ aData.Length() ]; + CleanupStack::PushL(data); + Mem::Copy( data, aData.Ptr(), aData.Length() ); + AddTagL( aIfd, aTag, EUndefined, data, aData.Length() ); + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, const TUint8* aValue ) + { + TInt l = User::StringLength( aValue ) + 1; + TUint8* data = new( ELeave )TUint8[ l ]; + CleanupStack::PushL(data); + Mem::Copy( data, aValue, l ); + AddTagL( aIfd, aTag, EAscii, data, l ); + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TUint32 aNominator, TUint32 aDenominator ) + { + TUint8* data = new( ELeave )TUint8[ 8 ]; + CleanupStack::PushL(data); + if( iIntelByteOrder ) + { + data[ 0 ] = aNominator & 255; + data[ 1 ] = ( aNominator >> 8 ) & 255; + data[ 2 ] = ( aNominator >> 16 ) & 255; + data[ 3 ] = ( aNominator >> 24 ) & 255; + data[ 4 ] = aDenominator & 255; + data[ 5 ] = ( aDenominator >> 8 ) & 255; + data[ 6 ] = ( aDenominator >> 16 ) & 255; + data[ 7 ] = ( aDenominator >> 24 ) & 255; + } + else + { + data[ 3 ] = aNominator & 255; + data[ 2 ] = ( aNominator >> 8 ) & 255; + data[ 1 ] = ( aNominator >> 16 ) & 255; + data[ 0 ] = ( aNominator >> 24 ) & 255; + data[ 7 ] = aDenominator & 255; + data[ 6 ] = ( aDenominator >> 8 ) & 255; + data[ 5 ] = ( aDenominator >> 16 ) & 255; + data[ 4 ] = ( aDenominator >> 24 ) & 255; + } + AddTagL( aIfd, aTag, ERational, data, 8 ); + + CleanupStack::Pop(); + } + + + +void CExifParser::AddTagL( TInt aIfd, TUint16 aTag, TInt aType, TUint8* aData, TInt aDataLen ) + { + TExifEntry* e = new( ELeave )TExifEntry; + e->iIfd = aIfd; + e->iTag = aTag; + e->iType = aType; + e->iData = aData; + e->iCount = aDataLen / KTypeLength[ aType ]; + iEntry.Append( e ); + } + + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/src/CFbsBitmapHack.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/src/CFbsBitmapHack.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,33 @@ +/* +* 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: +* +*/ + + +#include "CFbsBitmapHack.h" + + +void CFbsBitmapHack::DoLock() + { + LockHeap(); + } + + +void CFbsBitmapHack::DoUnlock() + { + UnlockHeap(); + } + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/src/CFilterStack.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/src/CFilterStack.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,268 @@ +/* +* 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: +* +*/ + + +#include "CFilterStack.h" +#include + +// Debug logger definitions +#include "imageeditordebugutils.h" +_LIT(KMIAWrapperLogFile,"EngineWrapper.log"); + +CFilterStack* CFilterStack::NewL() + { + CFilterStack* self = new( ELeave )CFilterStack(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + + + +CFilterStack::~CFilterStack() + { + iStack.ResetAndDestroy(); + } + + + +CFilterStack::CFilterStack() + { + + } + + + +void CFilterStack::ConstructL() + { + /* + TFileName fileName( _L("c:\\filterscript.txt") ); + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + RFile file; + User::LeaveIfError( file.Open( fs, fileName, EFileRead ) ); + CleanupClosePushL( file ); + + TInt l = 0; + file.Size( l ); + TUint8* t = new TUint8[ l ]; + CleanupStack::PushL( t ); + TPtr8 txt8o( t, l ); + User::LeaveIfError( file.Read( txt8o ) ); + TPtrC8 txt8( txt8o ); + TInt strl = txt8.Find( _L8(" ") ); + + while( strl > 0 ) + { + TPtrC8 filterName( txt8.Ptr(), strl ); + txt8.Set( txt8.Mid( strl+1 ) ); + + strl = txt8.Find( _L8("\r") ); + TPtrC8 filterParam( txt8.Ptr(), strl ); + txt8.Set( txt8.Mid( strl+1 ) ); + + if( txt8.Length() > 0 ) + { + if( txt8[ 0 ] == '\n' ) + { + txt8.Set( txt8.Mid( 1 ) ); + } + } + + strl = txt8.Find( _L8(" ") ); + + TFilter* f = new( ELeave )TFilter; + TInt error = KErrNone; + + if( filterName.Compare( _L8("jpegsource") ) == 0 ) + { + error = f->iLibrary.Load( _L("FilterJpegSource.dll" ) ); + } + else if( filterName.Compare( _L8("jpegtarget") ) == 0 ) + { + error = f->iLibrary.Load( _L("FilterJpegTarget.dll" ) ); + } + else if( filterName.Compare( _L8("negate") ) == 0 ) + { + error = f->iLibrary.Load( _L("FilterNegate.dll" ) ); + } + else if( filterName.Compare( _L8("buffer") ) == 0 ) + { + error = f->iLibrary.Load( _L("FilterBuffer.dll" ) ); + } + + User::LeaveIfError( error ); + + MImageFilter*& filter = f->iFilter; + filter = (MImageFilter*)(f->iLibrary.Lookup( 1 )()); + + if( filter == NULL ) + { + delete f; + User::Panic( _L("Could not load filter"), 0 ); + } + + f->iFilter = filter; + iStack.Append( f ); + InitStack(); + TBuf< 100 > cmd16; + cmd16.Copy( filterParam ); + filter->CmdL( cmd16 ); + } + + + CleanupStack::PopAndDestroy( 3 ); // t, file, fs + */ + } + + + +void CFilterStack::InitStack() + { + TInt c = iStack.Count(); + TInt i; + for( i=0; i= 0 ) + { + iStack[ i ]->iFilter->SetChild( iStack[ childn ]->iFilter ); + } + if( parentn < c ) + { + iStack[ i ]->iFilter->SetParent( iStack[ parentn ]->iFilter ); + } + } + } + + + +MImageFilter* CFilterStack::Filter( TInt aPosition ) + { + return iStack[ aPosition ]->iFilter; + } + + + +void CFilterStack::AddFilterL( const TDesC& aName ) + { + AddFilterL( aName, iStack.Count() ); + } + + + +void CFilterStack::AddFilterL( const TDesC& aName, TInt aPosition ) + { + LOG ( KMIAWrapperLogFile, "CFilterStack::AddFilterL" ); + + TFilter* f = new( ELeave )TFilter; + CleanupStack::PushL(f); + + LOG ( KMIAWrapperLogFile, "CFilterStack::AddFilterL: Loading" ); + User::LeaveIfError( f->iLibrary.Load( aName ) ); + MImageFilter*& filter = f->iFilter; + + LOG ( KMIAWrapperLogFile, "CFilterStack::AddFilterL: Lookup" ); + filter = (MImageFilter*)(f->iLibrary.Lookup( 1 )()); + if( filter == NULL ) + { + LOG ( KMIAWrapperLogFile, "CFilterStack::AddFilterL: Filter null" ); + f->iLibrary.Close(); + User::Leave( KErrNoMemory ); + } + f->iFilter = filter; + + if( iStack.Count() == aPosition ) + { + iStack.Append( f ); + } + else + { + /* + iStack.Append( 0 ); + + TInt s = aPosition; + TInt e = iStack.Count()-2; + TInt i; + for( i=s; iiFilter->CmdL( aCmd ); + } + + + + +TInt CFilterStack::NumFilters() + { + return iStack.Count(); + } diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/src/CJpeg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/src/CJpeg.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,2370 @@ +/* +* 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: +* +*/ + + + +#include "CJpeg.h" +#include + + +const TUint8 KQuantIndex[ 3 ] = { 0,1,1 }; +const TUint8 KHuffIndex[ 3 ] = { 0,1,1 }; + + + + +const TUint8 KZigZag[] = { + 0, 8, 1, 2, 9, 16, 24, 17, + 10, 3, 4, 11, 18, 25, 32, 40, + 33, 26, 19, 12, 5, 6, 13, 20, + 27, 34, 41, 48, 56, 49, 42, 35, + 28, 21, 14, 7, 15, 22, 29, 36, + 43, 50, 57, 58, 51, 44, 37, 30, + 23, 31, 38, 45, 52, 59, 60, 53, + 46, 39, 47, 54, 61, 62, 55, 63 + }; + + + + + + +/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */ +/* IMPORTANT: these are only valid for 8-bit data precision! */ + +const TUint8 bits_dc_luminance[17] = +{ /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; +const TUint8 val_dc_luminance[] = +{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + +const TUint8 bits_dc_chrominance[17] = +{ /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; +const TUint8 val_dc_chrominance[] = +{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + +const TUint8 bits_ac_luminance[17] = +{ /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; +const TUint8 val_ac_luminance[] = +{ 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa +}; + +const TUint8 bits_ac_chrominance[17] = +{ /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; + +const TUint8 val_ac_chrominance[] = +{ 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa +}; + +const TUint8 KExifHeader[] = "Exif"; + +class THuffman + { + public: + TInt8 iLength[ 256 ]; + TUint8 iSymbol[ 256 ]; + TUint8 iSearch[ 65536 ]; + }; + + +CJpeg* CJpeg::NewL() + { + CJpeg* self = NewLC(); + CleanupStack::Pop( self ); + return self; + } + + +CJpeg* CJpeg::NewLC() + { + CJpeg* self = new( ELeave )CJpeg(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + +CJpeg::~CJpeg() + { + delete iHuffman[ 0 ]; + delete iHuffman[ 1 ]; + delete iHuffman[ 2 ]; + delete iHuffman[ 3 ]; + + delete iQt[ 0 ]; + delete iQt[ 1 ]; + delete iQt[ 2 ]; + delete iQt[ 3 ]; + + iCurrentQt = NULL; + iExifData = NULL; + + //iBlock.Reset(); + delete iBlock; + + delete iBuffer; + delete iC[ 0 ]; + delete iC[ 1 ]; + delete iC[ 2 ]; + + //iDebug.Close(); + //iFs.Close(); + } + +CJpeg::CJpeg() + { + + } + +void CJpeg::ConstructL() + { + } + + + + +void CJpeg::OpenL( const TFileName& aFile ) + { + if (iBuffer) + { + delete iBuffer; + iBuffer = NULL; + } + + RFs fs; + User::LeaveIfError( fs.Connect() ); + CleanupClosePushL( fs ); + + RFile file; + TInt err = file.Open( fs, aFile, EFileRead | EFileShareReadersOnly ); + if (KErrNone != err) + { + User::LeaveIfError( file.Open( fs, aFile, EFileRead | EFileShareAny ) ); + } + CleanupClosePushL( file ); + + TInt size; + file.Size( size ); + iBuffer = new( ELeave )TUint8[ size + 2 ]; + TPtr8 ptr( iBuffer, size ); + file.Read( ptr ); + + CleanupStack::PopAndDestroy( 2 ); // file, fs + OpenL( ptr ); + } + + + +void CJpeg::OpenL( const TPtr8& aData ) + { + //iFs.Connect(); + //iDebug.Replace( iFs, _L("e:\\TestData\\jpdeb.txt"), EFileWrite ); + + EnableRgvConv(); + + iBuffer = (TUint8*)aData.Ptr(); + + // if used again, all variables should be cleared + iBuf = 0; + iBufBits = 0; + + delete iHuffman[ 0 ]; + delete iHuffman[ 1 ]; + delete iHuffman[ 2 ]; + delete iHuffman[ 3 ]; + iHuffman[ 0 ] = 0; + iHuffman[ 1 ] = 0; + iHuffman[ 2 ] = 0; + iHuffman[ 3 ] = 0; + + //iDebug.Write( _L8("d1\n") ); + + // + // This is only needed if no huffman tables found + // + //CreateDefaultHuffmanL(); + + + iQt[ 0 ] = 0; + iQt[ 1 ] = 0; + iQt[ 2 ] = 0; + iQt[ 3 ] = 0; + + // + + //TBitmapHandle bm; + //bm.iData = 0; + + TBool moreChunks = ETrue; + TBool possibleChunk = EFalse; + +// TInt pos; + + while( moreChunks ) + { + TUint8 b = iBuffer[ iBufPos++ ]; + if( possibleChunk ) + { + possibleChunk = EFalse; + switch( b ) + { + case 0xd8: // start of image + { + //RDebug::Print( _L("--Jpeg start of image") ); + //iDebug.Write( _L8("d2\n") ); + break; + } + case 0xe0: // JFIF application segment + { + //RDebug::Print( _L("--Jpeg application segment") ); + //iDebug.Write( _L8("d3\n") ); + break; + } + case 0xe1: // APP1 segment, possible EXIF + { + //iDebug.Write( _L8("d4\n") ); + //RDebug::Print( _L("--Jpeg app1 segment") ); + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + l -= 2; + + // this could be used to read exif data: + //TPtrC8 exifData( iBuffer + iBufPos, l ); + + // Check that there is "Exif" header in the data + const TUint8* pos = &iBuffer[ iBufPos ]; + if (Mem::Compare(pos, 2, &KExifHeader[0], 2 )) + { + iBufPos += l; + break; + } + + // suppose there is exif here + // exif header is 6 bytes ( 45 78 69 66 00 00 "Exif.." ) + iBufPos += 6; + l -= 6; + + iExifData = iBuffer + iBufPos; + iExifDataLength = l; + + iBufPos += l; + break; + } + case 0xe2: + case 0xe3: + case 0xe4: + case 0xe5: + case 0xe6: + case 0xe7: + case 0xe8: + case 0xe9: + case 0xea: + case 0xeb: + case 0xec: + case 0xed: + case 0xee: + case 0xef: + { + //iDebug.Write( _L8("d5\n") ); + // + // Unused segment, skip + // + //RDebug::Print( _L("--Jpeg unused tag %x"), b ); + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + + iBufPos += l-2; + break; + } + case 0xdb: // Quantization table + { + //iDebug.Write( _L8("d6\n") ); + + //RDebug::Print( _L("--Jpeg quant table") ); + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + ////RDebug::Print( _L("Start:%x length:%d"), iBufPos-2, l ); + TInt nqt = l / 65; + TInt i; + + // one or more quantization table + for( i=0; i> 4; + + if (iQt[ n ]) + { + delete iQt[ n ]; + iQt[ n ] = NULL; + } + + iQt[ n ] = new( ELeave )TUint8[ 64 ]; + TInt j; + for( j=0; j<64; j++ ) + { + iQt[ n ][ j ] = iBuffer[ iBufPos++ ]; + //RDebug::Print( _L("Quant %d:first=%d"), j, iQt[ n ][ j ] ); + } + } + + break; + } + case 0xc0: // start of frame ( SOF ) + { + //iDebug.Write( _L8("d7\n") ); + + //RDebug::Print( _L("--Jpeg start of frame") ); + + //TInt length = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; + iBufPos += 2; + + ////RDebug::Print( _L("Start:%x length:%d"), iBufPos-2, length ); + + // not used: + // TInt precision = iBuffer[ iBufPos ]; + iBufPos++; + + // height + TInt t = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + iData.iSize.iHeight = t; + + // width + t = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + iData.iSize.iWidth = t; + + // component data + iNumComponents = iBuffer[ iBufPos++ ]; + + TInt i; + for( i=0; i> 4; + iComponent[ i ].iYFactor = samplingFactor & 15; + iComponent[ i ].iQuantTable = quantizationTable; + iComponent[ i ].iID = compID; + //RDebug::Print( _L("component %d = %d"), i, compID ); + //RDebug::Print( _L("component %d quanttable=%d"), i, quantizationTable ); + //RDebug::Print( _L("component %d factor = %d,%d"), iComponent[ i ].iXFactor, iComponent[ i ].iYFactor ); + } + + TInt xBlocks = 0; + TInt yBlocks = 0; + + for( i=0; i xBlocks ) + { + xBlocks = x; + } + if( y > yBlocks ) + { + yBlocks = y; + } + } + + iData.iBlockSize.iWidth = xBlocks * 8; + iData.iBlockSize.iHeight = yBlocks * 8; + + TSize size = iData.iSize; + size.iWidth /= iData.iBlockSize.iWidth; + size.iHeight /= iData.iBlockSize.iHeight; + + if( iData.iSize.iWidth & ( iData.iBlockSize.iWidth - 1 ) ) + { + size.iWidth++; + } + + if( iData.iSize.iHeight & ( iData.iBlockSize.iHeight - 1 ) ) + { + size.iHeight++; + } + + iData.iSizeInBlocks = size; + + + break; + } + case 0xc1: + { + //iDebug.Write( _L8("d8\n") ); + //RDebug::Print( _L("--Jpeg tag 0xc1, extended sequential, unsupported") ); + + // Extended sequential Jpeg, not supported + User::Leave( KErrNotSupported ); + break; + }; + case 0xc2: + { + //iDebug.Write( _L8("d9\n") ); + //RDebug::Print( _L("--Jpeg tag 0xc2, Progressive DCT, unsupported") ); + + // Progressive DCT jpeg, not supported + User::Leave( KErrNotSupported ); + break; + }; + case 0xc3: + { + //iDebug.Write( _L8("d10\n") ); + + //RDebug::Print( _L("--Jpeg tag 0xc1, Lossless, unsupported") ); + // Lossless ( sequential ) Jpeg, not supported + User::Leave( KErrNotSupported ); + break; + }; + + case 0xc5: + case 0xc6: + case 0xc7: + case 0xc8: + case 0xc9: + case 0xca: + case 0xcb: + case 0xcc: + case 0xcd: + case 0xce: + case 0xcf: + { + //iDebug.Write( _L8("d11\n") ); + + //RDebug::Print( _L("--Jpeg tag %x, unknown"), b ); + User::Leave( KErrNotSupported ); + break; + }; + case 0xc4: // huffman table + { + //iDebug.Write( _L8("d12\n") ); + + //RDebug::Print( _L("--Jpeg huffman table") ); + TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + + TInt table = 0; + + TInt n = 0; + + // one or more huffman tables + while( niSymbol[ i ] = v; + n++; + } + + + // Generate huffman lookup tables ( huffSize, table ) + + + TInt ll; + TInt p = 0; + for( ll=0; ll<16; ll++ ) + { + for( i=0; iiLength[ p++ ] = ll+1; + } + } + + TInt code = 0; + huff->iLength[ p ] = 0; + TInt si = huff->iLength[ 0 ]; + TInt lastP = p; + + TInt hc[ 256 ]; + p = 0; + + while( huff->iLength[ p ] ) + { + while( huff->iLength[ p ] == si ) + { + hc[ p++ ] = code++; + } + code *= 2; + si++; + } + + ll = 65536; + for( i=lastP-1; i>=0; i-- ) + { + TInt t = 16 - huff->iLength[ i ]; + TInt k = hc[ i ] * ( 1 << t ); + TInt j; + for( j=k; jiSearch[ j ] = i; + } + ll = k; + } + + i = ( table & 16 ) / 8 + ( table & 15 ); + delete iHuffman[ i ]; + iHuffman[ i ] = huff; + } + + break; + } +// + case 0xda: // start of scan ( SOS ) + { + //iDebug.Write( _L8("d13\n") ); + + //RDebug::Print( _L("--Jpeg start of scan") ); + //TInt l = 256 * iBuffer[ iBufPos ] + iBuffer[ iBufPos + 1 ]; iBufPos += 2; + iBufPos += 2; + + TInt numComponents = iBuffer[ iBufPos++ ]; + //RDebug::Print( _L("JPEG: number of components=%d"), numComponents ); + if( numComponents != iNumComponents ) + { + // non-interleaved( planar ) not supported + User::Leave( KErrNotSupported ); + } + //RDebug::Print( _L("Number of components=%d"), numComponents ); + + TInt componentHt[ 3 ]; + + TInt i; + for( i=0; irgb scale + TInt bw = iBm.iSize.iWidth; + TInt bh = iBm.iSize.iHeight; + iYxa = 256 * ( 8 * iComponent[ 0 ].iXFactor ) / bw; + iYya = 256 * ( 8 * iComponent[ 0 ].iYFactor ) / bh; + iUxa = 256 * ( 8 * iComponent[ 1 ].iXFactor ) / bw; + iUya = 256 * ( 8 * iComponent[ 1 ].iYFactor ) / bh; + iVxa = 256 * ( 8 * iComponent[ 2 ].iXFactor ) / bw; + iVya = 256 * ( 8 * iComponent[ 2 ].iYFactor ) / bh; + + // + // Select YUV -> RGB function + // + iYuv2rgbFunc = Yuv2RgbFree; // default, handles all combinations + + if( iComponent[ 0 ].iXFactor == 2 && iComponent[ 0 ].iYFactor == 1 && + iComponent[ 1 ].iXFactor == 1 && iComponent[ 1 ].iYFactor == 1 && + iComponent[ 2 ].iXFactor == 1 && iComponent[ 2 ].iYFactor == 1 ) + { + iYuv2rgbFunc = Yuv2Rgb21_11_11; + } + else if( iComponent[ 0 ].iXFactor == 2 && iComponent[ 0 ].iYFactor == 2 && + iComponent[ 1 ].iXFactor == 1 && iComponent[ 1 ].iYFactor == 1 && + iComponent[ 2 ].iXFactor == 1 && iComponent[ 2 ].iYFactor == 1 ) + { + iYuv2rgbFunc = Yuv2Rgb22_11_11; + } + + iLoadBlockPrepared = true; + } + + + +void CJpeg::ScanRandomL() + { + if( iRandomScanned ) + { + return; + } + // + // Set file read position + // + iBufPos = iImageDataStart; + iBufBits = 0; + iBuf = 0; + + // + // Reserve memory for random access tables + // + TInt numBlocks = iData.iSizeInBlocks.iWidth * iData.iSizeInBlocks.iHeight; + iBlock = new( ELeave )TJpegBlock[ numBlocks ]; + + + TInt bw = iData.iSizeInBlocks.iWidth; + TInt bh = iData.iSizeInBlocks.iHeight; + + TInt bx; + TInt by; + + TInt c1 = 0; + TInt c2 = 0; + TInt c3 = 0; + + //TInt blockNum = 0; + + for( by=0; by= iData.iSizeInBlocks.iWidth ) + { + blkNum = -1; + } + //if( blkNum < 0 || blkNum >= iBlock.Count() ) + if( blkNum < 0 || blkNum >= iNumBlocks ) + { + Mem::FillZ( bm.iData, iBlkPixels * sizeof( TUint32 ) ); + return bm; + } + + TJpegBlock& blk = iBlock[ blkNum ]; + + iBuf = blk.iBuf; + iBufBits = blk.iBufBits; + iBufPos = blk.iOffset; + + // + // Decode block + // + + TInt c1 = blk.iY; + TInt c2 = blk.iU; + TInt c3 = blk.iV; + + + /////////// + TInt x; + TInt y; + TInt xx; + TInt yy; + TInt w; + TInt* p; + + // Y-component + iCurrentHuffman = 0; + iCurrentQt = iQt[ 0 ]; + xx = iComponent[ 0 ].iXFactor; + yy = iComponent[ 0 ].iYFactor; + w = xx * 8; + p = iBlk; + iDct[ 0 ] = c1; + + for( y=0; yRGB + // + + TInt bw = bm.iSize.iWidth; + TInt bh = bm.iSize.iHeight; + + + TInt y1y = 0; + TInt y1u = 0; + TInt y1v = 0; + + TInt yw = iComponent[ 0 ].iXFactor * 8; + TInt uw = iComponent[ 1 ].iXFactor * 8; + TInt vw = iComponent[ 2 ].iXFactor * 8; + + TUint32* prgb = rgb; + for( y=0; y 255 ) cr = 255; + if( cg > 255 ) cg = 255; + if( cb > 255 ) cb = 255; + + //rgb[ x + y * bw ] = cr * 65536 + cg * 256 + cb; + *prgb++ = cr * 65536 + cg * 256 + cb; + } + y1y += iYya; + y1u += iUya; + y1v += iVya; + } + + CleanupStack::Pop(); + return bm; + } + + + + +void CJpeg::DecodeBlock() + { + // //RDebug::Print( _L("DecodeBlock()") ); + // + // Dummy version of block decode + // only traverses through huffman data + // and collects DC-values + // + THuffman* h = iHuffman[ iCurrentHuffman ]; + + TInt k; + for( k=0; k<64; k++ ) + { + TInt v = Buf16(); + TInt index = h->iSearch[ v ]; + TInt symbol = h->iSymbol[ index ]; + BufFwd( h->iLength[ index ] ); + + TInt nullCount = 0; + if( k>0 ) + { + nullCount = symbol >> 4; + symbol &= 15; + } + + v = BufBits( symbol ); + if( v < ( 1 << ( symbol-1 ) ) ) + { + v += 1 - ( 1 << symbol ); + } + + if( k ) + { + if( nullCount==0 && v==0 ) + { + k = 64; + break; + } + else if( nullCount==15 && v==0 ) + { + k += 15; + } + else + { + k += nullCount; + } + } + else + { + iDct[ 0 ] += v * iCurrentQt[ 0 ]; + h = iHuffman[ iCurrentHuffman+2 ]; + } + } + } + + + +void CJpeg::DecodeBlock2() + { + // + // Real block decoder + // fills iDct table and calls Idct() function + // + THuffman* h = iHuffman[ iCurrentHuffman ]; + + TInt k; + + for( k=1; k<64; k++ ) + { + iDct[ k ] = 0; + } + + for( k=0; k<64; k++ ) + { + TInt v = Buf16(); + TInt index = h->iSearch[ v ]; + TInt symbol = h->iSymbol[ index ]; + BufFwd( h->iLength[ index ] ); + + TInt nullCount = 0; + if( k>0 ) + { + nullCount = symbol >> 4; + symbol &= 15; + } + + v = BufBits( symbol ); + + if( v < ( 1 << ( symbol-1 ) ) ) + { + v += 1 - ( 1 << symbol ); + } + + if( k ) + { + if( nullCount==0 && v==0 ) + { + k = 64; + break; + } + else if( nullCount==15 && v==0 ) + { + k += 15; + } + else + { + k += nullCount; + iDct[ KZigZag[ k ] ] = v * iCurrentQt[ k ]; + } + } + else + { + iDct[ 0 ] += v * iCurrentQt[ 0 ]; + h = iHuffman[ iCurrentHuffman+2 ]; + } + + } + Idct(); + } + + + +void CJpeg::DecodeBlock3() + { + // + // Real block decoder + // fills iDct table and calls Idct() function + // + THuffman* h = iHuffman[ iCurrentHuffman ]; + + TInt k; + + for( k=1; k<64; k++ ) + { + iDct[ k ] = 0; + } + + for( k=0; k<64; k++ ) + { + TInt v = Buf16(); + TInt index = h->iSearch[ v ]; + TInt symbol = h->iSymbol[ index ]; + BufFwd( h->iLength[ index ] ); + + TInt nullCount = 0; + if( k>0 ) + { + nullCount = symbol >> 4; + symbol &= 15; + } + + v = BufBits( symbol ); + + if( v < ( 1 << ( symbol-1 ) ) ) + { + v += 1 - ( 1 << symbol ); + } + + if( k ) + { + if( nullCount==0 && v==0 ) + { + k = 64; + break; + } + else if( nullCount==15 && v==0 ) + { + k += 15; + } + else + { + k += nullCount; + iDct[ KZigZag[ k ] ] = v * iCurrentQt[ k ]; + } + } + else + { + iDct[ 0 ] += v * iCurrentQt[ 0 ]; + h = iHuffman[ iCurrentHuffman+2 ]; + } + + } + } + + + + +void CJpeg::Idct() + { + TInt even[ 4 ]; + TInt odd[ 4 ]; + TInt res[ 64 ]; + + TInt* p = iDct; + + for( TInt x=0; x<8; x++ ) + { + TInt x0 = *p++; + TInt x1 = *p++; + TInt x2 = *p++; + TInt x3 = *p++; + TInt x4 = *p++; + TInt x5 = *p++; + TInt x6 = *p++; + TInt x7 = *p++; + + TInt tx0 = x0; + x0 = (x0 + x4) * 181; + x4 = (tx0 - x4) * 181; + + TInt tx2 = x2; + TInt tx6 = x6; + x2 = tx2 * 236 + tx6 * 98; + x6 = tx2 * 98 - tx6 * 236; + + even[0] = x0 + x2; + even[1] = x4 + x6; + even[2] = x4 - x6; + even[3] = x0 - x2; + + odd[0] = x1 * 251 + x5 * 142 + x3 * 212 + x7 * 49; + odd[1] = x1 * 213 - x5 * 251 - x3 * 50 - x7 * 142; + odd[2] = x1 * 142 + x5 * 50 - x3 * 251 + x7 * 213; + odd[3] = x1 * 50 + x5 * 213 - x3 * 142 - x7 * 251; + + res[x + 0] = even[0] + odd[0]; + res[x + 8] = even[1] + odd[1]; + res[x + 16] = even[2] + odd[2]; + res[x + 24] = even[3] + odd[3]; + res[x + 32] = even[3] - odd[3]; + res[x + 40] = even[2] - odd[2]; + res[x + 48] = even[1] - odd[1]; + res[x + 56] = even[0] - odd[0]; + } + + p = res; + TInt* tp = iBlk; + + for( TInt y=0; y<8; y++ ) + { + TInt x0 = *p++; + TInt x1 = *p++; + TInt x2 = *p++; + TInt x3 = *p++; + TInt x4 = *p++; + TInt x5 = *p++; + TInt x6 = *p++; + TInt x7 = *p++; + + TInt tx0 = x0; + x0 = (x0 + x4) * 181; + x4 = (tx0 - x4) * 181; + + TInt tx2 = x2; + TInt tx6 = x6; + x2 = tx2 * 236 + tx6 * 98; + x6 = tx2 * 98 - tx6 * 236; + + even[0] = x0 + x2; + even[1] = x4 + x6; + even[2] = x4 - x6; + even[3] = x0 - x2; + + odd[0] = x1 * 251 + x5 * 142 + x3 * 212 + x7 * 49; + odd[1] = x1 * 213 - x5 * 251 - x3 * 50 - x7 * 142; + odd[2] = x1 * 142 + x5 * 50 - x3 * 251 + x7 * 213; + odd[3] = x1 * 50 + x5 * 213 - x3 * 142 - x7 * 251; + + *tp++ = (even[0] + odd[0]) / 262144 + 128; + *tp++ = (even[1] + odd[1]) / 262144 + 128; + *tp++ = (even[2] + odd[2]) / 262144 + 128; + *tp++ = (even[3] + odd[3]) / 262144 + 128; + *tp++ = (even[3] - odd[3]) / 262144 + 128; + *tp++ = (even[2] - odd[2]) / 262144 + 128; + *tp++ = (even[1] - odd[1]) / 262144 + 128; + *tp++ = (even[0] - odd[0]) / 262144 + 128; + } + + // + // Clamp + // + tp = iBlk; + TInt* tpe = tp + 64; + while( tp < tpe ) + { + if( *tp < 0 ) *tp = 0; + if( *tp > 255 ) *tp = 255; + tp++; + } + } + + + +void CJpeg::IdctHalf() + { + TInt even[ 4 ]; + TInt odd[ 4 ]; + TInt res[ 64 ]; + + TInt* p = iDct; + + for( TInt x=0; x<4; x++ ) + { + TInt x0 = *p++; + TInt x1 = *p++; + TInt x2 = *p++; + TInt x3 = *p++; + p += 4; + + x0 = x0 * 181; + + TInt x6 = x2 * 98; + x2 = x2 * 236; + + even[0] = x0 + x2; + even[1] = x0 + x6; + even[2] = x0 - x6; + even[3] = x0 - x2; + + odd[0] = x1 * 251 + x3 * 212; + odd[1] = x1 * 213 - x3 * 50; + odd[2] = x1 * 142 - x3 * 251; + odd[3] = x1 * 50 - x3 * 142; + + res[x + 0] = even[0] + odd[0]; + res[x + 4] = even[2] + odd[2]; + res[x + 8] = even[3] - odd[3]; + res[x + 12] = even[1] - odd[1]; + } + + p = res; + TInt* tp = iBlk; + + for( TInt y=0; y<4; y++ ) + { + TInt x0 = *p++; + TInt x1 = *p++; + TInt x2 = *p++; + TInt x3 = *p++; + + x0 = x0 * 181; + + TInt x6 = x2 * 98; + x2 = x2 * 236; + + even[0] = x0 + x2; + even[1] = x0 + x6; + even[2] = x0 - x6; + even[3] = x0 - x2; + + odd[0] = x1 * 251 + x3 * 212; + odd[1] = x1 * 213 - x3 * 50; + odd[2] = x1 * 142 - x3 * 251; + odd[3] = x1 * 50 - x3 * 142; + + *tp++ = (even[0] + odd[0]) / 262144 + 128; + *tp++ = (even[2] + odd[2]) / 262144 + 128; + *tp++ = (even[3] - odd[3]) / 262144 + 128; + *tp++ = (even[1] - odd[1]) / 262144 + 128; + } + + // + // Clamp + // + tp = iBlk; + TInt* tpe = tp + 16; + while( tp < tpe ) + { + if( *tp < 0 ) *tp = 0; + if( *tp > 255 ) *tp = 255; + tp++; + } + } + + + + +const TJpegData& CJpeg::Info() + { + return iData; + } + + +TPtrC8 CJpeg::ExifData() + { + return TPtrC8( iExifData, iExifDataLength ); + } + + + +void CJpeg::CreateHuffmanL( THuffman* aHuffman, const TUint8* aBits, const TUint8* aVal ) + { + // + // default huffman lookup table generator + // + + TInt huffSize[ 16 ]; + TInt numSymbols = 0; + TInt i; + + for( i=0; i<16; i++ ) + { + TInt size = aBits[ i+1 ]; + huffSize[ i ] = size; + numSymbols += size; + } + + for( i=0; iiSymbol[ i ] = aVal[ i ]; + } + + TInt l; + TInt p = 0; + for( l=0; l<16; l++ ) + { + for( i=0; iiLength[ p++ ] = l+1; + } + } + + TInt code = 0; + aHuffman->iLength[ p ] = 0; + TInt si = aHuffman->iLength[ 0 ]; + TInt lastP = p; + + TInt hc[ 256 ]; + p = 0; + + while( aHuffman->iLength[ p ] ) + { + while( aHuffman->iLength[ p ] == si ) + { + hc[ p++ ] = code++; + } + code *= 2; + si++; + } + + l = 65536; + for( i=lastP-1; i>=0; i-- ) + { + TInt t = 16 - aHuffman->iLength[ i ]; + TInt k = hc[ i ] * ( 1 << t ); + TInt j; + for( j=k; jiSearch[ j ] = i; + } + l = k; + } + + } + + + +void CJpeg::CreateDefaultHuffmanL() + { + // + // Creates default huffman tables + // needed if jpeg file doesn't have huffman tables + // for example motion jpeg file doesn't have. + // + THuffman* huff = new( ELeave )THuffman; + CleanupStack::PushL( huff ); + CreateHuffmanL( huff, bits_dc_luminance, val_dc_luminance ); + iHuffman[ 0 ] = huff; + CleanupStack::Pop( huff ); + + huff = new( ELeave )THuffman; + CleanupStack::PushL( huff ); + CreateHuffmanL( huff, bits_dc_chrominance, val_dc_chrominance ); + iHuffman[ 1 ] = huff; + CleanupStack::Pop( huff ); + + huff = new( ELeave )THuffman; + CleanupStack::PushL( huff ); + CreateHuffmanL( huff, bits_ac_luminance, val_ac_luminance ); + iHuffman[ 2 ] = huff; + CleanupStack::Pop( huff ); + + huff = new( ELeave )THuffman; + CleanupStack::PushL( huff ); + CreateHuffmanL( huff, bits_ac_chrominance, val_ac_chrominance ); + iHuffman[ 3 ] = huff; + CleanupStack::Pop( huff ); + } + + + +void CJpeg::DecRgb1_1L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ) + { + PrepareLoadBlockL(); + + // + // Set file read position + // + iBufPos = iImageDataStart; + iBufBits = 0; + iBuf = 0; + + TInt c[ 3 ]; + c[ 0 ] = 0; + c[ 1 ] = 0; + c[ 2 ] = 0; + + TInt w = aBitmap.iSize.iWidth; + TUint32* rgb = (TUint32*)aBitmap.iData; + + // + // Store data for yuv->rgb conversion + // + iYuvConv.iBlkSize = iData.iBlockSize; + iYuvConv.iRgbWidth = w; + iYuvConv.iBlkPixels = 8; + + TInt blw = aBlockRect.Size().iWidth; + TInt blh = aBlockRect.Size().iHeight; + + for( TInt by=0; byRGB + // + if( iRgbConv ) + { + iYuv2rgbFunc( this ); + } + + } + } + } + + + + +void CJpeg::DecRgb1_2L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ) + { + PrepareLoadBlockL(); + + // + // Set file read position + // + iBufPos = iImageDataStart; + iBufBits = 0; + iBuf = 0; + + TInt c[ 3 ]; + c[ 0 ] = 0; + c[ 1 ] = 0; + c[ 2 ] = 0; + + TInt w = aBitmap.iSize.iWidth; + TUint32* rgb = (TUint32*)aBitmap.iData; + + TInt bw = iData.iBlockSize.iWidth / 2; + TInt bh = iData.iBlockSize.iHeight / 2; + // + // Store data for yuv->rgb conversion + // + iYuvConv.iBlkSize = TSize( bw, bh ); + iYuvConv.iRgbWidth = w; + iYuvConv.iBlkPixels = 4; + + TInt blw = aBlockRect.Size().iWidth; + TInt blh = aBlockRect.Size().iHeight; + + for( TInt by=0; byRGB + // + if( iRgbConv ) + { + iYuv2rgbFunc( this ); + } + + + } + } + } + + + +void CJpeg::DecRgb1_4L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ) + { + PrepareLoadBlockL(); + + // + // Set file read position + // + iBufPos = iImageDataStart; + iBufBits = 0; + iBuf = 0; + + TInt c[ 3 ]; + c[ 0 ] = 0; + c[ 1 ] = 0; + c[ 2 ] = 0; + + TInt w = aBitmap.iSize.iWidth; + TUint32* rgb = (TUint32*)aBitmap.iData; + + TInt bw = iData.iBlockSize.iWidth / 4; + TInt bh = iData.iBlockSize.iHeight / 4; + // + // Store data for yuv->rgb conversion + // + iYuvConv.iBlkSize = TSize( bw, bh ); + iYuvConv.iRgbWidth = w; + iYuvConv.iBlkPixels = 2; + + TInt blw = aBlockRect.Size().iWidth; + TInt blh = aBlockRect.Size().iHeight; + + for( TInt by=0; by255 ) v=255; tp[ 0 ] = v; + + v = (v1 + v2 - 50*v4 ) / 262144 + 128; + if( v<0 ) v=0; if( v>255 ) v=255; tp[ dw ] = v; + + v = (v1 + v3 + 251*v5 ) / 262144 + 128; + if( v<0 ) v=0; if( v>255 ) v=255; tp[ 1 ] = v; + + v = (v1 + v3 - 50*v5 ) / 262144 + 128; + if( v<0 ) v=0; if( v>255 ) v=255; tp[ dw+1 ] = v; + } + } + c[ i ] = iDct[ 0 ]; + } + + + // + // Scaled blit YUV->RGB + // + if( iRgbConv ) + { + iYuv2rgbFunc( this ); + } + + + } + } + } + + + +void CJpeg::DecRgb1_8L( const TBitmapHandle& aBitmap, const TRect& aBlockRect ) + { + PrepareLoadBlockL(); + + // + // Set file read position + // + iBufPos = iImageDataStart; + iBufBits = 0; + iBuf = 0; + + TInt c[ 3 ]; + c[ 0 ] = 0; + c[ 1 ] = 0; + c[ 2 ] = 0; + + TInt w = aBitmap.iSize.iWidth; + TUint32* rgb = (TUint32*)aBitmap.iData; + + TInt bw = iData.iBlockSize.iWidth / 8; + TInt bh = iData.iBlockSize.iHeight / 8; + + // + // Store data for yuv->rgb conversion + // + iYuvConv.iBlkSize = TSize( bw, bh ); + iYuvConv.iRgbWidth = w; + iYuvConv.iBlkPixels = 1; + + TInt blw = aBlockRect.Size().iWidth; + TInt blh = aBlockRect.Size().iHeight; + + for( TInt by=0; byRGB + // + if( iRgbConv ) + { + iYuv2rgbFunc( this ); + } + + } + } + } + + + +void CJpeg::SetScale( TJpegScale aScale ) + { + iScale = aScale; + } + + + +void CJpeg::Yuv2Rgb22_11_11( TAny* aPtr ) + { + CJpeg& p = *(CJpeg*)aPtr; + + // + // YUV420 + // + // YY + // YY U V + // + + TUint8* cY = p.iC[ 0 ]; + TUint8* cU = p.iC[ 1 ]; + TUint8* cV = p.iC[ 2 ]; + TUint32* rgb = p.iYuvConv.iRgb; + TInt modulo = p.iYuvConv.iRgbWidth - p.iYuvConv.iBlkSize.iWidth; + + TInt w = p.iYuvConv.iBlkSize.iWidth; + TInt h = p.iYuvConv.iBlkSize.iHeight; + + + for( TInt y=0; y 255 ) cc = 255; + c = cc << 16; + + // add green + cc = cy - ( 88 * cu + 183 * cv ) / 256; + if( cc < 0 ) cc = 0; + if( cc > 255 ) cc = 255; + c |= cc << 8; + + // add blue + cc = cy + ( 454 * cu ) / 256; + if( cc < 0 ) cc = 0; + if( cc > 255 ) cc = 255; + + // write to bitmap + *rgb++ = c + cc; + + } + rgb += modulo; + if( ( y & 1 ) == 0 ) + { + // only advance color components on odd Y + // so on even, do rewind + cU -= x/2; + cV -= x/2; + } + } + } + + + +void CJpeg::Yuv2Rgb21_11_11( TAny* aPtr ) + { + CJpeg& p = *(CJpeg*)aPtr; + // + // YUV422 + // + // YY U V + // + + TUint8* cY = p.iC[ 0 ]; + TUint8* cU = p.iC[ 1 ]; + TUint8* cV = p.iC[ 2 ]; + TUint32* rgb = p.iYuvConv.iRgb; + TInt modulo = p.iYuvConv.iRgbWidth - p.iYuvConv.iBlkSize.iWidth; + + TInt w = p.iYuvConv.iBlkSize.iWidth; + TInt h = p.iYuvConv.iBlkSize.iHeight; + + for( TInt y=0; y 255 ) cc = 255; + c = cc << 16; + + // add green + cc = cy - ( 88 * cu + 183 * cv ) / 256; + if( cc < 0 ) cc = 0; + if( cc > 255 ) cc = 255; + c |= cc << 8; + + // add blue + cc = cy + ( 454 * cu ) / 256; + if( cc < 0 ) cc = 0; + if( cc > 255 ) cc = 255; + + // write to bitmap + *rgb++ = c + cc; + } + rgb += modulo; + } + } + + + +void CJpeg::Yuv2RgbFree( TAny* aPtr ) + { + CJpeg& p = *(CJpeg*)aPtr; + + TInt bw = p.iYuvConv.iBlkSize.iWidth; + TInt bh = p.iYuvConv.iBlkSize.iHeight; + + TInt y1y = 0; + TInt y1u = 0; + TInt y1v = 0; + + TInt yw = p.iComponent[ 0 ].iXFactor * p.iYuvConv.iBlkPixels; + TInt uw = p.iComponent[ 1 ].iXFactor * p.iYuvConv.iBlkPixels; + TInt vw = p.iComponent[ 2 ].iXFactor * p.iYuvConv.iBlkPixels; + + TUint32* rgb = p.iYuvConv.iRgb; + TInt modulo = p.iYuvConv.iRgbWidth - bw; + + for( TInt y=0; y 255 ) cc = 255; + c = cc << 16; + + // add green + cc = cy - ( 88 * cu + 183 * cv ) / 256; + if( cc < 0 ) cc = 0; + if( cc > 255 ) cc = 255; + c |= cc << 8; + + // add blue + cc = cy + ( 454 * cu ) / 256; + if( cc < 0 ) cc = 0; + if( cc > 255 ) cc = 255; + + // write to bitmap + *rgb++ = c + cc; + } + y1y += p.iYya; + y1u += p.iUya; + y1v += p.iVya; + rgb += modulo; + } + } + + + + +void CJpeg::EnableRgvConv() + { + iRgbConv = true; + } + + + +void CJpeg::DisableRgbConv() + { + iRgbConv = false; + } + + + +TBitmapHandle CJpeg::LoadImageL( TRect& aRect ) + { + // + // Crop possible illegal rect + // + //aRect.BoundingRect( TRect( iData.iSize ) ); + + if( aRect.iTl.iX < 0 ) aRect.iTl.iX = 0; + if( aRect.iTl.iY < 0 ) aRect.iTl.iY = 0; + if( aRect.iBr.iX < 0 ) aRect.iBr.iX = 0; + if( aRect.iBr.iY < 0 ) aRect.iBr.iY = 0; + if( aRect.iTl.iX > iData.iSize.iWidth ) aRect.iTl.iX = iData.iSize.iWidth; + if( aRect.iTl.iY > iData.iSize.iHeight ) aRect.iTl.iY = iData.iSize.iHeight; + if( aRect.iBr.iX > iData.iSize.iWidth ) aRect.iBr.iX = iData.iSize.iWidth; + if( aRect.iBr.iY > iData.iSize.iHeight ) aRect.iBr.iY = iData.iSize.iHeight; + + // + // Create rectangle of blocks that has all the pixels of aRect + // + TRect blockRect = aRect; + blockRect.iTl.iX /= iData.iBlockSize.iWidth; + blockRect.iBr.iX /= iData.iBlockSize.iWidth; + blockRect.iTl.iY /= iData.iBlockSize.iHeight; + blockRect.iBr.iY /= iData.iBlockSize.iHeight; + + if( aRect.iBr.iX & ( iData.iBlockSize.iWidth - 1 ) ) + { + blockRect.iBr.iX++; + } + + if( aRect.iBr.iY & ( iData.iBlockSize.iHeight - 1 ) ) + { + blockRect.iBr.iY++; + } + + // + // Return the real 1:1 scale pixel rectangle back in aRect + // + aRect.iTl.iX = blockRect.iTl.iX * iData.iBlockSize.iWidth; + aRect.iTl.iY = blockRect.iTl.iY * iData.iBlockSize.iHeight; + aRect.iBr.iX = blockRect.iBr.iX * iData.iBlockSize.iWidth; + aRect.iBr.iY = blockRect.iBr.iY * iData.iBlockSize.iHeight; + + + // decode area size in blocks + TSize blockSize = blockRect.Size(); + + // create bitmap + TBitmapHandle bm; + bm.iSize.iWidth = iData.iBlockSize.iWidth * blockSize.iWidth; + bm.iSize.iHeight = iData.iBlockSize.iHeight * blockSize.iHeight; + + // + // If not whole image decode, random access must be initialized + // + if( iData.iSizeInBlocks != blockSize ) + { + ScanRandomL(); + } + + // + // ...and decode + // + switch( iScale ) + { + case EScale1: + { + bm.iData = new( ELeave )TUint32[ bm.iSize.iWidth * bm.iSize.iHeight ]; + CleanupStack::PushL( bm.iData ); + DecRgb1_1L( bm, blockRect ); + CleanupStack::Pop( bm.iData ); + break; + } + case EScale2: + { + bm.iSize.iWidth /= 2; + bm.iSize.iHeight /= 2; + bm.iData = new( ELeave )TUint32[ bm.iSize.iWidth * bm.iSize.iHeight ]; + CleanupStack::PushL( bm.iData ); + DecRgb1_2L( bm, blockRect ); + CleanupStack::Pop( bm.iData ); + break; + } + case EScale4: + { + bm.iSize.iWidth /= 4; + bm.iSize.iHeight /= 4; + bm.iData = new( ELeave )TUint32[ bm.iSize.iWidth * bm.iSize.iHeight ]; + CleanupStack::PushL( bm.iData ); + DecRgb1_4L( bm, blockRect ); + CleanupStack::Pop( bm.iData ); + break; + } + case EScale8: + { + bm.iSize.iWidth /= 8; + bm.iSize.iHeight /= 8; + bm.iData = new( ELeave )TUint32[ bm.iSize.iWidth * bm.iSize.iHeight ]; + CleanupStack::PushL( bm.iData ); + DecRgb1_8L( bm, blockRect ); + CleanupStack::Pop( bm.iData ); + break; + } + } + + return bm; + } diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/src/CJpegSave.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/src/CJpegSave.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,1009 @@ +/* +* 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: +* +*/ + + +// +// Jpeg encoder class + +#include "CJpegSave.h" +#include +#include + +const TUint8 KZigZag[] = { + 0,8,1,2,9,16,24,17, + 10,3,4,11,18,25,32,40, + 33,26,19,12,5,6,13,20, + 27,34,41,48,56,49,42,35, + 28,21,14,7,15,22,29,36, + 43,50,57,58,51,44,37,30, + 23,31,38,45,52,59,60,53, + 46,39,47,54,61,62,55,63 + }; + + + +//Table K.1 from JPEG specification +const int jpeg_luma_quantizer[64] = { + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68, 109, 103, 77, + 24, 35, 55, 64, 81, 104, 113, 92, + 49, 64, 78, 87, 103, 121, 120, 101, + 72, 92, 95, 98, 112, 100, 103, 99 +}; + + +// Table K.2 from JPEG specification +const int jpeg_chroma_quantizer[64] = { + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 +}; + + + +// Set up the standard Huffman tables (cf. JPEG standard section K.3) +// IMPORTANT: these are only valid for 8-bit data precision! + +const TUint8 bits_dc_luminance[17] = { 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }; +const TUint8 val_dc_luminance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; +const TUint8 bits_dc_chrominance[17] = { 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; +const TUint8 val_dc_chrominance[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }; + +const TUint8 bits_ac_luminance[17] = { 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d }; +const TUint8 val_ac_luminance[] = + { + 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, + 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07, + 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08, + 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, + 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, + 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28, + 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, + 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, + 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, + 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, + 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, + 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, + 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, + 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, + 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, + 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, + 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2, + 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, + 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa + }; + +const TUint8 bits_ac_chrominance[17] = { 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 }; + +const TUint8 val_ac_chrominance[] = + { + 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, + 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71, + 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91, + 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, + 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, + 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26, + 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, + 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, + 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, + 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, + 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, + 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, + 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, + 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, + 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, + 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, + 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, + 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, + 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, + 0xf9, 0xfa + }; + + +// Jpeg store huffman lookup +class TSHuffman + { + public: + TUint8 iLength[ 256 ]; + TInt8 iCode[ 256 ]; + }; + + + +CJpegSave* CJpegSave::NewL( RFs* aFs, RFile* aFile ) + { + CJpegSave* self = NewLC( aFs, aFile ); + CleanupStack::Pop( self ); + return self; + } + + + +CJpegSave* CJpegSave::NewLC( RFs* aFs, RFile* aFile ) + { + CJpegSave* self = new( ELeave )CJpegSave( aFs, aFile ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + + +CJpegSave::~CJpegSave() + { + delete iHuffman[ 0 ]; + delete iHuffman[ 1 ]; + delete iHuffman[ 2 ]; + delete iHuffman[ 3 ]; + delete iSaveBuf; + iFs = NULL; + iSaveFile = NULL; + iCurrentHuffman = NULL; + iCurrentQuant = NULL; + } + + + +CJpegSave::CJpegSave( RFs* aFs, RFile* aFile ) + : iFs( aFs ) + , iSaveFile( aFile ) + { + } + + + +void CJpegSave::ConstructL() + { + TSHuffman* huff = new( ELeave )TSHuffman; + CleanupStack::PushL(huff); + CreateHuffmanL( huff, bits_dc_luminance, val_dc_luminance ); + iHuffman[ 0 ] = huff; + CleanupStack::Pop(); + + huff = new( ELeave )TSHuffman; + CleanupStack::PushL(huff); + CreateHuffmanL( huff, bits_dc_chrominance, val_dc_chrominance ); + iHuffman[ 1 ] = huff; + CleanupStack::Pop(); + + huff = new( ELeave )TSHuffman; + CleanupStack::PushL(huff); + CreateHuffmanL( huff, bits_ac_luminance, val_ac_luminance ); + iHuffman[ 2 ] = huff; + CleanupStack::Pop(); + + huff = new( ELeave )TSHuffman; + CleanupStack::PushL(huff); + CreateHuffmanL( huff, bits_ac_chrominance, val_ac_chrominance ); + iHuffman[ 3 ] = huff; + CleanupStack::Pop(); + + iSaveByte = 0; + iSaveBufPos = 0; + iSaveBufBitPos = 0; + + } + + + +void CJpegSave::StartSaveL( const TSize& aSize, TPtr8 aExif, TInt aSaveBufferSize, TInt aQuality ) + { + iSaveBufSize = aSaveBufferSize; + if (iSaveBuf) + { + delete iSaveBuf; + iSaveBuf = NULL; + } + + iSaveBuf = new( ELeave )TUint8[ iSaveBufSize ]; + + // create quantization tables + MakeTables( aQuality, iYQuant, iUVQuant ); + + + TSize size = aSize; + TInt len; + + // D8 Start Of Image + + WriteSaveBuffer( (TUint16)0xffd8 ); + + + + // + // Exif ( if any ) + // + + if( aExif.Length() != 0 ) + { + WriteSaveBuffer( (TUint16) 0xffe1 ); + + TUint32 l = aExif.Length() + 6 + 2; // +header+tagsize + WriteSaveBuffer( (TUint16) l ); + + // exif header is 6 bytes ( 45 78 69 66 00 00 "Exif.." ) + WriteSaveBuffer( (TUint8) 0x45 ); + WriteSaveBuffer( (TUint8) 0x78 ); + WriteSaveBuffer( (TUint8) 0x69 ); + WriteSaveBuffer( (TUint8) 0x66 ); + WriteSaveBuffer( (TUint8) 0x00 ); + WriteSaveBuffer( (TUint8) 0x00 ); + + l -= ( 6+2 ); // minus header, minus tag size + + // save exif chunck + WriteSaveBuffer( aExif.Ptr(), l ); + } + else + { + // + // if no exif, standard application segment here + // + + // E0 jpeg application segment + WriteSaveBuffer( (TUint16)0xffe0 ); + + // segment length + WriteSaveBuffer( (TUint16)16 ); + + // 0x4a, 0x46, 0x49, 0x46, 0x00 JFIF #0 + WriteSaveBuffer( (TUint8) 0x4a ); + WriteSaveBuffer( (TUint8) 0x46 ); + WriteSaveBuffer( (TUint8) 0x49 ); + WriteSaveBuffer( (TUint8) 0x46 ); + WriteSaveBuffer( (TUint8) 0x00 ); + + WriteSaveBuffer( (TUint8) 0x01 ); // major revision number + WriteSaveBuffer( (TUint8) 0x01 ); // minor revision number + + // 0=aspect ratio, 1=dots/inch, 2=dots/cm + WriteSaveBuffer( (TUint8) 0x01 ); + + TInt dpi = 72; + // x dpi + WriteSaveBuffer( (TUint16) dpi ); + + // y dpi + WriteSaveBuffer( (TUint16) dpi ); + + // thumbnail width + WriteSaveBuffer( (TUint8) 0 ); + + // thumbnail height + WriteSaveBuffer( (TUint8) 0 ); + + + } + + + + // + // quant table + // + + TUint8 quant[ 2 ][ 64 ]; + + TInt i; + TInt n; + for( i=0; i<64; i++ ) + { + quant[ 0 ][ i ] = iYQuant[ i ]; + quant[ 1 ][ i ] = iUVQuant[ i ]; + } + + + for( n=0; n<2; n++ ) + { + WriteSaveBuffer( (TUint16) 0xffdb ); + + len = 2 + 1 * 65; + // chunk length + WriteSaveBuffer( (TUint16) len ); + + // quantization table # + WriteSaveBuffer( (TUint8) n ); + + // quantization table + WriteSaveBuffer( quant[ n ], 64 ); + } + + + + + + // + // Huffman Table + // + + const TUint8* nBits[ 4 ]; + const TUint8* values[ 4 ]; + + nBits[ 0 ] = bits_dc_luminance; + nBits[ 1 ] = bits_dc_chrominance; + nBits[ 2 ] = bits_ac_luminance; + nBits[ 3 ] = bits_ac_chrominance; + values[ 0 ] = val_dc_luminance; + values[ 1 ] = val_dc_chrominance; + values[ 2 ] = val_ac_luminance; + values[ 3 ] = val_ac_chrominance; + + + for( n=0; n<4; n++ ) + { + WriteSaveBuffer( (TUint16) 0xffc4 ); + + TInt numSymbols = 0; + for( i=0; i<16; i++ ) + { + TUint8 size = nBits[ n ][ i + 1 ]; + numSymbols += size; + } + + len = 2 + 1 + 16 + numSymbols; + // chunk length + WriteSaveBuffer( (TUint16) len ); + + // huffman table # + WriteSaveBuffer( (TUint8)( ( n / 2 ) * 16 + ( n & 1 ) ) ); + + // bit lengths for huffman table codes + for( i=0; i<16; i++ ) + { + TUint8 size = nBits[ n ][ i + 1 ]; + WriteSaveBuffer( size ); + } + + // huffman table symbols + WriteSaveBuffer( values[ n ], numSymbols ); + } + + + + + + // + // Start of frame + // + WriteSaveBuffer( (TUint16)0xffc0 ); + + len = 8 + 3 * 3; + // chunk length + WriteSaveBuffer( (TUint16)len ); + + // precision + WriteSaveBuffer( (TUint8)8 ); + + // image height + WriteSaveBuffer( (TUint16)size.iHeight ); + + // image width + WriteSaveBuffer( (TUint16)size.iWidth ); + + // number of components + WriteSaveBuffer( (TUint8)3 ); + + // component 0: + + WriteSaveBuffer( (TUint8)1 ); // number of component + WriteSaveBuffer( (TUint8) ( 1 + 16*2 ) ); // sampling factor + WriteSaveBuffer( (TUint8)0 ); // number of quantization table + + // component 1: + WriteSaveBuffer( (TUint8)2 ); // number of component + WriteSaveBuffer( (TUint8) ( 1 + 16*1 ) ); // sampling factor + WriteSaveBuffer( (TUint8)1 ); // number of quantization table + + // component 2: + WriteSaveBuffer( (TUint8)3 ); // number of component + WriteSaveBuffer( (TUint8) ( 1 + 16*1 ) ); // sampling factor + WriteSaveBuffer( (TUint8)1 ); // number of quantization table + + + // + // Start Of Scan ( SOS ) + // + WriteSaveBuffer( (TUint16)0xffda ); + + len = 3 + 3*2 + 3; + // chunk length + WriteSaveBuffer( (TUint16)len ); + + // number of components + WriteSaveBuffer( (TUint8)3 ); + + /// component1: + // component ID + WriteSaveBuffer( (TUint8)1 ); + // component huffman table ac(low4) dc(hi4) + WriteSaveBuffer( (TUint8)0 ); + + /// component2: + // component ID + WriteSaveBuffer( (TUint8)2 ); + // component huffman table ac(low4) dc(hi4) + WriteSaveBuffer( (TUint8)17 ); + + /// component3: + // component ID + WriteSaveBuffer( (TUint8)3 ); + // component huffman table ac(low4) dc(hi4) + WriteSaveBuffer( (TUint8)17 ); + + // stuffing ( actually dctsize-1 can be stored ) + WriteSaveBuffer( (TUint8)0 ); + WriteSaveBuffer( (TUint8)63 ); // dctsize - 1 + WriteSaveBuffer( (TUint8)0 ); + + iDy = 0; + iDu = 0; + iDv = 0; + } + + + +void CJpegSave::SaveBlock( const TBitmapHandle& aBitmap ) + { + // + // Macroblocks: + // + TInt by[ 256 ]; + TInt bu[ 64 ]; + TInt bv[ 64 ]; + TInt dct[ 64 ]; + + + Rgb2Yuv( (TUint32*)aBitmap.iData, aBitmap.iSize.iWidth, by, bu, bv ); + + iCurrentQuant = (TUint8*)iYQuant; + + Dct( by, dct ); + dct[ 0 ] -= iDy; + iDy += WriteDct( dct, iHuffman[ 0 ], iHuffman[ 2 ] ); + + Dct( by+64, dct ); + dct[ 0 ] -= iDy; + iDy += WriteDct( dct, iHuffman[ 0 ], iHuffman[ 2 ] ); + + iCurrentQuant = (TUint8*)iUVQuant; + Dct( bu, dct ); + dct[ 0 ] -= iDu; + iDu += WriteDct( dct, iHuffman[ 1 ], iHuffman[ 3 ] ); + + Dct( bv, dct ); + dct[ 0 ] -= iDv; + iDv += WriteDct( dct, iHuffman[ 1 ], iHuffman[ 3 ] ); + + } + + + +void CJpegSave::FinalizeSave() + { + + // + // End Of Image ( EOI ) + // + + // flush last bits to save buffer + if( iSaveBufBitPos ) + { + WriteBits( 0, 8-iSaveBufBitPos ); + } + + // end of image tag + WriteSaveBuffer( (TUint16)0xffd9 ); + + // there might still be stuff in save buffer + FlushSaveBuf(); + } + + +TPtrC8 CJpegSave::Finalize() + { + + // + // End Of Image ( EOI ) + // + + // flush last bits to save buffer + if( iSaveBufBitPos ) + { + WriteBits( 0, 8-iSaveBufBitPos ); + } + + // end of image tag + WriteSaveBuffer( (TUint16)0xffd9 ); + + return TPtrC8( iSaveBuf, iSaveBufPos ); + } + + + +void CJpegSave::WriteHuffman( TInt aValue ) + { + TInt code = iCurrentHuffman->iCode[ aValue ]; + TInt len = iCurrentHuffman->iLength[ aValue ]; + WriteBits( code, len ); + } + + + +void CJpegSave::CreateHuffmanL( TSHuffman* aHuffman, const TUint8* aBits, const TUint8* aVal ) + { + TInt huffSize[ 16 ]; + + TUint32 huffCode[ 256 ]; + TInt huffValue[ 256 ]; + TInt huffLength[ 256 ]; + + TInt numSymbols = 0; + TInt i; + + for( i=0; i<16; i++ ) + { + TInt size = aBits[ i+1 ]; + huffSize[ i ] = size; + numSymbols += size; + } + + for( i=0; iiLength[ v ] = huffLength[ i ]; + aHuffman->iCode[ v ] = huffCode[ i ]; + } + } + + + +void CJpegSave::WriteBits( TUint32 aValue, TInt aNumBits ) + { + + aValue &= ( ( 1 << aNumBits ) - 1 ); + while( aNumBits > 0 ) + { + TInt bitroom = 8 - iSaveBufBitPos; + iSaveByte |= ( ( aValue << ( 24+bitroom-aNumBits ) ) >> 24 ); + + if( aNumBits < bitroom ) + { + iSaveBufBitPos += aNumBits; + } + else + { + iSaveBufBitPos += bitroom; + } + + if( iSaveBufBitPos == 8 ) + { + iSaveBufBitPos = 0; + iSaveBuf[ iSaveBufPos ] = iSaveByte; + + if( iSaveByte == 255 ) + { + iSaveBufPos++; + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + iSaveBuf[ iSaveBufPos ] = 0; // 255,0 = 255 ( escaped 255 ) + } + iSaveByte = 0; + iSaveBufPos++; + + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + + } + aNumBits -= bitroom; + } + } + + + +TInt CJpegSave::WriteDct( TInt* aDct, TSHuffman* aDc, TSHuffman* aAc ) + { + TInt rv = 0; + TInt nullCount = 0; + bool theEnd = false; + + for( TInt i=0; i<64; i++ ) + { + if( i == 0 ) + { + iCurrentHuffman = aDc; + } + else + { + iCurrentHuffman = aAc; + } + + TInt value = aDct[ KZigZag[ i ] ] / iCurrentQuant[ i ]; + if( i==0 ) rv = value * iCurrentQuant[ 0 ]; + + bool doSave = true; + + if( i > 0 && value == 0 ) + { + + if( nullCount < 14 ) + { + nullCount++; + doSave = false; + } + else + { + value = 0; // end of block, too many zeros + nullCount = 0; + theEnd = true; + } + + } + + if( i == 63 && nullCount > 0 ) + { + doSave = true; + value = 0; + nullCount = 0; + theEnd = true; + } + + if( doSave ) + { + bool minus = false; + if( value < 0 ) + { + minus = true; + value = -value; + } + TInt v = value; + TInt vl = 0; + + while( v ) + { + v >>= 1; + vl++; + } + + if( minus ) + { + TInt a = ( 1 << vl ) - 1; + value ^= a; + } + + WriteHuffman( vl + nullCount * 16 ); + WriteBits( value, vl ); + if( theEnd ) // this is the end + { + break; + } + nullCount = 0; + } + } + return rv; + } + + + +void CJpegSave::Dct( TInt* aSrc, TInt* aTgt ) + { + const TInt w1 = 237; + const TInt w2 = 98; + const TInt w3 = 181; + const TInt w4 = 251; + const TInt w5 = 50; + const TInt w6 = 213; + const TInt w7 = 142; + + TInt s[8]; + TInt t[6]; + TInt r[4]; + + int j; + + + TInt* tp = aTgt; + + for( j=0; j<8; j++ ) + { + s[0] = aSrc[j + 0] + aSrc[j + 56]; + s[1] = aSrc[j + 8] + aSrc[j + 48]; + s[2] = aSrc[j + 16] + aSrc[j + 40]; + s[3] = aSrc[j + 24] + aSrc[j + 32]; + s[4] = aSrc[j + 24] - aSrc[j + 32]; + s[5] = aSrc[j + 16] - aSrc[j + 40]; + s[6] = aSrc[j + 8] - aSrc[j + 48]; + s[7] = aSrc[j + 0] - aSrc[j + 56]; + + t[0] = s[0] + s[3]; + t[1] = s[1] + s[2]; + t[2] = s[1] - s[2]; + t[3] = s[0] - s[3]; + t[4] = (s[6] - s[5]) * w3; + t[5] = (s[6] + s[5]) * w3; + + r[0] = s[4] * 256 + t[4]; + r[1] = s[4] * 256 - t[4]; + r[2] = s[7] * 256 - t[5]; + r[3] = s[7] * 256 + t[5]; + + *tp++ = (t[0] + t[1]) * w3 / 256; + *tp++ = (r[0] * w5 + r[3] * w4) / 256 / 256; + *tp++ = (t[2] * w2 + t[3] * w1) / 256; + *tp++ = (r[2] * w6 - r[1] * w7) / 256 / 256; + *tp++ = (t[0] - t[1]) * w3 / 256; + *tp++ = (r[1] * w6 + r[2] * w7) / 256 / 256; + *tp++ = (t[3] * w2 - t[2] * w1) / 256; + *tp++ = (r[3] * w5 - r[0] * w4) / 256 / 256; + } + + for( j=0; j<8; j++ ) + { + s[0] = aTgt[j + 0] + aTgt[j + 56]; + s[1] = aTgt[j + 8] + aTgt[j + 48]; + s[2] = aTgt[j + 16] + aTgt[j + 40]; + s[3] = aTgt[j + 24] + aTgt[j + 32]; + s[4] = aTgt[j + 24] - aTgt[j + 32]; + s[5] = aTgt[j + 16] - aTgt[j + 40]; + s[6] = aTgt[j + 8] - aTgt[j + 48]; + s[7] = aTgt[j + 0] - aTgt[j + 56]; + + t[0] = s[0] + s[3]; + t[1] = s[1] + s[2]; + t[2] = s[1] - s[2]; + t[3] = s[0] - s[3]; + t[4] = (s[6] - s[5]) * w3; + t[5] = (s[6] + s[5]) * w3; + + r[0] = s[4] * 256 + t[4]; + r[1] = s[4] * 256 - t[4]; + r[2] = s[7] * 256 - t[5]; + r[3] = s[7] * 256 + t[5]; + + aTgt[ 0 + j] = (t[0] + t[1]) * w3 / 256 / 4; + aTgt[32 + j] = (t[0] - t[1]) * w3 / 256 / 4; + aTgt[ 8 + j] = (r[0] * w5 + r[3] * w4) / 256 / 256 / 4; + aTgt[56 + j] = (r[3] * w5 - r[0] * w4) / 256 / 256 / 4; + aTgt[24 + j] = (r[2] * w6 - r[1] * w7) / 256 / 256 / 4; + aTgt[40 + j] = (r[1] * w6 + r[2] * w7) / 256 / 256 / 4; + aTgt[16 + j] = (t[2] * w2 + t[3] * w1) / 256 / 4; + aTgt[48 + j] = (t[3] * w2 - t[2] * w1) / 256 / 4; + } + + } + + + +void CJpegSave::Rgb2Yuv( TUint32* aRgb, TInt /*aWidth*/, TInt* aY, TInt* aU, TInt* aV ) + { + TInt pos = 0; + TInt yy; + TInt xx; + TInt y; + for( yy=0; yy<1; yy++ ) + for( xx=0; xx<2; xx++ ) + for( y=0; y<8; y++ ) + { + TInt cpos = xx*4 + y*8; + TInt x; + for( x=0; x<8; x++ ) + { + TUint32 c = aRgb[ x + xx*8 + y*16 + yy * 128 ]; + TInt r = ( c >> 16 ) & 0xff; + TInt g = ( c >> 8 ) & 0xff; + TInt b = c & 0xff; + + TInt cy = ( 19595*r + 38470*g + 7471*b ) >> 16; + //TInt cy = 0.29900*r + 0.58700*g + 0.11400*b; + //if( y<0 ) cy=0; + //if( y>255 ) cy=255; + aY[ pos++ ] = cy - 128; + + if( x & 1 ) + { + TInt t = ( ( -11059*r - 21710*g + 32768*b ) >> 16 ); + //TInt t = -0.16874*r - 0.33126*g + 0.50000*b + 128; + //if( t<-128 ) t=-128; + //if( t>127 ) t=127; + aU[ cpos ] = t; + + t = ( ( 32768*r - 27439*g - 5329*b ) >> 16 ); + //t = 0.50000*r - 0.41869*g - 0.08131*b + 128; + //if( t<-128 ) t=-128; + //if( t>127 ) t=127; + aV[ cpos++ ] = t; + } + } + } + + + // 1:1:1 macroblock version + /* + TUint32* p = aRgb; + TInt mod = ( aWidth - 8 ); + TInt pos = 0; + TInt y; + + for( y=0; y<8; y++ ) + { + TInt x; + for( x=0; x<8; x++ ) + { + TUint32 c = *p++; + TInt r = c >> 16; + TInt g = ( c >> 8 ) & 0xff; + TInt b = c & 0xff; + + TInt y = ( 19595*r + 38470*g + 7471*b ) >> 16; + //TInt y = 0.29900*r + 0.58700*g + 0.11400*b; + if( y<0 ) y=0; + if( y>255 ) y=255; + aY[ pos ] = y - 128; + + + TInt t = ( ( -11059*r - 21710*g + 32768*b ) >> 16 ); + //TInt t = -0.16874*r - 0.33126*g + 0.50000*b + 128; + if( t<-128 ) t=-128; + if( t>127 ) t=127; + aU[ pos ] = t; + + t = ( ( 32768*r - 27439*g - 5329*b ) >> 16 ); + //t = 0.50000*r - 0.41869*g - 0.08131*b + 128; + if( t<-128 ) t=-128; + if( t>127 ) t=127; + aV[ pos ] = t; + pos++; + } + p += mod; + } +*/ + + } + + + +void CJpegSave::MakeTables( TInt aQuality, TUint8* aY, TUint8* aUV ) + { + TInt i; + TInt factor = aQuality; + + if( aQuality < 1 ) factor = 1; + if( aQuality > 99 ) factor = 99; + if( aQuality < 50 ) + { + aQuality = 5000 / factor; + } + else + { + aQuality = 200 - factor*2; + } + + + for( i=0; i < 64; i++ ) + { + TInt y = ( jpeg_luma_quantizer[i] * aQuality + 50) / 100; + TInt uv = ( jpeg_chroma_quantizer[i] * aQuality + 50) / 100; + + if( y < 1) y = 1; + if( uv < 1) uv = 1; + if( y > 255) y = 255; + if( uv > 255) uv = 255; + + aY[ i ] = y; + aUV[ i ] = uv; + } + } + + + +void CJpegSave::WriteSaveBuffer( const TUint8* aSrc, TInt aBytes ) + { + TInt pos = 0; + while( aBytes ) + { + TInt bytes = aBytes; + if( iSaveBufPos + bytes > iSaveBufSize ) + { + bytes = iSaveBufSize - iSaveBufPos; + } + Mem::Copy( iSaveBuf + iSaveBufPos, aSrc + pos, bytes ); + iSaveBufPos += bytes; + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + aBytes -= bytes; + pos += bytes; + } + } + + + +void CJpegSave::WriteSaveBuffer( TUint8 aValue ) + { + iSaveBuf[ iSaveBufPos++ ] = aValue; + if( iSaveBufPos == iSaveBufSize ) + { + FlushSaveBuf(); + } + } + + + +void CJpegSave::WriteSaveBuffer( TUint16 aValue ) + { + WriteSaveBuffer( (TUint8) ( aValue / 256 ) ); + WriteSaveBuffer( (TUint8) ( aValue & 255 ) ); + } + + + +void CJpegSave::FlushSaveBuf() + { + if( &iSaveFile == NULL ) return; // no flushing without file + TPtr8 ptr( iSaveBuf, iSaveBufPos ); + ptr.SetLength( iSaveBufPos ); + if( iSaveFile )iSaveFile->Write( ptr ); + iSaveBufPos = 0; + } + diff -r 57d4cdd99204 -r edfc90759b9f imageeditorengine/src/JpegSaveFactory.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imageeditorengine/src/JpegSaveFactory.cpp Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* +*/ + + +#include "JpegSaveFactory.h" +#include "CJpegSave.h" + + +MJpegSave* JpegSaveFactory::CreateJpegSaveL( RFs* aFs, RFile* aFile ) + { + return CJpegSave::NewL( aFs, aFile ); + } + + + +MJpegSave* JpegSaveFactory::CreateJpegSaveLC( RFs* aFs, RFile* aFile ) + { + return CJpegSave::NewLC( aFs, aFile ); + } diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +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: +* Includes all the Domain API specific bld.inf files, which +* export files. +* +*/ + + + +#include "../image_editor_debug_utilities_api/group/bld.inf" +#include "../image_editor_utilities_api/group/bld.inf" +#include "../image_editor_definitions_api/group/bld.inf" +#include "../image_editor_system_parameters_api/group/bld.inf" +#include "../image_processing_engine_api/group/bld.inf" diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_debug_utilities_api/group/ABLD.BAT --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_debug_utilities_api/group/ABLD.BAT Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,32 @@ +rem +rem Copyright (c) 2010 Ixonos Plc. +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of the "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem +rem Initial Contributors: +rem Nokia Corporation - Initial contribution +rem +rem Contributors: +rem Ixonos Plc +rem +rem Description: +rem + +@ECHO OFF + +REM Bldmake-generated batch file - ABLD.BAT +REM ** DO NOT EDIT ** + +perl -S ABLD.PL "\editorengines_dom#kaikomul\editorengines_dom\image_editor_debug_utilities_api\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9 +if errorlevel==1 goto CheckPerl +goto End + +:CheckPerl +perl -v >NUL +if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed? +goto End + +:End diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_debug_utilities_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_debug_utilities_api/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* File that exports the files belonging to +* : Image Editor Debug Utilities API. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/imageeditordebugutils.h MW_LAYER_PLATFORM_EXPORT_PATH(imageeditordebugutils.h) diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_debug_utilities_api/image_editor_debug_utilities_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_debug_utilities_api/image_editor_debug_utilities_api.metaxml Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + Image Editor Debug Utilities API + Utility methods for Image Editor + c++ + imageeditorengine + + + + + + + + no + no + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_debug_utilities_api/inc/imageeditordebugutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_debug_utilities_api/inc/imageeditordebugutils.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,360 @@ +/* +* 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: +* Simple RFileLogger based set of log writer macros. +* +*/ + + + +// Instructions: +// +// 1. Add the following line into your MMP file +// LIBRARY flogger.lib +// +// 2. Add the following lines to a .cpp file to be debugged +// (note that the #define must be before the #include) +// +// #define ENABLE_DEBUGLOG +// #include "imageeditordebugutils.h" +// +// 3a. Call LOG_INIT to create the log file, overwriting possibly +// existing old log file. +// +// 3b. Alternatively, you can skip the step 3a, in which case the +// the output is appended to the possibly existing old file. +// +// 4. Use the macros to write to the log file. For example +// LOG("Started processing") +// +// 5. To enable the logs, manually create the logging +// directory "C:\Logs\ImageEditor" on the device. +// + +#ifndef __DEBUGUTILS_H__ +#define __DEBUGUTILS_H__ + +// Two alternative implementations: +// - using RFileLogger (system component) +// - using ClogFile (implemented in this project) +//#define _FLOGGER_IMPLEMENTATION_ +#define _FLOGGER_IMPLEMENTATION_ + +#ifdef _FLOGGER_IMPLEMENTATION_ +#include +#else +#include <../logfile.h> +#include +#include +#endif +#include + +/** Default log file */ +_LIT(KImageEditorLogFile,"ImageEditor.log"); + +/** Log directory */ +_LIT(KLogDir, "ImageEditor"); + +/** Log file names */ +_LIT(KJpegRotatorLogFile,"JpegRotator.log"); +_LIT(KJpegRotatorTimingLogFile,"JpegRotatorTiming.log"); + +/** Maximum length for a log line */ +const TInt KMaxLogLineLength = 256; + +/** + * Overflow handler. Too long lines are truncated. + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib - + * @since S60 v5.0 + */ +class TLogFileDes16OverflowHandler : public TDes16Overflow + { + virtual void Overflow(TDes16& /*aDes*/) + { + // do nothing + } + }; + + +#ifdef ENABLE_DEBUGLOG + +#ifdef _FLOGGER_IMPLEMENTATION_ + + +// Initializes the log file, overwrites existing +// Log files are always created in C:\Logs. The first argument to CreateLog() +// is a directory name relative to this C:\Logs directory. +#define LOG_INIT(aLogFile) \ + {\ + RFileLogger logger;\ + logger.Connect();\ + logger.CreateLog(KLogDir,aLogFile,EFileLoggingModeOverwrite);\ + logger.Write(KLogDir,aLogFile,EFileLoggingModeAppend,_L("*** Log file created ***"));\ + logger.CloseLog();\ + logger.Close();\ + } + +// Logs a simple text, e.g. +// LOG(_L("logfile.txt"),"Something happens here") +#define LOG(aLogFile,aText) \ + {\ + RFileLogger::Write(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText));\ + RDebug::Print(_L(aText));\ + } + +// Logs a Descriptor +#define LOGDES(aLogFile,aDes) \ + {\ + RFileLogger::Write(KLogDir,aLogFile,EFileLoggingModeAppend,aDes);\ + RDebug::Print(aDes);\ + } + +// Logs a number with string format, e.g. +// LOGFMT(KLogFile,"Result=%d",err) +// LOGFMT(KLogFile, "FileName: %S", &aFileName ); +#define LOGFMT(aLogFile,aText,aParam) \ + {\ + RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam);\ + RDebug::Print(_L(aText), aParam);\ + } + +// Logs text and two 2 parameters +#define LOGFMT2(aLogFile,aText,aParam1,aParam2) \ + {\ + RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2);\ + RDebug::Print(_L(aText), aParam1,aParam2);\ + } + +// Logs text and two 3 parameters +#define LOGFMT3(aLogFile,aText,aParam1,aParam2,aParam3) \ + {\ + RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2,aParam3);\ + RDebug::Print(_L(aText), aParam1,aParam2,aParam3);\ + } + +// Logs text and two 4 parameters +#define LOGFMT4(aLogFile,aText,aParam1,aParam2,aParam3,aParam4) \ + {\ + RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,_L(aText),aParam1,aParam2,aParam3,aParam4);\ + RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4);\ + } + +// Logs a hex dump +#define LOGHEXDUMP(aLogFile,aHeader,aMargin,aPtr,aLen) \ + RFileLogger::HexDump(KLogDir,aLogFile, EFileLoggingModeAppend, _S(aHeader), _S(aMargin), aPtr, aLen); + +// Logs the memory allocated on the current thread's default heap +#define LOG_HEAP_USAGE(aLogFile) \ + {\ + TInt allocSize;\ + User::Heap().AllocSize(allocSize);\ + _LIT(KText,"* Memory allocated on the thread's default heap: %d *");\ + RFileLogger::WriteFormat(KLogDir,aLogFile,EFileLoggingModeAppend,KText,allocSize);\ + RDebug::Print(KText,allocSize);\ + } + +#else // _FLOGGER_IMPLEMENTATION_ + +_LIT(KLogsFolder, "C:\\Logs\\"); +_LIT(KBackslash, "\\"); + +#define LOG_INIT(aLogFile)\ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + RFile file;\ + file.Replace(fs, fileNameAndPath, EFileShareAny|EFileWrite);\ + file.Close();\ + CLogFile::StaticLog(fileNameAndPath,_L("*** Log file created ***\n"));\ + }\ + fs.Close();\ + } + +#define LOG(aLogFile,aText) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + CLogFile::StaticLog(fileNameAndPath,_L(aText));\ + }\ + fs.Close();\ + RDebug::Print(_L(aText));\ + } + +#define LOGDES(aLogFile,aDes) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + CLogFile::StaticLog(fileNameAndPath,aDes);\ + }\ + fs.Close();\ + RDebug::Print(aDes);\ + } + +#define LOGFMT(aLogFile,aText,aParam) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + _LIT(KText,aText);\ + TLogFileDes16OverflowHandler ofh;\ + TBuf buf;\ + buf.AppendFormat(KText,&ofh,aParam);\ + CLogFile::StaticLog(fileNameAndPath,buf);\ + }\ + fs.Close();\ + RDebug::Print(_L(aText), aParam);\ + } + +// With 2 parameters +#define LOGFMT2(aLogFile,aText,aParam1,aParam2) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + _LIT(KText,aText);\ + TLogFileDes16OverflowHandler ofh;\ + TBuf buf;\ + buf.AppendFormat(KText,&ofh,aParam1,aParam2);\ + CLogFile::StaticLog(fileNameAndPath,buf);\ + }\ + fs.Close();\ + RDebug::Print(_L(aText), aParam1,aParam2);\ + } + +// With 3 parameters +#define LOGFMT3(aLogFile,aText,aParam1,aParam2,aParam3) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + _LIT(KText,aText);\ + TLogFileDes16OverflowHandler ofh;\ + TBuf buf;\ + buf.AppendFormat(KText,&ofh,aParam1,aParam2,aParam3);\ + CLogFile::StaticLog(fileNameAndPath,buf);\ + }\ + fs.Close();\ + RDebug::Print(_L(aText), aParam1,aParam2,aParam3);\ + } + +// With 4 parameters +#define LOGFMT4(aLogFile,aText,aParam1,aParam2,aParam3,aParam4) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + _LIT(KText,aText);\ + TLogFileDes16OverflowHandler ofh;\ + TBuf buf;\ + buf.AppendFormat(KText,&ofh,aParam1,aParam2,aParam3,aParam4);\ + CLogFile::StaticLog(fileNameAndPath,buf);\ + }\ + fs.Close();\ + RDebug::Print(_L(aText), aParam1,aParam2,aParam3,aParam4);\ + } + +// Not implemented +#define LOGHEXDUMP(aLogFile,aHeader,aMargin,aPtr,aLen) + +// Log the memory allocated on the current thread's default heap +#define LOG_HEAP_USAGE(aLogFile) \ + {\ + TFileName path(KLogsFolder);\ + path.Append(KLogDir);\ + path.Append(KBackslash);\ + TFileName fileNameAndPath(path);\ + fileNameAndPath.Append(aLogFile);\ + RFs fs;\ + fs.Connect();\ + TInt allocSize;\ + User::Heap().AllocSize(allocSize);\ + _LIT(KText,"* Memory allocated on the thread's default heap: %d *");\ + if(BaflUtils::FolderExists(fs,path))\ + {\ + TLogFileDes16OverflowHandler ofh;\ + TBuf buf;\ + buf.AppendFormat(KText,&ofh,allocSize);\ + CLogFile::StaticLog(fileNameAndPath,buf);\ + }\ + fs.Close();\ + RDebug::Print(KText, allocSize);\ + } + +#endif // _FLOGGER_IMPLEMENTATION_ + +#else // ENABLE_DEBUGLOG + +#define LOG_INIT(aLogFile) +#define LOG(aLogFile,aText) +#define LOGDES(aLogFile,aDes) +#define LOGFMT(aLogFile,aText,aParam) +#define LOGFMT2(aLogFile,aText,aParam1,aParam2) +#define LOGFMT3(aLogFile,aText,aParam1,aParam2,aParam3) +#define LOGFMT4(aLogFile,aText,aParam1,aParam2,aParam3,aParam4) +#define LOGHEXDUMP(aLogFile,aHeader,aMargin,aPtr,aLen) + +#endif // ENABLE_DEBUGLOG + +#endif // __DEBUGUTILS_H__ diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_definitions_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_definitions_api/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,31 @@ +/* +* 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: +* File that exports the files belonging to +* :Image Editor Definitions API. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/commondefs.h MW_LAYER_PLATFORM_EXPORT_PATH(commondefs.h) +../inc/editorversion.h MW_LAYER_PLATFORM_EXPORT_PATH(editorversion.h) +../inc/ImageEditorError.h MW_LAYER_PLATFORM_EXPORT_PATH(ImageEditorError.h) diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_definitions_api/image_editor_definitions_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_definitions_api/image_editor_definitions_api.metaxml Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + Image Editor Definitions API + IE definitions + c++ + imageeditorengine + + + + + + + + no + no + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_definitions_api/inc/ImageEditorError.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_definitions_api/inc/ImageEditorError.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,41 @@ +/* +* 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 related error codes. +* +*/ + + +#ifndef IMAGEEDITORERROR_H +#define IMAGEEDITORERROR_H + +const TInt KSIEENone = KErrNone; +const TInt KSIEEErrorBase = -60000; +const TInt KSIEENotEnoughDiskSpace = KSIEEErrorBase - 2; +const TInt KSIEEOpenFile = KSIEEErrorBase - 3; +const TInt KSIEESaveFile = KSIEEErrorBase - 4; +const TInt KSIEEProcessFile = KSIEEErrorBase - 5; +const TInt KSIEEEngine = KSIEEErrorBase - 6; +const TInt KSIEEInternal = KSIEEErrorBase - 7; +const TInt KSIEEInternalNonRecoverable = KSIEEErrorBase - 8; +const TInt KSIEEProtectedFile = KSIEEErrorBase - 9; +const TInt KSIEEExifRead = KSIEEErrorBase - 10; // should be handled exactly like KSIEEOpenFile +const TInt KSIEEExifUpdate = KSIEEErrorBase - 11; +const TInt KSIEEIncompatibleImage = KSIEEErrorBase - 12; +const TInt KSIEEFileExists = KSIEEErrorBase - 13; +const TInt KSIEEErrorOkToExit = KSIEEErrorBase - 98; +const TInt KSIEEErrorMax = KSIEEErrorBase - 99; + +#endif // IMAGEEDITORERROR_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_definitions_api/inc/commondefs.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_definitions_api/inc/commondefs.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,89 @@ +/* +* 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: +* Common definitions. +* +*/ + + +#ifndef COMMONDEFS_H +#define COMMONDEFS_H + + /** Directions */ + enum TDirection + { + EDirectionMin = 0, + EDirectionUp, + EDirectionDown, + EDirectionLeft, + EDirectionRight, + EDirectionMax + }; + + /** Rotation directions */ + enum TRotation + { + ERotationCounterClockwise = 0, + ERotationClockwise = 1, + ERotation90 = ERotationCounterClockwise, + ERotation180 = 2, + ERotation270 = ERotationClockwise + }; + + /** Zoom directions */ + enum TZoom + { + EZoomMin = 0, + EZoomIn, + EZoomOut + }; + + /** Zoom Modes */ + enum TZoomMode + { + EZoomNormal = 0, + EZoomIn1, + EZoomIn2, + EZoomIn3, + ENumOfZooms // has to be the last one + }; + +/** File name extensions for known used types */ +_LIT (KJpegExtension, ".jpg"); +_LIT (KBmpExtension, ".bmp"); + +/** Temporary file directory */ +_LIT (KTempPath, "\\private\\101ffa91\\temp\\"); + +/** Temporary save name for an image */ +_LIT (KTempSaveFile, "_tmpfile.sav"); + +/** Temporary save name for sending an image */ +_LIT (KTempSentFile, "tmp_send.jpg"); + +/** Default quality factor for saved images */ +const TInt KDefaultSavedJpegQuality = 90; + +/** Property category Uid */ +const TUid KImageEditorProperties = {0x02341234}; + +/** Image editor property keys */ +enum TImageEditorPropertyKeys +{ + EPropertyFilename // Document file name +}; + + +#endif // COMMONDEFS_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_definitions_api/inc/editorversion.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_definitions_api/inc/editorversion.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,24 @@ +/* +* 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: +* System parameters in plug-in framework. +* +*/ + + +/** Editor version numbers */ +const TInt my_version_major = 2; +const TInt my_version_minor = 7; +const TInt my_version_build = 4; diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_system_parameters_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_system_parameters_api/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* File that exports the files belonging to +* :Image Editor System Parameters API. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/SystemParameters.h MW_LAYER_PLATFORM_EXPORT_PATH(SystemParameters.h) diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_system_parameters_api/image_editor_system_parameters_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_system_parameters_api/image_editor_system_parameters_api.metaxml Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + Image Editor System Parameters API + IE system parameters and settings + c++ + imageeditorengine + + + + + + + + no + no + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_system_parameters_api/inc/SystemParameters.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_system_parameters_api/inc/SystemParameters.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,196 @@ +/* +* 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: +* System parameters in plug-in framework. +* +*/ + + +#ifndef SYSTEMPARAMETERS_H +#define SYSTEMPARAMETERS_H + + +#include + +/** + * CSystemParameters represents system parameters in plug-in framework + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib SystemParameters.lib + * @since S60 v5.0 + */ +class CSystemParameters : public CBase +{ + +public: + + /** + * Destructor. + */ + IMPORT_C ~CSystemParameters(); + + + /** + * Getter for source image size, non-const + * + * @since S60 v5.0 + * @param - + * @return Source image size + */ + IMPORT_C TSize & SourceSize(); + + /** + * Getter for source image size, const + * + * @since S60 v5.0 + * @param - + * @return Source image size + */ + IMPORT_C const TSize & SourceSize() const; + + + /** + * Getter for view port rect, non-const + * + * @since S60 v5.0 + * @param - + * @return View port rect + */ + IMPORT_C TRect & ViewPortRect(); + + /** + * Getter for view port rect, const + * + * @since S60 v5.0 + * @param - + * @return View port rect + */ + IMPORT_C const TRect & ViewPortRect() const; + + /** + * Getter for visible image rect, non-const + * + * @since S60 v5.0 + * @param - + * @return Visible image rect + */ + IMPORT_C TRect & VisibleImageRect(); + + /** + * Getter for visible image rect, const + * + * @since S60 v5.0 + * @param - + * @return Visible image rect + */ + IMPORT_C const TRect & VisibleImageRect() const; + + /** + * Getter for visible image rect in preview, non-const + * + * @since S60 v5.0 + * @param - + * @return Visible image rect in preview + */ + IMPORT_C TRect & VisibleImageRectPrev(); + + /** + * Getter for visible image rect in preview, const + * + * @since S60 v5.0 + * @param - + * @return Visible image rect in preview + */ + IMPORT_C const TRect & VisibleImageRectPrev() const; + + /** + * Getter for output scale, non-const + * + * @since S60 v5.0 + * @param - + * @return Output scale + */ + IMPORT_C TReal & Scale(); + + /** + * Getter for output scale, const + * + * @since S60 v5.0 + * @param - + * @return Output scale + */ + IMPORT_C const TReal & Scale() const; + + /** + * Getter for relative scale, non-const + * + * @since S60 v5.0 + * @param - + * @return Relative scale + */ + IMPORT_C TReal & RelScale(); + + /** + * Getter for relative scale, const + * + * @since S60 v5.0 + * @param - + * @return Relative scale + */ + IMPORT_C const TReal & RelScale() const; + +protected: + +private: // data + + /** + * Source image size + */ + TSize iSourceSize; + + /** + * View port rectangle + */ + TRect iViewPortRect; + + /** + * Visible image rect (from view port) + */ + TRect iVisibleImageRect; + + /** + * Visible image rect (from view port) in preview image + */ + TRect iVisibleImageRectPrev; + + /** + * Scale + */ + TReal iScale; + + /** + * Scale relative to the source image + */ + TReal iRelScale; + +}; + + +#endif // SYSTEMPARAMETERS_H + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,34 @@ +/* +* 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: +* File that exports the files belonging to +* : Image Editor Utilities API. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ResolutionUtil.h MW_LAYER_PLATFORM_EXPORT_PATH(ResolutionUtil.h) +../inc/plugininfo.h MW_LAYER_PLATFORM_EXPORT_PATH(plugininfo.h) +../inc/ImageEditorUtils.h MW_LAYER_PLATFORM_EXPORT_PATH(ImageEditorUtils.h) +../inc/CallbackMethod.h MW_LAYER_PLATFORM_EXPORT_PATH(callbackmethod.h) +../inc/Callback.h MW_LAYER_PLATFORM_EXPORT_PATH(Callback.h) +../inc/BitField.h MW_LAYER_PLATFORM_EXPORT_PATH(bitfield.h) diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/image_editor_utilities_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/image_editor_utilities_api.metaxml Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + Image Editor Utilities API + API to provide utility functions for Image Editor + c++ + imageeditorengine + + + + + + + + no + no + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/inc/BitField.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/inc/BitField.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,114 @@ +/* +* 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: +* Represents an N-bit bit field. +* +*/ + + +#ifndef BITFIELD_H +#define BITFIELD_H + +#include + +/** Class name */ +_LIT(KClassName, "BitField"); + +/** Max size */ +const TUint32 KSize = 32; + + +/** + * Represents an N-bit bit field + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib ImageEditorUtils.lib + * @since S60 v5.0 + */ +class TBitField +{ + +public: + + + /** : Should be changed to private and NewL used */ + IMPORT_C TBitField (); + + /** + * Destructor. + */ + IMPORT_C ~TBitField (); + + /** + * Copy constructor, disabled + * + * @since S60 v5.0 + * @param rhs reference to TBitField + * @return - + */ + IMPORT_C TBitField (const TBitField & rhs); + + /** + * Assignment operator, disabled + * + * @since S60 v5.0 + * @param rhs reference to TBitField + * @return reference to the copied TBitField + */ + IMPORT_C TBitField & operator= (const TBitField & rhs); + + /** + * Reset + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void Reset (); + + /** + * Set bit + * + * @since S60 v5.0 + * @param aIndex bit field position + * @return - + */ + IMPORT_C void SetBit (const TUint32 aIndex); + + /** + * Get bit + * + * @since S60 v5.0 + * @param aIndex bit field position + * @return bit value in TInt + */ + IMPORT_C TInt GetBit (const TUint32 aIndex) const; + + +protected: + +private: + + /** + * Data + */ + TUint8 iData[(KSize >> 3) + 1]; + +}; + +#endif // BITFIELD_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/inc/Callback.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/inc/Callback.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,117 @@ +/* +* 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: +* Forces an asynchronous callback to be called. +* +*/ + + +#ifndef CALLBACK_H +#define CALLBACK_H + +#include +#include "callbackmethod.h" + +/** + * Forces an asynchronous callback to be called. + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib ImageEditorUtils.lib + * @since S60 v5.0 + */ +class CObCallback : public CActive +{ + +public: + +/** @name Methods:*/ +//@{ + + /** + * Two-phased constructor. + * @param aMethod - observer reference + * @param ?arg2 ?description + */ + IMPORT_C static CObCallback * NewL (MObCallbackMethod * aMethod); + + /** + * Destructor. + */ + IMPORT_C ~CObCallback(); + + /** + * Forces the active scheduler to do callback + * + * @since S60 ?S60_version + * @param aParam - ID for callback, returned to observer + * @param ?arg2 ?description + * @return ?description + */ + IMPORT_C void DoCallback (TInt aParam); + +protected: + +private: + + CObCallback (MObCallbackMethod * aMethod); + + void ConstructL(); + +// from base class CActive + + /** + * From CActive. + * See CActive + * + * @since S60 ?S60_version + */ + virtual void RunL(); + + + /** + * From CActive. + * See CActive + * + * @since S60 ?S60_version + */ + virtual void DoCancel(); + + /** CompleteRequest + * + * Force RunL + * + * @param - + * @return - + */ + void CompleteRequest(); + +private: // data + + /** + * Observer reference + */ + MObCallbackMethod * iMethod; + + /** + * Callback ID + */ + TInt iParam; +}; + + +#endif // CALLBACK_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/inc/CallbackMethod.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/inc/CallbackMethod.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,49 @@ +/* +* 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: +* Observer API for CObCallback class. +* +*/ + + +#ifndef CALLBACKMETHOD_H +#define CALLBACKMETHOD_H + +/** + * Observer API for CObCallback class + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib - + * @since S60 v5.0 + */ +class MObCallbackMethod +{ + +public: + + /** + * Returns ETrue if callback is called again, otherwise EFalse + * + * @since S60 v5.0 + * @param aParam Callback ID + * @return TBool - ETrue if callback called again, EFalse otherwise + */ + virtual TBool CallbackMethodL ( TInt aParam ) = 0; +}; + +#endif // CALLBACKMETHOD_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/inc/ImageEditorUtils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/inc/ImageEditorUtils.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,322 @@ +/* +* 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: +* Static utility class. +* +*/ + + +#ifndef IMAGEEDITORUTILS_H +#define IMAGEEDITORUTILS_H + +#include +#include + +class CMGXFileManager; +class RFs; + + +/** + * Static utility class + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib ImageEditorUtils.lib + * @since S60 v5.0 + */ +class ImageEditorUtils +{ +public: + + /** Memory location */ + enum TMemoryLocation + { + EPhone, + EMmc, + EMixed + }; + + /** Memory location selection options */ + enum TMemorySelection + { + ESelectAutomatic, + ESelectPhone, + ESelectMmc + }; + + /** + * Generates a new name for the loaded document at the startup. + * If automatic memory selection is used, the generated file is located on the + * MMC dy default. If the MMC is full or not present, the file will be in phone + * memory. Optionally the file can be forced onto either drive. + * Internally, ImageFitsToDriveL is used to check the space. + * + * Media gallery album id list is no longer supported due to Media Gallery removal. + * If an invalid album list is passed the behaviour is undefined. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFileName source file name + * @param aTargetFileName target file name + * @param aMgAlbumIdList list of the albums the source image belongs to + * @param aReservedFileNames additional list of already reserved file names + * @param aMemoryInUse where the target file is created + * @return KErrNone if successfully generated file name + * KSIEENotEnoughDiskSpace if no disk space to save the file + * (size of aSourceFileName used to check the space) + * KSIEEOpenFile if the source filename is invalid + */ + IMPORT_C static TInt GenerateNewDocumentNameL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + TDes& aTargetFileName, + RArray* aMgAlbumIdList = NULL, + const CDesCArray* aReservedFileNames = NULL, + ImageEditorUtils::TMemorySelection aMemoryInUse = ImageEditorUtils::ESelectAutomatic + ); + + /** + * Generates a new name for the loaded document in filename query. A + * unique filename is generated by adding running number after source + * filename until unique name is found. e.g. if image name is "Image", + * first attempt for new filename is "Image-001". If that is already + * in use, "Image-002" is tried and so on. First unused filename is + * then proposed for the user. + * ImageFitsToDriveL is used to check the space. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFileName source file name + * @param aTargetFileName target file name + * @param aDrive the drive where the target file is to be created + * @param aReservedFileNames additional list of already reserved file names + * @return KErrNone if successfully generated file name + * KSIEENotEnoughDiskSpace if no disk space to save the file + * (size of aSourceFileName used to check the space) + * KSIEEOpenFile if the source filename is invalid + */ + IMPORT_C static TInt GenerateNewFileNameL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + TDes& aTargetFileName, + TFileName aDrive, + const CDesCArray* aReservedFileNames = NULL ); + + + /** GenerateFilePath + * + * Generates a path for an image file. The memory selection option is given + * as a parameter. + * ImageEditorUtilsImageFitsToDriveL is used to check the space. + * + * Media gallery album id list is no longer supported due to Media Gallery removal. + * If an invalid album list is passed the behaviour is undefined. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFileName source file name + * @param aTargetFileName target file name + * @param aMgAlbumIdList list of the albums the source image belongs to + * @param aReservedFileNames additional list of already reserved file names + * @param aMemoryInUse where the target file is created + * @return KErrNone if successfully generated file name + * KSIEENotEnoughDiskSpace if no disk space to save the file + * (size of aSourceFileName used to check the space) + * KSIEEOpenFile if the source filename is invalid + */ + IMPORT_C static TInt GenerateFilePathL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + TDes& aTargetFileName, + ImageEditorUtils::TMemorySelection aMemoryInUse ); + + /** + * Checks whether there is enough disk space to save + * the given file. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFile the file that would be saved + * @param aTargetPath the path to save (only drive part needed) + * @return ETrue if there is enough disk space to save the file + * EFalse if there is not enough disk space + */ + IMPORT_C static TBool ImageFitsToDriveL ( + RFs& aFsSession, + const TDesC& aSourceFile, + const TDesC& aTargetPath + ); + + /** + * Checks whether there is enough disk space to save + * the given list of files. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFileList the files that would be saved + * @param aTargetFileList the paths to save (only drive part needed) + * @return ETrue if there is enough disk space to save the files + * EFalse if there is not enough disk space + */ + IMPORT_C static TBool ImagesFitToDriveL ( + RFs& aFsSession, + const CDesCArray& aSourceFileList, + const CDesCArray& aTargetFileList + ); + + /** + * Notifies the system that a new image has been saved, + * This is depreciated now and not used after MediaGallery removal. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aFileName name of the new file + * @return - + */ + IMPORT_C static void NotifyNewMediaDocumentL ( + RFs& aFsSession, + const TDesC& aFileName + ); + + /** + * Notifies the system that new images have been saved, + * making them visible in the Media Gallery. + * This is depreciated now and not used after MediaGallery removal. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aFileNameArray new file names + * @return - + */ + IMPORT_C static void NotifyNewMediaDocumentL ( + RFs& aFsSession, + const MDesCArray& aFileNameArray + ); + + /** + * Finds out in which Media Gallery Album the file belongs to. + * If compiled without album support, this function + * returns an empty array. + * Reset() is called for the array at the begining. + * + * @since S60 v5.0 + * @param aAlbumList on return, contains the ID:s of the + * Media Gallery albums the file belongs to + * @param aFileName the image file name + * @return - + */ + IMPORT_C static void FindAlbumsForImageFileL ( + RArray& aAlbumIdList, + const TDesC& aFilename + ); + + /** + * Adds the given image file to the given album (e.g. video album). + * If compiled without album support, this function does nothing. + * + * @since S60 v5.0 + * @param aFileName file name to be added to the album + * @param aAlbumId id of the album + * @return - + */ + IMPORT_C static void AddImageFileToAlbumL ( + const TDesC& aFileName, + TInt aAlbumId + ); + + /** + * Helper function to get the manufacturer and model of the device. + * Uses Shared Data client to retrieve the information. + * If compiled on a public SDKs, which do not contain shared data, + * this returns empty descriptors. + * + * @since S60 v5.0 + * @param aMake manufacturer of the device + * @param aModel model of the device + * @return - + */ + IMPORT_C static void GetMakeAndModelL( TDes8& aMake, TDes8& aModel ); + + /** + * Copies file without opening it, using RFs::ReadFileSection. + * Synchronous. + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFileName source file name + * @param aDestinationFileName destination file name + * @param aOverwriteTarget is the target overwritten if it exists + * @return error code + */ + IMPORT_C static TInt CopyFile ( + RFs& aFsSession, + const TDesC& aSourceFileName, + const TDesC& aDestinationFileName, + TBool aOverwrite = ETrue + ); + +private: + + /** + * Finds the offset of the edited image suffix of form "-NNN", + * where NNN is the edit sequence number. + * + * @since S60 v5.0 + * @param aName image name without extension + * @return offset of the edited image suffix + */ + static TInt FindSuffix ( + const TDesC & aName + ); + + /** + * Checks if a file with the specified name already exists in the system. + * + * @since S60 v5.0 + * @param aFs file server session handle + * @param aFileName file name to be checked + * @param aReservedFileNames explicitly recerved file names + * @return TBool + */ + static TBool FileAlreadyExistsL ( + RFs& aFsSession, + const TDesC& aFileName, + const CDesCArray* aReservedFileNames + ); + + /** + * Internal implementation of CopyFile + * + * @since S60 v5.0 + * @param aFsSession file server session handle + * @param aSourceFileName source file + * @param aDestinationFileName destination file + * @param aSourceFileSize source file size in bytes + * @return - + */ + static void DoCopyL ( + RFs& aFsSession, + const TDesC& aSourceFileName, + const TDesC& aDestinationFileName, + TUint aSourceFileSize + ); +}; + + +#endif // IMAGEEDITORUTILS_H + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/inc/ResolutionUtil.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/inc/ResolutionUtil.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,231 @@ +/* +* 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: +* CResolutionUtil provides functions to query current screen dimensions. +* +*/ + + + +#ifndef RESOLUTIONUTIL_H +#define RESOLUTIONUTIL_H + +#include +#include + +/** + * The class provides functions to query current screen dimensions. + * The class is used through CCoeEnv::Static() + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib ImageEditorUtils.lib + * @since S60 v5.0 + */ +class CResolutionUtil : public CCoeStatic + { + +public: + + /** Screen modes */ + enum TScreenModes + { + EUnknown, + EStandard, + EStandardFullScreen, + EStandardLandscape, + EStandardLandscapeFullScreen, + ESquare, + ESquareFullScreen, + ESquareRotated, + ESquareRotatedFullScreen, + EQVGA, + EQVGAFullScreen, + EQVGALandscape, + EQVGALandscapeFullScreen, + EDouble, + EDoubleFullScreen, + EDoubleLandscape, + EDoubleLandscapeFullScreen, + EHVGA, + EHVGAFullScreen, + EHVGALandscape, + EHVGALandscapeFullScreen, + EVGA, + EVGAFullScreen, + EVGALandscape, + EVGALandscapeFullScreen, + EQHD, + EQHDFullScreen, + EQHDLandscape, + EQHDLandscapeFullScreen + }; + + /** + * Returns the singleton instance of this CCoeStatic. + * If the instance does not exist, panics the tread. + * + * @since S60 v5.0 + * @param - + * @return the singleton instance of CResolutionUtil + */ + IMPORT_C static CResolutionUtil* Self(); + + /** + * Returns the singleton instance of this CCoeStatic. + * If the instance does not exist, a new one is created. + * + * @since S60 v5.0 + * @param - + * @return the singleton instance of CResolutionUtil + */ + IMPORT_C static CResolutionUtil* InitializeL(); + + /** + * Destructor. + */ + IMPORT_C virtual ~CResolutionUtil(); + + /** + * Returns the screen mode. + * + * @since S60 v5.0 + * @param - + * @return screen mode, see TScreenModes + */ + IMPORT_C TInt ScreenMode() const; + + /** + * Returns the screen mode. Return the real screen mode i.e. Image Editor + * flagging has no effect on return value. + * + * @since S60 v5.0 + * @param - + * @return screen mode, see TScreenModes + */ + IMPORT_C TInt GetScreenMode() const; + + /** + * Returns the screen rect for the current screen mode. + * + * @since S60 v5.0 + * @param aRect screen rect for specified screen mode + * @return - + */ + IMPORT_C void GetScreenRect(TRect& aRect) const; + + /** + * Sets the screen rect for the current screen mode. + * + * @since S60 v5.0 + * @param aRect screen rect for specified screen mode + * @return - + */ + IMPORT_C void SetScreenRect(const TRect& aRect); + + /** + * Gets the client rect for the current screen mode. + * + * @since S60 v5.0 + * @param aRect client rect for specified screen mode + * @return - + */ + IMPORT_C void GetClientRect(TRect& aRect) const; + + /** + * Sets the client rect for the current screen mode. + * + * @since S60 v5.0 + * @param aRect client rect for specified screen mode + * @return - + */ + IMPORT_C void SetClientRect(const TRect& aRect); + + /** + * Determines the current screen size and updates rect. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void UpdateScreenMode(); + + /** + * Sets Full Screen mode to true or false. + * + * @since S60 v5.0 + * @param aFullScreen ETrue if full screen, otherwise EFalse + * @return - + */ + IMPORT_C void SetFullScreen(TBool aFullScreen); + + /** + * Gets the Full Screen state. + * + * @since S60 v5.0 + * @param aFullScreen ETrue if full screen, otherwise EFalse + * @return - + */ + IMPORT_C TBool GetFullScreen() const; + + /** + * Sets the landscape mode to true or false. + * + * @since S60 v5.0 + * @param aLandscape ETrue if landscape, otherwise EFalse + * @return - + */ + IMPORT_C void SetLandscape(TBool aLandscape); + + /** + * Gets the landscape mode to true or false. + * + * @since S60 v5.0 + * @param aLandscape ETrue if landscape, otherwise EFalse + * @return - + */ + IMPORT_C TBool GetLandscape() const; + +private: + + CResolutionUtil( const TUid& aUid ); + +private: + + /** + * Screen rect + */ + TRect iScreenRect; + + /** + * Client rect + */ + TRect iClientRect; + + /** + * Landscape mode + */ + TBool iLandscape; + + /** + * Full Screen mode + */ + TBool iFullScreen; + + }; + +#endif // RESUTIL_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_editor_utilities_api/inc/plugininfo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_editor_utilities_api/inc/plugininfo.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,626 @@ +/* +* 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: +* CPluginInfo class represents information about editor plug-in. +* +*/ + + +#ifndef PLUGININFO_H +#define PLUGININFO_H + +#include +#include +#include + +/** Array for menu items */ +typedef CArrayFixSeg CMenuItemArray; + + +class CFbsBitmap; +class RReadStream; +class RWriteStream; + +/** + * Represents information about editor plug-in. + * The class encapsulates the following info: + * + * PLUG-IN DLL INFO: + * + * plug-in DLL name + * plug-in DLL UID 2 (API UID) + * plug-in DLL UID 3 + * plug-in UI type + * plug-in filter type + * + * PLUG-IN UI INFO: + * + * plug-in run-time ID + * plug-in name + * icon file name + * icon bitmap + * icon mask bitmap + * parameter array + * softkey 1 items + * softkey 2 items + * menu items + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib ImageEditorUtils.lib + * @since S60 v5.0 + */ +class CPluginInfo : public CBase +{ + +public: + + /** + * Comparison method for CPluginInfo instances based on RID + * + * @since S60 v5.0 + * @param aItem1 - first item to be compared + * @param aItem2 - second item to be compared + * @return -1 if aItem1 < aItem2 + * 1 if aItem1 > aItem2 + * 0 otherwise + */ + IMPORT_C static TInt ComparePluginInfo ( + const CPluginInfo & aItem1, + const CPluginInfo & aItem2 + ); + + /** + * Comparison method for CPluginInfo instances based on plug-in order + * + * @since S60 v5.0 + * @param aItem1 - first item to be compared + * @param aItem2 - second item to be compared + * @return -1 if aItem1 < aItem2 + * 1 if aItem1 > aItem2 + * 0 otherwise + */ + IMPORT_C static TInt ComparePluginOrder ( + const CPluginInfo & aItem1, + const CPluginInfo & aItem2 + ); + + + /** + * Two-phased constructor. + * @param - + * @return pointer to created CPluginInfo object + */ + IMPORT_C static CPluginInfo * NewL (); + + /** + * Two-phased constructor. + * Leaves the object in cleanup stack. + * @param - + * @return pointer to created CPluginInfo object + */ + IMPORT_C static CPluginInfo * NewLC (); + + /** + * Destructor. + */ + IMPORT_C ~CPluginInfo (); + + /** + * Getter for plug-in DLL file name. + * + * @since S60 v5.0 + * @param - + * @return plug-in DLL name + */ + IMPORT_C HBufC *& PluginDll (); + + /** + * Getter for plug-in DLL file name, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in DLL name + */ + IMPORT_C const TDesC & PluginDll () const; + + /** + * Getter for plug-in DLL UID2, non-const. + * + * @since S60 v5.0 + * @param - + * @return plug-in DLL UID2 + */ + IMPORT_C TUid & Uid2 (); + + /** + * Getter for plug-in DLL UID2, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in DLL UID2 + */ + IMPORT_C const TUid & Uid2 () const; + + /** + * Getter for plug-in DLL UID3, non-const. + * + * @since S60 v5.0 + * @param - + * @return plug-in DLL UID3 + */ + IMPORT_C TUid & Uid3 (); + + /** + * Getter for plug-in DLL UID3, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in DLL UID3 + */ + IMPORT_C const TUid & Uid3 () const; + + /** + * Getter for plug-in UI type, non-const. + * + * @since S60 v5.0 + * @param - + * @return plug-in UI type + */ + IMPORT_C TInt & PluginUiType(); + + /** + * Getter for plug-in UI type, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in UI type + */ + IMPORT_C const TInt & PluginUiType() const; + + /** + * Getter for plug-in filter type, non-const. + * + * @since S60 v5.0 + * @param - + * @return plug-in filter type + */ + IMPORT_C TInt & PluginFilterType(); + + /** + * Getter for plug-in filter type, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in filter type + */ + IMPORT_C const TInt & PluginFilterType() const; + + /** + * Getter for plug-in scope, non-const. + * + * @since S60 v5.0 + * @param - + * @return plug-in scope + */ + IMPORT_C TInt & PluginScope(); + + /** + * Getter for plug-in scope, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in scope + */ + IMPORT_C const TInt & PluginScope() const; + + /** + * Getter for plug-in display order, non-const. + * Determines the order in which the plugins are + * displayed in the user interface. + * + * @since S60 v5.0 + * @param - + * @return plug-in order + */ + IMPORT_C TInt & PluginDisplayOrder(); + + /** + * Getter for plug-in display order, const. + * Determines the order in which the plugins are + * displayed in the user interface. + * + * @since S60 v5.0 + * @param - + * @return plug-in order + */ + IMPORT_C const TInt & PluginDisplayOrder() const; + + /** + * Getter for plug-in RID, non-const. + * + * @since S60 v5.0 + * @param - + * @return plug-in RID + */ + IMPORT_C TInt & PluginRID(); + + /** + * Getter for plug-in RID, const. + * + * @since S60 v5.0 + * @param - + * @return plug-in RID + */ + IMPORT_C const TInt & PluginRID() const; + + /** + * Getter for plug-in name, non-const. + * + * @param - + * @return plug-in name + */ + IMPORT_C HBufC *& PluginName(); + + /** + * Getter for plug-in name, const. + * + * @param - + * @return plug-in name + */ + IMPORT_C const TDesC & PluginName() const; + + /** + * Getter for plug-in group icon file name, non-const. + * + * @since S60 v5.0 + * @param - + * @return icon file name + */ + IMPORT_C HBufC *& IconFile(); + + /** + * Getter for plug-in group icon file name, const. + * + * @since S60 v5.0 + * @param - + * @return icon file name + */ + IMPORT_C const TDesC & IconFile() const; + + /** + * Getter for plug-in group icon bitmap, non-const. + * + * @since S60 v5.0 + * @param - + * @return icon bitmap + */ + IMPORT_C CFbsBitmap *& Icon(); + + /** + * Getter for plug-in group icon bitmap, const. + * + * @since S60 v5.0 + * @param - + * @return icon bitmap + */ + IMPORT_C const CFbsBitmap * Icon() const; + + /** + * Getter for plug-in mask bitmap, non-const. + * + * @since S60 v5.0 + * @param - + * @return mask bitmap + */ + IMPORT_C CFbsBitmap *& Mask(); + + /** + * Getter for plug-in mask bitmap, const. + * + * @since S60 v5.0 + * @param - + * @return mask bitmap + */ + IMPORT_C const CFbsBitmap * Mask() const; + + /** + * Getter for parameter descriptor array, non-const. + * + * @since S60 v5.0 + * @param - + * @return pointer to descriptor array + */ + IMPORT_C CDesCArray & Parameters(); + + /** + * Getter for parameter descriptor array, const. + * + * @since S60 v5.0 + * @param - + * @return pointer to descriptor array + */ + IMPORT_C const CDesCArray & Parameters() const; + + /** + * Getter for soft key 1 command ID, non-const. + * + * @since S60 v5.0 + * @param - + * @return command ID for soft key 1 + */ + IMPORT_C CArrayFix & Sk1Cmds(); + + /** + * Getter for soft key 1 command ID, const. + * + * @since S60 v5.0 + * @param - + * @return command ID for soft key 1 + */ + IMPORT_C const CArrayFix & Sk1Cmds() const; + + /** + * Getter for soft key 1 texts, non-const. + * + * @since S60 v5.0 + * @param - + * @return soft key texts + */ + IMPORT_C CDesCArray & Sk1Texts(); + + /** + * Getter for soft key 1 texts, const. + * + * @since S60 v5.0 + * @param - + * @return soft key texts + */ + IMPORT_C const CDesCArray & Sk1Texts() const; + + /** + * Getter for soft key 2 command ID, non-const. + * + * @since S60 v5.0 + * @param - + * @return command ID for soft key 2 + */ + IMPORT_C CArrayFix & Sk2Cmds(); + + /** + * Getter for soft key 2 command ID, const. + * + * @since S60 v5.0 + * @param - + * @return command ID for soft key 2 + */ + IMPORT_C const CArrayFix & Sk2Cmds() const; + + /** + * Getter for soft key 2 texts, non-const. + * + * @since S60 v5.0 + * @param - + * @return soft key texts + */ + IMPORT_C CDesCArray & Sk2Texts(); + + /** + * Getter for soft key 1 texts, const. + * + * @since S60 v5.0 + * @param - + * @return soft key texts + */ + IMPORT_C const CDesCArray & Sk2Texts() const; + + /** + * Getter for middle soft key command ID, non-const. + * + * @since S60 v5.0 + * @param - + * @return command ID for soft key 2 + */ + IMPORT_C CArrayFix & MSKCmds(); + + /** + * Getter for middle soft key command ID, const. + * + * @since S60 v5.0 + * @param - + * @return command ID for soft key 2 + */ + IMPORT_C const CArrayFix & MSKCmds() const; + + /** + * Getter for middle soft key texts, non-const. + * + * @since S60 v5.0 + * @param - + * @return soft key texts + */ + IMPORT_C CDesCArray & MSKTexts(); + + /** + * Getter for middle soft key texts, const. + * + * @since S60 v5.0 + * @param - + * @return soft key texts + */ + IMPORT_C const CDesCArray & MSKTexts() const; + + /** + * Getter for menu items, non-const. + * + * @since S60 v5.0 + * @param - + * @return reference to menu item array + */ + IMPORT_C CMenuItemArray & MenuItems(); + + /** + * Getter for menu items, const. + * + * @since S60 v5.0 + * @param - + * @return reference to menu item array + */ + IMPORT_C const CMenuItemArray & MenuItems() const; + + /** + * Externalises the object. + * All the member variables are serialized into the stream, + * except for the CFbsBitmap members iIcon and iMask. For those, + * only file path is stored, and the icons need to be created + * from file when internalizing the object. + * + * @since S60 v5.0 + * @param aStream - write stream + * @return - + */ + IMPORT_C void ExternalizeL(RWriteStream& aStream) const; + + /** InternalizeL + * + * Internalises the object. + * All the member variables are serialized into the stream, + * except for the CFbsBitmap members iIcon and iMask. For those, + * only file path is stored, and the icons need to be created + * from file when internalizing the object. + * + * @since S60 v5.0 + * @param aStream - read stream + * @return - + */ + IMPORT_C void InternalizeL(RReadStream& aStream); + + +protected: +private: + + CPluginInfo (); + + void ConstructL (); + +private: // data + + /** + * Plug-in DLL name + */ + HBufC * iPluginDllName; + + /** + * Plug-in DLL UID 2 + */ + TUid iUID2; + + /** + * Plug-in DLL UID 3 + */ + TUid iUID3; + + /** + * Plug-in UI type + */ + TInt iPluginUiType; + + /** + * Plug-in filter type + */ + TInt iPluginFilterType; + + /** + * Plug-in scope + */ + TInt iScope; + + /** + * Plug-in run-time ID (RID) + */ + TInt iPluginRID; + + /** + * Plug-in display order + */ + TInt iPluginDisplayOrder; + + /** + * Plug-in name + */ + HBufC * iPluginName; + + /** + * Icon name + */ + HBufC * iIconFileName; + + /** + * Icon bitmap + */ + CFbsBitmap * iIcon; + + /** + * Icon mask bitmap + */ + CFbsBitmap * iMask; + + /** + * Parameter array + */ + CDesCArray * iParams; + + /** + * Soft key 1 command ID + */ + CArrayFix * iSk1Cmds; + + /** + * Soft key 1 text + */ + CDesCArray * iSk1Texts; + + /** + * Soft key 2 command ID + */ + CArrayFix * iSk2Cmds; + + /** + * Soft key 2 text + */ + CDesCArray * iSk2Texts; + + /** + * Middle soft key command ID + */ + CArrayFix * iMSKCmds; + + /** + * Middle soft key text + */ + CDesCArray * iMSKTexts; + + + /** + * Menu items + */ + CMenuItemArray * iMenuItems; + +}; + + +#endif // PLUGININFO_H diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_processing_engine_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_processing_engine_api/group/bld.inf Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: +* File that exports the files belonging to +* : Image Processing Engine API. +* +*/ + + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/ImageEditorEngineWrapper.h MW_LAYER_PLATFORM_EXPORT_PATH(ImageEditorEngineWrapper.h) diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_processing_engine_api/image_processing_engine_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_processing_engine_api/image_processing_engine_api.metaxml Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,17 @@ + + + Image Processing Engine API + API that encapsulates services provided by the IPE filters + c++ + imageeditorengine + + + + + + + + no + no + + diff -r 57d4cdd99204 -r edfc90759b9f imgeditor_plat/image_processing_engine_api/inc/ImageEditorEngineWrapper.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/imgeditor_plat/image_processing_engine_api/inc/ImageEditorEngineWrapper.h Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,600 @@ +/* +* 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: +* CEngineWrapper wraps functionality of Gonzales image +* processing engine architecture. +* +*/ + + +#ifndef IMAGEEDITORENGINEWRAPPER_H +#define IMAGEEDITORENGINEWRAPPER_H + +/// INCLUDES +#include +#include "commondefs.h" + + +/** Panic category */ +_LIT (KEnginePanic, "ENGINE PANIC"); + +/** Panic reasons */ +const TInt KEnginePanicAllocation = -1; +const TInt KEnginePanicInternal = -2; +const TInt KEnginePanicParameter = -3; + +/// FORWARD DECLARATIONS +class CFbsBitmap; +class CFilterStack; +class CSystemParameters; +class TFilter; +class CExifParser; + + +/** + * CEngineWrapper wraps functionality of Gonzales image processing + * engine architecture. + * + * @code + * ?good_class_usage_example(s) + * @endcode + * + * @lib EngineWrapper.lib + * @since S60 v5.0 + */ +class CEngineWrapper : public CBase +{ + +public: + + + /** + * Two-phased constructor. + * @param - + */ + IMPORT_C static CEngineWrapper * NewL (); + + /** + * Destructor. + */ + IMPORT_C ~CEngineWrapper (); + + /** + * Creates JPEG source to engine. + * + * @since S60 v5.0 + * @param aFileName source image file name + * @return - + */ + IMPORT_C void CreateJpegSourceL (const TDesC & aFileName); + + /** + * Creates JPEG target for engine. + * + * @since S60 v5.0 + * @param aFileName saved image file name + * @param aQuality saved image quality + * @param aSize image size (width and height) + * @return - + */ + IMPORT_C void CreateJpegTargetL ( + const TDesC & aFileName, + const TInt aQuality, + const TSize * aSize = NULL + ); + + /** + * Creates ICL source to engine. + * + * @since S60 v5.0 + * @param aFileName source image file name + * @return / + */ + IMPORT_C void CreateIclSourceL (const TDesC & aFileName); + + /** + * Creates RGB888 buffer target to engine. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void CreateRGB888TargetL (); + + /** + * Sets screen size to engine. + * + * @since S60 v5.0 + * @param aSize screen size + * @return - + */ + IMPORT_C void SetScreenSizeL (const TSize & aSize); + + /** + * Adds new filter to the engine. + * + * @since S60 v5.0 + * @param aFilterName filter plug-in name + * @return - + */ + IMPORT_C void AddFilterL (const TDesC & aFilterName); + + /** + * Sets filter parameters for the last (top) filter. + * + * @since S60 v5.0 + * @param aParam reference to parameter structure + * @return - + */ + IMPORT_C void SetParamsL (const TDesC & aParam); + + /** + * Renders the engine graph. + * + * @since S60 v5.0 + * @param aMultiSessionBlockCount not used + * @return - + */ + IMPORT_C void RenderL (TInt* aMultiSessionBlockCount = NULL); + + /** + * Renders a block + * + * @since S60 v5.0 + * @return return percentage of image data saved, 100 when ready + */ + IMPORT_C TInt RenderBlockL (); + + /** + * Aborts block rendering + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void RenderAbortL (); + + /** + * Initializes undo / redo stack. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void InitUndoRedo(); + + /** + * Sets a new undo / redo step. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void AddUndoRedoStepL(); + + /** + * Undoes the last operation. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void UndoL(); + + /** + * Checks if it is possible to undo. + * + * @since S60 v5.0 + * @param - + * @return ETrue if undo possible, EFalse otherwise + */ + IMPORT_C TBool CanUndo (); + + /** + * Checks if the image is changed after last saving. + * + * @since S60 v5.0 + * @param - + * @return ETrue if image is changed, EFalse otherwise + */ + IMPORT_C TBool IsImageChanged(); + + /** + * Stores current zoom value. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void StoreZoomL (); + + /** + * Restores stored zoom value. + * + * @since S60 v5.0 + * @param - + * @return - + */ + IMPORT_C void RestoreZoomL(); + + /** ZoomL + * Zooms the image. + * + * @since S60 v5.0 + * @param aZoom zoom direction + * @return - + */ + IMPORT_C void ZoomL (const TZoom aZoom); + + /** GetZoomMode + * Returns current zoom mode. + * + * @since S60 v5.0 + * @param - + * @return TZoomMode current zooming mode + */ + IMPORT_C TZoomMode GetZoomMode(); + + /** + * Pans the image. + * + * @since S60 v5.0 + * @param aDir direction, see commondefs.h + * @return - + */ + IMPORT_C void PanL (const TDirection aDir); + + + /** + * Pans the image. Used when panning is done with touch + * + * @since S60 v5.0 + * @param aXChange x-directional change on the screen + * @param aYChange y-directional change on the screen + * @return - + */ + IMPORT_C void PanL( TInt aXChange, TInt aYChange ); + + + /** + * Rotates the image. + * + * @since S60 v5.0 + * @param aRot rotation direction, see commodefs.h + * @return - + */ + IMPORT_C void RotateL (const TRotation aRot); + + /** + * Gets system parameters + * + * @since S60 v5.0 + * @param - + * @return pointer to the system parameters + */ + IMPORT_C CSystemParameters * GetSystemPars (); + + /** + * No functionality. + * + * @since S60 v5.0 + * @param aWidth width of the output image in pixels + * @param aHeight height of the output image in pixels + * @return - + */ + IMPORT_C void GetOutputImageSize ( TInt& aWidth, TInt& aHeight ) const; + + /** + * No functionality. + * + * @since S60 v5.0 + * @param aComment comment to be set + * @return - + */ + IMPORT_C void SetJpegCommentL (const TDesC8& aComment); + + /** + * Sets the bitmap to member variable. + * + * @since S60 v5.0 + * @param aBitmap bitmap to be set + * @return - + */ + IMPORT_C void SetBitmap (CFbsBitmap * aBitmap); + + /** + * Creates new EXIF thumbnail from the current filter stack. + * + * @since S60 v5.0 + * @param - + * @param - + * @return - + */ + IMPORT_C void CreateExifThumbNailL (); + +protected: + +private: + + CEngineWrapper (); + + void ConstructL (); + + /** + * Checks if a file exists or not, on return has the correct + * path to the checked file. + * + * @since S60 v5.0 + * @param aFileName file name, on return includes the correct path + * @return KErrNone if file exists, system wide error code otherwise + */ + TInt FileExists (TDes & aFileName) const; + + /** + * Cleans up the engine, frees allocated memory. Does not delete + * the engine itself. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void Cleanup(); + + /** + * Computes current system parameters. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void ComputeSystemParameters (); + + /** + * No functionality. + * + * @since S60 v5.0 + * @param aStartInd view port start index, defaults to 2 + * @return the current view port + */ + TRect ComputeViewPort( const TInt aStartInd = 2 ); + + /** + * No functionality. + * + * @since S60 v5.0 + * @param aViewPort the current view port + * @return the current visible view port area + */ + TRect ComputeVisibleViewPort (const TRect & aViewPort); + + /** + * No functionality + * + * @since S60 v5.0 + * @param aVvpOld the old visible view port area + * @return new pan value + */ + TPoint ComputeNewPanValue (const TRect & aVvpOld); + + /** + * Adds rotation filter to the engine. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void AddRotateFilterL(); + + /** + * Copies rendered buffer from engine to screen bitmap. + * + * @since S60 v5.0 + * @param aBuffer pointer to engine buffer data + * @return - + */ + void CopyBufferL (TUint32 * aBuffer); + + /** + * Checks if two strings are equal. + * + * @since S60 v5.0 + * @param aString1 first string to be compared + * @param aString2 second string to be compared + * @return ETrue if equal, EFalse otherwise + */ + TBool CEngineWrapper::IsSameString ( + const TUint8 * aString1, + const TUint8 * aString2 + ); + + /** + * Updates scale and pan to crop rectangle. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void UpdateCropRectL (); + + /** + * Updates thumbnail data to EXIF parser. + * + * @since S60 v5.0 + * @param - + * @return - + */ + TPtrC8 UpdateExifThumbnailL (); + + /** + * Handles tags that are always updated to the new image. If tags + * do not exist, creates new ones. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void UpdateExifTagsL(); + + /** + * Gets current date and time as descriptor. + * + * @since S60 v5.0 + * @param aDateTimeBuf contains datetime on return + * @return - + */ + void GetCurrentDateTime (TDes8 & aDateTimeBuf) const; + + /** + * Computes current total rotation of the original image + * in degrees. + * + * @since S60 v5.0 + * @param - + * @return rotation in degrees + */ + TInt ComputeRotationL (); + + /** + * Computes bounding rectangle used from global cropping. + * + * @since S60 v5.0 + * @param - + * @return - + */ + void ComputeBoundingRectL(); + + /** + * Rendering mode + */ + enum TRenderingMode + { + // Invalid + ERenderingModeMin = 0, + // Render to jpeg + ERenderingModeJpeg, + // Render RGB888 buffer + ERenderingModeRGB888, + // Invalid + ERenderingModeMax + } iMode; + + /** + * Main engine + */ + CFilterStack * iMainEngine; + + /** + * Engine command line + */ + TBuf<256> iCmd; + + /** + * Source image size + */ + TSize iSourceSize; + + /** + * Screen size + */ + TSize iScreenSize; + + /** + * Screen data address + */ + CFbsBitmap * iScreenBitmap; + + /** + * Target image name + */ + TFileName iTargetFile; + + /** + * System parameters + */ + CSystemParameters * iSysPars; + + /** + * Undo points + */ + RArray iUndoPoints; + + /** + * Undo buffer for scale parameter + */ + RArray iScaleUndoBuf; + + /** + * EXIF parser + */ + CExifParser * iExifParser; + + /** + * EXIF thumbnail buffer + */ + TUint32 * iThumb; + + /** + * EXIF thumbnail dimensions + */ + TSize iThumbSize; + + /** + * JPEG comment text + */ + HBufC8* iJpegComment; + + /** + * Change counter, 0 if no changes after save + */ + TInt iChangeCount; + + /** + * Previous change counter + */ + TInt iPrevChangeCount; + + /** + * Scale buffer changed + */ + TBool iRenderScaleBuffer; + + /** + * Crop parameters + */ + TReal iScale; + TReal iMinScale; + TReal iMaxScale; + TReal iPanX; + TReal iPanY; + TReal iPanStep; + TRect iBoundingRect; + + /** + * Stored crop parameters + */ + TReal iScaleSt; + TReal iPanXSt; + TReal iPanYSt; + TRect iOldCropRect; + + /** + * Current zooming mode + */ + TZoomMode iZoomMode; + +}; + +#endif // IMAGEEDITORENGINEWRAPPER_H + diff -r 57d4cdd99204 -r edfc90759b9f layers.sysdef.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/layers.sysdef.xml Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,26 @@ + + +]> + + + + + + + + + + + + + + + + + + + + + + diff -r 57d4cdd99204 -r edfc90759b9f sysdef_1_4_0.dtd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sysdef_1_4_0.dtd Fri Jan 29 13:53:17 2010 +0200 @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +