Crop Landscape implementation
authorchitta ranjan <chitta.rs@samsung.com>
Thu, 28 Mar 2013 08:49:02 +0000 (17:49 +0900)
committerchitta ranjan <chitta.rs@samsung.com>
Thu, 28 Mar 2013 08:49:02 +0000 (17:49 +0900)
Change-Id: I7218126c529cb00d1f460adc9c2daa817883ace7
Signed-off-by: chitta ranjan <chitta.rs@samsung.com>
inc/IvImageCrop.h
inc/IvImageJob.h
res/screen-size-normal/IDL_FORM_IMAGE_CROP.xml
src/IvCommonUtil.cpp
src/IvImageCrop.cpp
src/IvImageEvent.cpp
src/IvImageEventArg.cpp
src/IvImageInfo.cpp
src/IvImageJob.cpp
src/IvImageProvider.cpp
src/IvImageViewerForm.cpp

index f42c0e6..6c885df 100644 (file)
@@ -45,6 +45,7 @@ class ImageCropForm
        , public::Tizen::Ui::IActionEventListener
        , public Tizen::Ui::Scenes::ISceneEventListener
        , public Tizen::Ui::ITouchEventListener
+       , public Tizen::Ui::IOrientationEventListener
 {
 public:
        ImageCropForm(void);
@@ -65,6 +66,9 @@ public:
 
        virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
 
+       virtual void OnOrientationChanged(const Tizen::Ui::Control &source,
+                       Tizen::Ui::OrientationStatus orientationStatus);
+
        virtual void OnSceneActivatedN(const Tizen::Ui::Scenes::SceneId& previousSceneId,
                        const Tizen::Ui::Scenes::SceneId& currentSceneId, Tizen::Base::Collection::IList* pArgs);
        virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
@@ -79,6 +83,8 @@ public:
 
        void CheckCurrentPosition(const Tizen::Graphics::Point currentPosition);
 
+       void SetValue(void);
+
 private:
        static const int IDA_BUTTON_SAVE = 105;
        static const int IDA_BUTTON_CW_ROTATION = 102;
@@ -91,6 +97,7 @@ private:
        Tizen::Media::ImageBuffer __imageBuffer;
        int __imageHeight;
        int __imageWidth;
+       bool __isOrientationChanged;
        Tizen::Graphics::Canvas* __pCanvas;
        Tizen::Graphics::Bitmap* __pCurrentBitmap;
        Tizen::Graphics::Bitmap* __pRectangleBitmap;
index f60504e..e8a497f 100644 (file)
@@ -37,7 +37,7 @@ public:
                        const ImageEvent* pRequestEvent);
 
        Tizen::Base::String GetFilePath(void) const;
-       unsigned long GetRequestId() const;
+       unsigned long GetRequestId(void) const;
        const ImageEvent* GetEvent(void) const;
 
 private:
index 516bb82..94f2e47 100644 (file)
@@ -6,38 +6,38 @@
 <Scene Bversion="2.0.0.201303182057" Dversion="20120315">
     <LogicalCoordinate>720</LogicalCoordinate>
     <Form id="IDL_FORM_IMAGE_CROP">
-        <property backgroundColor="" backgroundColorOpacity="100" notificationTrayOpenEnabled="false" orientation="Portrait" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
+        <property backgroundColor="" backgroundColorOpacity="100" notificationTrayOpenEnabled="false" orientation="Automatic" softKey0NormalIcon="" softKey0PressedIcon="" softKey0Text="" softKey1NormalIcon="" softKey1PressedIcon="" softKey1Text="" title="" titleAlign="ALIGN_CENTER" titleIcon="" translucentFooter="false" translucentHeader="false" translucentIndicator="false"/>
         <layout mode="Portrait" style="FORM_STYLE_INDICATOR" type="LAYOUT_RELATIVE"/>
         <layout mode="Landscape" style="FORM_STYLE_INDICATOR" type="LAYOUT_RELATIVE"/>
     </Form>
     <Panel id="IDC_FOOTER_PANEL" parent="IDL_FORM_IMAGE_CROP">
         <property backgroundColor="" backgroundColorOpacity="0" compositeEnabled="true" groupStyle="GROUP_STYLE_NONE"/>
         <layout bottomRelation="IDL_FORM_IMAGE_CROP" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_PARENT" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" type="LAYOUT_RELATIVE" verticalFitPolicy="FIT_POLICY_FIXED" width="720.0" x="0" y="1122.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="46.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" type="LAYOUT_RELATIVE" verticalFitPolicy="FIT_POLICY_FIXED" width="474.0" x="805.0" y="613.0"/>
