Fixed issue 56567
authorHimanshu <himanshu.t@samsung.com>
Tue, 29 Oct 2013 08:27:15 +0000 (13:57 +0530)
committerHimanshu <himanshu.t@samsung.com>
Tue, 29 Oct 2013 08:27:15 +0000 (13:57 +0530)
Change-Id: I4a10b978b14dd9a1a99fd0dbf130448437feeeaf
Signed-off-by: Himanshu <himanshu.t@samsung.com>
inc/GlImageCropForm.h
src/GlImageCropForm.cpp

index 726998e..ef1fef5 100644 (file)
@@ -25,6 +25,8 @@
 #include <FMedia.h>
 #include <FUi.h>
 
 #include <FMedia.h>
 #include <FUi.h>
 
+#include "GlFileListPresentationModel.h"
+
 enum TouchLocation
 {
        INSIDE_CROPBOX = 0,
 enum TouchLocation
 {
        INSIDE_CROPBOX = 0,
@@ -40,7 +42,8 @@ enum TouchLocation
 };
 
 class ImageCropForm
 };
 
 class ImageCropForm
-       : public Tizen::Ui::Controls::Form
+       : public IFormContentUpdateEventListener
+       , public Tizen::Ui::Controls::Form
        , public Tizen::Ui::Controls::IFormBackEventListener
        , public Tizen::Ui::IActionEventListener
        , public Tizen::Ui::IOrientationEventListener
        , public Tizen::Ui::Controls::IFormBackEventListener
        , public Tizen::Ui::IActionEventListener
        , public Tizen::Ui::IOrientationEventListener
@@ -59,6 +62,10 @@ public:
        virtual result OnInitializing(void);
        virtual result OnDraw(void);
 
        virtual result OnInitializing(void);
        virtual result OnDraw(void);
 
+       virtual void OnContentUpdated(void);
+       virtual void ShowAnimation(void){};
+       virtual void StopAnimation(void){};
+
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
 
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
        virtual void OnFormBackRequested(Tizen::Ui::Controls::Form& source);
 
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
@@ -83,7 +90,7 @@ private:
        Tizen::Graphics::Point __touchStart;
        Tizen::Graphics::Rectangle __cropBox;
        Tizen::Graphics::Rectangle __imageBox;
        Tizen::Graphics::Point __touchStart;
        Tizen::Graphics::Rectangle __cropBox;
        Tizen::Graphics::Rectangle __imageBox;
-       Tizen::Media::ImageBuffer __imageBuffer;
+       Tizen::Media::ImageBuffer* __imageBuffer;
        Tizen::Media::ImageFormat __imageFormat;
        TouchLocation __pointLocation;
        bool __isOrientationChanged;
        Tizen::Media::ImageFormat __imageFormat;
        TouchLocation __pointLocation;
        bool __isOrientationChanged;
@@ -93,6 +100,7 @@ private:
        int __formHeight;
        int __formWidth;
        int __skipMoveEvent;
        int __formHeight;
        int __formWidth;
        int __skipMoveEvent;
+       FileListPresentationModel* __pPresentationModel;
 };
 
 #endif /* _GL_IMAGE_CROP_H_ */
 };
 
 #endif /* _GL_IMAGE_CROP_H_ */
index 33f91b6..28774ea 100644 (file)
@@ -57,6 +57,7 @@ ImageCropForm::ImageCropForm(void)
     , __pCurrentBitmap(null)
        , __pRectangleBitmap(null)
        , __imageFormat(IMG_FORMAT_NONE)
     , __pCurrentBitmap(null)
        , __pRectangleBitmap(null)
        , __imageFormat(IMG_FORMAT_NONE)
+    , __imageBuffer(null)
        , __pointLocation(OUTSIDE_CROPBOX)
        , __isOrientationChanged(false)
        , __imageHeight(0)
        , __pointLocation(OUTSIDE_CROPBOX)
        , __isOrientationChanged(false)
        , __imageHeight(0)
@@ -65,6 +66,7 @@ ImageCropForm::ImageCropForm(void)
        , __formHeight(0)
        , __formWidth(0)
        , __skipMoveEvent(0)
        , __formHeight(0)
        , __formWidth(0)
        , __skipMoveEvent(0)
+
 {
 }
 
 {
 }
 
@@ -119,6 +121,8 @@ ImageCropForm::OnInitializing(void)
                pFooter->AddItem(footerItem1);
        }
 
                pFooter->AddItem(footerItem1);
        }
 
