_EditCopyPasteHandler::SetHandlerCursorPosition(int handlerCursorPos)
{
__handlerCursorPos = handlerCursorPos;
+ __rowIndex = -1;
+ __columnIndex = -1;
}
void
}
}
+ if (__singleHandler && pEdit->IsViewModeEnabled())
+ {
+ SetVisibleState(false);
+ }
+
SetBounds(rect);
return;
}
{
String copyText;
String cutText;
+ String selectAllText;
GET_STRING_CONFIG(IDS_TPLATFORM_OPT_COPY, copyText);
GET_STRING_CONFIG(IDS_TPLATFORM_OPT_CUT, cutText);
+ GET_STRING_CONFIG(IDS_TPLATFORM_OPT_SELECT_ALL, selectAllText);
+ if (__pEditPresenter->IsViewModeEnabled())
+ {
+ __pCopyPastePopup->AddItem(selectAllText, COPY_PASTE_SELECT_ALL_ID, null, null, null);
+ }
__pCopyPastePopup->AddItem(copyText, COPY_PASTE_COPY_ID, null, null, null);
if (!__pEditPresenter->IsViewModeEnabled())
{
__pHandle[HANDLER_TYPE_CENTER] = _EditCopyPasteHandler::CreateInstanceN(centerHandler, __pEdit->GetCursorPosition(), this, true, true);
#if EDIT_COPY_PASTE_MAGNIFIER
-// __pHandle[HANDLER_TYPE_CENTER]->CreateCopyPasteMagnifier();
+ __pHandle[HANDLER_TYPE_CENTER]->CreateCopyPasteMagnifier();
#endif
}
}
__pHandle[HANDLER_TYPE_CENTER]->CheckReverseStatus();
__pHandle[HANDLER_TYPE_CENTER]->Invalidate();
__pEditPresenter->DrawText();
+ __pHandle[HANDLER_TYPE_CENTER]->MoveCopyPasteMagnifier();
}
if (__pHandle[HANDLER_TYPE_LEFT] && __pHandle[HANDLER_TYPE_RIGHT])
if (__pCopyPastePopup)
{
__pCopyPastePopup->Open();
- {
- _Window* pWindow = null;
- _Control* pControlCore = null;
-
- for (pControlCore = __pEdit->GetParent(); pWindow == null; pControlCore = pControlCore->GetParent())
- {
- if (pControlCore == null)
- {
- break;
- }
-
- pWindow = dynamic_cast<_Window*>(pControlCore);
- if (pWindow)
- {
- __pCopyPastePopup->SetOwner(pWindow);
- break;
- }
- }
- }
__pCopyPastePopup->ReleaseTouchCapture();
_Control* pControl = __pCopyPastePopup->GetOwner();
return;
}
+void
+_EditCopyPasteManager::DestroyCopyPasteMagnifier(void)
+{
+ //only single case.
+ if (__pHandle[HANDLER_TYPE_CENTER])
+ {
+ __pHandle[HANDLER_TYPE_CENTER]->DestroyCopyPasteMagnifier();
+ }
+}
+
+void
+_EditCopyPasteManager::CreateCopyPasteMagnifier(void)
+{
+ //only single case.
+ if (__pHandle[HANDLER_TYPE_CENTER])
+ {
+ __pHandle[HANDLER_TYPE_CENTER]->CreateCopyPasteMagnifier();
+ }
+}
+
}}} // Tizen::Ui::Controls
, __calculatedCursorBounds(FloatRectangle(0.0f, 0.0f, 0.0f, 0.0f))
, __dragAndDropStarted(false)
, __dragAndDropString("")
+ , __isTouchLongPressed(false)
{
}
RestoreCopyPasteManager();
+ if (__isCopyPasteManagerExist)
+ {
+ __pCopyPasteManager->Show();
+ }
+
InitializeCursor();
// Set scroll bar
return true;
}
+ __isTouchLongPressed = false;
+
if (__isCopyPasteManagerExist)
{
if (__isTouchPressed && !__isCopyPastePopupMoving)
__pEdit->SetFocused();
}
+ if (GetTextLength() > 0 && __pEdit->IsViewModeEnabled())
+ {
+ FloatRectangle cursorBounds;
+ int start = -1;
+ int end = -1;
+ int cursorPos = GetCursorPositionAt(touchInfo.GetCurrentPosition());
+
+ if (cursorPos == -1)
+ {
+ cursorPos = __cursorPos;
+ }
+ else
+ {
+ int curCursorLine = __pTextObject->GetLineIndexAtTextIndex(cursorPos);
+ int firstTextIndex = __pTextObject->GetFirstTextIndexAt(curCursorLine);
+ if (cursorPos != 0 && cursorPos == firstTextIndex && __rowCursorIndex != curCursorLine)
+ {
+ cursorPos--;
+ }
+ }
+
+ GetWordPosition(cursorPos, start, end);
+ SetBlockRange(start, end);
+ __pCopyPasteManager->CreateHandle();
+ }
+
FadeOutScrollBar(); // Fade out scrollbar when copypaste popup is moving.
- __pCopyPasteManager->CreateCopyPastePopup();
+ if (__needToCreateCopyPastePopup)
+ {
+ __pCopyPasteManager->CreateCopyPastePopup();
+ }
+ __needToCreateCopyPastePopup = false;
__pCopyPasteManager->Show();
__isTouchPressed = false;
needToCreatePopup = false;
}
- if (IsViewModeEnabled() && GetTextLength() == 0)
+ if (IsViewModeEnabled())
{
needToCreatePopup = false;
}
SysTryReturn(NID_UI_CTRL, __pCopyPasteManager != null, false, E_SYSTEM, "Unable to create _EditCopyPasteManager instance.");
__pCopyPasteManager->AddCopyPasteEventListener(*this);
UpdateComponentInformation();
+ __pCopyPasteManager->DestroyCopyPasteMagnifier();
__pCopyPasteManager->Show();
__isCopyPasteManagerExist = true;
}
if (__isCopyPasteManagerExist)
{
- __pCopyPasteManager->Show();
- if (!__isClearIconPressed)
+ if (!IsBlocked() && GetTextLength() > 0 && __isTouchLongPressed)
{
- __isCopyPastePopupMoving = true;
+ int cursorPos = -1;
+ int rowIndex = -1;
+ int columnIndex = -1;
+ FloatPoint touchPoint = touchInfo.GetCurrentPosition();
+ int curCursorLine = __pTextObject->GetLineIndexAtTextIndex(__cursorPos);
+ int totalLine = __pTextObject->GetTotalLineCount();
+ float firstDisplayY = __pTextObject->GetFirstDisplayPositionYF();
+ float totalHeight = __pTextObject->GetTotalHeightF();
+
+ if (touchPoint.x < __textObjectBounds.x)
+ {
+ touchPoint.x = __textObjectBounds.x;
+ }
+ if (touchPoint.x > __textObjectBounds.x + __textObjectBounds.width)
+ {
+ touchPoint.x = __textObjectBounds.x + __textObjectBounds.width;
+ }
+ if (__textObjectBounds.y > touchPoint.y)
+ {
+ if (totalLine == 1 || firstDisplayY == 0.0f) // whether need to scroll the text or not
+ {
+ touchPoint.y = __textObjectBounds.y; //not need to scroll the text.
+ }
+ }
+ if (__textObjectBounds.y + __textObjectBounds.height < touchPoint.y)
+ {
+ if (totalLine == 1 || (totalHeight - firstDisplayY < __textObjectBounds.height) || curCursorLine == (totalLine - 1)) // || pTextObject->IsDisplayedLastLine()) // whether need to scroll the text or not
+ {
+ touchPoint.y = __textObjectBounds.y + __textObjectBounds.height; // check TextObject
+ }
+ }
+
+ if(!(__pEdit->GetEditStyle() & EDIT_STYLE_SINGLE_LINE))
+ {
+ if (totalHeight < __textObjectBounds.height)
+ {
+ if (totalHeight < touchPoint.y)
+ {
+ touchPoint.y = totalHeight;
+ }
+ }
+ }
+ cursorPos = GetCursorPositionAt(touchPoint, rowIndex, columnIndex);
+ if (cursorPos == -1)
+ {
+ FloatRectangle cursorRect(0.0f, 0.0f, 0.0f, 0.0f);
+ CalculateCursorBounds(__textObjectBounds, cursorRect, __rowCursorIndex, __columnCursorIndex);
+ if (totalLine != 1)
+ {
+ if (touchPoint.y > (cursorRect.y + cursorRect.height))
+ {
+ if (curCursorLine < totalLine - 1)
+ {
+ int offset = __cursorPos - __pTextObject->GetFirstTextIndexAt(curCursorLine);
+ int firstTextIndex = __pTextObject->GetFirstTextIndexAt(curCursorLine+1);
+ cursorPos = offset + firstTextIndex;
+ int textLength = __pTextObject->GetTextLengthAt(curCursorLine+1);
+ if (offset > textLength)
+ {
+ cursorPos = firstTextIndex+textLength;
+ }
+ }
+ }
+ else
+ {
+ if (curCursorLine !=0)
+ {
+ if (__rowCursorIndex == 0)
+ {
+ cursorPos = -1;
+ }
+ else
+ {
+ int offset = __cursorPos - __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)
+ {
+ return true;
+ }
+ SetCursorPosition(cursorPos);
+ }
+ else
+ {
+ SetCursorPosition(cursorPos, rowIndex, columnIndex);
+ }
+ ScrollPanelToCursorPosition(true);
+ __pTextObject->SetFirstDisplayLineIndexFromTextIndex(cursorPos);
+ __pCopyPasteManager->Show();
+ if (!__isClearIconPressed)
+ {
+ __isCopyPastePopupMoving = true;
+ }
+ return true;
+ }
+ else
+ {
+ __pCopyPasteManager->Show();
+ if (!__isClearIconPressed)
+ {
+ __isCopyPastePopupMoving = true;
+ }
}
}
return false;
}
+ int rowIndex = -1;
+ int columnIndex = -1;
+ int cursorPos = -1;
+
if (__isCopyPasteManagerExist)
{
_DragAndDropItem* pDragAndDropItem = _DragAndDropItem::CreateInstanceN(_DRAG_AND_DROP_TYPE_TEXT, __dragAndDropString);
SysTryReturn(NID_UI_CTRL, pDragAndDropItem, false, E_OUT_OF_MEMORY, "Memory allocation failed.");
- int rowIndex;
- int columnIndex;
- int cursorPos = GetCursorPositionAt(__pressedPoint, rowIndex, columnIndex);
+ cursorPos = GetCursorPositionAt(__pressedPoint, rowIndex, columnIndex);
if (cursorPos != -1)
{
SetCursorPosition(cursorPos);
__dragAndDropStarted = true;
InitializeCopyPasteManager();
}
+ else
#endif
+ if (!IsBlocked())
+ {
+ cursorPos = GetCursorPositionAt(__pressedPoint, rowIndex, columnIndex);
+ if (cursorPos != -1)
+ {
+ SetCursorPosition(cursorPos);
+ }
+ else
+ {
+ return true;
+ }
+ __pCopyPasteManager->CreateCopyPasteMagnifier();
+ __pCopyPasteManager->Show();
+ __isTouchLongPressed = true;
+ __needToCreateCopyPastePopup = true;
+ }
return true;
}
else if (IsCurrentFocused() == false)
StopPasswordTimer();
}
- int rowIndex;
- int columnIndex;
- int cursorPos = GetCursorPositionAt(__pressedPoint, rowIndex, columnIndex);
+ cursorPos = GetCursorPositionAt(__pressedPoint, rowIndex, columnIndex);
if (cursorPos != -1)
{
SetCursorPosition(cursorPos);
__pCopyPasteManager->AddCopyPasteEventListener(*this);
__pCopyPasteManager->Show();
__isCopyPasteManagerExist = true;
+ __isTouchLongPressed = true;
+ __needToCreateCopyPastePopup = true;
}
__pCopyPasteManager->AddCopyPasteEventListener(*this);
__pCopyPasteManager->Show();
__isCopyPasteManagerExist = true;
+ __needToCreateCopyPastePopup = true;
__pEdit->Draw();
}
if (__pCopyPasteManager)
{
__pCopyPasteManager->CreateHandle();
+ __pCopyPasteManager->DestroyCopyPasteMagnifier();
if (__needToCreateCopyPastePopup)
{
if (__pParentPanel)