From 37759cf8c7ce60e50f0a74c7f186cf079edc6e30 Mon Sep 17 00:00:00 2001 From: HyukSoon Choi Date: Wed, 3 Apr 2013 18:27:45 +0900 Subject: [PATCH] Add Crop opeation Change-Id: I8e01cc6b84e64c503b992cc4371627ce9e4982f2 Signed-off-by: HyukSoon Choi --- inc/IvImageCropForm.h | 4 +++- inc/IvImageViewerForm.h | 1 - inc/IvTypes.h | 1 + src/IvImageCropForm.cpp | 23 +++++++++++++---------- src/IvMainFrame.cpp | 4 ++++ src/IvTypes.cpp | 1 + 6 files changed, 22 insertions(+), 12 deletions(-) diff --git a/inc/IvImageCropForm.h b/inc/IvImageCropForm.h index 3be9ee9..92ca959 100644 --- a/inc/IvImageCropForm.h +++ b/inc/IvImageCropForm.h @@ -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_ */ diff --git a/inc/IvImageViewerForm.h b/inc/IvImageViewerForm.h index 703f94a..b8932b3 100644 --- a/inc/IvImageViewerForm.h +++ b/inc/IvImageViewerForm.h @@ -43,7 +43,6 @@ class ImageViewerForm; class ImageViewerPresentationModel; class SettingPresentationModel; - class ImageViewerForm : public BaseForm , public Tizen::App::IAppControlResponseListener diff --git a/inc/IvTypes.h b/inc/IvTypes.h index 9dfe2ca..396a646 100644 --- a/inc/IvTypes.h +++ b/inc/IvTypes.h @@ -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; diff --git a/src/IvImageCropForm.cpp b/src/IvImageCropForm.cpp index 004e3d7..4f41b50 100644 --- a/src/IvImageCropForm.cpp +++ b/src/IvImageCropForm.cpp @@ -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(pArgs->GetAt(0)); + filePath = *(static_cast(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); - } diff --git a/src/IvMainFrame.cpp b/src/IvMainFrame.cpp index 0f1707e..ae852d1 100644 --- a/src/IvMainFrame.cpp +++ b/src/IvMainFrame.cpp @@ -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(); diff --git a/src/IvTypes.cpp b/src/IvTypes.cpp index 1c02abe..d125d33 100644 --- a/src/IvTypes.cpp +++ b/src/IvTypes.cpp @@ -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"; -- 2.7.4