#include <FSystem.h>
#include <FSocial.h>
#include "IvImageCropForm.h"
+#include "IvImageViewerApp.h"
#include "IvImageViewerPresentationModel.h"
#include "IvResourceManager.h"
#include "IvTypes.h"
static const int CROP_BOX_LINE_WIDTH = 5;
ImageCropForm::ImageCropForm(void)
- : __imageHeight(0)
+ : __cropMode(APPCONTROL_DATA_AUTO)
+ , __imageHeight(0)
, __imageWidth(0)
, __isOrientationChanged(false)
, __pCanvas(null)
, __pRectangleBitmap(null)
, __pointLocation(OUTSIDE_CROPBOX)
, __pPresentationModel(null)
+ , __statusValue(-1)
+ , __formHeight(0)
+ , __formWidth(0)
{
}
result
ImageCropForm::OnInitializing(void)
{
- result r = E_SUCCESS;
-
AppResource* pAppResource = null;
Bitmap* pSaveButtonBitmap = null;
Bitmap* pCancelButtonBitmap = null;
- Bitmap* pCWRotationButtonBitmap = null;
- Bitmap* pCCWRotationButtonBitmap = null;
Panel* pPanel = null;
Button* pSaveButton = null;
Button* pCancelButton = null;
{
pSaveButtonBitmap = pAppResource->GetBitmapN(IDB_IMAGE_CROP_FORM_SAVE_ICON);
pCancelButtonBitmap = pAppResource->GetBitmapN(IDB_IMAGE_CROP_FORM_CANCEL_ICON);
- pCWRotationButtonBitmap = pAppResource->GetBitmapN(IDB_IMAGE_CROP_FORM_CW_ROTATION_ICON);
- pCCWRotationButtonBitmap = pAppResource->GetBitmapN(IDB_IMAGE_CROP_FORM_CCW_ROTATION_ICON);
__pRectangleBitmap = pAppResource->GetBitmapN(IDB_IMAGE_CROP_RECTANGLE);
}
AddOrientationEventListener(*this);
__pPresentationModel->AddFileUpdateListener(this);
- delete pCWRotationButtonBitmap;
- delete pCCWRotationButtonBitmap;
- return r;
+ return E_SUCCESS;
}
void
AppLogDebug("ENTER pArgs(%x)", pArgs);
if (pArgs != null)
{
- IEnumerator* pEnum = pArgs->GetEnumeratorN();
- if (pEnum->MoveNext() != E_SUCCESS)
- {
- delete pEnum;
- delete pArgs;
- AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+ __sourceFilePath = *(static_cast<String*>(pArgs->GetAt(0)));
+ __cropMode = *(static_cast<String*>(pArgs->GetAt(1)));
+ }
+ else
+ {
+ __sourceFilePath = __pPresentationModel->GetFilePathAt(0);
- return;
- }
- __sourceFilePath = *(static_cast<String*>(pEnum->GetCurrent()));
- if (__sourceFilePath.IsEmpty() == false)
- {
- result r = __imageBuffer.Construct(__sourceFilePath.GetPointer());
- if (r == E_SUCCESS)
- {
- __imageWidth = __imageBuffer.GetWidth();
- __imageHeight = __imageBuffer.GetHeight();
- __pCurrentBitmap = __imageBuffer.GetBitmapN(BITMAP_PIXEL_FORMAT_RGB565, BUFFER_SCALING_AUTO);
- }
- Image img;
- __imageFormat = img.GetImageFormat(__sourceFilePath);
- }
- if (pEnum->MoveNext() != E_SUCCESS)
- {
- delete pEnum;
- delete pArgs;
- AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
+ ImageViewerApp* pImageViewerApp = static_cast<ImageViewerApp*>(ImageViewerApp::GetInstance());
+ const IMap* pIMap = pImageViewerApp->GetAppControlArguments();
- return;
- }
- __cropMode = *(static_cast<String*>(pEnum->GetCurrent()));
- if (__cropMode.IsEmpty() == false)
+ if (pIMap != null)
{
- __cropMode.ToLowerCase();
- if (__cropMode == "auto")
- {
- delete pEnum;
- delete pArgs;
- SetValue();
- return;
- }
- else if (__cropMode == "fit-to-screen")
- {
- if (pEnum->MoveNext() != E_SUCCESS)
- {
- delete pEnum;
- delete pArgs;
- AppLogDebug("EXIT 3(%s)", GetErrorMessage(GetLastResult()));
-
- return;
- }
- Integer *pStatus = static_cast<Integer*>(pEnum->GetCurrent());
- if (pStatus != null)
- {
- __statusValue = pStatus->ToInt();
- }
- if (__statusValue == SET_AT_TYPE_CALLER_IMAGE)
- {
- if (pEnum->MoveNext() != E_SUCCESS)
- {
- delete pEnum;
- delete pArgs;
- AppLogDebug("EXIT 4(%s)", GetErrorMessage(GetLastResult()));
-
- return;
- }
-
- LongLong* pContentId = static_cast<LongLong*>(pEnum->GetCurrent());
- if (pContentId != null)
- {
- __contentId = pContentId->ToLongLong();
- }
- }
+ const String* pCropMode = static_cast<const String*>(pIMap->GetValue(String(APPCONTROL_KEY_IMAGE_CROP_MODE)));
- delete pEnum;
- delete pArgs;
- SetValue();
+ if (pCropMode != null)
+ {
+ __cropMode = *pCropMode;
}
}
}
-// if (pArgs != null)
-// {
-// __sourceFilePath = *(static_cast<String*>(pArgs->GetAt(0)));
-// __cropMode = *(static_cast<String*>(pArgs->GetAt(1)));
-// delete pArgs;
-// }
-// else
-// {
-// __sourceFilePath = __pPresentationModel->GetFilePathAt(0);
-// }
-/* if (__sourceFilePath.IsEmpty() == false && __cropMode.IsEmpty() == false)
+
+ if (__sourceFilePath.IsEmpty() == false)
{
- __cropMode.ToLowerCase();
result r = __imageBuffer.Construct(__sourceFilePath.GetPointer());
if (r == E_SUCCESS)
{
}
Image img;
__imageFormat = img.GetImageFormat(__sourceFilePath);
- }*/
- SetValue();
+ }
+
+ if (__cropMode == APPCONTROL_DATA_AUTO)
+ {
+ SetValue();
+ return;
+ }
+ else if (__cropMode == APPCONTROL_DATA_FIT_TO_SCREEN)
+ {
+ Integer *pStatus = static_cast<Integer*>(pArgs->GetAt(2));
+ if (pStatus != null)
+ {
+ __statusValue = pStatus->ToInt();
+ }
+ if (__statusValue == SET_AT_TYPE_CALLER_IMAGE)
+ {
+ LongLong* pContentId = static_cast<LongLong*>(pArgs->GetAt(3));
+ if (pContentId != null)
+ {
+ __contentId = pContentId->ToLongLong();
+ }
+ }
+ SetValue();
+ }
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
r = __pCanvas->SetLineWidth(CROP_BOX_LINE_WIDTH);
r = __pCanvas->DrawBitmap(Rectangle(__imageBox.x, __imageBox.y, __imageBox.width, __imageBox.height), *__pCurrentBitmap);
r = __pCanvas->DrawRectangle(Rectangle(__cropBox.x, __cropBox.y, __cropBox.width, __cropBox.height));
- r = __pCanvas->DrawBitmap(Rectangle((__cropBox.x + __cropBox.width / 2) - (CROP_RECTANGLE_HEIGHT / 2), __cropBox.y - (CROP_RECTANGLE_HEIGHT / 2), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Top Rectangle
- r = __pCanvas->DrawBitmap(Rectangle((__cropBox.x + __cropBox.width / 2) - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Bottom Rectangle
- r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height / 2) - (CROP_RECTANGLE_HEIGHT / 2), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); //Left Rectangle
- r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height / 2) - (CROP_RECTANGLE_HEIGHT / 2), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); //Right Rectangle
- r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2), __cropBox.y - (CROP_RECTANGLE_HEIGHT / 2), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Top Left Rectangle
- r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (CROP_RECTANGLE_HEIGHT / 2), __cropBox.y - (CROP_RECTANGLE_HEIGHT / 2), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Top Right Rectangle
- r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Bottom Right Rectangle
- r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2), (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)), CROP_RECTANGLE_HEIGHT, CROP_RECTANGLE_HEIGHT), *__pRectangleBitmap); // Bottom Left Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2), __cropBox.y - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Top Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Bottom Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); //Left Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); //Right Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (H_CROP_RECTANGLE / 2), __cropBox.y - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Top Left Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2), __cropBox.y - (H_CROP_RECTANGLE / 2), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Top Right Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Bottom Right Rectangle
+ r = __pCanvas->DrawBitmap(Rectangle(__cropBox.x - (H_CROP_RECTANGLE / 2), (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)), H_CROP_RECTANGLE, H_CROP_RECTANGLE), *__pRectangleBitmap); // Bottom Left Rectangle
}
- AppLogDebug("EXIT");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return r;
}
switch(actionId)
{
case IDA_BUTTON_CANCEL:
- pSceneManager->GoBackward(BackwardSceneTransition());
- break;
+ {
+ ImageViewerApp* pApp = dynamic_cast<ImageViewerApp*>(UiApp::GetInstance());
+
+ if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_IMAGE_CROP)
+ {
+ if (pApp != null)
+ {
+ pApp->SendAppControlResult(APP_CTRL_RESULT_CANCELED, null);
+ pApp->Terminate();
+ }
+ }
+ else
+ {
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ }
+ }
+ break;
+
case IDA_BUTTON_SAVE:
{
- if (__cropMode == "auto")
+ if (__cropMode == APPCONTROL_DATA_AUTO)
{
ImageBuffer* pCropBuffer = null;
int count = 1;
int index = 0;
String destFilePath;
- String stringToInsert = L"_";
- String delimiter = L".";
+ ImageViewerApp* pApp = dynamic_cast<ImageViewerApp*>(UiApp::GetInstance());
+
if (__sourceFilePath.IsEmpty() == false)
{
- __sourceFilePath.Reverse();
- __sourceFilePath.IndexOf(delimiter, 0, index);
- __sourceFilePath.Reverse();
- __sourceFilePath.Insert(stringToInsert, __sourceFilePath.GetLength() - index - 1);
- destFilePath.Append(__sourceFilePath);
- destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
- while (File::IsFileExist(destFilePath) == true)
+ if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_IMAGE_CROP)
{
- count++;
- destFilePath.Clear();
+ destFilePath.Append(App::GetInstance()->GetAppDataPath());
+ destFilePath.Append(__pPresentationModel->GetFileName(__sourceFilePath));
+ destFilePath.Reverse();
+ destFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index);
+ destFilePath.Reverse();
+ destFilePath.Insert(FILE_NAME_SEPARATOR, destFilePath.GetLength() - index - 1);
+ destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
+
+ while (File::IsFileExist(destFilePath) == true)
+ {
+ count++;
+ destFilePath.Clear();
+ destFilePath.Append(App::GetInstance()->GetAppDataPath());
+ destFilePath.Append(__pPresentationModel->GetFileName(__sourceFilePath));
+ destFilePath.Insert(FILE_NAME_SEPARATOR, destFilePath.GetLength() - index - 1);
+ destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
+ }
+
+ }
+ else
+ {
+ __sourceFilePath.Reverse();
+ __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index);
+ __sourceFilePath.Reverse();
+ __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1);
destFilePath.Append(__sourceFilePath);
destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
+ while (File::IsFileExist(destFilePath) == true)
+ {
+ count++;
+ destFilePath.Clear();
+ destFilePath.Append(__sourceFilePath);
+ destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
+ }
+
}
+
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);
pCropBuffer->EncodeToFile(destFilePath, __imageFormat, true, 100);
}
ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
pList->Add(new (std::nothrow) String(destFilePath));
- AppLog("Manish %ls", destFilePath.GetPointer());
- pSceneManager->GoBackward(BackwardSceneTransition(), pList);
+
+ if (pApp->GetAppControlOperationId() == APPCONTROL_OPERATION_ID_IMAGE_CROP)
+ {
+ HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter);
+ pMap->Construct();
+ pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_SELECTED), pList);
+
+ if (pApp != null)
+ {
+ pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap);
+ pApp->Terminate();
+ }
+ }
+ else
+ {
+ pSceneManager->GoBackward(BackwardSceneTransition(), pList);
+ }
}
- else if(__cropMode == "fit-to-screen")
+ else if (__cropMode == APPCONTROL_DATA_FIT_TO_SCREEN)
{
- AppLog("Manish OnActionPerformed");
ImageBuffer* pCropBuffer = null;
result r = E_SUCCESS;
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 (__statusValue == SET_AT_TYPE_HOME_SCREEN_WALLPAPER)
{
- String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER;
+ String destPath = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER;
r = pCropBuffer->EncodeToFile(destPath, __imageFormat, true, 100);
if (r == E_SUCCESS)
{
r = SettingInfo::SetValue(SETTING_VALUE_HOME_SCREEN_WALLPAPER, destPath);
}
- else if (r == E_OVERFLOW)
- {
- MessageBox messageBox;
- messageBox.Construct(L"", L"File size is too big", MSGBOX_STYLE_NONE, 3000);
- int modalResult = 0;
- messageBox.ShowAndWait(modalResult);
- }
}
else if (__statusValue == SET_AT_TYPE_LOCK_SCREEN_WALLPAPER)
{
- String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER;
+ String destPath = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER;
r = pCropBuffer->EncodeToFile(destPath, __imageFormat, true, 100);
if (r == E_SUCCESS)
{
r = SettingInfo::SetValue(SETTING_VALUE_LOCK_SCREEN_WALLPAPER, destPath);
}
- else if (r == E_OVERFLOW)
- {
- MessageBox messageBox;
- messageBox.Construct(L"", L"File size is too big", MSGBOX_STYLE_NONE, 3000);
- int modalResult = 0;
- messageBox.ShowAndWait(modalResult);
- }
}
else if (__statusValue == SET_AT_TYPE_HOME_AND_LOCK_SCREEN_WALLPAPER)
{
- String destPath = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER;
- String destPathHome = App::GetInstance()->GetAppRootPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER;
+ String destPath = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_LOCK_SCREEN_WALLPAPER;
+ String destPathHome = App::GetInstance()->GetAppDataPath() + TEMP_FILE_PATH_HOME_SCREEN_WALLPAPER;
r = pCropBuffer->EncodeToFile(destPath, __imageFormat, true, 100);
r = pCropBuffer->EncodeToFile(destPathHome, __imageFormat, true, 100);
if (r == E_SUCCESS)
}
else if (__statusValue == SET_AT_TYPE_CALLER_IMAGE)
{
+ int count = 1;
+ int index = 0;
+ String destFilePath;
+
+ if (__sourceFilePath.IsEmpty() == false)
+ {
+ __sourceFilePath.Reverse();
+ __sourceFilePath.IndexOf(FILE_EXT_SEPARATOR, 0, index);
+ __sourceFilePath.Reverse();
+ __sourceFilePath.Insert(FILE_NAME_SEPARATOR, __sourceFilePath.GetLength() - index - 1);
+ destFilePath.Append(__sourceFilePath);
+ destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
+ while (File::IsFileExist(destFilePath) == true)
+ {
+ count++;
+ destFilePath.Clear();
+ destFilePath.Append(__sourceFilePath);
+ destFilePath.Insert(count, destFilePath.GetLength() - index - 1);
+ }
+ }
+ r = pCropBuffer->EncodeToFile(destFilePath, __imageFormat, true, 100);
+ ContentManager::ScanFile(destFilePath);
Contact* pContact = null;
AddressbookManager* pAddressbookManager = AddressbookManager::GetInstance();
Addressbook* pAddressbook = null;
pAddressbook = pAddressbookManager->GetAddressbookN(DEFAULT_ADDRESSBOOK_ID);
pContact = pAddressbook->GetContactN(__contentId);
- pContact->SetThumbnail(__sourceFilePath);
+ pContact->SetThumbnail(destFilePath);
pAddressbook->UpdateContact(*pContact);
delete pContact;
delete pAddressbook;
+ delete pCropBuffer;
+
+ ArrayList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+ pList->Add(new (std::nothrow) String(destFilePath));
+ pSceneManager->GoBackward(BackwardSceneTransition(), pList);
+
+ AppLogDebug("EXIT(%s)1", GetErrorMessage(GetLastResult()));
+ return;
}
delete pCropBuffer;
- pSceneManager->GoForward(ForwardSceneTransition(IDSCN_IMAGE_VIEWER));
+ pSceneManager->GoBackward(BackwardSceneTransition());
}
}
break;
}
- AppLog("Exit");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
__isOrientationChanged = true;
SetValue();
__pCanvas->Clear();
- AppLogDebug("EXIT");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
AppLogDebug("ENTER");
__touchStart = currentPosition;
CheckCurrentPosition(currentPosition);
- AppLogDebug("EXIT");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
AppLogDebug("ENTER");
int deltaX = currentPosition.x - __touchStart.x;
int deltaY = currentPosition.y - __touchStart.y;
- if (__cropMode.Equals("auto", false))
+ if (__cropMode.Equals(APPCONTROL_DATA_AUTO, false))
{
switch(__pointLocation)
{
case INSIDE_TOP_RECTANGLE:
{
- if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (CROP_RECTANGLE_HEIGHT * 3)))
+ if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (H_CROP_RECTANGLE * 3)))
{
__cropBox.y += deltaY;
__cropBox.height -= deltaY;
case INSIDE_BOTTOM_RECTANGLE:
{
if ((__cropBox.y + __cropBox.height + deltaY) < (__imageBox.y + __imageBox.height)
- && (__cropBox.height + deltaY) > (CROP_RECTANGLE_HEIGHT * 3))
+ && (__cropBox.height + deltaY) > (H_CROP_RECTANGLE * 3))
{
__cropBox.height += deltaY;
}
case INSIDE_LEFT_RECTANGLE:
{
- if ((__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (CROP_RECTANGLE_HEIGHT * 3))
+ if ((__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3))
{
__cropBox.x += deltaX;
__cropBox.width -= deltaX;
case INSIDE_RIGHT_RECTANGLE:
{
if ((__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width)
- && __cropBox.width + deltaX > (CROP_RECTANGLE_HEIGHT * 3))
+ && __cropBox.width + deltaX > (H_CROP_RECTANGLE * 3))
{
__cropBox.width += deltaX;
}
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))
+ if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (H_CROP_RECTANGLE * 3))
+ && (__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3))
{
__cropBox.y += deltaY;
__cropBox.height -= deltaY;
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))
+ if ((__cropBox.y + deltaY) > __imageBox.y && deltaY < (__cropBox.height - (H_CROP_RECTANGLE * 3))
+ && (__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (H_CROP_RECTANGLE * 3))
{
__cropBox.width += deltaX;
__cropBox.y += deltaY;
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))
+ if ((__cropBox.y + __cropBox.height + deltaY) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (H_CROP_RECTANGLE * 3)
+ && (__cropBox.x + deltaX) > __imageBox.x && deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3))
{
__cropBox.x += deltaX;
__cropBox.width -= deltaX;
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))
+ if ((__cropBox.x + __cropBox.width + deltaX) < (__imageBox.x + __imageBox.width) && __cropBox.width + deltaX > (H_CROP_RECTANGLE * 3)
+ && (__cropBox.y + __cropBox.height + deltaY) < (__imageBox.y + __imageBox.height) && (__cropBox.height + deltaY) > (H_CROP_RECTANGLE * 3))
{
__cropBox.width += deltaX;
__cropBox.height += deltaY;
break;
}
}
- else if (__cropMode != "auto")
+ else if (__cropMode != APPCONTROL_DATA_AUTO)
{
- //AppLog("Manish Fit to screen");
if (__pointLocation == INSIDE_LEFT_RECTANGLE || __pointLocation == INSIDE_BOTTOM_LEFT_RECTANGLE
|| __pointLocation == INSIDE_TOP_LEFT_RECTANGLE)
{
int temp = __cropBox.height;
int height = (__formHeight * (__cropBox.width - (2 * deltaX))) /__formWidth;
temp = height - temp;
- if ((__cropBox.width - (2 * deltaX) > (CROP_RECTANGLE_HEIGHT * 3)) && (!(height >= __imageBox.height || (__cropBox.width - (2 * deltaX)) >= __imageBox.width)))
+ if ((__cropBox.width - (2 * deltaX) > (H_CROP_RECTANGLE * 3)) && (!(height >= __imageBox.height || (__cropBox.width - (2 * deltaX)) >= __imageBox.width)))
{
if (__cropBox.x + deltaX >= __imageBox.x && __cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width
&& __cropBox.y - (temp / 2) >= __imageBox.y && __cropBox.y + __cropBox.height + (temp / 2) < __imageBox.y + __imageBox.height
- && (__cropBox.width - (2 * deltaX) > (CROP_RECTANGLE_HEIGHT * 3)))
+ && (__cropBox.width - (2 * deltaX) > (H_CROP_RECTANGLE * 3)))
{
- AppLog("Manish 0");
__cropBox.x += deltaX;
__cropBox.width = __cropBox.width - (2 * deltaX);
__cropBox.height = height;
&& __cropBox.width < __imageBox.width
&& __cropBox.x + deltaX >= __imageBox.x && __cropBox.y - temp >= __imageBox.y )
{
- AppLog("Manish 1");
if (__cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width
&& __cropBox.x + deltaX >= __imageBox.x)
{
- //AppLog("Manish 2");
__cropBox.x += deltaX;
}
else
{
- AppLog("Manish 3");
__cropBox.x = __cropBox.x + (2 * deltaX);
}
__cropBox.width = __cropBox.width - (2 * deltaX);
{
if (__cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width)
{
- AppLog("Manish 4");
__cropBox.x += deltaX;
}
else
{
- AppLog("Manish 5");
__cropBox.x = __cropBox.x + (2 * deltaX);
}
__cropBox.width = __cropBox.width - (2 * deltaX);
int temp = __cropBox.height;
int height = (__formHeight * (__cropBox.width - (2 * deltaX))) / __formWidth;
temp = height - temp;
- if ((__cropBox.width - (2 * deltaX) > (CROP_RECTANGLE_HEIGHT * 3)) && (!(height >= __imageBox.height || (__cropBox.width - (2 * deltaX)) >= __imageBox.width)))
+ if ((__cropBox.width - (2 * deltaX) > (H_CROP_RECTANGLE * 3)) && (!(height >= __imageBox.height || (__cropBox.width - (2 * deltaX)) >= __imageBox.width)))
{
- if (deltaX < __cropBox.width - (CROP_RECTANGLE_HEIGHT * 3))
+ if (deltaX < __cropBox.width - (H_CROP_RECTANGLE * 3))
{
if (__cropBox.x + deltaX > __imageBox.x && __cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width
&& __cropBox.y - (temp / 2) > __imageBox.y && __cropBox.y + __cropBox.height + (temp / 2) < __imageBox.y + __imageBox.height)
{
- AppLog("Manish 0");
__cropBox.x += deltaX;
__cropBox.width = __cropBox.width - (2 * deltaX);;
__cropBox.height = height;
&& __cropBox.x + __cropBox.width - (2 * deltaX) <= __imageBox.x + __imageBox.width
&& __cropBox.x - deltaX >= __imageBox.x && __cropBox.y - temp >= __imageBox.y )
{
- AppLog("Manish 1");
if (__cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width
&& __cropBox.x + deltaX >= __imageBox.x)
{
- AppLog("Manish 2");
__cropBox.x += deltaX;
}
else
{
- AppLog("Manish 3");
__cropBox.width = __cropBox.width - (2 * deltaX);
}
__cropBox.width = __cropBox.width - (2 * deltaX);
else if (__cropBox.y - (temp / 2) <= __imageBox.y && __cropBox.width - (deltaX) <= __imageBox.width
&& __cropBox.x + deltaX <= __imageBox.x && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height)
{
- AppLog("Manish 25");
if (__cropBox.x + deltaX >= __imageBox.x)
{
- AppLog("Manish 4");
__cropBox.x += deltaX;
}
else
&& __cropBox.x + __cropBox.width - deltaX <= __imageBox.x + __imageBox.width
&& __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height)
{
- AppLog("Manish 999");
__cropBox.x += deltaX;
__cropBox.width = __cropBox.width - (2 * deltaX);
__cropBox.height = height;
int temp = __cropBox.width;
int width = (__formWidth * (__cropBox.height - (2 * deltaY))) / __formHeight;
temp = width - temp;
- if (__cropBox.height - (2 * deltaY) > (__formHeight * (CROP_RECTANGLE_HEIGHT * 3)) / __formWidth && (!(__cropBox.height - (2 * deltaY) >= __imageBox.height || width >= __imageBox.width)))
+ if (__cropBox.height - (2 * deltaY) > (__formHeight * (H_CROP_RECTANGLE * 3)) / __formWidth && (!(__cropBox.height - (2 * deltaY) >= __imageBox.height || width >= __imageBox.width)))
{
if (__cropBox.x - (temp /2 ) > __imageBox.x && __cropBox.x + __cropBox.width + temp < __imageBox.x + __imageBox.width
&& __cropBox.y + (deltaY) > __imageBox.y && __cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height)
{
- AppLog("Manish 0");
__cropBox.y += deltaY;
__cropBox.height = __cropBox.height - (2 * deltaY);
__cropBox.width = width;
}
else if (__cropBox.x - (temp / 2) < __imageBox.x)
{
- AppLog("manish 55");
if (__cropBox.x + __cropBox.width + temp <= __imageBox.x + __imageBox.width)
{
__cropBox.width = width;
}
if (__cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height)
{
- AppLog("Manish 56");
__cropBox.height = __cropBox.height - (2 * deltaY);
}
}
else if (__cropBox.y + __cropBox.height - (2 * deltaY) >= __imageBox.x + __imageBox.height
&& __cropBox.y + (2 * deltaY) >= __imageBox.y)
{
- AppLog("Manish 1");
if (__cropBox.x - temp >= __imageBox.x
&& __cropBox.x + __cropBox.width + temp > __imageBox.x + __imageBox.width)
{
&& __cropBox.x - temp >= __imageBox.x && __cropBox.y + deltaY >= __imageBox.y
&& __cropBox.y + __cropBox.height - (2 * deltaY) <= __imageBox.y + __imageBox.height)
{
- AppLog("manish 58");
__cropBox.x = __cropBox.x - temp;
__cropBox.width = width;
__cropBox.y += deltaY;
}
else if (__pointLocation == INSIDE_BOTTOM_RECTANGLE)
{
- AppLog("Manish INSIDE BOTTOM RECTANGLE");
deltaY = deltaY * (-1);
int temp = __cropBox.width;
int width = (__formWidth * (__cropBox.height - (2 * deltaY))) / __formHeight;
temp = width - temp;
- if (__cropBox.height - (2 * deltaY) > (__formHeight * (CROP_RECTANGLE_HEIGHT * 3)) / __formWidth && (!(__cropBox.height - (2 * deltaY) >= __imageBox.height || width >= __imageBox.width)))
+ if (__cropBox.height - (2 * deltaY) > (__formHeight * (H_CROP_RECTANGLE * 3)) / __formWidth && (!(__cropBox.height - (2 * deltaY) >= __imageBox.height || width >= __imageBox.width)))
{
if (__cropBox.x - (temp / 2) >= __imageBox.x && __cropBox.x + __cropBox.width + temp < __imageBox.x + __imageBox.width
&& __cropBox.y + deltaY > __imageBox.y && __cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height)
{
- AppLog("Manish 0");
__cropBox.y += deltaY;
__cropBox.height = __cropBox.height - (2 * deltaY);;
__cropBox.width = width;
else if (__cropBox.y + deltaY < __imageBox.y && __cropBox.y + __cropBox.height - (2 * deltaY) < __imageBox.y + __imageBox.height
&& __cropBox.x - (temp / 2) > __imageBox.x && __cropBox.x + __cropBox.width + temp < __imageBox.x + __imageBox.width)
{
- AppLog("Manish 1");
__cropBox.x = __cropBox.x - (temp / 2);
__cropBox.width = width;
__cropBox.height = __cropBox.height - (2 * deltaY);
&& __cropBox.y + deltaY >= __imageBox.y && __cropBox.y + __cropBox.height + temp <= __imageBox.y + __imageBox.height
&& __cropBox.x - temp >= __imageBox.x)
{
- AppLog("Manish 2");
__cropBox.x = __cropBox.x - temp;
__cropBox.y += deltaY;
__cropBox.width = width;
&& __cropBox.y + deltaY <= __imageBox.y && __cropBox.x - temp > __imageBox.x
&& __cropBox.y + __cropBox.height + temp < __imageBox.y + __imageBox.height)
{
- AppLog("Manish 3");
__cropBox.x -= temp;
__cropBox.width = width;
__cropBox.height = __cropBox.height - (2 * deltaY);
else if (__cropBox.x - temp < __imageBox.x && __cropBox.x + __cropBox.width + temp <= __imageBox.x + __imageBox.width
&& __cropBox.y + __cropBox.height - (2 * deltaY) <= __imageBox.y + __imageBox.height)
{
- AppLog("manish 4");
if (__cropBox.y + deltaY >= __imageBox.y)
{
__cropBox.y += deltaY;
}
RequestRedraw(false);
__touchStart = currentPosition;
- AppLogDebug("EXIT");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
{
AppLogDebug("ENTER");
__pointLocation = OUTSIDE_CROPBOX;
- AppLogDebug("EXIT");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
ImageCropForm::CheckCurrentPosition(const Point currentPosition)
{
AppLogDebug("ENTER");
- if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < ((__cropBox.x + __cropBox.width / 2) + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > (__cropBox.y - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < (__cropBox.y + (CROP_RECTANGLE_HEIGHT / 2)))
+ if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2)) && currentPosition.x < ((__cropBox.x + __cropBox.width / 2) + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > (__cropBox.y - (H_CROP_RECTANGLE / 2)) && currentPosition.y < (__cropBox.y + (H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_TOP_RECTANGLE;
}
- else if (currentPosition.x > (__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < (__cropBox.x + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > ((__cropBox.y + __cropBox.height / 2) - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < ((__cropBox.y + __cropBox.height / 2) + (CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > (__cropBox.x - (H_CROP_RECTANGLE / 2)) && currentPosition.x < (__cropBox.x + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > ((__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2)) && currentPosition.y < ((__cropBox.y + __cropBox.height / 2) + (H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_LEFT_RECTANGLE;
}
- else if (currentPosition.x > (__cropBox.x + __cropBox.width - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < (__cropBox.x + __cropBox.width + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > ((__cropBox.y + __cropBox.height / 2) - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < ((__cropBox.y + __cropBox.height / 2) + (CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > (__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2)) && currentPosition.x < (__cropBox.x + __cropBox.width + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > ((__cropBox.y + __cropBox.height / 2) - (H_CROP_RECTANGLE / 2)) && currentPosition.y < ((__cropBox.y + __cropBox.height / 2) + (H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_RIGHT_RECTANGLE;
}
- else if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < ((__cropBox.x + __cropBox.width / 2) + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < (__cropBox.y + __cropBox.height + (CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2)) && currentPosition.x < ((__cropBox.x + __cropBox.width / 2) + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)) && currentPosition.y < (__cropBox.y + __cropBox.height + (H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_BOTTOM_RECTANGLE;
}
- else if (currentPosition.x > (__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < (__cropBox.x + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > (__cropBox.y - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < (__cropBox.y +(CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > (__cropBox.x - (H_CROP_RECTANGLE / 2)) && currentPosition.x < (__cropBox.x + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > (__cropBox.y - (H_CROP_RECTANGLE / 2)) && currentPosition.y < (__cropBox.y +(H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_TOP_LEFT_RECTANGLE;
}
- else if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < (__cropBox.x + __cropBox.width + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > (__cropBox.y - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < (__cropBox.y +(CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > ((__cropBox.x + __cropBox.width / 2) - (H_CROP_RECTANGLE / 2)) && currentPosition.x < (__cropBox.x + __cropBox.width + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > (__cropBox.y - (H_CROP_RECTANGLE / 2)) && currentPosition.y < (__cropBox.y +(H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_TOP_RIGHT_RECTANGLE;
}
- else if (currentPosition.x > (__cropBox.x + __cropBox.width - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < (__cropBox.x + __cropBox.width + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < (__cropBox.y + __cropBox.height + (CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > (__cropBox.x + __cropBox.width - (H_CROP_RECTANGLE / 2)) && currentPosition.x < (__cropBox.x + __cropBox.width + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)) && currentPosition.y < (__cropBox.y + __cropBox.height + (H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_BOTTOM_RIGHT_RECTANGLE;
}
- else if (currentPosition.x > (__cropBox.x - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.x < (__cropBox.x + (CROP_RECTANGLE_HEIGHT / 2))
- && currentPosition.y > (__cropBox.y + __cropBox.height - (CROP_RECTANGLE_HEIGHT / 2)) && currentPosition.y < (__cropBox.y + __cropBox.height + (CROP_RECTANGLE_HEIGHT / 2)))
+ else if (currentPosition.x > (__cropBox.x - (H_CROP_RECTANGLE / 2)) && currentPosition.x < (__cropBox.x + (H_CROP_RECTANGLE / 2))
+ && currentPosition.y > (__cropBox.y + __cropBox.height - (H_CROP_RECTANGLE / 2)) && currentPosition.y < (__cropBox.y + __cropBox.height + (H_CROP_RECTANGLE / 2)))
{
__pointLocation = INSIDE_BOTTOM_LEFT_RECTANGLE;
}
{
__pointLocation = OUTSIDE_CROPBOX;
}
- AppLogDebug("EXIT");
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return;
}
__formHeight = Form::GetBounds().height;
__formWidth = Form::GetBounds().width;
}
- else if(GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
+ else if (GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE || GetOrientationStatus() == ORIENTATION_STATUS_LANDSCAPE_REVERSE)
{
__formHeight = Form::GetBounds().width;
__formWidth = Form::GetBounds().height;
}
- AppLog("Manish h value %d", __formHeight);
- AppLog("Manish w value %d", __formWidth);
- float clientAreaRatio = (GetClientAreaBoundsF().height - FOOTER_PANEL_HEIGHT) / GetClientAreaBoundsF().width;
- AppLog("Manish %f", clientAreaRatio);
- if (__imageWidth >= GetClientAreaBounds().width || __imageHeight > (GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT))
+ float clientAreaRatio = (GetClientAreaBoundsF().height - H_FOOTER_PANEL) / GetClientAreaBoundsF().width;
+ if (__imageWidth >= GetClientAreaBounds().width || __imageHeight > (GetClientAreaBounds().height - H_FOOTER_PANEL))
{
float imageRatio = __imageHeight / (float) __imageWidth;
if (imageRatio < clientAreaRatio)
__imageBox.width = GetClientAreaBounds().width;
__imageBox.height = (__imageHeight * __imageBox.width) / __imageWidth;
__imageBox.x = GetClientAreaBounds().x;
- __imageBox.y = GetClientAreaBounds().y + ((GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT) - __imageBox.height) / 2;
+ __imageBox.y = GetClientAreaBounds().y + ((GetClientAreaBounds().height - H_FOOTER_PANEL) - __imageBox.height) / 2;
}
else
{
- __imageBox.height = GetClientAreaBounds().height - FOOTER_PANEL_HEIGHT;
+ __imageBox.height = GetClientAreaBounds().height - H_FOOTER_PANEL;
__imageBox.width = (__imageWidth * __imageBox.height) / __imageHeight;
__imageBox.x = (GetClientAreaBounds().width - __imageBox.width) / 2;
__imageBox.y = GetClientAreaBounds().y;
temp = (__cropBox.width * __imageBox.width) / (float)prevWidth;
__cropBox.width = (temp + 0.5);
}
- AppLog("Manish %d %d", __imageBox.width, __imageBox.height);
- AppLog("Manish %d %d", __cropBox.width, __cropBox.height);
__pCanvas = GetCanvasN();
__pCanvas->SetForegroundColor(CROP_BOX_RECTANGLE_COLOR);
}
void ImageCropForm::OnFormFileEventOccuered(const int index, const unsigned long eventId)
{
AppLogDebug(" ENTER");
- if (File::IsFileExist(__sourceFilePath) == false)
- {
- UiApp::GetInstance()->Terminate();
- }
+ UiApp::GetInstance()->Terminate();
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}