+        <layout bottomRelation="IDL_FORM_IMAGE_CROP" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_PARENT" leftRelation="IDL_FORM_IMAGE_CROP" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="IDL_FORM_IMAGE_CROP" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" topRelation="" topRelationType="" type="LAYOUT_RELATIVE" verticalFitPolicy="FIT_POLICY_FIXED" width="1280.0" x="0" y="562.0"/>
     </Panel>
     <Label id="IDC_PANEL_LABEL" parent="IDC_FOOTER_PANEL">
         <property accessibilityHint="" backgroundBitmapPath="" backgroundColor="#383838" backgroundColorOpacity="100" horizontalAlign="ALIGN_LEFT" leftMargin="16" text="" textColor="" textSize="33.0" textStyle="LABEL_TEXT_STYLE_NORMAL" topMargin="0" verticalAlign="ALIGN_TOP"/>
         <layout bottomRelation="IDC_FOOTER_PANEL" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDC_FOOTER_PANEL" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="IDC_FOOTER_PANEL" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" topRelation="IDC_FOOTER_PANEL" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="720.0" x="0.0" y="0.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="46.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="40.0" x="30.0" y="0.0"/>
+        <layout bottomRelation="IDC_FOOTER_PANEL" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_PARENT" leftRelation="IDC_FOOTER_PANEL" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="IDC_FOOTER_PANEL" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" topRelation="IDC_FOOTER_PANEL" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_PARENT" width="1280.0" x="0" y="0"/>
     </Label>
     <Button id="IDC_SAVE_BUTTON" parent="IDC_FOOTER_PANEL">
         <property DisabledBitmapX="0.0" DisabledBitmapY="0.0" NormalBitmapX="0.0" NormalBitmapY="0.0" PressedBitmapX="0.0" PressedBitmapY="0.0" accessibilityHint="" disableTextColor="" disabledBGBitmapPath="" disabledBitmapPath="" disabledColor="" disabledColorOpacity="100" highlightedBGBitmapPath="" highlightedBitmapPath="" highlightedBitmapX="0.0" highlightedBitmapY="0.0" highlightedColor="" highlightedColorOpacity="100" highlightedTextColor="" horizontalAlign="ALIGN_CENTER" normalBGBitmapPath="EditBackground.png" normalBitmapPath="" normalColor="" normalColorOpacity="100" normalTextColor="" pressedBGBitmapPath="EditBackground.png" pressedBitmapPath="" pressedColor="" pressedColorOpacity="100" pressedTextColor="" text="" textSize="32.0" verticalAlign="ALIGN_MIDDLE"/>
         <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="179.0" x="0.0" y="0.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="46.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="48.0" x="13.0" y="0.0"/>
