, public::Tizen::Ui::IActionEventListener
, public Tizen::Ui::Scenes::ISceneEventListener
, public Tizen::Ui::ITouchEventListener
+ , public Tizen::Ui::IOrientationEventListener
{
public:
ImageCropForm(void);
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,
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;
Tizen::Media::ImageBuffer __imageBuffer;
int __imageHeight;
int __imageWidth;
+ bool __isOrientationChanged;
Tizen::Graphics::Canvas* __pCanvas;
Tizen::Graphics::Bitmap* __pCurrentBitmap;
Tizen::Graphics::Bitmap* __pRectangleBitmap;
const ImageEvent* pRequestEvent);
Tizen::Base::String GetFilePath(void) const;
- unsigned long GetRequestId() const;
+ unsigned long GetRequestId(void) const;
const ImageEvent* GetEvent(void) const;
private:
<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>
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;
ImageCropForm::ImageCropForm(void)
: __imageHeight(0)
, __imageWidth(0)
+ , __isOrientationChanged(false)
, __pCanvas(null)
, __pCurrentBitmap(null)
, __pRectangleBitmap(null)
SetControlAlwaysAtBottom(*pLabel, true);
}
AddTouchEventListener(*this);
+ AddOrientationEventListener(*this);
delete pSaveButtonBitmap;
delete pCancelButtonBitmap;
__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()));
}
}
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");
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)))
{
__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))
{
__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))
__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))
__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))
__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))
__cropBox.width += deltaX;
__cropBox.height += deltaY;
}
-
}
- else if (__pointLocation == INSIDE_CROPBOX)
+ break;
+
+ case INSIDE_CROPBOX:
{
if ((__cropBox.x + deltaX) > __imageBox.x)
{
__cropBox.y = __imageBox.y + __imageBox.height - __cropBox.height;
}
}
+ break;
+
+ default:
+ break;
+ }
RequestRedraw(false);
__touchStart = currentPosition;
AppLogDebug("EXIT");
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);
+
+}
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)));
}
}
if (__pBitmap != null)
{
delete __pBitmap;
+ __pBitmap = null;
}
}
if (__pBitmap != null)
{
delete __pBitmap;
+ __pBitmap = null;
}
}
}
unsigned long
-ImageJob::GetRequestId() const
+ImageJob::GetRequestId(void) const
{
return __requestId;
}
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;
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();
__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()));
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;
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