Add Crop opeation
authorHyukSoon Choi <hs619.choi@samsung.com>
Wed, 3 Apr 2013 09:27:45 +0000 (18:27 +0900)
committerHyukSoon Choi <hs619.choi@samsung.com>
Wed, 3 Apr 2013 09:27:45 +0000 (18:27 +0900)
Change-Id: I8e01cc6b84e64c503b992cc4371627ce9e4982f2
Signed-off-by: HyukSoon Choi <hs619.choi@samsung.com>
inc/IvImageCropForm.h
inc/IvImageViewerForm.h
inc/IvTypes.h
src/IvImageCropForm.cpp
src/IvMainFrame.cpp
src/IvTypes.cpp

index 3be9ee9..92ca959 100644 (file)
@@ -41,6 +41,8 @@ enum TouchLocation
        INSIDE_BOTTOM_RIGHT_RECTANGLE,
 };
 
+class ImageViewerPresentationModel;
+
 class ImageCropForm
        : public Tizen::Ui::Controls::Form
        , public::Tizen::Ui::IActionEventListener
@@ -50,7 +52,6 @@ class ImageCropForm
 {
 public:
        ImageCropForm(void);
-
        ~ImageCropForm(void);
 
        bool Initialize(void);
@@ -96,6 +97,7 @@ private:
        TouchLocation __pointLocation;
        Tizen::Graphics::Point __touchStart;
        Tizen::Media::ImageFormat __imageFormat;
+       ImageViewerPresentationModel* __pPresentationModel;
 };
 
 #endif /* _IV_IMAGE_CROP_H_ */
index 703f94a..b8932b3 100644 (file)
@@ -43,7 +43,6 @@ class ImageViewerForm;
 class ImageViewerPresentationModel;
 class SettingPresentationModel;
 
-
 class ImageViewerForm
        : public BaseForm
        , public Tizen::App::IAppControlResponseListener
index 9dfe2ca..396a646 100644 (file)
@@ -100,6 +100,7 @@ extern const wchar_t* APPCONTROL_OPERATION_ID_VIEW;
 extern const wchar_t* APPCONTROL_OPERATION_ID_COMPOSE;
 extern const wchar_t* APPCONTROL_OPERATION_ID_MAIN;
 extern const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE;
+extern const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_CROP;
 
 extern const wchar_t* APPCONTROL_KEY_TYPE;
 extern const wchar_t* APPCONTROL_KEY_PATH;
index 004e3d7..4f41b50 100644 (file)
@@ -46,8 +46,9 @@ ImageCropForm::ImageCropForm(void)
        , __pCanvas(null)
        , __pCurrentBitmap(null)
        , __pRectangleBitmap(null)
+       , __pointLocation(OUTSIDE_CROPBOX)
+       , __pPresentationModel(null)
 {
-       __pointLocation = OUTSIDE_CROPBOX;
 }
 
 ImageCropForm::~ImageCropForm(void)
@@ -63,7 +64,6 @@ ImageCropForm::~ImageCropForm(void)
        if (__pCanvas != null)
        {
                delete __pCanvas;
-               __pCanvas = null;
        }
 }
 
@@ -72,6 +72,9 @@ ImageCropForm::Initialize(void)
 {
        Form::Construct(IDL_FORM_IMAGE_CROP);
        Form::SetFormStyle(FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
+
+       __pPresentationModel = ImageViewerPresentationModel::GetInstance();
+
        return true;
 }
 
@@ -140,21 +143,22 @@ ImageCropForm::OnInitializing(void)
 void
 ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& currentSceneId, IList* pArgs)
 {
-       AppLogDebug("ENTER");
-       String* pFilePath = null;
+       AppLogDebug("ENTER pArgs(%x)", pArgs);
+       String filePath;
        if (pArgs != null)
        {
-               pFilePath = static_cast<String*>(pArgs->GetAt(0));
+               filePath = *(static_cast<String*>(pArgs->GetAt(0)));
                delete pArgs;
        }
        else
        {
-               return;
+               filePath = __pPresentationModel->GetFilePathAt(0);
        }
-       if (pFilePath != null)
+
+       if (filePath.IsEmpty() == false)
        {
-               __sourceFilePath.Append(*pFilePath);
-               result r = __imageBuffer.Construct(pFilePath->GetPointer());
+               __sourceFilePath.Append(filePath);
+               result r = __imageBuffer.Construct(__sourceFilePath.GetPointer());
                if (r == E_SUCCESS)
                {
                        __imageWidth = __imageBuffer.GetWidth();
@@ -546,5 +550,4 @@ ImageCropForm::SetValue(void)
        }
        __pCanvas = GetCanvasN();
        __pCanvas->SetForegroundColor(CROP_BOX_RECTANGLE_COLOR);
-
 }
index 0f1707e..ae852d1 100644 (file)
@@ -65,6 +65,10 @@ MainFrame::OnInitializing(void)
        {
                pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_VIEWER), null);
        }
+       else if (operationID.CompareTo(APPCONTROL_OPERATION_ID_IMAGE_CROP) == 0)
+       {
+               pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_CROP), null);
+       }
        else
        {
                pImageViewerApp->Terminate();
index 1c02abe..d125d33 100644 (file)
@@ -49,6 +49,7 @@ const wchar_t* APPCONTROL_OPERATION_ID_VIEW = L"http://tizen.org/appcontrol/oper
 const wchar_t* APPCONTROL_OPERATION_ID_COMPOSE = L"http://tizen.org/appcontrol/operation/compose";
 const wchar_t* APPCONTROL_OPERATION_ID_MAIN = L"http://tizen.org/appcontrol/operation/main";
 const wchar_t* APPCONTROL_OPERATION_ID_CONFIGURE = L"http://tizen.org/appcontrol/operation/configure";
+const wchar_t* APPCONTROL_OPERATION_ID_IMAGE_CROP = L"http://tizen.org/appcontrol/operation/image/crop";
 
 const wchar_t* APPCONTROL_KEY_TYPE = L"http://tizen.org/appcontrol/data/type";
 const wchar_t* APPCONTROL_KEY_PATH = L"http://tizen.org/appcontrol/data/path";