#include "FUi_EcoreEvas.h"
#include "FUi_Window.h"
+#define EDIT_COPY_PASTE_MAGNIFIER 1
+
using namespace Tizen::Ui;
using namespace Tizen::App;
using namespace Tizen::Base;
const int COPY_PASTE_CLIPBOARD_ID = 236;
const int COPY_PASTE_SEARCH_ID = 237;
+class _EditCopyPasteMagnifier
+ : public _Window
+{
+public:
+ _EditCopyPasteMagnifier(_EditCopyPasteManager* pCopyPasteManager, int handlerCursorPos);
+ virtual ~_EditCopyPasteMagnifier(void);
+ static _EditCopyPasteMagnifier* CreateInstanceN(const FloatPoint& point, int handlerCursorPos, _EditCopyPasteManager* pCopyPasteManager);
+ virtual void OnDraw(void);
+ void CaptureTextArea(Canvas& canvas);
+ void MoveMagnifier(const FloatPoint& point, int handlerCursorPos);
+ Bitmap* GetMagnifierBitmap(void) const;
+
+private:
+ _EditCopyPasteMagnifier(const _EditCopyPasteMagnifier& value);
+ _EditCopyPasteMagnifier& operator =(const _EditCopyPasteMagnifier& value);
+
+private:
+ _EditCopyPasteManager* __pCopyPasteManager;
+ Bitmap* __pMagnifierBitmap;
+ _VisualElement* __pRoot;
+ int __handlerCursorPos;
+};
+
+_EditCopyPasteMagnifier::_EditCopyPasteMagnifier(_EditCopyPasteManager* pCopyPasteManager, int handlerCursorPos)
+ : __pCopyPasteManager(pCopyPasteManager)
+ , __pMagnifierBitmap(null)
+ , __pRoot(null)
+ , __handlerCursorPos(handlerCursorPos)
+{
+ AcquireHandle();
+ __pRoot = GetVisualElement();
+ __pRoot->SetSurfaceOpaque(false);
+
+ GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_MAGNIFIER, BITMAP_PIXEL_FORMAT_ARGB8888, __pMagnifierBitmap);
+}
+
+_EditCopyPasteMagnifier::~_EditCopyPasteMagnifier(void)
+{
+ if (__pMagnifierBitmap)
+ {
+ delete __pMagnifierBitmap;
+ __pMagnifierBitmap = null;
+ }
+}
+
+Bitmap*
+_EditCopyPasteMagnifier::GetMagnifierBitmap(void) const
+{
+ return __pMagnifierBitmap;
+}
+
+_EditCopyPasteMagnifier*
+_EditCopyPasteMagnifier::CreateInstanceN(const FloatPoint& point, int handlerCursorPos, _EditCopyPasteManager* pCopyPasteManager)
+{
+ _EditCopyPasteMagnifier* pCopyPasteMagnifier = new (std::nothrow) _EditCopyPasteMagnifier(pCopyPasteManager, handlerCursorPos);
+ SysTryReturn(NID_UI_CTRL, pCopyPasteMagnifier != null, null, E_OUT_OF_MEMORY, "pCopyPasteMagnifier is null");
+
+ FloatPoint cursorPoint(point);
+ FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+ float width = 0.0f;
+ float height = 0.0f;
+ _Edit* pEdit = pCopyPasteManager->GetEdit();
+ _ControlOrientation orientation = pEdit->GetOrientation();
+
+ Bitmap* pMagnifierBitmap = pCopyPasteMagnifier->GetMagnifierBitmap();
+ SysTryReturn(NID_UI_CTRL, pMagnifierBitmap != null, null, E_OUT_OF_MEMORY, "pMagnifierBitmap is null");
+
+ result r = pCopyPasteMagnifier->CreateRootVisualElement();
+ SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pCopyPasteMagnifier->SetActivationEnabled(false);
+
+ GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_WIDTH, orientation, width);
+ GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_HEIGHT, orientation, height);
+
+ bounds = FloatRectangle(cursorPoint.x - width/2, cursorPoint.y - height, width, height);
+ pCopyPasteMagnifier->SetBounds(bounds);
+ pCopyPasteMagnifier->Open();
+
+ return pCopyPasteMagnifier;
+
+CATCH:
+ pCopyPasteMagnifier->Close();
+ delete pCopyPasteMagnifier;
+
+ return null;
+}
+
+void
+_EditCopyPasteMagnifier::OnDraw(void)
+{
+ Canvas* pCanvas = GetCanvasN();
+ if (pCanvas == null)
+ {
+ return;
+ }
+ pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+ pCanvas->Clear();
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pMagnifierBitmap))
+ {
+ pCanvas->DrawNinePatchedBitmap(pCanvas->GetBoundsF(), *__pMagnifierBitmap);
+ }
+ else
+ {
+ pCanvas->DrawBitmap(pCanvas->GetBoundsF(), *__pMagnifierBitmap);
+ }
+
+ CaptureTextArea(*pCanvas);
+
+ delete pCanvas;
+
+}
+
+void
+_EditCopyPasteMagnifier::CaptureTextArea(Canvas& canvas)
+{
+ _Edit* pEdit = __pCopyPasteManager->GetEdit();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEdit, E_INVALID_STATE, "pEdit is null.");
+
+ _EditPresenter* pEditPresenter = pEdit->GetPresenter();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEditPresenter, E_INVALID_STATE, "pEditPresenter is null.");
+
+ _VisualElement* pTextVisualElement = pEditPresenter->GetTextVisualElement();
+ SysTryReturnVoidResult(NID_UI_CTRL, pTextVisualElement, E_INVALID_STATE, "pTextVisualElement is null.");
+
+ Canvas* pTextCanvas = pTextVisualElement->GetCanvasN();
+
+ float captureWidth = 0.0f;
+ float captureHeight = 0.0f;
+ float capturePosX = 0.0f;
+ float capturePosY = 0.0f;
+ FloatRectangle cursorBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ FloatRectangle magnifierBounds = GetBoundsF();
+ pEditPresenter->CalculateCursorBounds(pEditPresenter->GetTextBoundsF(), cursorBounds, __handlerCursorPos);
+
+ GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_CAPTURE_WIDTH, pEdit->GetOrientation(), captureWidth);
+ GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_CAPTURE_HEIGHT, pEdit->GetOrientation(), captureHeight);
+ GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_CAPTURE_POSITION_X, pEdit->GetOrientation(), capturePosX);
+ GET_SHAPE_CONFIG(EDIT::COPYPASTE_MAGNIFIER_CAPTURE_POSITION_Y, pEdit->GetOrientation(), capturePosY);
+
+ FloatRectangle textVisualElementBounds = pTextVisualElement->GetBounds();
+ FloatRectangle captureBounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+ if (cursorBounds.x >= captureWidth/2.0f)
+ {
+ captureBounds.x = cursorBounds.x - captureWidth/2.0f;
+ }
+ else
+ {
+ captureBounds.x = captureWidth/2.0f - cursorBounds.x;
+ }
+ if (cursorBounds.x <= textVisualElementBounds.width - captureWidth/2.0f)
+ {
+ captureBounds.width = captureWidth;
+ }
+ else
+ {
+ captureBounds.width = textVisualElementBounds.width - captureBounds.x;
+ }
+
+ captureBounds.y = cursorBounds.y;
+ if (cursorBounds.y <= textVisualElementBounds.height - captureHeight)
+ {
+ captureBounds.height = captureHeight;
+ }
+ else
+ {
+ captureBounds.height = textVisualElementBounds.height - captureBounds.y;
+ }
+
+ Bitmap bitmap;
+ bitmap.Construct(*pTextCanvas, captureBounds);
+ bitmap.Scale(FloatDimension(bitmap.GetWidth()*1.5f, bitmap.GetHeight()*1.5f));
+
+ canvas.DrawBitmap(FloatPoint(capturePosX, capturePosY), bitmap);
+ delete pTextCanvas;
+}
+
+void
+_EditCopyPasteMagnifier::MoveMagnifier(const FloatPoint& point, int handlerCursorPos)
+{
+ FloatRectangle bounds = FloatRectangle(point.x - GetBoundsF().width/2, point.y - GetBoundsF().height, GetBoundsF().width, GetBoundsF().height);
+ __handlerCursorPos = handlerCursorPos;
+ SetBounds(bounds);
+ Invalidate();
+}
+
/**
* @class _EditCopyPasteHandler
* @brief This class defines the common behavior for the %_EditCopyPasteHandler.
void CheckReverseStatus(void);
void ChangeHandlerBitmap(void);
Bitmap* GetHandlerBitmap(void) const;
+ bool CreateCopyPasteMagnifier(void);
+ void DestroyCopyPasteMagnifier(void);
+ void MoveCopyPasteMagnifier(void);
// virtual function
virtual void OnDraw(void);
private:
_VisualElement* __pRoot;
Bitmap* __pHandlerBitmap;
- Bitmap* __pHandlerPressedBitmap;
FloatPoint __touchPressedPoint;
_EditCopyPasteManager* __pCopyPasteManager;
bool __leftHandler;
bool __isTouchPressed;
FloatRectangle __windowBounds;
HandlerDirection __handlerDirection;
-
+ bool __singleHandler;
+ _EditCopyPasteMagnifier* __pCopyPasteMagnifier;
+ bool __isTouchMoving;
}; // _EditCopyPasteHandler
Bitmap*
return __pHandlerBitmap;
}
+bool
+_EditCopyPasteHandler::CreateCopyPasteMagnifier(void)
+{
+ if (!__pCopyPasteMagnifier)
+ {
+ _Edit* pEdit = __pCopyPasteManager->GetEdit();
+ SysTryReturn(NID_UI_CTRL, pEdit, false, E_INVALID_STATE, "[E_INVALID_STATE] pEdit is null.\n");
+
+ _EditPresenter* pEditPresenter = pEdit->GetPresenter();
+ SysTryReturn(NID_UI_CTRL, pEditPresenter, false, E_INVALID_STATE, "[E_INVALID_STATE] pEditPresenter is null.\n");
+
+ FloatRectangle cursorBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ pEdit->CalculateAbsoluteCursorBounds(__handlerCursorPos, cursorBounds);
+
+ __pCopyPasteMagnifier = _EditCopyPasteMagnifier::CreateInstanceN(FloatPoint(cursorBounds.x, cursorBounds.y), __handlerCursorPos, __pCopyPasteManager);
+ SysTryReturn(NID_UI_CTRL, pEdit, false, E_INVALID_STATE, "[E_INVALID_STATE] pEdit is null.\n");
+ }
+ return true;
+}
+
+void
+_EditCopyPasteHandler::DestroyCopyPasteMagnifier(void)
+{
+ if (__pCopyPasteMagnifier)
+ {
+ __pCopyPasteMagnifier->Close();
+ delete __pCopyPasteMagnifier;
+ __pCopyPasteMagnifier = null;
+ }
+}
+
+void
+_EditCopyPasteHandler::MoveCopyPasteMagnifier(void)
+{
+ if (__pCopyPasteMagnifier)
+ {
+ _Edit* pEdit = __pCopyPasteManager->GetEdit();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEdit, E_INVALID_STATE, "pEdit is null.");
+
+ _EditPresenter* pEditPresenter = pEdit->GetPresenter();
+ SysTryReturnVoidResult(NID_UI_CTRL, pEditPresenter, E_INVALID_STATE, "pEditPresenter is null.");
+
+ FloatRectangle cursorBounds(0.0f, 0.0f, 0.0f, 0.0f);
+ pEdit->CalculateAbsoluteCursorBounds(__handlerCursorPos, cursorBounds);
+
+ __pCopyPasteMagnifier->MoveMagnifier(FloatPoint(cursorBounds.x, cursorBounds.y), __handlerCursorPos);
+ }
+}
+
void
_EditCopyPasteHandler::ChangeHandlerBitmap(void)
{
delete __pHandlerBitmap;
__pHandlerBitmap = null;
}
- if (__pHandlerPressedBitmap)
- {
- delete __pHandlerPressedBitmap;
- __pHandlerPressedBitmap = null;
- }
if (__leftHandler)
{
switch(__handlerDirection)
{
case HANDLER_DIRECTION_REVERSE_1:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
case HANDLER_DIRECTION_REVERSE_2:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_LEFT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
case HANDLER_DIRECTION_REVERSE_3:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_RIGHT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_RIGHT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
case HANDLER_DIRECTION_NONE:
//fall through
default:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
}
}
{
case HANDLER_DIRECTION_REVERSE_1:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
case HANDLER_DIRECTION_REVERSE_2:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_RIGHT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_RIGHT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
case HANDLER_DIRECTION_REVERSE_3:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_REVERSE_LEFT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
case HANDLER_DIRECTION_NONE:
//fall through
default:
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
break;
}
}
_EditCopyPasteHandler::_EditCopyPasteHandler(const Point& point, int handlerCursorPos, _EditCopyPasteManager* pCopyPasteManager, bool singleHandler, bool leftHandler)
: __pRoot(null)
, __pHandlerBitmap(null)
- , __pHandlerPressedBitmap(null)
, __touchPressedPoint(0.0f, 0.0f)
, __pCopyPasteManager(pCopyPasteManager)
, __leftHandler(leftHandler)
, __isTouchPressed(false)
, __windowBounds(0.0f, 0.0f, 0.0f, 0.0f)
, __handlerDirection(HANDLER_DIRECTION_NONE)
+ , __singleHandler(false)
+ , __pCopyPasteMagnifier(null)
+ , __isTouchMoving(false)
{
AcquireHandle();
if (singleHandler)
{
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
+ GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_CENTER_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
handlerPoint.x = handlerPoint.x - (__pHandlerBitmap->GetWidth() / 2);
+ __singleHandler = true;
}
else
{
if (leftHandler)
{
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
handlerPoint.x = handlerPoint.x - __pHandlerBitmap->GetWidth();
}
else
{
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
}
}
_EditCopyPasteHandler::_EditCopyPasteHandler(const FloatPoint& point, int handlerCursorPos, _EditCopyPasteManager* pCopyPasteManager, bool singleHandler, bool leftHandler)
: __pRoot(null)
, __pHandlerBitmap(null)
- , __pHandlerPressedBitmap(null)
, __touchPressedPoint(0.0f, 0.0f)
, __pCopyPasteManager(pCopyPasteManager)
, __leftHandler(leftHandler)
, __isTouchPressed(false)
, __windowBounds(0.0f, 0.0f, 0.0f, 0.0f)
, __handlerDirection(HANDLER_DIRECTION_NONE)
+ , __singleHandler(false)
+ , __pCopyPasteMagnifier(null)
+ , __isTouchMoving(false)
{
AcquireHandle();
FloatPoint handlerPoint(point);
if (singleHandler)
{
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
+ GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_CENTER_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
handlerPoint.x = handlerPoint.x - (__pHandlerBitmap->GetWidthF() / 2.0f);
+ __singleHandler = true;
}
else
{
if (leftHandler)
{
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_LEFT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
handlerPoint.x = handlerPoint.x - __pHandlerBitmap->GetWidthF();
}
else
{
GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerBitmap);
- GET_BITMAP_CONFIG_N(EDIT::COPY_PASTE_ICON_RIGHT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pHandlerPressedBitmap);
}
}
_EditCopyPasteHandler::~_EditCopyPasteHandler(void)
{
+ DestroyCopyPasteMagnifier();
+
if (__pHandlerBitmap)
{
delete __pHandlerBitmap;
__pHandlerBitmap = null;
}
- if (__pHandlerPressedBitmap)
- {
- delete __pHandlerPressedBitmap;
- __pHandlerPressedBitmap = null;
- }
}
_EditCopyPasteHandler*
void
_EditCopyPasteHandler::AdjustBounds(void)
{
- int previousCursorPos;
FloatRectangle cursorRect;
FloatRectangle rect = GetBoundsF();
FloatPoint checkPoint(0.0f, 0.0f);
+ _Edit* pEdit = __pCopyPasteManager->GetEdit();
+ _EditPresenter* pEditPresenter = pEdit->GetPresenter();
- previousCursorPos = __pCopyPasteManager->GetCursorPosition();
- __pCopyPasteManager->SetCursorPosition(__handlerCursorPos);
- cursorRect = __pCopyPasteManager->GetCursorBoundsF(true);
- __pCopyPasteManager->SetCursorPosition(previousCursorPos);
+ if (__singleHandler)
+ {
+ cursorRect = __pCopyPasteManager->GetCursorBoundsF(true);
+ rect.x = cursorRect.x - __pHandlerBitmap->GetWidthF()/2.0f;
+ rect.y = cursorRect.y + cursorRect.height;
+ checkPoint = FloatPoint(cursorRect.x , cursorRect.y + cursorRect.height);
+ }
+ else
+ {
+ pEditPresenter->CalculateAbsoluteCursorBounds(__handlerCursorPos, cursorRect);
- rect.x = cursorRect.x;
- rect.y = cursorRect.y + cursorRect.height;
+ rect.x = cursorRect.x;
+ rect.y = cursorRect.y + cursorRect.height;
- checkPoint = FloatPoint(rect.x, rect.y);
+ checkPoint = FloatPoint(cursorRect.x + cursorRect.width/2.0f, cursorRect.y + cursorRect.height);
- if (__leftHandler)
- {
- if (__handlerDirection == HANDLER_DIRECTION_NONE)
- {
- rect.x = rect.x - __pHandlerBitmap->GetWidthF();
- }
- else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_2)
+ if (__leftHandler)
{
- rect.x = rect.x - __pHandlerBitmap->GetWidthF();
- rect.y -= rect.height;
+ if (__handlerDirection == HANDLER_DIRECTION_NONE)
+ {
+ rect.x = rect.x - __pHandlerBitmap->GetWidthF();
+ }
+ else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_2)
+ {
+ rect.x = rect.x - __pHandlerBitmap->GetWidthF();
+ rect.y -= rect.height;
+ }
+ else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_3)
+ {
+ rect.y -= rect.height;
+ }
}
- else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_3)
+ else
{
- rect.y -= rect.height;
+ if (__handlerDirection == HANDLER_DIRECTION_REVERSE_1)
+ {
+ rect.x = rect.x - __pHandlerBitmap->GetWidthF();
+ }
+ else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_2)
+ {
+ rect.y -= rect.height;
+ }
+ else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_3)
+ {
+ rect.x = rect.x - __pHandlerBitmap->GetWidthF();
+ rect.y -= rect.height;
+ }
}
}
- else
+
+ if (!__isTouchMoving)
{
- if (__handlerDirection == HANDLER_DIRECTION_REVERSE_1)
+ bool visibleState = __pCopyPasteManager->CheckHandleBounds(checkPoint);
+ if (visibleState && !GetVisibleState())
{
- rect.x = rect.x - __pHandlerBitmap->GetWidthF();
+ SetVisibleState(true);
+ Open();
}
- else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_2)
+ else if (!visibleState && GetVisibleState())
{
- rect.y -= rect.height;
+ SetVisibleState(false);
+ Close();
}
- else if (__handlerDirection == HANDLER_DIRECTION_REVERSE_3)
- {
- rect.x = rect.x - __pHandlerBitmap->GetWidthF();
- rect.y -= rect.height;
- }
- }
-
- bool visibleState = __pCopyPasteManager->CheckHandleBounds(checkPoint);
- if (visibleState && !GetVisibleState())
- {
- SetVisibleState(true);
- Open();
- }
- else if (!visibleState && GetVisibleState())
- {
- SetVisibleState(false);
- Close();
}
SetBounds(rect);
}
pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
pCanvas->Clear();
- if (__isTouchPressed)
+ if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pHandlerBitmap))
{
- if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pHandlerPressedBitmap))
- {
- pCanvas->DrawNinePatchedBitmap(pCanvas->GetBoundsF(), *__pHandlerPressedBitmap);
- }
- else
- {
- pCanvas->DrawBitmap(pCanvas->GetBoundsF(), *__pHandlerPressedBitmap);
- }
+ pCanvas->DrawNinePatchedBitmap(pCanvas->GetBoundsF(), *__pHandlerBitmap);
}
else
{
- if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pHandlerBitmap))
- {
- pCanvas->DrawNinePatchedBitmap(pCanvas->GetBoundsF(), *__pHandlerBitmap);
- }
- else
- {
- pCanvas->DrawBitmap(pCanvas->GetBoundsF(), *__pHandlerBitmap);
- }
+ pCanvas->DrawBitmap(pCanvas->GetBoundsF(), *__pHandlerBitmap);
}
delete pCanvas;
_EditCopyPasteHandler::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
{
__pCopyPasteManager->ReleaseCopyPastePopup();
+#if EDIT_COPY_PASTE_MAGNIFIER
+ CreateCopyPasteMagnifier();
+#endif
__touchPressedPoint = touchinfo.GetCurrentPosition();
__isTouchPressed = true;
Invalidate();
{
CheckReverseStatus();
__isTouchPressed = false;
+ __isTouchMoving = false;
+ DestroyCopyPasteMagnifier();
__pCopyPasteManager->CreateCopyPastePopup();
__pCopyPasteManager->Show();
__pCopyPasteManager->SendTextBlockEvent();
bool
_EditCopyPasteHandler::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
{
- int cursorPos;
- int previousCursorPos;
- FloatRectangle cursorRect;
- FloatRectangle absCursorRect;
+ int cursorPos = -1;
+ int previousCursorPos = -1;
+ FloatRectangle cursorRect(0.0f, 0.0f, 0.0f, 0.0f);
+ FloatRectangle absCursorRect(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle rect = GetBoundsF();
FloatPoint point = touchinfo.GetCurrentPosition();
- FloatPoint touchPoint;
- FloatPoint checkPoint;
+ FloatPoint touchPoint(0.0f, 0.0f);
+ FloatPoint checkPoint(0.0f, 0.0f);
+ __isTouchMoving = true;
_Edit* pEdit = __pCopyPasteManager->GetEdit();
SysTryReturn(NID_UI_CTRL, pEdit, false, E_INVALID_STATE, "[E_INVALID_STATE] pEdit is null.\n");
_EditPresenter* pEditPresenter = pEdit->GetPresenter();
SysTryReturn(NID_UI_CTRL, pEditPresenter, false, E_INVALID_STATE, "[E_INVALID_STATE] pEditPresenter is null.\n");
+ TextObject* pTextObject = pEditPresenter->GetTextObject();
if (__touchPressedPoint.x == point.x && __touchPressedPoint.y == point.y)
{
return true;
}
-
- previousCursorPos = __pCopyPasteManager->GetCursorPosition();
- __pCopyPasteManager->SetCursorPosition(__handlerCursorPos);
+ if (!__singleHandler)
+ {
+ previousCursorPos = __pCopyPasteManager->GetCursorPosition();
+ __pCopyPasteManager->SetCursorPosition(__handlerCursorPos);
+ }
cursorRect = __pCopyPasteManager->GetCursorBoundsF(false);
absCursorRect = __pCopyPasteManager->GetCursorBoundsF(true);
+
touchPoint.x = cursorRect.x + (point.x - __touchPressedPoint.x);
- touchPoint.y = cursorRect.y + cursorRect.height/2.0f + (point.y - __touchPressedPoint.y);
+ touchPoint.y = cursorRect.y + cursorRect.height + (point.y - __touchPressedPoint.y);
checkPoint.x = absCursorRect.x + (point.x - __touchPressedPoint.x);
- checkPoint.y = absCursorRect.y + absCursorRect.height/2.0f + (point.y - __touchPressedPoint.y);
+ checkPoint.y = absCursorRect.y + absCursorRect.height + (point.y - __touchPressedPoint.y);
cursorPos = __pCopyPasteManager->GetCursorPositionAt(touchPoint);
//if (cursorPos == -1 || (!__pCopyPasteManager->CheckHandleBounds(FloatPoint(absCursorRect.x, absCursorRect.y + absCursorRect.height))))
if (cursorPos == -1 || (!__pCopyPasteManager->CheckHandleBounds(FloatPoint(checkPoint.x, checkPoint.y))))
{
- TextObject* pTextObject = pEditPresenter->GetTextObject();
+ SysLog(NID_UI, "OnTouchMoved is called");
int curCursorLine = pTextObject->GetLineIndexAtTextIndex(__handlerCursorPos);
int totalLine = pTextObject->GetTotalLineCount();
FloatRectangle editVisibleArea = __pCopyPasteManager->GetEditVisibleAreaF();
- if (cursorPos != -1)
+ if (pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
{
- if (pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
+ if (point.x - __touchPressedPoint.x >= 0.0f) // RightSide
{
- if (point.x - __touchPressedPoint.x >= 0.0f) // RightSide
+ if (__handlerCursorPos == pEditPresenter->GetTextLength())
+ {
+ cursorPos = __handlerCursorPos;
+ }
+ else
{
- if (__handlerCursorPos == pEditPresenter->GetTextLength())
+ cursorPos = __handlerCursorPos + 1;
+
+ if (!__singleHandler && __leftHandler && (cursorPos == pEditPresenter->GetTextLength()))
{
cursorPos = __handlerCursorPos;
}
- else
- {
- cursorPos = __handlerCursorPos + 1;
-
- if (__leftHandler && (cursorPos == pEditPresenter->GetTextLength()))
- {
- cursorPos = __handlerCursorPos;
- }
- }
}
- else //LeftSide
+ }
+ else //LeftSide
+ {
+ if (__handlerCursorPos != 0)
{
- if (__handlerCursorPos != 0)
- {
- cursorPos = __handlerCursorPos - 1;
+ cursorPos = __handlerCursorPos - 1;
- if (__leftHandler)
- {
- pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
- }
+ if (!__singleHandler && __leftHandler)
+ {
+ pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
}
}
- if (point.y < 0.0f || (point.y > GetBoundsF().height))
- {
- return true;
- }
}
- else if (editVisibleArea.y <= absCursorRect.y) // DownSide
+ if (point.y < 0.0f || (point.y > GetBoundsF().height))
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if (point.y - __touchPressedPoint.y >= 0.0f) // DownSide
{
if (curCursorLine < totalLine - 1)
{
{
cursorPos = firstTextIndex+textLength;
}
-
- if (cursorPos != -1 && __leftHandler)
- {
- int line = pTextObject->GetFirstDisplayLineIndex();
- pTextObject->SetFirstDisplayLineIndex(line+1);
- __pCopyPasteManager->SetCursorPosition(cursorPos);
- absCursorRect = __pCopyPasteManager->GetCursorBoundsF(true);
- float firstDisplayY = pTextObject->GetFirstDisplayPositionYF();
- float gapY = absCursorRect.y + absCursorRect.height - (editVisibleArea.y + editVisibleArea.height);
- float tempMargin = 2.0f;
- if (gapY > 0.0f)
- {
- pTextObject->SetFirstDisplayPositionY(firstDisplayY + gapY + tempMargin);
- }
- }
+ int line = pTextObject->GetFirstDisplayLineIndex();
+ pTextObject->SetFirstDisplayLineIndex(line+1);
}
}
else
{
- if (curCursorLine !=0 )
+ if (curCursorLine !=0)
{
int offset = __handlerCursorPos - pTextObject->GetFirstTextIndexAt(curCursorLine);
int firstTextIndex = pTextObject->GetFirstTextIndexAt(curCursorLine-1);
{
cursorPos = firstTextIndex+textLength;
}
-
- if (cursorPos != -1 && __leftHandler)
- {
- int line = pTextObject->GetFirstDisplayLineIndex();
- if (__leftHandler)
- {
- pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
- }
- else
- {
- pTextObject->SetFirstDisplayLineIndex(line-1);
- }
- }
- }
- }
- }
- else
- {
- if (pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE)
- {
- if (point.x - __touchPressedPoint.x >= 0.0f) // RightSide
- {
- if (__handlerCursorPos == pEditPresenter->GetTextLength())
- {
- cursorPos = __handlerCursorPos;
- }
- else
- {
- cursorPos = __handlerCursorPos + 1;
-
- if (__leftHandler && (cursorPos == pEditPresenter->GetTextLength()))
- {
- cursorPos = __handlerCursorPos;
- }
- }
- }
- else //LeftSide
- {
- if (__handlerCursorPos != 0)
- {
- cursorPos = __handlerCursorPos - 1;
-
- if (__leftHandler)
- {
- pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
- }
- }
- }
-
- if (point.y < 0.0f || (point.y > GetBoundsF().height))
- {
- return true;
- }
- }
- else
- {
- if (point.y - __touchPressedPoint.y >= 0.0f) // DownSide
- {
- if (curCursorLine < totalLine - 1)
- {
- int offset = __handlerCursorPos - pTextObject->GetFirstTextIndexAt(curCursorLine);
- int firstTextIndex = pTextObject->GetFirstTextIndexAt(curCursorLine+1);
- cursorPos = offset + firstTextIndex;
- int textLength = pTextObject->GetTextLengthAt(curCursorLine+1);
- if (offset > textLength)
- {
- cursorPos = firstTextIndex+textLength;
- }
-
- if (cursorPos != -1 && __leftHandler)
- {
- int line = pTextObject->GetFirstDisplayLineIndex();
- if (__leftHandler)
- {
- pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
- }
- else
- {
- pTextObject->SetFirstDisplayLineIndex(line+1);
- }
- }
- }
- }
- else //UpSide
- {
- if (curCursorLine !=0 )
- {
- int offset = __handlerCursorPos - pTextObject->GetFirstTextIndexAt(curCursorLine);
- int firstTextIndex = pTextObject->GetFirstTextIndexAt(curCursorLine-1);
- cursorPos = offset + firstTextIndex;
- int textLength = pTextObject->GetTextLengthAt(curCursorLine-1);
- if (offset > textLength)
- {
- cursorPos = firstTextIndex+textLength;
- }
-
- if (!__leftHandler && cursorPos <= __pCopyPasteManager->GetHandlerCursorPosition(false))
- {
- cursorPos = __pCopyPasteManager->GetHandlerCursorPosition(false) + 1;
- }
-
- if (cursorPos != -1 && __leftHandler)
- {
- int line = pTextObject->GetFirstDisplayLineIndex();
- if (__leftHandler)
- {
- pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
- }
- else
- {
- pTextObject->SetFirstDisplayLineIndex(line-1);
- }
- }
- }
+ int line = pTextObject->GetFirstDisplayLineIndex();
+ pTextObject->SetFirstDisplayLineIndex(line-1);
}
}
}
}
- if (cursorPos == -1 || __handlerCursorPos == cursorPos ||!__pCopyPasteManager->CheckHandlePosition(__leftHandler, cursorPos))
+ if (!__singleHandler && !__pCopyPasteManager->CheckHandlePosition(__leftHandler, cursorPos))
{
__pCopyPasteManager->SetCursorPosition(previousCursorPos);
pEditPresenter->SetCursorChangedFlag(!__leftHandler);
return true;
}
- if (__leftHandler)
+ if (cursorPos == -1 || __handlerCursorPos == cursorPos)
{
- TextObject* pTextObject = pEditPresenter->GetTextObject();
- pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
+ if (__singleHandler)
+ {
+ return true;
+ }
+ __pCopyPasteManager->SetCursorPosition(previousCursorPos);
+ pEditPresenter->SetCursorChangedFlag(!__leftHandler);
+ return true;
}
+ pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
+
__pCopyPasteManager->SetCursorPosition(cursorPos);
__handlerCursorPos = cursorPos;
-
- __pCopyPasteManager->RefreshBlock(__leftHandler);
+ if (!__singleHandler)
+ {
+ __pCopyPasteManager->RefreshBlock(__leftHandler);
+ }
+ else
+ {
+ pEditPresenter->DrawText();
+ AdjustBounds();
+ }
+ MoveCopyPasteMagnifier();
return true;
}
, __contextMenuAlign(CONTEXT_MENU_CORE_ALIGN_UP)
, __pCoreCopyPasteEvent(null)
, __pEdit(&parenEdit)
+ , __pEditPresenter(null)
, __contextMenuHeight(0.0f)
, __needToReleaseBlock(true)
, __isHandlerMoving(false)
, __editVisibleArea(0.0f, 0.0f, 0.0f, 0.0f)
{
+ __pEditPresenter = __pEdit->GetPresenter();
+ __pHandle[HANDLER_TYPE_CENTER] = null;
__pHandle[HANDLER_TYPE_LEFT] = null;
__pHandle[HANDLER_TYPE_RIGHT] = null;
- if (__pEdit->IsBlocked())
- {
CreateHandle();
- }
}
_EditCopyPasteManager::~_EditCopyPasteManager(void)
__pCopyPastePopup = null;
}
+ if (__pHandle[HANDLER_TYPE_CENTER])
+ {
+ __pHandle[HANDLER_TYPE_CENTER]->Close();
+ delete __pHandle[HANDLER_TYPE_CENTER];
+ __pHandle[HANDLER_TYPE_CENTER] = null;
+ }
+
if (__pHandle[HANDLER_TYPE_LEFT])
{
__pHandle[HANDLER_TYPE_LEFT]->Close();
bool
_EditCopyPasteManager::IsCopyPasteHandle(const _Control& control) const
{
+ if (__pHandle[HANDLER_TYPE_CENTER] == &control)
+ {
+ return true;
+ }
+
if (__pHandle[HANDLER_TYPE_LEFT] == &control)
{
return true;
void
_EditCopyPasteManager::CreateCopyPastePopup(void)
{
+ if (__pHandle[HANDLER_TYPE_CENTER])
+ {
+ __pHandle[HANDLER_TYPE_CENTER]->DestroyCopyPasteMagnifier();
+ }
if (__pCopyPastePopup)
{
__pCopyPastePopup->Close();
_ControlOrientation orientation = __pEdit->GetOrientation();
+ FloatDimension screenSize;
+ _ControlManager* pControlManager = _ControlManager::GetInstance();
+ if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+ {
+ screenSize = pControlManager->GetScreenSizeF();
+ }
+ else
+ {
+ screenSize.width = pControlManager->GetScreenSizeF().height;
+ screenSize.height = pControlManager->GetScreenSizeF().width;
+ }
+
GET_SHAPE_CONFIG(EDIT::COPYPASTE_HANDLER_HEIGHT, orientation, handlerHeight);
GET_SHAPE_CONFIG(CONTEXTMENU::GRID_ITEM_HEIGHT, orientation, contextMenuHeight);
}
editAbsRect = __pEdit->GetAbsoluteBoundsF();
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- SysTryReturnVoidResult(NID_UI_CTRL, pEditPresenter, E_INVALID_STATE, "[EDIT] pEditPresenter is null.");
- _Toolbar* pCommandButton = pEditPresenter->GetKeypadCommandButton();
+ _Toolbar* pCommandButton = __pEditPresenter->GetKeypadCommandButton();
if (pCommandButton)
{
commandButtonBounds = pCommandButton->GetAbsoluteBoundsF();
commandButtonExist = true;
}
- _Form* pForm = pEditPresenter->GetParentForm();
+ _Form* pForm = __pEditPresenter->GetParentForm();
if (pForm)
{
formClientBounds = pForm->GetClientBoundsF();
}
- _ScrollPanel* pPanel = pEditPresenter->GetParentPanel();
+ _ScrollPanel* pPanel = __pEditPresenter->GetParentPanel();
if (pPanel)
{
panelAbsoulteBounds = pPanel->GetAbsoluteBoundsF();
// Edit Show Area
{
editShowAreaAbsRect = editAbsRect;
- FloatRectangle textObjectBounds = pEditPresenter->GetTextBoundsF();
+ FloatRectangle textObjectBounds = __pEditPresenter->GetTextBoundsF();
editShowAreaAbsRect.x += textObjectBounds.x;
editShowAreaAbsRect.y += textObjectBounds.y;
editShowAreaAbsRect.width = textObjectBounds.width;
if ( ((startRect.y + startRect.height) < editShowAreaAbsRect.y) && ((endRect.y + endRect.height) < editShowAreaAbsRect.y))
{
SysLog(NID_UI_CTRL, "Both of handlers are located on the top of the Editor.\n");
- PrintLog(copyPastePoint);
return;
}
//Both of handlers are located on the bottom of the Editor.
else if( ((startRect.y + startRect.height) > editShowAreaAbsRect.y + editShowAreaAbsRect.height ) && ((endRect.y + endRect.height) > editShowAreaAbsRect.y + editShowAreaAbsRect.height))
{
SysLog(NID_UI_CTRL, "Both of handlers are located on the bottom of the Editor.\n");
- PrintLog(copyPastePoint);
return;
}
// Left handler is located on the top of the Editor and Right handler is located on the bottom of the Editor.
}
// Left handler is located on the top of the Editor and Right handler is located on the Editor
- else if ( ((startRect.y + startRect.height) < editShowAreaAbsRect.y) && ((endRect.y + endRect.height) < (editShowAreaAbsRect.y + editShowAreaAbsRect.height)) )
+ else if ( ((startRect.y + startRect.height) < editShowAreaAbsRect.y) && ((endRect.y + endRect.height) <= (editShowAreaAbsRect.y + editShowAreaAbsRect.height)) )
{
if ( (endRect.y + endRect.height + handlerHeight + __contextMenuHeight) < keypadBounds.y)
{
else
{
SysLog(NID_UI_CTRL, "There is no space to draw the copy&paste popup\n");
- PrintLog(copyPastePoint);
return;
}
}
// Left handler is located on the Editor and Right handler is located on the bottom of the Editor
- else if ( ((startRect.y + startRect.height) > editShowAreaAbsRect.y) && ((endRect.y + endRect.height) > (editShowAreaAbsRect.y + editShowAreaAbsRect.height)) )
+ else if ( ((startRect.y + startRect.height) >= editShowAreaAbsRect.y) && ((endRect.y + endRect.height) > (editShowAreaAbsRect.y + editShowAreaAbsRect.height)) )
{
if (__contextMenuHeight < startRect.y)
{
copyPastePoint.y = startRect.y;
}
// There is a space on the bottom of the Editor.
- else if ( keypadBounds.y > (endRect.y + endRect.height + handlerHeight + __contextMenuHeight))
+ else if ( screenSize.height > (endRect.y + endRect.height + handlerHeight + __contextMenuHeight))
{
__contextMenuAlign = CONTEXT_MENU_CORE_ALIGN_DOWN;
if (endRect.y - startRect.y < __contextMenuHeight)
{
SysLog(NID_UI_CTRL, "There is no space to draw the copy&paste popup\n");
- PrintLog(copyPastePoint);
return;
}
copyPastePoint.y = startRect.y + __contextMenuHeight;
copyPastePoint.y += cursorRect.height;
__contextMenuAlign = CONTEXT_MENU_CORE_ALIGN_DOWN;
+ if (__pHandle[HANDLER_TYPE_CENTER])
+ {
+ copyPastePoint.y += __pHandle[HANDLER_TYPE_CENTER]->GetBounds().height;
+ }
}
}
GET_STRING_CONFIG(IDS_COM_BODY_CLIPBOARD, clipboardText);
__pCopyPastePopup->AddItem(pasteText, COPY_PASTE_PASTE_ID, null, null, null);
- if (!isPasswordStyle)
+ if (!isPasswordStyle && __pEdit->IsKeypadEnabled())
{
__pCopyPastePopup->AddItem(clipboardText, COPY_PASTE_CLIPBOARD_ID, null, null, null);
}
}
void
-_EditCopyPasteManager::PrintLog(const Point& point)
-{
- Rectangle startRect;
- Rectangle endRect;
- Rectangle editAbsRect;
- Rectangle keypadBounds;
- Rectangle editShowAreaAbsRect;
- Rectangle commandButtonBounds;
- Rectangle formClientBounds(0, 0, 0, 0);
- bool hasParentForm = false;
- bool hasCommandButton = false;
- Rectangle cursorRect = GetCursorBounds(true);
-
- editAbsRect = __pEdit->GetAbsoluteBounds();
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- _Toolbar* pCommandButton = pEditPresenter->GetKeypadCommandButton();
- if (pCommandButton)
- {
- commandButtonBounds = pCommandButton->GetAbsoluteBounds();
- hasCommandButton = true;
- }
- _Form* pForm = pEditPresenter->GetParentForm();
- if (pForm)
- {
- formClientBounds = pForm->GetClientBounds();
- hasParentForm = true;
- }
- int start = -1;
- int end = -1;
- __pEdit->GetBlockRange(start, end);
- if (start == -1 || end == -1)
- {
- SysLog(NID_UI_CTRL, "[EditCopyPasteManager] There is no blocked Range");
- return;
- }
- __pEdit->GetKeypadBounds(keypadBounds);
+_EditCopyPasteManager::CreateHandle(void)
+{
+ Release();
+ if (__pEdit->IsBlocked())
{
- editShowAreaAbsRect = editAbsRect;
-
- if (hasCommandButton)
- {
- if (editShowAreaAbsRect.y + editShowAreaAbsRect.height > commandButtonBounds.y)
- {
- editShowAreaAbsRect.height -= (editShowAreaAbsRect.y + editShowAreaAbsRect.height - commandButtonBounds.y);
- }
- }
- else
- {
- if (editShowAreaAbsRect.y + editShowAreaAbsRect.height > keypadBounds.y)
- {
- editShowAreaAbsRect.height -= (editShowAreaAbsRect.y + editShowAreaAbsRect.height - keypadBounds.y);
- }
- }
- }
+ int start = -1;
+ int end = -1;
+ FloatRectangle startRect;
+ FloatRectangle endRect;
- __pEdit->CalculateAbsoluteCursorBounds(start, startRect);
- __pEdit->CalculateAbsoluteCursorBounds(end, endRect);
+ __pEdit->GetBlockRange(start, end);
- SysLog(NID_UI_CTRL, "copyPastePoint (x=%d), (y=%d)\n", point.x, point.y );
- SysLog(NID_UI_CTRL, "startRect (x=%d), (y=%d), (width=%d), (height=%d) \n", startRect.x, startRect.y ,startRect.width, startRect.height);
- SysLog(NID_UI_CTRL, "endRect (x=%d), (y=%d), (width=%d), (height=%d) \n", endRect.x, endRect.y ,endRect.width, endRect.height);
- SysLog(NID_UI_CTRL, "editAbsRect (x=%d), (y=%d), (width=%d), (height=%d) \n", editAbsRect.x, editAbsRect.y ,editAbsRect.width, editAbsRect.height);
- SysLog(NID_UI_CTRL, "editShowAreaAbsRect (x=%d), (y=%d), (width=%d), (height=%d) \n", editShowAreaAbsRect.x, editShowAreaAbsRect.y ,editShowAreaAbsRect.width, editShowAreaAbsRect.height);
- SysLog(NID_UI_CTRL, "keypadBounds (x=%d), (y=%d), (width=%d), (height=%d) \n", keypadBounds.x, keypadBounds.y ,keypadBounds.width, keypadBounds.height);
- SysLog(NID_UI_CTRL, "commandButtonBounds (x=%d), (y=%d), (width=%d), (height=%d) \n", commandButtonBounds.x, commandButtonBounds.y ,commandButtonBounds.width, commandButtonBounds.height);
- SysLog(NID_UI_CTRL, "formClientBounds (x=%d), (y=%d), (width=%d), (height=%d) \n", formClientBounds.x, formClientBounds.y ,formClientBounds.width, formClientBounds.height);
- SysLog(NID_UI_CTRL, "contextMenuHeight = %d\n", __contextMenuHeight);
-}
+ __pEdit->CalculateAbsoluteCursorBounds(start, startRect);
+ __pEdit->CalculateAbsoluteCursorBounds(end, endRect);
-void
-_EditCopyPasteManager::PrintLog(const FloatPoint& point)
-{
- FloatRectangle startRect;
- FloatRectangle endRect;
- FloatRectangle editAbsRect;
- FloatRectangle keypadBounds;
- FloatRectangle editShowAreaAbsRect;
- FloatRectangle commandButtonBounds;
- FloatRectangle formClientBounds(0.0f, 0.0f, 0.0f, 0.0f);
- bool hasParentForm = false;
- bool hasCommandButton = false;
- FloatRectangle cursorRect = GetCursorBoundsF(true);
+ Point leftHandler(startRect.x, startRect.y + startRect.height);
+ Point rightHandler(endRect.x, endRect.y + endRect.height);
- editAbsRect = __pEdit->GetAbsoluteBoundsF();
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- _Toolbar* pCommandButton = pEditPresenter->GetKeypadCommandButton();
- if (pCommandButton)
- {
- commandButtonBounds = pCommandButton->GetAbsoluteBoundsF();
- hasCommandButton = true;
+ __pHandle[HANDLER_TYPE_LEFT] = _EditCopyPasteHandler::CreateInstanceN(leftHandler, start, this, false, true);
+ __pHandle[HANDLER_TYPE_RIGHT] = _EditCopyPasteHandler::CreateInstanceN(rightHandler, end, this, false, false);
}
- _Form* pForm = pEditPresenter->GetParentForm();
- if (pForm)
- {
- formClientBounds = pForm->GetClientBoundsF();
- hasParentForm = true;
- }
- int start = -1;
- int end = -1;
- __pEdit->GetBlockRange(start, end);
- if (start == -1 || end == -1)
- {
- SysLog(NID_UI_CTRL, "[EditCopyPasteManager] There is no blocked Range");
- return;
- }
- __pEdit->GetKeypadBounds(keypadBounds);
-
+ else
{
- editShowAreaAbsRect = editAbsRect;
+ FloatRectangle centerRect;
+ __pEdit->CalculateAbsoluteCursorBounds(__pEdit->GetCursorPosition(), centerRect);
+ Point centerHandler(centerRect.x, centerRect.y + centerRect.height);
- if (hasCommandButton)
- {
- if (editShowAreaAbsRect.y + editShowAreaAbsRect.height > commandButtonBounds.y)
- {
- editShowAreaAbsRect.height -= (editShowAreaAbsRect.y + editShowAreaAbsRect.height - commandButtonBounds.y);
- }
- }
- else
- {
- if (editShowAreaAbsRect.y + editShowAreaAbsRect.height > keypadBounds.y)
- {
- editShowAreaAbsRect.height -= (editShowAreaAbsRect.y + editShowAreaAbsRect.height - keypadBounds.y);
- }
- }
+ __pHandle[HANDLER_TYPE_CENTER] = _EditCopyPasteHandler::CreateInstanceN(centerHandler, __pEdit->GetCursorPosition(), this, true, true);
+#if EDIT_COPY_PASTE_MAGNIFIER
+// __pHandle[HANDLER_TYPE_CENTER]->CreateCopyPasteMagnifier();
+#endif
}
-
- __pEdit->CalculateAbsoluteCursorBounds(start, startRect);
- __pEdit->CalculateAbsoluteCursorBounds(end, endRect);
-
- SysLog(NID_UI_CTRL, "copyPastePoint (x=%f), (y=%f)\n", point.x, point.y );
- SysLog(NID_UI_CTRL, "startRect (x=%f), (y=%f), (width=%f), (height=%f) \n", startRect.x, startRect.y ,startRect.width, startRect.height);
- SysLog(NID_UI_CTRL, "endRect (x=%f), (y=%f), (width=%f), (height=%f) \n", endRect.x, endRect.y ,endRect.width, endRect.height);
- SysLog(NID_UI_CTRL, "editAbsRect (x=%f), (y=%f), (width=%f), (height=%f) \n", editAbsRect.x, editAbsRect.y ,editAbsRect.width, editAbsRect.height);
- SysLog(NID_UI_CTRL, "editShowAreaAbsRect (x=%f), (y=%f), (width=%f), (height=%f) \n", editShowAreaAbsRect.x, editShowAreaAbsRect.y ,editShowAreaAbsRect.width, editShowAreaAbsRect.height);
- SysLog(NID_UI_CTRL, "keypadBounds (x=%f), (y=%f), (width=%f), (height=%f) \n", keypadBounds.x, keypadBounds.y ,keypadBounds.width, keypadBounds.height);
- SysLog(NID_UI_CTRL, "commandButtonBounds (x=%f), (y=%f), (width=%f), (height=%f) \n", commandButtonBounds.x, commandButtonBounds.y ,commandButtonBounds.width, commandButtonBounds.height);
- SysLog(NID_UI_CTRL, "formClientBounds (x=%f), (y=%f), (width=%f), (height=%f) \n", formClientBounds.x, formClientBounds.y ,formClientBounds.width, formClientBounds.height);
- SysLog(NID_UI_CTRL, "contextMenuHeight = %f\n", __contextMenuHeight);
-}
-
-void
-_EditCopyPasteManager::CreateHandle(void)
-{
- int start = -1;
- int end = -1;
- FloatRectangle startRect;
- FloatRectangle endRect;
-
- __pEdit->GetBlockRange(start, end);
-
- __pEdit->CalculateAbsoluteCursorBounds(start, startRect);
- __pEdit->CalculateAbsoluteCursorBounds(end, endRect);
-
- Point leftHandler(startRect.x, startRect.y + startRect.height);
- Point rightHandler(endRect.x, endRect.y + endRect.height);
-
- __pHandle[HANDLER_TYPE_LEFT] = _EditCopyPasteHandler::CreateInstanceN(leftHandler, start, this, false, true);
- __pHandle[HANDLER_TYPE_RIGHT] = _EditCopyPasteHandler::CreateInstanceN(rightHandler, end, this, false, false);
}
void
_EditCopyPasteManager::Show(void)
{
+ if (__pHandle[HANDLER_TYPE_CENTER])
+ {
+ if (__pEdit->GetCursorPosition() != __pHandle[HANDLER_TYPE_CENTER]->GetHandlerCursorPosition())
+ {
+ __pHandle[HANDLER_TYPE_CENTER]->SetHandlerCursorPosition(__pEdit->GetCursorPosition());
+// __pHandle[HANDLER_TYPE_CENTER]->MoveCopyPasteMagnifier();
+ }
+ __pHandle[HANDLER_TYPE_CENTER]->AdjustBounds();
+ __pEdit->Invalidate();
+ }
+
if (__pHandle[HANDLER_TYPE_LEFT] && __pHandle[HANDLER_TYPE_RIGHT])
{
AdjustBounds();
Rectangle formClientBounds(0, 0, 0, 0);
Rectangle panelAbsoulteBounds(0, 0, 0, 0);
Rectangle editAbsBounds = __pEdit->GetAbsoluteBounds();
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- Rectangle textObjectBounds = pEditPresenter->GetTextBounds();
+ Rectangle textObjectBounds = __pEditPresenter->GetTextBounds();
editAbsBounds.x += textObjectBounds.x;
editAbsBounds.y += textObjectBounds.y;
editAbsBounds.width = textObjectBounds.width;
editAbsBounds.height = textObjectBounds.height;
- _Toolbar* pCommandButton = pEditPresenter->GetKeypadCommandButton();
+ _Toolbar* pCommandButton = __pEditPresenter->GetKeypadCommandButton();
if (pCommandButton)
{
commandButtonBounds = pCommandButton->GetAbsoluteBounds();
hasCommandButton = true;
}
- _Form* pForm = pEditPresenter->GetParentForm();
+ _Form* pForm = __pEditPresenter->GetParentForm();
if (pForm)
{
formClientBounds = pForm->GetClientBounds();
hasParentForm = true;
}
- _ScrollPanel* pPanel = pEditPresenter->GetParentPanel();
+ _ScrollPanel* pPanel = __pEditPresenter->GetParentPanel();
if (pPanel)
{
panelAbsoulteBounds = pPanel->GetAbsoluteBounds();
FloatRectangle formClientBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle panelAbsoulteBounds(0.0f, 0.0f, 0.0f, 0.0f);
FloatRectangle editAbsBounds = __pEdit->GetAbsoluteBoundsF();
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- FloatRectangle textObjectBounds = pEditPresenter->GetTextBoundsF();
+ FloatRectangle textObjectBounds = __pEditPresenter->GetTextBoundsF();
editAbsBounds.x += textObjectBounds.x;
editAbsBounds.y += textObjectBounds.y;
editAbsBounds.width = textObjectBounds.width;
editAbsBounds.height = textObjectBounds.height;
- _Toolbar* pCommandButton = pEditPresenter->GetKeypadCommandButton();
+ _Toolbar* pCommandButton = __pEditPresenter->GetKeypadCommandButton();
if (pCommandButton)
{
commandButtonBounds = pCommandButton->GetAbsoluteBoundsF();
hasCommandButton = true;
}
- _Form* pForm = pEditPresenter->GetParentForm();
+ _Form* pForm = __pEditPresenter->GetParentForm();
if (pForm)
{
formClientBounds = pForm->GetClientBoundsF();
hasParentForm = true;
}
- _ScrollPanel* pPanel = pEditPresenter->GetParentPanel();
+ _ScrollPanel* pPanel = __pEditPresenter->GetParentPanel();
if (pPanel)
{
panelAbsoulteBounds = pPanel->GetAbsoluteBoundsF();
int leftHandlerPos = __pHandle[HANDLER_TYPE_LEFT]->GetHandlerCursorPosition();
int rightHandlerPos = __pHandle[HANDLER_TYPE_RIGHT]->GetHandlerCursorPosition();
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- SysTryReturnVoidResult(NID_UI_CTRL, pEditPresenter, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
__pEdit->SetBlockRange(leftHandlerPos, rightHandlerPos);
- pEditPresenter->SetCursorChangedFlag(!isLeftHandle);
- pEditPresenter->DrawText();
+ __pEditPresenter->SetCursorChangedFlag(false);//!isLeftHandle);
+ __pEditPresenter->DrawText();
AdjustBounds();
}
}
int
-_EditCopyPasteManager::GetHandlerCursorPosition(bool rightHandler) const
+_EditCopyPasteManager::GetHandlerCursorPosition(HandlerType handlerType) const
{
- return __pHandle[rightHandler]->GetHandlerCursorPosition();
+ return __pHandle[handlerType]->GetHandlerCursorPosition();
}
void
_Clipboard* pClipBoard = _Clipboard::GetInstance();
SysTryReturnVoidResult(NID_UI_CTRL, pClipBoard, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
-
ReleaseCopyPastePopup();
switch (actionId)
int textLength = __pEdit->GetTextLength();
__pEdit->SetBlockRange(0, textLength);
SendTextBlockEvent();
- pEditPresenter->UpdateComponentInformation();
+ __pEditPresenter->UpdateComponentInformation();
Release();
CreateHandle();
int start = -1;
int end = -1;
__pEdit->GetBlockRange(start, end);
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- String blockText = pEditPresenter->GetText(start, end-1);
+ String blockText = __pEditPresenter->GetText(start, end-1);
_AppMessageImpl msg;
__pEdit->GetCursorBounds(false, cursorBounds);
FloatPoint cursorPoint(cursorBounds.x, cursorBounds.y);
- _EditPresenter* pEditPresenter = __pEdit->GetPresenter();
- TextObject* pTextObject = pEditPresenter->GetTextObject();
+ TextObject* pTextObject = __pEditPresenter->GetTextObject();
switch(moveType)
{
if (newCursorPosition >= 0 && leftHandlerPosition < newCursorPosition)
{
- __pHandle[HANDLER_TYPE_RIGHT]->SetHandlerCursorPosition(newCursorPosition);
+ __pHandle[HANDLER_TYPE_RIGHT]->SetHandlerCursorPosition(newCursorPosition);
RefreshBlock();
__pHandle[HANDLER_TYPE_RIGHT]->CheckReverseStatus();
__pHandle[HANDLER_TYPE_RIGHT]->Invalidate();
if (newCursorPosition >= 0)
{
- __pHandle[HANDLER_TYPE_RIGHT]->SetHandlerCursorPosition(newCursorPosition);
+ __pHandle[HANDLER_TYPE_RIGHT]->SetHandlerCursorPosition(newCursorPosition);
RefreshBlock();
__pHandle[HANDLER_TYPE_RIGHT]->CheckReverseStatus();
__pHandle[HANDLER_TYPE_RIGHT]->Invalidate();