+       __pPresentationModel = FileListPresentationModel::GetInstance();
+
        AddTouchEventListener(*this);
        AddOrientationEventListener(*this);
        SetFormBackEventListener(this);
        AddTouchEventListener(*this);
        AddOrientationEventListener(*this);
        SetFormBackEventListener(this);
@@ -228,7 +232,7 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                                r = utf8.GetByteCount(GetFileName(destFilePath), inputLength);
                        }
 
                                r = utf8.GetByteCount(GetFileName(destFilePath), inputLength);
                        }
 
-                       pCropBuffer = __imageBuffer.CropN(((__cropBox.x - __imageBox.x) * __imageWidth) / __imageBox.width, ((__cropBox.y - __imageBox.y) * __imageHeight) / __imageBox.height,
+                       pCropBuffer = __imageBuffer->CropN(((__cropBox.x - __imageBox.x) * __imageWidth) / __imageBox.width, ((__cropBox.y - __imageBox.y) * __imageHeight) / __imageBox.height,
                                                (__cropBox.width * __imageWidth) / __imageBox.width, (__cropBox.height * __imageHeight) / __imageBox.height);
 
                        if (pCropBuffer != null)
                                                (__cropBox.width * __imageWidth) / __imageBox.width, (__cropBox.height * __imageHeight) / __imageBox.height);
 
                        if (pCropBuffer != null)
@@ -717,6 +721,8 @@ ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
 {
        AppLogDebug("OnSceneActivatedN");
 
 {
        AppLogDebug("OnSceneActivatedN");
 
+       __pPresentationModel->AddContentEventListener(this);
+
        if (pArgs != null)
        {
                __sourceFilePath = *(static_cast<String*>(pArgs->GetAt(0)));
        if (pArgs != null)
        {
                __sourceFilePath = *(static_cast<String*>(pArgs->GetAt(0)));
@@ -725,15 +731,23 @@ ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
 
                if (__sourceFilePath.IsEmpty() == false)
                {
 
                if (__sourceFilePath.IsEmpty() == false)
                {
-                       result r = __imageBuffer.Construct(__sourceFilePath.GetPointer());
+                       if ( __imageBuffer != null)
+                       {
+                               delete __imageBuffer;
+                               __imageBuffer = null;
+                       }
+
+                       __imageBuffer = new (std::nothrow) ImageBuffer();
+
+                       result r = __imageBuffer->Construct(__sourceFilePath.GetPointer());
                        if (r == E_SUCCESS)
                        {
                        if (r == E_SUCCESS)
                        {
-                               __imageWidth = __imageBuffer.GetWidth();
-                               __imageHeight = __imageBuffer.GetHeight();
+                               __imageWidth = __imageBuffer->GetWidth();
+                               __imageHeight = __imageBuffer->GetHeight();
 
                                int physicalHeight = CoordinateSystem::ConvertToPhysicalY(__imageHeight);
                                int physicalWidth = CoordinateSystem::ConvertToPhysicalX(__imageWidth);
 
                                int physicalHeight = CoordinateSystem::ConvertToPhysicalY(__imageHeight);
                                int physicalWidth = CoordinateSystem::ConvertToPhysicalX(__imageWidth);
-                               __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, physicalWidth, physicalHeight);
+                               __pCurrentBitmap = __imageBuffer->GetBitmapN(BITMAP_PIXEL_FORMAT_ARGB8888, physicalWidth, physicalHeight);
                                SetValue();
 
                                Image img;
                                SetValue();
 
                                Image img;
@@ -761,7 +775,7 @@ void
 ImageCropForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
 {
        AppLogDebug("OnSceneDeactivated");
 ImageCropForm::OnSceneDeactivated(const SceneId& currentSceneId, const SceneId& nextSceneId)
 {
        AppLogDebug("OnSceneDeactivated");
-
+       __pPresentationModel->RemoveContentEventListener(this);
        RemoveOrientationEventListener(*this);
 }
 
        RemoveOrientationEventListener(*this);
 }
 
@@ -933,3 +947,14 @@ ImageCropForm::GetFileName(const String& filePath, bool isCheckExe) const
 
        return strResult;
 }
 
        return strResult;
 }
+
+void
+ImageCropForm::OnContentUpdated()
+{
+       AppLogDebug("ENTER");
+
+       SceneManager* pSceneManager = SceneManager::GetInstance();
+       pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+
+       AppLogDebug("EXIT(%s)");
+}