+        <layout bottomRelation="IDC_PANEL_LABEL" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="IDC_PANEL_LABEL" leftRelationType="RECT_EDGE_RELATION_LEFT_TO_LEFT" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="IDC_PANEL_LABEL" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="200.0" x="0.0" y="0.0"/>
     </Button>
     <Button id="IDC_CW_ROTATION_BUTTON" parent="IDC_FOOTER_PANEL">
         <property DisabledBitmapX="0.0" DisabledBitmapY="0.0" NormalBitmapX="0.0" NormalBitmapY="0.0" PressedBitmapX="0.0" PressedBitmapY="0.0" accessibilityHint="" disableTextColor="" disabledBGBitmapPath="" disabledBitmapPath="" disabledColor="" disabledColorOpacity="100" highlightedBGBitmapPath="" highlightedBitmapPath="" highlightedBitmapX="0.0" highlightedBitmapY="0.0" highlightedColor="" highlightedColorOpacity="100" highlightedTextColor="" horizontalAlign="ALIGN_CENTER" normalBGBitmapPath="EditBackground.png" normalBitmapPath="" normalColor="" normalColorOpacity="100" normalTextColor="" pressedBGBitmapPath="EditBackground.png" pressedBitmapPath="" pressedColor="" pressedColorOpacity="100" pressedTextColor="" text="" textSize="32.0" verticalAlign="ALIGN_MIDDLE"/>
         <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="179.0" x="180.0" y="0.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="46.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="48.0" x="60.0" y="0.0"/>
+        <layout bottomRelation="None" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="None" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="440.0" x="200.0" y="0.0"/>
     </Button>
     <Button id="IDC_CCW_ROTATION_BUTTON" parent="IDC_FOOTER_PANEL">
         <property DisabledBitmapX="0.0" DisabledBitmapY="0.0" NormalBitmapX="0.0" NormalBitmapY="0.0" PressedBitmapX="0.0" PressedBitmapY="0.0" accessibilityHint="" disableTextColor="" disabledBGBitmapPath="" disabledBitmapPath="" disabledColor="" disabledColorOpacity="100" highlightedBGBitmapPath="" highlightedBitmapPath="" highlightedBitmapX="0.0" highlightedBitmapY="0.0" highlightedColor="" highlightedColorOpacity="100" highlightedTextColor="" horizontalAlign="ALIGN_CENTER" normalBGBitmapPath="EditBackground.png" normalBitmapPath="" normalColor="" normalColorOpacity="100" normalTextColor="" pressedBGBitmapPath="EditBackground.png" pressedBitmapPath="" pressedColor="" pressedColorOpacity="100" pressedTextColor="" text="" textSize="32.0" verticalAlign="ALIGN_MIDDLE"/>
         <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="179.0" x="359.0" y="0.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="46.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="48.0" x="65.0" y="0.0"/>
+        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="440.0" x="640.0" y="0.0"/>
     </Button>
     <Button id="IDC_CANCEL_BUTTON" parent="IDC_FOOTER_PANEL">
         <property DisabledBitmapX="0.0" DisabledBitmapY="0.0" NormalBitmapX="0.0" NormalBitmapY="0.0" PressedBitmapX="0.0" PressedBitmapY="0.0" accessibilityHint="" disableTextColor="" disabledBGBitmapPath="" disabledBitmapPath="" disabledColor="" disabledColorOpacity="100" highlightedBGBitmapPath="" highlightedBitmapPath="" highlightedBitmapX="0.0" highlightedBitmapY="0.0" highlightedColor="" highlightedColorOpacity="100" highlightedTextColor="" horizontalAlign="ALIGN_CENTER" normalBGBitmapPath="EditBackground.png" normalBitmapPath="" normalColor="" normalColorOpacity="100" normalTextColor="" pressedBGBitmapPath="EditBackground.png" pressedBitmapPath="" pressedColor="" pressedColorOpacity="100" pressedTextColor="" text="" textSize="32.0" verticalAlign="ALIGN_MIDDLE"/>
         <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Portrait" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="180.0" x="540.0" y="0.0"/>
