From 7f8193ff4b6766d5843432c673157f0cc83a6c9d Mon Sep 17 00:00:00 2001 From: Chulheon Date: Fri, 7 Jun 2013 16:33:52 +0900 Subject: [PATCH] fixed bug and applied PostEvent logic Change-Id: Ibc23e1dea299d32f19c5871256cd48f328e1bb2b --- src/ui/controls/FUiCtrl_EditPresenter.cpp | 57 +++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/src/ui/controls/FUiCtrl_EditPresenter.cpp b/src/ui/controls/FUiCtrl_EditPresenter.cpp index fbe853b..158e0a0 100755 --- a/src/ui/controls/FUiCtrl_EditPresenter.cpp +++ b/src/ui/controls/FUiCtrl_EditPresenter.cpp @@ -2290,9 +2290,7 @@ _EditPresenter::Draw(Canvas& canvas) { if (__isCopyPasteManagerExist) { - __pCopyPasteManager->CreateHandle(); - __pCopyPasteManager->CreateCopyPastePopup(); - __pCopyPasteManager->Show(); + PostInternalEvent(String(L"ShowCopyPaste")); } __rotated = false; } @@ -3503,6 +3501,8 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) int textLength = 0; int start = 0; int end = 0; + FloatRectangle panelAbsBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle absCursorBounds(0.0f, 0.0f, 0.0f, 0.0f); if (IsViewModeEnabled() == true) { @@ -3874,6 +3874,17 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) SetCursorPosition(__cursorPos-1); } + if (__pParentPanel) + { + panelAbsBounds = __pParentPanel->GetAbsoluteBoundsF(); + GetCursorBounds(true, absCursorBounds); + + if (!panelAbsBounds.Contains(FloatPoint(absCursorBounds.x, absCursorBounds.y + absCursorBounds.height))) + { + ScrollPanelToCursorPosition(); + } + } + if ((__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN) == false) { DrawText(); @@ -3906,8 +3917,6 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) int firstTextIndex = __pTextObject->GetFirstTextIndexAt(curCursorLine-1); int newCursorPosition = offset + firstTextIndex; int textLength = __pTextObject->GetTextLengthAt(curCursorLine-1); - FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f); - FloatRectangle absCursorBounds(0.0f, 0.0f, 0.0f, 0.0f); if (offsetGetClientBoundsF(); + panelAbsBounds = __pParentPanel->GetAbsoluteBoundsF(); GetCursorBounds(true, absCursorBounds); - if (!clientBounds.Contains(FloatPoint(absCursorBounds.x, absCursorBounds.y))) + if (!panelAbsBounds.Contains(FloatPoint(absCursorBounds.x, absCursorBounds.y))) { ScrollPanelToCursorPosition(); - __pParentForm->Draw(); } } if ((__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN) == false) @@ -3972,8 +3980,6 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) int firstTextIndex = __pTextObject->GetFirstTextIndexAt(curCursorLine+1); int newCursorPosition = offset + firstTextIndex; int textLength = __pTextObject->GetTextLengthAt(curCursorLine+1); - FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f); - FloatRectangle absCursorBounds(0.0f, 0.0f, 0.0f, 0.0f); if (offsetGetClientBoundsF(); + panelAbsBounds = __pParentPanel->GetAbsoluteBoundsF(); GetCursorBounds(true, absCursorBounds); - if (!clientBounds.Contains(FloatPoint(absCursorBounds.x, absCursorBounds.y + absCursorBounds.height))) + if (!panelAbsBounds.Contains(FloatPoint(absCursorBounds.x, absCursorBounds.y + absCursorBounds.height))) { ScrollPanelToCursorPosition(); - __pParentForm->Draw(); } } if ((__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN) == false) @@ -4051,6 +4056,17 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo) SetCursorPosition(__cursorPos+1); } + if (__pParentPanel) + { + panelAbsBounds = __pParentPanel->GetAbsoluteBoundsF(); + GetCursorBounds(true, absCursorBounds); + + if (!panelAbsBounds.Contains(FloatPoint(absCursorBounds.x, absCursorBounds.y + absCursorBounds.height))) + { + ScrollPanelToCursorPosition(); + } + } + if ((__pEdit->GetEditStyle() & EDIT_STYLE_TOKEN) == false) { DrawText(); @@ -6059,6 +6075,8 @@ bool _EditPresenter::OnNotifiedN(IList* pArgs) { String showKeypad(L"ShowKeypad"); + String showCopyPaste(L"ShowCopyPaste"); + String* pType = dynamic_cast (pArgs->GetAt(0)); if (pType) @@ -6074,6 +6092,15 @@ _EditPresenter::OnNotifiedN(IList* pArgs) ShowFullscreenKeypad(); } } + else if (*pType == showCopyPaste) + { + if (__pCopyPasteManager) + { + __pCopyPasteManager->CreateHandle(); + __pCopyPasteManager->CreateCopyPastePopup(); + __pCopyPasteManager->Show(); + } + } pArgs->RemoveAll(true); delete pArgs; -- 2.7.4