Fixed to decide the position of the mini App
authorChoi Munseok <ms47.choi@samsung.com>
Mon, 8 Jul 2013 09:08:24 +0000 (18:08 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Mon, 8 Jul 2013 09:08:24 +0000 (18:08 +0900)
Change-Id: I96115fa51a565314af8b33615ed6a54a47b1c7b9
Signed-off-by: Choi Munseok <ms47.choi@samsung.com>
src/ui/controls/FUiCtrl_FormImpl.cpp
src/ui/controls/FUiCtrl_Frame.cpp
src/ui/controls/FUiCtrl_FrameImpl.cpp
src/ui/inc/FUiCtrl_Frame.h

index 8176e42..ae4e508 100644 (file)
@@ -1205,6 +1205,7 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation)
                        portraitSize = pFrameImpl->GetSizeF();
                        landscapeSize = portraitSize;
                        pFrameImpl->GetCore().SetMovable(movable);
+                       pFrameImpl->GetCore().SetFloatingOrientation(orientation);
                }
        }
 
index 6cc5b56..e318c02 100644 (file)
@@ -61,6 +61,7 @@ _Frame::_Frame(void)
        : __pFramePresenter(null)
        , __pFrameEvent(null)
        , __floatingBounds(0.0f, 0.0f, 0.0f, 0.0f)
+       , __floatingOrientation(_CONTROL_ORIENTATION_PORTRAIT)
        , __showMode(FRAME_SHOW_MODE_FULL_SCREEN)
        , __restore(false)
        , __minimized(false)
@@ -448,6 +449,15 @@ _Frame::SetFloatingBounds(const Rectangle& rect)
        __floatingBounds = _CoordinateSystemUtils::ConvertToFloat(rect);
 }
 
+void
+_Frame::SetFloatingOrientation(_ControlOrientation orientation)
+{
+       if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
+       {
+               __floatingOrientation = orientation;
+       }
+}
+
 result
 _Frame::SetShowMode(FrameShowMode showMode)
 {
@@ -494,6 +504,67 @@ _Frame::SetShowMode(FrameShowMode showMode)
        int oldShowMode = __showMode;
        __showMode = showMode;
 
+       if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
+       {
+               _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
+               _Form* pCurForm = GetCurrentForm();
+               if (pCurForm)
+               {
+                       orientation = pCurForm->GetOrientation();
+               }
+               else
+               {
+                       orientation = GetOrientation();
+               }
+
+               if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       if (__floatingOrientation == _CONTROL_ORIENTATION_LANDSCAPE)
+                       {
+                               FloatDimension screenSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
+                               FloatPoint prevPoint(__floatingBounds.x, __floatingBounds.y);
+                               FloatPoint curPoint(prevPoint.x, prevPoint.y);
+                               float ratio = screenSize.width / screenSize.height;
+
+                               if (prevPoint.x > 0.0f)
+                               {
+                                       curPoint.x = prevPoint.x * ratio;
+                               }
+                       
+                               if (prevPoint.y > 0.0f)
+                               {
+                                       curPoint.y = prevPoint.y / ratio;
+                               }
+
+                               __floatingBounds.x = curPoint.x;
+                               __floatingBounds.y = curPoint.y;
+                       }
+               }
+               else
+               {
+                       if (__floatingOrientation == _CONTROL_ORIENTATION_PORTRAIT)
+                       {
+                               FloatDimension screenSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
+                               FloatPoint prevPoint(__floatingBounds.x, __floatingBounds.y);
+                               FloatPoint curPoint(prevPoint.x, prevPoint.y);
+                               float ratio = screenSize.width / screenSize.height;
+
+                               if (prevPoint.x > 0.0f)
+                               {
+                                       curPoint.x = prevPoint.x / ratio;
+                               }
+                       
+                               if (prevPoint.y > 0.0f)
+                               {
+                                       curPoint.y = prevPoint.y * ratio;
+                               }
+                       
+                               __floatingBounds.x = curPoint.x;
+                               __floatingBounds.y = curPoint.y;
+                       }
+               }
+       }
+
        result r = E_SUCCESS;
 
        switch (__showMode)
@@ -558,6 +629,19 @@ _Frame::SetShowMode(FrameShowMode showMode)
                break;
        }
 
+       if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
+       {
+               _Form* pCurForm = GetCurrentForm();
+               if (pCurForm)
+               {
+                       __floatingOrientation = pCurForm->GetOrientation();
+               }
+               else
+               {
+                       __floatingOrientation = GetOrientation();
+               }
+       }
+
        return E_SUCCESS;
 }
 
index c05cb7c..94a8dfa 100644 (file)
@@ -390,6 +390,7 @@ _FrameImpl::OnChangeLayout(_ControlOrientation orientation)
 
                SetPosition(curPoint);
                SetMovable(movable);
+               GetCore().SetFloatingOrientation(orientation);
        }
 
        SetResizable(resizable);
index e1f1784..532d4a4 100644 (file)
@@ -81,6 +81,7 @@ public:
 // Floating
        void SetFloatingBounds(const Tizen::Graphics::Rectangle& rect);
        void SetFloatingBounds(const Tizen::Graphics::FloatRectangle& rect);
+       void SetFloatingOrientation(Tizen::Ui::_ControlOrientation orientation);
        result SetShowMode(FrameShowMode showMode);
        FrameShowMode GetShowMode(bool minimize = true) const;
        bool IsActivated(void) const;
@@ -112,6 +113,7 @@ private:
        _FramePresenter* __pFramePresenter;
        _FrameEvent* __pFrameEvent;
        Tizen::Graphics::FloatRectangle __floatingBounds;
+       Tizen::Ui::_ControlOrientation __floatingOrientation;
        FrameShowMode __showMode;
        bool __restore;
        bool __minimized;