fixed bug and applied PostEvent logic
authorChulheon <ch.jeong47@samsung.com>
Fri, 7 Jun 2013 07:33:52 +0000 (16:33 +0900)
committerChulheon <ch.jeong47@samsung.com>
Fri, 7 Jun 2013 07:35:24 +0000 (16:35 +0900)
Change-Id: Ibc23e1dea299d32f19c5871256cd48f328e1bb2b

src/ui/controls/FUiCtrl_EditPresenter.cpp

index fbe853b..158e0a0 100755 (executable)
@@ -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 (offset<textLength)
                        {
                                int startPosition = -1;
@@ -3933,14 +3942,13 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
                                }
                        }
 
-                       if (__pParentForm)
+                       if (__pParentPanel)
                        {
-                               clientBounds = __pParentForm->GetClientBoundsF();
+                               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 (offset<textLength)
                        {
@@ -4000,15 +4006,14 @@ _EditPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
                                }
                        }
 
-                       if (__pParentForm)
+                       if (__pParentPanel)
                        {
-                               clientBounds = __pParentForm->GetClientBoundsF();
+                               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 <String*>(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;