-        <layout bottomRelation="" bottomRelationType="" centerHorizontal="false" centerVertical="false" height="46.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="" rightRelationType="" topRelation="" topRelationType="" verticalFitPolicy="FIT_POLICY_FIXED" width="48.0" x="76.0" y="0.0"/>
+        <layout bottomRelation="IDC_PANEL_LABEL" bottomRelationType="RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM" centerHorizontal="false" centerVertical="false" height="98.0" horizontalFitPolicy="FIT_POLICY_FIXED" leftRelation="" leftRelationType="" marginBottom="0.0" marginLeft="0.0" marginRight="0.0" marginTop="0.0" mode="Landscape" rightRelation="IDC_PANEL_LABEL" rightRelationType="RECT_EDGE_RELATION_RIGHT_TO_RIGHT" topRelation="IDC_PANEL_LABEL" topRelationType="RECT_EDGE_RELATION_TOP_TO_TOP" verticalFitPolicy="FIT_POLICY_FIXED" width="200.0" x="1080.0" y="0.0"/>
     </Button>
 </Scene>
index e1e8761..a427707 100644 (file)
@@ -84,7 +84,7 @@ CommonUtil::CloneBitmapN(const Bitmap& bitmap)
                mainCanvas.Construct(mainRect);
                mainCanvas.DrawBitmap(mainRect, bitmap);
                pResultBitmap = new (std::nothrow) Bitmap();
-               pResultBitmap->Construct(mainCanvas,mainRect);
+               pResultBitmap->Construct(mainCanvas, mainRect);
        }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
        return pResultBitmap;
index fb8a92c..4340225 100644 (file)
@@ -41,6 +41,7 @@ static const int CROP_BOX_LINE_WIDTH = 5;
 ImageCropForm::ImageCropForm(void)
        : __imageHeight(0)
        , __imageWidth(0)
+       , __isOrientationChanged(false)
        , __pCanvas(null)
        , __pCurrentBitmap(null)
        , __pRectangleBitmap(null)
@@ -124,6 +125,7 @@ ImageCropForm::OnInitializing(void)
                SetControlAlwaysAtBottom(*pLabel, true);
        }
        AddTouchEventListener(*this);
+       AddOrientationEventListener(*this);
 
        delete pSaveButtonBitmap;
        delete pCancelButtonBitmap;
@@ -153,63 +155,7 @@ ImageCropForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId&
                __imageBuffer.Construct(pFilePath->GetPointer());
                __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO);
        }
-
-       if (__imageWidth > GetClientAreaBounds().width && __imageHeight > GetClientAreaBounds().height)
-       {
-               if (__imageHeight > __imageWidth)
-               {
-                       __imageBox.height = GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT;
-                       __imageBox.width = (__imageWidth * GetClientAreaBounds().height) / __imageHeight;
-                       __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
-                       __imageBox.y = INDICATOR_BAR_HEIGHT;
-               }
-               else
-               {
-                       __imageBox.width = GetClientAreaBounds().width;
-                       __imageBox.height = (GetClientAreaBounds().width * __imageHeight) / __imageWidth;
-                       __imageBox.x = 0;
-                       __imageBox.y = (GetClientAreaBounds().height - __imageBox.height) / 2;
-               }
-       }
-       else if (__imageWidth > GetClientAreaBounds().width)
-       {
-               __imageBox.width = GetClientAreaBounds().width;
-               __imageBox.height = (__imageHeight * GetClientAreaBounds().width) / __imageWidth;
-               __imageBox.x = 0;
-               __imageBox.y = (GetClientAreaBounds().height - __imageBox.height) / 2;
-
-       }
-       else if (__imageHeight > GetClientAreaBounds().height)
-       {
-               __imageBox.height = GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT;
-               __imageBox.width = (__imageWidth * GetClientAreaBounds().height) / __imageHeight;
-               __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
-               __imageBox.y = INDICATOR_BAR_HEIGHT;
-       }
-       else
-       {
-               __imageBox.height = __imageHeight;
-               __imageBox.width = __imageWidth;
-               __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
-               __imageBox.y = (GetClientAreaBounds().height - __imageBox.height) / 2 ;
-       }
-       if (__imageHeight >= __imageWidth)
-       {
-               __cropBox.height = __imageBox.height / 2;
-               __cropBox.width = __imageBox.width / 2;
-               __cropBox.y =  __imageBox.y + (__imageBox.height / 4);
-               __cropBox.x = __imageBox.x + (__imageBox.width / 4);
-       }
-       else
-       {
-               __cropBox.height = (2 * __imageBox.height) / 3;
-               __cropBox.width = (2 * __imageBox.width) / 3;
-               __cropBox.y = __imageBox.y + (__imageBox.height - __cropBox.height) / 2;
-               __cropBox.x = __imageBox.x + (__imageBox.width - __cropBox.width) / 2;
-       }
-
-       __pCanvas = GetCanvasN();
-       __pCanvas->SetForegroundColor(CROP_BOX_RECTANGLE_COLOR);
+       SetValue();
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
@@ -288,6 +234,16 @@ ImageCropForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
 }
 
 void
