fixed bug(N_SE-49566, N_SE-50445)
authorChulheon <ch.jeong47@samsung.com>
Fri, 30 Aug 2013 10:24:23 +0000 (19:24 +0900)
committerChulheon <ch.jeong47@samsung.com>
Fri, 30 Aug 2013 10:24:23 +0000 (19:24 +0900)
Change-Id: I7f94b6c8bf8ce2cecec42a74c18f0b57dd550e2c

src/ui/controls/FUiCtrl_Edit.cpp
src/ui/controls/FUiCtrl_EditCopyPasteManager.cpp
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/inc/FUiCtrl_Edit.h
src/ui/inc/FUiCtrl_EditCopyPasteManager.h
src/ui/inc/FUiCtrl_EditPresenter.h

index 52eff49..975ecc0 100755 (executable)
@@ -132,10 +132,6 @@ _EditInternalTouchEventListener::OnTouchPressed(const _Control& source, const _T
                {
                        return true;
                }
-               else
-               {
-                       return false;
-               }
        }
        return false;
 }
@@ -154,15 +150,6 @@ _EditInternalTouchEventListener::OnTouchMoved(const _Control& source, const _Tou
                        {
                                return true;
                        }
-                       else if (__pEdit == &source)
-                       {
-                               return false;
-                       }
-                       else
-                       {
-                               pEditPresenter->InitializeCopyPasteManager();
-                               return false;
-                       }
                }
        }
        return false;
@@ -191,15 +178,6 @@ _EditInternalTouchEventListener::OnTouchReleased(const _Control& source, const _
                                        return false;
                                }
                        }
-                       else if (__pEdit == &source)
-                       {
-                               return false;
-                       }
-                       else if (pEditPresenter->IsCopyPasteHandleExist())
-                       {
-                               pEditPresenter->InitializeCopyPasteManager();
-                               return false;
-                       }
                }
        }
 
@@ -1494,6 +1472,23 @@ _Edit::RemoveScrollPanelEventListener(const _IScrollPanelEventListener& listener
        return E_SUCCESS;
 }
 
