From f82ad30d2eb10d4d229d0a9278e4c137ff7c9335 Mon Sep 17 00:00:00 2001 From: Keuckdo Bang Date: Fri, 12 Apr 2013 09:48:30 +0900 Subject: [PATCH] Apply float bounds. Change-Id: If017b4f25e868ffda5532a8a6b95a72c8366cbef --- src/ui/FUi_Control.cpp | 10 +++--- src/ui/FUi_DimmingLayer.cpp | 6 ++-- src/ui/FUi_EcoreEvas.cpp | 44 +++++++++++++++++++------- src/ui/FUi_EflUiEventManager.cpp | 4 +-- src/ui/controls/FUiCtrl_MessageBox.cpp | 18 +++++------ src/ui/controls/FUiCtrl_Popup.cpp | 52 +++++++++++++++---------------- src/ui/controls/FUiCtrl_ProgressPopup.cpp | 10 +++--- src/ui/inc/FUiCtrl_Popup.h | 6 ++-- src/ui/inc/FUi_EcoreEvas.h | 1 + 9 files changed, 86 insertions(+), 65 deletions(-) diff --git a/src/ui/FUi_Control.cpp b/src/ui/FUi_Control.cpp index 9e09b79..6f7e49f 100644 --- a/src/ui/FUi_Control.cpp +++ b/src/ui/FUi_Control.cpp @@ -3545,11 +3545,11 @@ _Control::GetAbsoluteBounds(void) const { if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) { - popupRect = pPopup->GetNativeBounds(true); + popupRect = _CoordinateSystemUtils::ConvertToInteger(pPopup->GetNativeBounds(true)); } else { - popupRect = pPopup->GetNativeBounds(false); + popupRect = _CoordinateSystemUtils::ConvertToInteger(pPopup->GetNativeBounds(false)); } } @@ -3596,7 +3596,7 @@ _Control::GetAbsoluteBoundsF(void) const { FloatPoint winPoint = pWindow->GetPositionF(); - Rectangle popupRect(0, 0, 0, 0); + FloatRectangle popupRect(0.0f, 0.0f, 0.0f, 0.0f); _Popup* pPopup = dynamic_cast<_Popup*>(pWindow); if (pPopup) { @@ -3610,8 +3610,8 @@ _Control::GetAbsoluteBoundsF(void) const } } - accumPoint.x = accumPoint.x + winPoint.x + _CoordinateSystemUtils::ConvertToFloat(popupRect).x; - accumPoint.y = accumPoint.y + winPoint.y + _CoordinateSystemUtils::ConvertToFloat(popupRect).y; + accumPoint.x = accumPoint.x + winPoint.x + popupRect.x; + accumPoint.y = accumPoint.y + winPoint.y + popupRect.y; } absoluteBounds.x = accumPoint.x; diff --git a/src/ui/FUi_DimmingLayer.cpp b/src/ui/FUi_DimmingLayer.cpp index 804d487..80f70f1 100755 --- a/src/ui/FUi_DimmingLayer.cpp +++ b/src/ui/FUi_DimmingLayer.cpp @@ -188,16 +188,16 @@ _DimmingLayer::Rearrange(void) result r = E_SUCCESS; - Dimension size = _ControlManager::GetInstance()->GetScreenSize(); + FloatDimension size = _ControlManager::GetInstance()->GetScreenSizeF(); bool oldValue = __pDimmingElement->IsImplicitAnimationEnabled(); __pDimmingElement->SetImplicitAnimationEnabled(false); if (__pControl->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) { - __pDimmingElement->SetBounds(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, (float)size.width, (float)size.height)); + __pDimmingElement->SetBounds(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, size.width, size.height)); } else { - __pDimmingElement->SetBounds(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, (float)size.height, (float)size.width)); + __pDimmingElement->SetBounds(Tizen::Graphics::FloatRectangle(0.0f, 0.0f, size.height, size.width)); } __pDimmingElement->SetImplicitAnimationEnabled(oldValue); diff --git a/src/ui/FUi_EcoreEvas.cpp b/src/ui/FUi_EcoreEvas.cpp index 6d6108e..994d206 100644 --- a/src/ui/FUi_EcoreEvas.cpp +++ b/src/ui/FUi_EcoreEvas.cpp @@ -1262,18 +1262,19 @@ _EcoreEvas::RotateWindow(const _Window& window, int orientation) _Popup* pPopup = dynamic_cast<_Popup*>(pWindow); if (pPopup) { - Rectangle nativeBounds(0, 0, 0, 0); + FloatRectangle nativeBoundsF(0.0f, 0.0f, 0.0f, 0.0f); if ((rotate == 0) || (rotate == 180)) { - nativeBounds = pPopup->GetNativeBounds(true); + nativeBoundsF = pPopup->GetNativeBounds(true); } else { - nativeBounds = pPopup->GetNativeBounds(false); + nativeBoundsF = pPopup->GetNativeBounds(false); } - nativeBounds = _CoordinateSystemUtils::Transform(nativeBounds); + nativeBoundsF = _CoordinateSystemUtils::Transform(nativeBoundsF); + Rectangle nativeBounds = _CoordinateSystemUtils::ConvertToInteger(nativeBoundsF); winBounds.x = nativeBounds.x; winBounds.y = nativeBounds.y; @@ -2246,18 +2247,19 @@ _EcoreEvas::SetWindowBounds(const _Window& window, const Rectangle& bounds) _Popup* pPopup = dynamic_cast<_Popup*>(pWindow); if (pPopup) { - Rectangle nativeBounds(0, 0, 0, 0); + FloatRectangle nativeBoundsF(0.0f, 0.0f, 0.0f, 0.0f); if ((rotate == 0) || (rotate == 180)) { - nativeBounds = pPopup->GetNativeBounds(true); + nativeBoundsF = pPopup->GetNativeBounds(true); } else { - nativeBounds = pPopup->GetNativeBounds(false); + nativeBoundsF = pPopup->GetNativeBounds(false); } - nativeBounds = _CoordinateSystemUtils::Transform(nativeBounds); + nativeBoundsF = _CoordinateSystemUtils::Transform(nativeBoundsF); + Rectangle nativeBounds = _CoordinateSystemUtils::ConvertToInteger(nativeBoundsF); winBounds.x = nativeBounds.x; winBounds.y = nativeBounds.y; @@ -2340,18 +2342,19 @@ _EcoreEvas::SetWindowBounds(const _Window& window, const FloatRectangle& bounds) _Popup* pPopup = dynamic_cast<_Popup*>(pWindow); if (pPopup) { - Rectangle nativeBounds(0, 0, 0, 0); + FloatRectangle nativeBoundsF(0.0f, 0.0f, 0.0f, 0.0f); if ((rotate == 0) || (rotate == 180)) { - nativeBounds = pPopup->GetNativeBounds(true); + nativeBoundsF = pPopup->GetNativeBounds(true); } else { - nativeBounds = pPopup->GetNativeBounds(false); + nativeBoundsF = pPopup->GetNativeBounds(false); } - nativeBounds = _CoordinateSystemUtils::Transform(nativeBounds); + nativeBoundsF = _CoordinateSystemUtils::Transform(nativeBoundsF); + Rectangle nativeBounds = _CoordinateSystemUtils::ConvertToInteger(nativeBoundsF); winBounds.x = nativeBounds.x; winBounds.y = nativeBounds.y; @@ -2616,6 +2619,23 @@ _EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const T SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set rotation bounds(rot = %d, %d, %d, %d, %d).", win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height); ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height); } + +void +_EcoreEvas::SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds) +{ + _EflLayer* pLayer = GetEflLayer(window); + if (!pLayer) + { + return; + } + + FloatRectangle winBoundsF = _CoordinateSystemUtils::Transform(bounds); + Rectangle winBounds = _CoordinateSystemUtils::ConvertToInteger(winBoundsF); + + Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas()); + SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x] Set rotation bounds(rot = %d, %d, %d, %d, %d).", win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height); + ecore_x_e_window_rotation_geometry_set(win, rotation, winBounds.x, winBounds.y, winBounds.width, winBounds.height); +} #endif // [ToDo] Remove API diff --git a/src/ui/FUi_EflUiEventManager.cpp b/src/ui/FUi_EflUiEventManager.cpp index 7ef7090..7bcdd4e 100644 --- a/src/ui/FUi_EflUiEventManager.cpp +++ b/src/ui/FUi_EflUiEventManager.cpp @@ -727,11 +727,11 @@ private: { if (pPopup->GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) { - popupRect = pPopup->GetNativeBounds(true); + popupRect = _CoordinateSystemUtils::ConvertToInteger(pPopup->GetNativeBounds(true)); } else { - popupRect = pPopup->GetNativeBounds(false); + popupRect = _CoordinateSystemUtils::ConvertToInteger(pPopup->GetNativeBounds(false)); } } diff --git a/src/ui/controls/FUiCtrl_MessageBox.cpp b/src/ui/controls/FUiCtrl_MessageBox.cpp index 8b115c4..5356090 100644 --- a/src/ui/controls/FUiCtrl_MessageBox.cpp +++ b/src/ui/controls/FUiCtrl_MessageBox.cpp @@ -74,14 +74,14 @@ _MessageBox::CreateMessageBoxN(void) _MessageBox* pMsgbox = new (std::nothrow) _MessageBox(); SysTryReturn(NID_UI, pMsgbox != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - Dimension screenSize = _ControlManager::GetInstance()->GetScreenSize(); + FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF(); _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); SysTryReturn(NID_UI_CTRL, pFrame != null, null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed."); _Form* pForm = pFrame->GetCurrentForm(); - int portIndiHeight = 0; - int landIndiHeight = 0; + float portIndiHeight = 0.0f; + float landIndiHeight = 0.0f; if (pForm && pForm->IsIndicatorVisible()) { @@ -89,18 +89,18 @@ _MessageBox::CreateMessageBoxN(void) GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, _CONTROL_ORIENTATION_LANDSCAPE, landIndiHeight); } - Rectangle portBounds(0, 0, screenSize.width, screenSize.height - portIndiHeight); - Rectangle landBounds(0, 0, screenSize.width - landIndiHeight, screenSize.height); + FloatRectangle portBoundsF(0.0f, 0.0f, screenSize.width, screenSize.height - portIndiHeight); + FloatRectangle landBoundsF(0.0f, 0.0f, screenSize.width - landIndiHeight, screenSize.height); _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); result r = pMsgbox->CreateRootVisualElement(_WINDOW_TYPE_SUB); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); - pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 0, portBounds); - pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 180, portBounds); - pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 90, landBounds); - pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 270, landBounds); + pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 0, portBoundsF); + pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 180, portBoundsF); + pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 90, landBoundsF); + pEcoreEvas->SetWindowRotationBounds(*pMsgbox, 270, landBoundsF); // for taking touch event pMsgbox->AcquireHandle(); diff --git a/src/ui/controls/FUiCtrl_Popup.cpp b/src/ui/controls/FUiCtrl_Popup.cpp index bd581aa..5cd8396 100644 --- a/src/ui/controls/FUiCtrl_Popup.cpp +++ b/src/ui/controls/FUiCtrl_Popup.cpp @@ -60,10 +60,10 @@ _Popup::_Popup(void) , __pPopupPresenter(null) , __bounds(0.0f, 0.0f, 0.0f, 0.0f) , __popupResult(POPUP_RESULT_NONE) - , __portBounds(0, 0, 0, 0) - , __landBounds(0, 0, 0, 0) + , __portBounds(0.0f, 0.0f, 0.0f, 0.0f) + , __landBounds(0.0f, 0.0f, 0.0f, 0.0f) { - Dimension screenSize = _ControlManager::GetInstance()->GetScreenSize(); + FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF(); _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); SysTryReturnVoidResult(NID_UI_CTRL, pFrame != null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed."); @@ -76,8 +76,8 @@ _Popup::_Popup(void) GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, portIndiHeight); GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, _CONTROL_ORIENTATION_LANDSCAPE, landIndiHeight); } - __portBounds = Rectangle(0, portIndiHeight, screenSize.width, screenSize.height - portIndiHeight); - __landBounds = Rectangle(0, landIndiHeight, screenSize.height, screenSize.width - landIndiHeight); + __portBounds = FloatRectangle(0, portIndiHeight, screenSize.width, screenSize.height - portIndiHeight); + __landBounds = FloatRectangle(0, landIndiHeight, screenSize.height, screenSize.width - landIndiHeight); } _Popup::~_Popup(void) @@ -115,14 +115,14 @@ _Popup::CreatePopupN(void) _Popup* pPopup = new (std::nothrow) _Popup(); SysTryReturn(NID_UI_CTRL, pPopup != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - Dimension screenSize = _ControlManager::GetInstance()->GetScreenSize(); + FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF(); _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); SysTryReturn(NID_UI_CTRL, pFrame != null, null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed."); _Form* pForm = pFrame->GetCurrentForm(); - int portIndiHeight = 0; - int landIndiHeight = 0; + float portIndiHeight = 0.0f; + float landIndiHeight = 0.0f; if (pForm && pForm->IsIndicatorVisible()) { @@ -130,18 +130,18 @@ _Popup::CreatePopupN(void) GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, _CONTROL_ORIENTATION_LANDSCAPE, landIndiHeight); } - Rectangle portBounds(0, 0, screenSize.width, screenSize.height - portIndiHeight); - Rectangle landBounds(0, 0, screenSize.width - landIndiHeight, screenSize.height); + FloatRectangle portBoundsF(0.0f, 0.0f, screenSize.width, screenSize.height - portIndiHeight); + FloatRectangle landBoundsF(0.0f, 0.0f, screenSize.width - landIndiHeight, screenSize.height); _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); result r = pPopup->CreateRootVisualElement(_WINDOW_TYPE_SUB); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); - pEcoreEvas->SetWindowRotationBounds(*pPopup, 0, portBounds); - pEcoreEvas->SetWindowRotationBounds(*pPopup, 180, portBounds); - pEcoreEvas->SetWindowRotationBounds(*pPopup, 90, landBounds); - pEcoreEvas->SetWindowRotationBounds(*pPopup, 270, landBounds); + pEcoreEvas->SetWindowRotationBounds(*pPopup, 0, portBoundsF); + pEcoreEvas->SetWindowRotationBounds(*pPopup, 180, portBoundsF); + pEcoreEvas->SetWindowRotationBounds(*pPopup, 90, landBoundsF); + pEcoreEvas->SetWindowRotationBounds(*pPopup, 270, landBoundsF); // for taking touch event pPopup->AcquireHandle(); @@ -499,33 +499,33 @@ _Popup::OnAttachedToMainTree(void) GetEcoreEvasMgr()->GetEcoreEvas()->SetOwner(*this, *GetOwner()); - Dimension screenSize = _ControlManager::GetInstance()->GetScreenSize(); + FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF(); _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); SysTryReturnResult(NID_UI_CTRL, pFrame != null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed."); _Form* pForm = pFrame->GetCurrentForm(); - int portIndiHeight = 0; - int landIndiHeight = 0; + float portIndiHeight = 0.0f; + float landIndiHeight = 0.0f; if (pForm && pForm->IsIndicatorVisible()) { GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, portIndiHeight); GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, _CONTROL_ORIENTATION_LANDSCAPE, landIndiHeight); } - Rectangle portBounds(0, 0, screenSize.width, screenSize.height - portIndiHeight); - Rectangle landBounds(0, 0, screenSize.width - landIndiHeight, screenSize.height); + FloatRectangle portBoundsF(0.0f, 0.0f, screenSize.width, screenSize.height - portIndiHeight); + FloatRectangle landBoundsF(0.0f, 0.0f, screenSize.width - landIndiHeight, screenSize.height); _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); - pEcoreEvas->SetWindowRotationBounds(*this, 0, portBounds); - pEcoreEvas->SetWindowRotationBounds(*this, 180, portBounds); - pEcoreEvas->SetWindowRotationBounds(*this, 90, landBounds); - pEcoreEvas->SetWindowRotationBounds(*this, 270, landBounds); + pEcoreEvas->SetWindowRotationBounds(*this, 0, portBoundsF); + pEcoreEvas->SetWindowRotationBounds(*this, 180, portBoundsF); + pEcoreEvas->SetWindowRotationBounds(*this, 90, landBoundsF); + pEcoreEvas->SetWindowRotationBounds(*this, 270, landBoundsF); - __portBounds = Rectangle(0, portIndiHeight, screenSize.width, screenSize.height - portIndiHeight); - __landBounds = Rectangle(0, landIndiHeight, screenSize.height, screenSize.width - landIndiHeight); + __portBounds = FloatRectangle(0, portIndiHeight, screenSize.width, screenSize.height - portIndiHeight); + __landBounds = FloatRectangle(0, landIndiHeight, screenSize.height, screenSize.width - landIndiHeight); return E_SUCCESS; } @@ -640,7 +640,7 @@ _Popup::IsRotationSynchronized(void) const return true; } -Rectangle +FloatRectangle _Popup::GetNativeBounds(bool isPortrait) const { if (isPortrait) diff --git a/src/ui/controls/FUiCtrl_ProgressPopup.cpp b/src/ui/controls/FUiCtrl_ProgressPopup.cpp index 78e3f55..36b6f45 100755 --- a/src/ui/controls/FUiCtrl_ProgressPopup.cpp +++ b/src/ui/controls/FUiCtrl_ProgressPopup.cpp @@ -99,14 +99,14 @@ _ProgressPopup::CreateProgressPopupN(void) _ProgressPopup* pProgressPopup = new (std::nothrow) _ProgressPopup(); SysTryReturn(NID_UI_CTRL, pProgressPopup != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); - Dimension screenSize = _ControlManager::GetInstance()->GetScreenSize(); + FloatDimension screenSize = _ControlManager::GetInstance()->GetScreenSizeF(); _Frame* pFrame = dynamic_cast<_Frame*>(_ControlManager::GetInstance()->GetCurrentFrame()); SysTryReturn(NID_UI_CTRL, pFrame != null, null, E_SYSTEM, "[E_SYSTEM] This instance is not constructed."); _Form* pForm = pFrame->GetCurrentForm(); - int portIndiHeight = 0; - int landIndiHeight = 0; + float portIndiHeight = 0.0f; + float landIndiHeight = 0.0f; if (pForm && pForm->IsIndicatorVisible()) { @@ -114,8 +114,8 @@ _ProgressPopup::CreateProgressPopupN(void) GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, _CONTROL_ORIENTATION_LANDSCAPE, landIndiHeight); } - Rectangle portBounds(0, 0, screenSize.width, screenSize.height - portIndiHeight); - Rectangle landBounds(0, 0, screenSize.width - landIndiHeight, screenSize.height); + FloatRectangle portBoundsF(0.0f, 0.0f, screenSize.width, screenSize.height - portIndiHeight); + FloatRectangle landBoundsF(0.0f, 0.0f, screenSize.width - landIndiHeight, screenSize.height); _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas(); diff --git a/src/ui/inc/FUiCtrl_Popup.h b/src/ui/inc/FUiCtrl_Popup.h index b5259f4..30c16af 100644 --- a/src/ui/inc/FUiCtrl_Popup.h +++ b/src/ui/inc/FUiCtrl_Popup.h @@ -105,7 +105,7 @@ public: virtual void UpdateClientBounds(const Tizen::Graphics::FloatDimension& size, Tizen::Graphics::FloatRectangle& clientBounds); virtual bool IsRotationSynchronized(void) const; - Tizen::Graphics::Rectangle GetNativeBounds(bool isPortrait) const; + Tizen::Graphics::FloatRectangle GetNativeBounds(bool isPortrait) const; // Accessor public: @@ -161,8 +161,8 @@ private: PopupModalResult __popupResult; - Tizen::Graphics::Rectangle __portBounds; - Tizen::Graphics::Rectangle __landBounds; + Tizen::Graphics::FloatRectangle __portBounds; + Tizen::Graphics::FloatRectangle __landBounds; }; // _Popup diff --git a/src/ui/inc/FUi_EcoreEvas.h b/src/ui/inc/FUi_EcoreEvas.h index 62279a8..c45956d 100644 --- a/src/ui/inc/FUi_EcoreEvas.h +++ b/src/ui/inc/FUi_EcoreEvas.h @@ -115,6 +115,7 @@ public: void SetWindowAvailabledRotation(const _Window& window, int* rotations, unsigned int count); void RegisterWindowStateCallback(const _Window& window); void SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::Rectangle& bounds); + void SetWindowRotationBounds(const _Window& window, int rotation, const Tizen::Graphics::FloatRectangle& bounds); #else void SetWindowOrientationEnabled(const _Window& window, bool enable); #endif -- 2.7.4