+ImageCropForm::OnOrientationChanged(const Control &source, OrientationStatus orientationStatus)
+{
+       AppLogDebug("ENTER");
+       __isOrientationChanged = true;
+       SetValue();
+       __pCanvas->Clear();
+       AppLogDebug("EXIT");
+}
+
+void
 ImageCropForm::OnTouchPressed(const Tizen::Ui::Control& source, const Tizen::Graphics::Point& currentPosition, const Tizen::Ui::TouchEventInfo& touchInfo)
 {
        AppLogDebug("ENTER");
@@ -302,7 +258,9 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
        AppLogDebug("ENTER");
        int deltaX = currentPosition.x - __touchStart.x;
        int deltaY = currentPosition.y - __touchStart.y;
-       if (__pointLocation == INSIDE_TOP_RECTANGLE)
+       switch(__pointLocation)
+       {
+       case INSIDE_TOP_RECTANGLE:
        {
                if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (CROP_RECTANGLE_HEIGHT * 3)))
                {
@@ -310,14 +268,18 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.height -= deltaY;
                }
        }
-       else if (__pointLocation == INSIDE_BOTTOM_RECTANGLE)
+       break;
+
+       case INSIDE_BOTTOM_RECTANGLE:
        {
                if ((__cropBox.y + __cropBox.height + deltaY ) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (CROP_RECTANGLE_HEIGHT * 3))
                {
                        __cropBox.height += deltaY;
                }
        }
-       else if (__pointLocation == INSIDE_LEFT_RECTANGLE)
+       break;
+
+       case INSIDE_LEFT_RECTANGLE:
        {
                if ((__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (CROP_RECTANGLE_HEIGHT * 3))
                {
@@ -325,14 +287,18 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.width -= deltaX;
                }
        }
-       else if (__pointLocation == INSIDE_RIGHT_RECTANGLE)
+       break;
+
+       case INSIDE_RIGHT_RECTANGLE:
        {
                if ((__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (CROP_RECTANGLE_HEIGHT * 3))
                {
                        __cropBox.width += deltaX;
                }
        }
-       else if (__pointLocation == INSIDE_TOP_LEFT_RECTANGLE)
+       break;
+
+       case INSIDE_TOP_LEFT_RECTANGLE:
        {
                if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (CROP_RECTANGLE_HEIGHT * 3))
                                && (__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (CROP_RECTANGLE_HEIGHT * 3))
@@ -343,7 +309,9 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.width -= deltaX;
                }
        }
-       else if (__pointLocation == INSIDE_TOP_RIGHT_RECTANGLE)
+       break;
+
+       case INSIDE_TOP_RIGHT_RECTANGLE:
        {
                if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (CROP_RECTANGLE_HEIGHT * 3))
                                && (__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (CROP_RECTANGLE_HEIGHT * 3))
@@ -353,7 +321,9 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.height -= deltaY;
                }
        }