+void
+_Edit::OnScrollStopped(Tizen::Ui::_Control& source)
+{
+       _pEditPresenter->OnScrollStopped(source);
+
+       return;
+}
+
+void
+_Edit::OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition)
+{
+       _pEditPresenter->OnScrollPositionChanged(source, scrollPosition);
+
+       return;
+}
+
+
 result
 _Edit::AddActionEventListener(const _IActionEventListener& listener)
 {
index ff90611..25b2f44 100644 (file)
@@ -1664,7 +1664,8 @@ _EditCopyPasteManager::_EditCopyPasteManager(_Edit& parenEdit)
 
 _EditCopyPasteManager::~_EditCopyPasteManager(void)
 {
-       Release();
+       ReleaseCopyPastePopup();
+       ReleaseHandle();
 
        if (__pCoreCopyPasteEvent)
        {
@@ -1674,15 +1675,8 @@ _EditCopyPasteManager::~_EditCopyPasteManager(void)
 }
 
 void
-_EditCopyPasteManager::Release(void)
+_EditCopyPasteManager::ReleaseHandle(void)
 {
-       if (__pCopyPastePopup)
-       {
-               __pCopyPastePopup->Close();
-               delete __pCopyPastePopup;
-               __pCopyPastePopup = null;
-       }
-
        if (__pHandle[HANDLER_TYPE_CENTER])
        {
                __pHandle[HANDLER_TYPE_CENTER]->Close();
@@ -2180,7 +2174,7 @@ CATCH:
 void
 _EditCopyPasteManager::CreateHandle(void)
 {
-       Release();
+       ReleaseHandle();
 
        if (__pEdit->IsBlocked())
        {
@@ -2456,8 +2450,6 @@ _EditCopyPasteManager::OnActionPerformed(const _Control& source, int actionId)
                        __pEdit->GetWordPosition(cursorPos, start, end);
                        __pEdit->SetBlockRange(start, end);
                        SendTextBlockEvent();
-
-                       Release();
                        CreateHandle();
                        CreateCopyPastePopup();
                        Show();
@@ -2472,8 +2464,6 @@ _EditCopyPasteManager::OnActionPerformed(const _Control& source, int actionId)
                        __pEdit->SetBlockRange(0, textLength);
                        SendTextBlockEvent();
                        __pEditPresenter->UpdateComponentInformation();
-
-                       Release();
                        CreateHandle();
                        CreateCopyPastePopup();
                        Show();
index eb315c2..849d72c 100644 (file)
@@ -1192,6 +1192,10 @@ _EditPresenter::Dispose(void)
        __initialFooterVisibleStatus = EDIT_FOOTER_VISIBLE_STATUS_NONE;
        __footerVisibleChanged = false;
 
+       if (__pParentPanel)
+       {
+               __pParentPanel->RemoveScrollEventListener(*__pEdit);
+       }
 
        if (__pClipboard)
        {
@@ -6649,8 +6653,25 @@ _EditPresenter::OnNotifiedN(IList* pArgs)
                                __pCopyPasteManager->CreateHandle();
                                if (__needToCreateCopyPastePopup)
                                {
-                                       __pCopyPasteManager->CreateCopyPastePopup();
-                                       __needToCreateCopyPastePopup = false;
+                                       if (__pParentPanel)
+                                       {
+                                               if (!__pParentPanel->IsScrollAnimationRunning())
+                                               {
+                                                       __pCopyPasteManager->CreateCopyPastePopup();
+                                                       if (__pCopyPasteManager->GetCopyPastePopup())
+                                                       {
+                                                               __needToCreateCopyPastePopup = false;
+                                                       }
+                                               }
+                                       }
+                                       else
+                                       {
+                                               __pCopyPasteManager->CreateCopyPastePopup();
+                                               if (__pCopyPasteManager->GetCopyPastePopup())
+                                               {
+                                                       __needToCreateCopyPastePopup = false;
+                                               }
+                                       }
                                }
                                __pCopyPasteManager->Show();
                        }
@@ -7811,7 +7832,8 @@ _EditPresenter::ChangeLayout(_ControlOrientation orientation)
                {
                        __needToCreateCopyPastePopup = true;
                }
-               __pCopyPasteManager->Release();
+               __pCopyPasteManager->ReleaseCopyPastePopup();
+               __pCopyPasteManager->ReleaseHandle();
        }
 
        bool isScrollPanelBoundsReloaded = false;
@@ -10770,6 +10792,7 @@ _EditPresenter::InitializeParentPanel(void)
                        if (pScrollPanel)
                        {
                                __pParentPanel = pScrollPanel;
+                               __pParentPanel->AddScrollEventListener(*__pEdit);
                                break;
                        }
                }
@@ -10825,10 +10848,6 @@ _EditPresenter::ScrollPanelToCursorPosition(bool show)
        float upSideGap = 0.0f;
        float newScrollPosition = 0.0f;
 
-       SysLog(NID_UI_CTRL, "absPanelRect(%f, %f, %f, %f)", absPanelRect.x, absPanelRect.y, absPanelRect.width, absPanelRect.height);
-       SysLog(NID_UI_CTRL, "absEditRect(%f, %f, %f, %f)", absEditRect.x, absEditRect.y, absEditRect.width, absEditRect.height);
-       SysLog(NID_UI_CTRL, "absCursorBounds(%f, %f, %f, %f)", absCursorBounds.x, absCursorBounds.y, absCursorBounds.width, absCursorBounds.height);
-
        if (__textObjectBounds.height < absCursorBounds.height)
        {
                absCursorBounds.height = __textObjectBounds.height;
@@ -10848,17 +10867,6 @@ _EditPresenter::ScrollPanelToCursorPosition(bool show)
                        newScrollPosition = scrollPosition -(absPanelRect.y -absCursorBounds.y);
                        SysLog(NID_UI_CTRL, "[multi-line edit] Move up till up position of cursor.");
                }
-               /*
-               if (__pTextObject->GetFirstDisplayLineIndex() == __pTextObject->GetCursorIndex()) //cursor exists in first line
-               {
-                       newScrollPosition = scrollPosition -(absPanelRect.y -absEditRect.y);
-                       SysLog(NID_UI_CTRL, "Move up till top boundary of edit.");
-               }
-               else
-               {
-                       newScrollPosition = scrollPosition -(absPanelRect.y -absCursorBounds.y);
-                       SysLog(NID_UI_CTRL, "Move up till up position of cursor.");
-               }*/
 
                SysLog(NID_UI_CTRL, "move up scroll position from %f to %f", scrollPosition, newScrollPosition);
        }
@@ -10889,18 +10897,6 @@ _EditPresenter::ScrollPanelToCursorPosition(bool show)
                        SysLog(NID_UI_CTRL, "Move down till down position of cursor.");
                }
 
-               /*
-               if (__pTextObject->GetLineIndexAtTextIndex(__pTextObject->GetCursorIndex()) == (__pTextObject->GetFirstDisplayLineIndex() + __pTextObject->GetDisplayLineCount() - 1))//cursor exists in last line
-               {
-                       newScrollPosition = scrollPosition + ((absEditRect.y + absEditRect.height) -(absPanelRect.y + absPanelRect.height));
-                       SysLog(NID_UI_CTRL, "Move down till down boundary of edit.");
-               }
-               else
-               {
-                       newScrollPosition = scrollPosition + ((absCursorBounds.y + absCursorBounds.height) -(absPanelRect.y + absPanelRect.height));
-                       SysLog(NID_UI_CTRL, "Move down till down position of cursor.");
-               }*/
-
                SysLog(NID_UI_CTRL, "move down scroll position from %f to %f", scrollPosition, newScrollPosition);
        }
 
@@ -11986,6 +11982,32 @@ CATCH:
        return r;
 }
 
