Fix clipboard layout issue
authorTaejun <tj.twt.park@samsung.com>
Tue, 19 Mar 2013 08:54:50 +0000 (17:54 +0900)
committerTaejun <tj.twt.park@samsung.com>
Tue, 19 Mar 2013 08:54:50 +0000 (17:54 +0900)
Change-Id: I278a7ba3bd298c5d14704b80fbe2f0abe685fbd7

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

index 5b80b5e..569b008 100644 (file)
@@ -224,6 +224,7 @@ _EditPresenter::_EditPresenter(void)
        , __pTextFilter(null)
        , __textBlockMoveLeft(false)
        , __textBlockMoving(false)
+       , __clipboardConnected(false)
 {
 }
 
@@ -233,10 +234,9 @@ _EditPresenter::OnInputConnectionPanelShowStateChanged(InputConnection& source,
        if (showState == INPUT_PANEL_SHOW_STATE_SHOW)// 1. bounded 2.bounded&rotate
        {
                __isKeypadShowing = false;
-               __isKeypadExist = true;//[TWT]temporary test
+               __isKeypadExist = true;
 
                CheckUSBKeyboardStatus();
-               CheckKeypadStatus();
 
                if (__isInputConnectionBound)
                {
@@ -282,9 +282,8 @@ _EditPresenter::OnInputConnectionPanelShowStateChanged(InputConnection& source,
        else if (showState == INPUT_PANEL_SHOW_STATE_HIDE)// 1.unbound  2.bounded&usb off -> usb on 3.Flick keypad hide
        {
                CheckUSBKeyboardStatus();
-               CheckKeypadStatus();
 
-               __isKeypadExist = false;//[TWT]temporary test
+               __isKeypadExist = false;
 
                if (__isCopyPasteManagerExist)
                {
@@ -383,9 +382,8 @@ void
 _EditPresenter::OnInputConnectionPanelBoundsChanged(InputConnection& source, const Rectangle& bounds)
 {
        CheckUSBKeyboardStatus();
-       CheckKeypadStatus();
 
-       if ((__isUSBKeyboardConnected == false) && (IsKeypadExist() == false))
+       if ((__isUSBKeyboardConnected == false) && (__isKeypadExist == false))
        {
                return;
        }
@@ -406,25 +404,6 @@ _EditPresenter::OnInputConnectionPanelBoundsChanged(InputConnection& source, con
 void
 _EditPresenter::OnInputConnectionTextPredictionShowStateChanged(InputConnection& source, bool isShown)
 {
-       /*
-       CheckUSBKeyboardStatus();
-       CheckKeypadStatus();
-
-       if ((__isUSBKeyboardConnected == false) && (IsKeypadExist() == false))
-       {
-               return;
-       }
-
-       ChangeLayoutInternal(__pEdit->GetOrientation());
-       AdjustParentPanelHeight(false, true);
-       if (__pParentForm)
-       {
-               __pParentForm->Draw();
-               ScrollPanelToCursorPosition();
-       }
-
-       __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
-       */
        return;
 }
 
@@ -773,9 +752,11 @@ _EditPresenter::GetPreviousText(InputConnection& source, String& text, int& curs
 void
 _EditPresenter::OnClipboardPopupOpened(Tizen::Graphics::Dimension& clipboardPopupSize)
 {
-       //if (__isInputConnectionBound)//[twt]already keypad closed before clipboard show, __isInputConnectionBound cann't be clue at this point.
        FloatDimension floatClipboardPopupSize = _CoordinateSystemUtils::ConvertToFloat(clipboardPopupSize);
-       if (IsFocused()) //temporal condition
+
+       SysLog(NID_UI_CTRL, "clipboard opended!: EditPresent(%x), clipboard connected(%d)", this, __clipboardConnected);
+
+       if (__clipboardConnected)
        {
                __isClipboardExist = true;
                FloatRectangle absKeypadBounds;
@@ -784,9 +765,9 @@ _EditPresenter::OnClipboardPopupOpened(Tizen::Graphics::Dimension& clipboardPopu
 
                __clipboardHeight = floatClipboardPopupSize.height;
 
-               SysLog(NID_UI_CTRL, "clipboard popup : opened! height = %f, keypad height = %f", floatClipboardPopupSize.height, absKeypadBounds.height);
+               SysLog(NID_UI_CTRL, "clipboard height = %f, keypad height = %f", floatClipboardPopupSize.height, absKeypadBounds.height);
 
-               if (IsKeypadExist()) //resize as difference between clipboard height vs keypad height
+               if (__isKeypadExist) //resize as difference between clipboard height vs keypad height
                {
                        if (floatClipboardPopupSize.height > absKeypadBounds.height)
                        {
@@ -826,19 +807,21 @@ _EditPresenter::OnClipboardPopupOpened(Tizen::Graphics::Dimension& clipboardPopu
 void
 _EditPresenter::OnClipboardPopupBoundsChanged(Tizen::Graphics::Dimension& clipboardPopupSize)
 {
-       //if (__isInputConnectionBound)
        FloatDimension floatClipboardPopupSize = _CoordinateSystemUtils::ConvertToFloat(clipboardPopupSize);
-       if (IsFocused())//[twt]temporal condition
+
+       SysLog(NID_UI_CTRL, "clipboard rotated!: EditPresent(%x), clipboard connected(%d)", this, __clipboardConnected);
+
+       if (__clipboardConnected)
        {
                FloatRectangle absKeypadBounds;
                GetKeypadBounds(absKeypadBounds);
                CheckUSBKeyboardStatus();
-               //CheckKeypadStatus();
+
                __clipboardHeight = floatClipboardPopupSize.height;
 
-               SysLog(NID_UI_CTRL, "clipboard popup : bounds changed!  height = %f, keypad height = %f", floatClipboardPopupSize.height, absKeypadBounds.height);
+               SysLog(NID_UI_CTRL, "clipboard height = %f, keypad height = %f", floatClipboardPopupSize.height, absKeypadBounds.height);
 
-               if (IsKeypadExist())
+               if (__isKeypadExist)
                {
                        if (floatClipboardPopupSize.height > absKeypadBounds.height)
                        {
@@ -873,8 +856,9 @@ _EditPresenter::OnClipboardPopupBoundsChanged(Tizen::Graphics::Dimension& clipbo
 void
 _EditPresenter::OnClipboardPopupClosed(void)
 {
-       //if (__isInputConnectionBound)
-       if (IsFocused())//[twt]temporal condition
+       SysLog(NID_UI_CTRL, "clipboard closed!: EditPresent(%x), clipboard connected(%d)", this, __clipboardConnected);
+
+       if (__clipboardConnected)
        {
                __isClipboardExist = false;
                FloatRectangle absKeypadBounds;
@@ -883,11 +867,11 @@ _EditPresenter::OnClipboardPopupClosed(void)
 
                __clipboardHeight = 0.0f;
 
-               SysLog(NID_UI_CTRL, "clipboard popup : closed!keypad height = %f", absKeypadBounds.height);
+               SysLog(NID_UI_CTRL, "clipboard closed!keypad height = %f", absKeypadBounds.height);
 
                ChangeLayoutInternal(__pEdit->GetOrientation());
 
-               if (IsKeypadExist())
+               if (__isKeypadExist)
                {
                        AdjustParentPanelHeight(false, true);
                        __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_BOUNDS_CHANGED);
@@ -904,6 +888,8 @@ _EditPresenter::OnClipboardPopupClosed(void)
                        __pEdit->SendScrollPanelEvent(CORE_OVERLAY_CONTROL_CLOSED);
                        __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_CLOSE);
                }
+
+               __clipboardConnected = false;
        }
 
        return;
@@ -945,8 +931,7 @@ _EditPresenter::Dispose(void)
                AdjustParentPanelHeight(true);
        }
 
-       //if (__isInputConnectionBound)
-       if (__isClipboardExist)//[twt]temporal condition
+       if (__clipboardConnected)
        {
                __pClipboard->HidePopup();
                __isClipboardExist = false;
@@ -1070,50 +1055,6 @@ _EditPresenter::Dispose(void)
        return E_SUCCESS;
 }
 
-void
-_EditPresenter::CheckKeypadStatus(void)
-{
-/*
-       if (!__pEdit)
-       {
-               return ;
-       }
-
-       FloatDimension screenSize;
-       FloatRectangle absKeypadBounds;
-       _ControlManager* pControlManager = _ControlManager::GetInstance();
-
-       GetKeypadBounds(absKeypadBounds);
-
-       _ControlOrientation orientation = __pEdit->GetOrientation();
-
-       if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
-       {
-               screenSize.height = pControlManager->GetScreenSizeF().height;
-       }
-       else
-       {
-               screenSize.height = pControlManager->GetScreenSizeF().width;
-       }
-
-       if (absKeypadBounds.w == 0 && absKeypadBounds.h == 0)
-       {
-               __isKeypadExist = false;
-               return;
-       }
-
-       if (absKeypadBounds.y != screenSize.height)
-       {
-               __isKeypadExist = true;
-       }
-       else
-       {
-               __isKeypadExist = false;
-       }
-*/
-       return;
-}
-
 bool
 _EditPresenter::IsKeypadExist(void) const
 {
@@ -3027,9 +2968,8 @@ _EditPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchI
                        }
                        else
                        {
-                               CheckKeypadStatus();
 
-                               if (!IsKeypadExist() || !__isInputConnectionBound)
+                               if (!__isKeypadExist || !__isInputConnectionBound)
                                {
                                        if (__pEdit->GetInputStyle() == INPUT_STYLE_OVERLAY)
                                        {
@@ -5492,7 +5432,7 @@ _EditPresenter::OnFocusLost(void)
                __isTouchReleaseSkipped = false;
                __isUSBKeyboardConnected = false;
 
-               if (__isClipboardExist)//[twt]check later
+               if (__clipboardConnected)
                {
                        if (__pClipboard)
                        {
@@ -6149,7 +6089,6 @@ _EditPresenter::ShowKeypad(bool focus)
                return E_SUCCESS;
        }*/
 
-       CheckKeypadStatus();
        CheckUSBKeyboardStatus();
 
        __pInputConnection->BindInputMethod();
@@ -6188,7 +6127,7 @@ _EditPresenter::ShowKeypad(bool focus)
        {
                __pInputConnection->ShowInputPanel();
 
-               if (!IsKeypadExist())
+               if (!__isKeypadExist)
                {
                        __pEdit->SendKeypadEvent(GetKeypadAction(), CORE_KEYPAD_EVENT_STATUS_CREATED);
                }
@@ -6200,7 +6139,7 @@ _EditPresenter::ShowKeypad(bool focus)
                        SetFooterVisible(false);
                }
 
-               if (IsKeypadExist())
+               if (__isKeypadExist)
                {
                        ChangeLayoutInternal(__pEdit->GetOrientation());
                        AdjustParentPanelHeight(false);
@@ -6227,7 +6166,7 @@ _EditPresenter::ChangeLayout(_ControlOrientation orientation)
 
        CheckUSBKeyboardStatus();
 
-       if (__isInputConnectionBound || IsFocused())//[twt]IsFocused() condition will be deleted
+       if (__isInputConnectionBound || __clipboardConnected)
        {
                if (__pParentForm)
                {
@@ -6239,8 +6178,7 @@ _EditPresenter::ChangeLayout(_ControlOrientation orientation)
                        __pCommandButton->SetVisibleState(false);
                }
 
-               //if (IsKeypadExist() || __isClipboardExist)
-               if (IsKeypadExist()) //Only keypad Exist should be checked because clipboard boundschanged callback will be called after onchagelayout
+               if (__isKeypadExist) //Only keypad Exist should be checked because clipboard boundschanged callback will be called after onchagelayout
                {
                        __initialParentHeight = 0.0f;
                        ChangeLayoutInternal(orientation);
@@ -6281,12 +6219,11 @@ _EditPresenter::ChangeLayoutInternal(_ControlOrientation orientation)
                screenSize.height = pControlManager->GetScreenSizeF().width;
        }
 
-       //if (__isInputConnectionBound)
-       if (__isInputConnectionBound || IsFocused())//[twt]temporal
+       if (__isInputConnectionBound || __clipboardConnected)
        {
                GetKeypadBounds(keypadBounds);
 
-               if (IsKeypadExist())
+               if (__isKeypadExist)
                {
                        if (__isClipboardExist)
                        {
@@ -6332,7 +6269,7 @@ _EditPresenter::ChangeLayoutInternal(_ControlOrientation orientation)
                                {
                                        formDeflateHeight += commandButtonBounds.height;
 
-                                       if (IsKeypadExist())
+                                       if (__isKeypadExist)
                                        {
                                                formDeflateHeight += shrinkedHeight;
                                                commandButtonBounds.y = screenSize.height - shrinkedHeight - commandButtonBounds.height - __pParentForm->GetClientBoundsF().y;
@@ -6344,7 +6281,7 @@ _EditPresenter::ChangeLayoutInternal(_ControlOrientation orientation)
                                }
                                else
                                {
-                                       if (IsKeypadExist())
+                                       if (__isKeypadExist)
                                        {
                                                commandButtonBounds.y = screenSize.height - shrinkedHeight - commandButtonBounds.height;
                                        }
@@ -6368,7 +6305,7 @@ _EditPresenter::ChangeLayoutInternal(_ControlOrientation orientation)
                {
                        if (__pParentForm)
                        {
-                               if (IsKeypadExist() || __isClipboardExist)
+                               if (__isKeypadExist || __isClipboardExist)
                                {
                                        formDeflateHeight += shrinkedHeight;
                                }
@@ -6378,6 +6315,8 @@ _EditPresenter::ChangeLayoutInternal(_ControlOrientation orientation)
 
        if (__pParentForm)
        {
+               SysLog(NID_UI_CTRL, "ChangeLayoutInternal: formDeflateHeight:%f, KeypadExist(%d), ClipboardExist(%d), CommandButtonVisible(%d)",
+                       formDeflateHeight, __isKeypadExist, __isClipboardExist, __isKeypadCommandButtonVisible);
                __pParentForm->DeflateClientRectHeight(formDeflateHeight);
        }
 
@@ -6459,7 +6398,7 @@ _EditPresenter::AdjustParentPanelHeight(bool restore, bool panelResizeByPredicti
        }
        else
        {
-               if (IsKeypadExist())
+               if (__isKeypadExist)
                {
                        GetKeypadBounds(absKeypadBounds);
 
@@ -6582,7 +6521,7 @@ _EditPresenter::HideKeypad(bool focus)
                __pCommandButton->SetVisibleState(false);
        }
 
-       if (IsKeypadExist())
+       if (__isKeypadExist)
        {
                if (__pParentForm)
                {
@@ -6656,6 +6595,7 @@ _EditPresenter::OnEditCopyPasteStatusChanged(CoreCopyPasteStatus status, CoreCop
                        break;
                case CORE_COPY_PASTE_ACTION_SEARCH:
                case CORE_COPY_PASTE_ACTION_CLIPBOARD:
+                       __clipboardConnected = true;
                //fall through
                default:
                        break;
index 7ba33eb..c2d77d9 100644 (file)
@@ -255,7 +255,6 @@ public:
        bool IsTextPredictionEnabled(void) const;
        bool IsKeypadExist(void) const;
        void CheckUSBKeyboardStatus(void);
-       void CheckKeypadStatus(void);
        bool IsUsbKeyboardConnected(void) const;
 
        result AppendCharacter(const Tizen::Base::Character& character);
@@ -569,6 +568,7 @@ private:
        _IEditTextFilter* __pTextFilter;
        bool __textBlockMoveLeft;
        bool __textBlockMoving;
+       bool __clipboardConnected;
 }; // _EditPresenter
 
 }}} // Tizen::Ui::Controls