-       else if (__pointLocation == INSIDE_BOTTOM_LEFT_RECTANGLE)
+       break;
+
+       case INSIDE_BOTTOM_LEFT_RECTANGLE:
        {
                if ((__cropBox.y + __cropBox.height + deltaY ) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (CROP_RECTANGLE_HEIGHT * 3)
                        && (__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (CROP_RECTANGLE_HEIGHT * 3))
@@ -363,7 +333,9 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.height += deltaY;
                }
        }
-       else if (__pointLocation == INSIDE_BOTTOM_RIGHT_RECTANGLE)
+       break;
+
+       case INSIDE_BOTTOM_RIGHT_RECTANGLE:
        {
                if ((__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (CROP_RECTANGLE_HEIGHT * 3)
                        && (__cropBox.y + __cropBox.height + deltaY ) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (CROP_RECTANGLE_HEIGHT * 3))
@@ -371,9 +343,10 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.width += deltaX;
                        __cropBox.height += deltaY;
                }
-
        }
-       else if (__pointLocation == INSIDE_CROPBOX)
+       break;
+
+       case INSIDE_CROPBOX:
        {
                if ((__cropBox.x + deltaX) > __imageBox.x)
                {
@@ -400,6 +373,11 @@ ImageCropForm::OnTouchMoved(const Tizen::Ui::Control& source, const Tizen::Graph
                        __cropBox.y = __imageBox.y + __imageBox.height - __cropBox.height;
                }
        }
+       break;
+
+       default:
+               break;
+       }
        RequestRedraw(false);
        __touchStart = currentPosition;
        AppLogDebug("EXIT");
@@ -468,3 +446,93 @@ ImageCropForm::CheckCurrentPosition(const Point currentPosition)
        AppLogDebug("EXIT");
        return;
 }
+
+void
+ImageCropForm::SetValue(void)
+{
+       int prevHeight = __imageBox.height;
+       int prevWidth = __imageBox.width;
+       int prevImageboxX = __imageBox.x;
+       int prevImageBoxY = __imageBox.y;
+       int indicatorBarHeight = 0;
+
+       if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
+       {
+               indicatorBarHeight = 21;
+       }
+       else
+       {
+               indicatorBarHeight = 60;
+       }
+
+       if (__imageWidth > GetClientAreaBounds().width && __imageHeight > GetClientAreaBounds().height)
+       {
+               if (__imageHeight > __imageWidth)
+               {
+                       __imageBox.height = GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT;
+                       __imageBox.width = (__imageWidth * GetClientAreaBounds().height) / __imageHeight;
+                       __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
+                       __imageBox.y = indicatorBarHeight;
+               }
+               else
+               {
+                       __imageBox.width = GetClientAreaBounds().width;
+                       __imageBox.height = (GetClientAreaBounds().width * __imageHeight) / __imageWidth;
+                       __imageBox.x = 0;
+                       __imageBox.y = (GetClientAreaBounds().height - __imageBox.height) / 2;
+               }
+       }
+       else if (__imageWidth > GetClientAreaBounds().width)
+       {
+               __imageBox.width = GetClientAreaBounds().width;
+               __imageBox.height = (__imageHeight * GetClientAreaBounds().width) / __imageWidth;
+               __imageBox.x = 0;
+               __imageBox.y = (GetClientAreaBounds().height - __imageBox.height) / 2;
+
+       }
+       else if (__imageHeight > GetClientAreaBounds().height)
+       {
+               __imageBox.height = GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT;
+               __imageBox.width = (__imageWidth * GetClientAreaBounds().height) / __imageHeight;
+               __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
+               __imageBox.y = indicatorBarHeight;
+       }
+       else
+       {
+               __imageBox.height = __imageHeight;
+               __imageBox.width = __imageWidth;
+               __imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
+               __imageBox.y = (GetClientAreaBounds().height - __imageBox.height) / 2 ;
+       }
+       if (__isOrientationChanged == false)
+       {
+               if (__imageHeight >= __imageWidth)
+               {
+                       __cropBox.height = __imageBox.height / 2;
+                       __cropBox.width = __imageBox.width / 2;
+                       __cropBox.y =  __imageBox.y + (__imageBox.height / 4);
+                       __cropBox.x = __imageBox.x + (__imageBox.width / 4);
+               }
+               else
+               {
+                       __cropBox.height = (2 * __imageBox.height) / 3;
+                       __cropBox.width = (2 * __imageBox.width) / 3;
+                       __cropBox.y = __imageBox.y + (__imageBox.height - __cropBox.height) / 2;
+                       __cropBox.x = __imageBox.x + (__imageBox.width - __cropBox.width) / 2;
+               }
+       }
+       else
+       {
+               float temp = __imageBox.x + ((__cropBox.x - prevImageboxX) * __imageBox.width) / (float)prevWidth;
+               __cropBox.x = (temp + 0.5);
+               temp = __imageBox.y + ((__cropBox.y - prevImageBoxY) * __imageBox.height) / (float)prevHeight;
+               __cropBox.y = (temp + 0.5);
+               temp = (__cropBox.height * __imageBox.height) / (float)prevHeight;
+               __cropBox.height = (temp + 0.5);
+               temp = (__cropBox.width * __imageBox.width) / (float)prevWidth;
+               __cropBox.width = (temp + 0.5);
+       }
+       __pCanvas = GetCanvasN();
+       __pCanvas->SetForegroundColor(CROP_BOX_RECTANGLE_COLOR);
+
+}
index e2f7376..0502719 100644 (file)
@@ -32,9 +32,9 @@ ImageEvent::~ImageEvent(void)
 void
 ImageEvent::FireImpl(IEventListener& listener, const IEventArg& eventArg)
 {
-       IImageProviderEventListener* plistener = static_cast<IImageProviderEventListener*> (&listener);
-       if (plistener != null)
+       IImageProviderEventListener* pListener = static_cast<IImageProviderEventListener*> (&listener);
+       if (pListener != null)
        {
-               plistener->OnImageReceivedN(*(const_cast<IEventArg*>(&eventArg)));
+               pListener->OnImageReceivedN(*(const_cast<IEventArg*>(&eventArg)));
        }
 }