+void
+_EditPresenter::OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition)
+{
+       if (__isCopyPasteManagerExist)
+       {
+               __pCopyPasteManager->Show();
+       }
+}
+
+void
+_EditPresenter::OnScrollStopped(Tizen::Ui::_Control& source)
+{
+       if (__pCopyPasteManager)
+       {
+               if (__needToCreateCopyPastePopup && !__pCopyPasteManager->GetCopyPastePopup())
+               {
+                       __pCopyPasteManager->CreateCopyPastePopup();
+                       if (__pCopyPasteManager->GetCopyPastePopup())
+                       {
+                               __needToCreateCopyPastePopup = false;
+                       }
+               }
+               __pCopyPasteManager->Show();
+       }
+}
+
 _Window*
 _EditPresenter::OnDragAndDropBeginning(void)
 {
index fdf84c1..abdbd31 100755 (executable)
@@ -57,6 +57,7 @@
 #include "FUiCtrl_ITextBlockEventListener.h"
 #include "FUiCtrl_ITextEventListener.h"
 #include "FUiCtrl_ILanguageEventListener.h"
+#include "FUiCtrl_IScrollEventListener.h"
 #include "FUiCtrl_IScrollPanelEventListener.h"
 #include "FUiCtrl_IUiLinkEventListener.h"
 #include "FUiCtrl_KeypadEvent.h"
@@ -175,6 +176,7 @@ class _OSP_EXPORT_ _Edit
        , public _ITouchTapGestureEventListener
        , public IClipboardPopupEventListener
        , public _IEditTextFilter
+       , public _IScrollEventListener
        , virtual public Tizen::System::ISettingEventListener
 {
 public:
@@ -508,6 +510,9 @@ public:
        virtual void OnDragAndDropLeft(void);
        virtual void OnDragAndDropDropped(const _DragAndDropItem& dragAndDropItem);
 
+       virtual void OnScrollEndReached(Tizen::Ui::_Control& source, ScrollEndEvent type) {};
+       virtual void OnScrollStopped(Tizen::Ui::_Control& source);
+       virtual void OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition);
 
        _EditPresenter* GetPresenter(void) const;
        Tizen::Graphics::FloatDimension GetContentSizeInternalF(bool horizontalMode, bool verticalMode) const;
index 071e233..121e59c 100644 (file)
@@ -95,7 +95,7 @@ public:
        int GetCursorPosition(void) const;
        int GetHandlerCursorPosition(HandlerType handlerType) const;
        void SendTextBlockEvent(void);
-       void Release(void);
+       void ReleaseHandle(void);
        void ReleaseCopyPastePopup(void);
        bool IsCopyPastePopup(const _Control& control) const;
        bool IsCopyPasteHandle(const _Control& control) const;
index b7c2fcb..c317a04 100755 (executable)
@@ -339,6 +339,8 @@ public:
        void DrawDragAndDropVisualCue(void);
        void ResetDragAndDrop(void);
        bool IsDragAndDropStarted(void) const;
+       virtual void OnScrollPositionChanged(Tizen::Ui::_Control& source, float scrollPosition);
+       virtual void OnScrollStopped(Tizen::Ui::_Control& source);
 
        virtual _Window* OnDragAndDropBeginning(void);
        virtual void OnDragAndDropDropping(void);