index 87f43d2..46ddc71 100644 (file)
@@ -37,6 +37,7 @@ ImageEventArg::~ImageEventArg(void)
        if (__pBitmap != null)
        {
                delete __pBitmap;
+               __pBitmap = null;
        }
 }
 
index cadc1a2..7e2e69b 100644 (file)
@@ -35,6 +35,7 @@ ImageInfo::~ImageInfo(void)
        if (__pBitmap != null)
        {
                delete __pBitmap;
+               __pBitmap = null;
        }
 }
 
index ae92a15..4670005 100644 (file)
@@ -51,7 +51,7 @@ ImageJob::GetFilePath(void) const
 }
 
 unsigned long
-ImageJob::GetRequestId() const
+ImageJob::GetRequestId(void) const
 {
        return __requestId;
 }
index de06d3f..752d593 100644 (file)
@@ -185,8 +185,8 @@ ImageProvider::RequestImage(const String& filePath, const ImageEvent* event)
        AppLogDebug("ENTER");
        AppLogDebug("[THREAD] Request Job - (MainThread)");
 
-       if ( filePath.IsEmpty() == true || event == null
-                       || __pMutexCmd == null || __pCmdQueue == null)
+       if (filePath.IsEmpty() == true || event == null
+               || __pMutexCmd == null || __pCmdQueue == null)
        {
                AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
                return;
index 4f47f0e..70008a1 100644 (file)
@@ -194,8 +194,8 @@ ImageViewerForm::OnInitializing(void)
        InitializePopup();
 
        if (__initializeDisplayModeCurrent == APPCONTROL_MODE_NORMAL
-               || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
-               || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
+                       || __initializeDisplayModeCurrent == APPCONTROL_MODE_MESSAGE
+                       || __initializeDisplayModeCurrent == APPCONTROL_MODE_EMAIL)
        {
                int index = __pPresentationModel->GetStartIndex();
                __pGallery->UpdateGallery();
@@ -648,6 +648,39 @@ ImageViewerForm::InitializePanelDetail()
        __pScrollPanel->SetBackgroundColor(COLOR_HEADER_CONTORL_PANEL);
        __pScrollPanel->SetShowState(false);
 
+       __pRenameButton = new (std::nothrow) Button();
+       Rectangle rect = GetBounds();
+       __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON - 20, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
+       __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
+       __pRenameButton->AddActionEventListener(*this);
+
+       Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
+       Bitmap* pIconBackground =
+                       ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
+       Bitmap* pIconPressed =
+                       ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
+
+       if (pIcon != null && pIconPressed != null && pIconBackground != null)
+       {
+               __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
+               __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
+               Point iconPosition(0, 0);
+               __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
+               __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
+       }
+       else
+       {
+               __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
+               __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
+       }
+       delete pIcon;
+       delete pIconPressed;
+       delete pIconBackground;
+
+       __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
+       __pScrollPanel->AddControl(*__pRenameButton);
+
+
        AddControl(*__pScrollPanel);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -937,45 +970,9 @@ ImageViewerForm::SetDetailInfo(void)
                return r;
        }
 
-       if (__pRenameButton == null)
-       {
-               __pRenameButton = new (std::nothrow) Button();
                Rectangle rect = GetBounds();
-               __pRenameButton->Construct(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
-               __pRenameButton->SetActionId(ACTION_ID_PANEL_HEADER_DETAILS_RENAME);
+               __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON - 20, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
 
-               Bitmap* pIcon = ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME);
-               Bitmap* pIconBackground =
-                               ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND);
-               Bitmap* pIconPressed =
-                               ResourceManager::GetBitmapN(IDB_IMAGE_VIEWERFORM_BUTTON_EDIT_NAME_NORMAL_BACKGROUND_PRESS);
-
-               if (pIcon != null && pIconPressed != null && pIconBackground != null)
-               {
-                       __pRenameButton->SetNormalBackgroundBitmap(*pIconBackground);
-                       __pRenameButton->SetPressedBackgroundBitmap(*pIconPressed);
-                       Point iconPosition(0, 0);
-                       __pRenameButton->SetNormalBitmap(iconPosition, *pIcon);
-                       __pRenameButton->SetPressedBitmap(iconPosition, *pIconPressed);
-               }
-               else
-               {
-                       __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
-                       __pRenameButton->SetColor(BUTTON_STATUS_PRESSED, COLOR_HEADER_BUTTON1);
-               }
-               delete pIcon;
-               delete pIconPressed;
-               delete pIconBackground;
-
-               __pScrollPanel->AddControl(*__pRenameButton);
-               __pRenameButton->SetColor(BUTTON_STATUS_NORMAL, COLOR_HEADER_BUTTON1);
-               __pRenameButton->AddActionEventListener(*this);
-       }
-       else
-       {
-               Rectangle rect = GetBounds();
-               __pRenameButton->SetBounds(Rectangle(rect.width - W_RENAME_BUTTON, Y_RENAME_BUTTON, W_RENAME_BUTTON, H_RENAME_BUTTON));
-       }
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        return r;
@@ -1899,7 +1896,7 @@ ImageViewerForm::GetQuickThumbnailN(String& filePath)
                                        if ( imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_RIGHT_TOP ||
                                                        imageBuffer->GetExifOrientation() == EXIF_ORIENTATION_LEFT_BOTTOM )
                                        {
-                                               Dimension srcDim( imageBuffer->GetHeight(),imageBuffer->GetWidth());
+                                               Dimension srcDim(imageBuffer->GetHeight(), imageBuffer->GetWidth());
                                                pBitmap->Scale(srcDim);
                                        }
                                        else