Fix for Control draw in Non-Focussed state (TDIS-4558 & 4579)
authorSaravana Balaji <saravana.bs@samsung.com>
Mon, 18 Mar 2013 15:06:04 +0000 (20:36 +0530)
committerSaravana Balaji <saravana.bs@samsung.com>
Tue, 19 Mar 2013 06:18:51 +0000 (11:48 +0530)
Change-Id: I975227e4af8cd93ad1a237ad0c6cb3850cf6be95
Signed-off-by: Saravana Balaji <saravana.bs@samsung.com>
src/ui/controls/FUiCtrl_EditPresenter.cpp
src/ui/controls/FUiCtrl_TokenEditPresenter.cpp
src/ui/inc/FUiCtrl_EditPresenter.h

index 75476c3..04480e1 100644 (file)
@@ -5318,6 +5318,12 @@ _EditPresenter::IsInternalFocused(void) const
        return __pEdit->IsInternalFocused();    
 }
 
+_VisualElement*
+_EditPresenter::GetTextVisualElement(void)
+{
+       return __pTextVisualElement;
+}
+
 bool
 _EditPresenter::OnFocusGained(void)
 {
index afc39b0..f2a0236 100644 (file)
@@ -104,7 +104,7 @@ _Token::_Token(const String& text, Font* pEditFont)
        result r = E_SUCCESS;
 
        currTokenLength = text.GetLength();
-       float tokenFontSize = 0;\r
+       float tokenFontSize = 0.0f;
 
        pTextObject = new (std::nothrow) TextObject;
        SysTryReturnVoidResult(NID_UI_CTRL, pTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
@@ -308,7 +308,7 @@ result
 _TokenEditPresenter::InitializeDescriptionText(void)
 {
        result r = E_SUCCESS;
-       float descriptionTextSize = 0;\r
+       float descriptionTextSize = 0.0f;
 
        __pDescriptionTextTextObject = new (std::nothrow) TextObject();
        SysTryReturnResult(NID_UI_CTRL, __pDescriptionTextTextObject != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
@@ -448,11 +448,11 @@ _TokenEditPresenter::Initialize(const _Control& control)
 
        SetKeypadEnabled(true);
 
-       float tokenLeftMargin = 0;\r
-       float tokenRightMargin = 0;\r
-       float tokenTopMargin = 0;\r
-       float tokenBottomMargin = 0;\r
-       float tokenHeight = 0;\r
+       float tokenLeftMargin = 0.0f;
+       float tokenRightMargin = 0.0f;
+       float tokenTopMargin = 0.0f;
+       float tokenBottomMargin = 0.0f;
+       float tokenHeight = 0.0f;
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::LEFT_MARGIN, orientation, tokenLeftMargin);
@@ -472,7 +472,7 @@ _TokenEditPresenter::Initialize(const _Control& control)
        FloatRectangle tempDspRect(__initTextRect.x, __initTextRect.y, __clientRect.width, tokenHeight);
        SetTextBounds(tempDspRect);
 
-       float textSize = 0;\r
+       float textSize = 0.0f;
        GET_SHAPE_CONFIG(TOKENEDIT::TEXT_SIZE, orientation, textSize);
 
        Font* pFont = new (std::nothrow) Font();
@@ -573,7 +573,19 @@ _TokenEditPresenter::DrawText(void)
        }
        else
        {
-               _EditPresenter::DrawText();
+               _VisualElement* pTextVisualElement = null;
+               pTextVisualElement = GetTextVisualElement();
+               if (pTextVisualElement)
+               {
+                       _EditPresenter::DrawText();
+               }
+               else
+               {
+                       Canvas* pCanvas = __pTokenEdit->GetCanvasN();
+                       SysTryReturnVoidResult(NID_UI_CTRL, pCanvas, E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to get visual element of Control.");
+
+                       _EditPresenter::DrawText(*pCanvas);
+               }
        }
 }
 
@@ -664,8 +676,8 @@ _TokenEditPresenter::DrawToken(int count)
 {
        int drawStartIndex = 0;
        int tokenCount = 0;
-       float tokenTextLeftMargin = 0;\r
-       float tokenVerticalSpacing = 0;\r
+       float tokenTextLeftMargin = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
        bool isCustomBitmap = false;
 
        SysTryReturn(NID_UI_CTRL, __pTokenEdit != null, false, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
@@ -1184,16 +1196,16 @@ _TokenEditPresenter::CalculateTokenPositionFromIndex(int startIndex, bool leftWa
 
        int tokenCount = __pTokenList->GetCount();
 
-       float tokenLeftMargin = 0;\r
-       float tokenRighttMargin = 0;\r
-       float tokenTopMargin = 0;\r
-       float tokenBottomMargin = 0;\r
-       float tokenHeight = 0;\r
-       float tokenVerticalSpacing = 0;\r
-       float tokenHorizontalSpacing = 0;\r
-       float tokenTextLeftMargin = 0;\r
-       float tokenTextRightMargin = 0;\r
-       float descriptionTextRightMargin = 0;\r
+       float tokenLeftMargin = 0.0f;
+       float tokenRighttMargin = 0.0f;
+       float tokenTopMargin = 0.0f;
+       float tokenBottomMargin = 0.0f;
+       float tokenHeight = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
+       float tokenHorizontalSpacing = 0.0f;
+       float tokenTextLeftMargin = 0.0f;
+       float tokenTextRightMargin = 0.0f;
+       float descriptionTextRightMargin = 0.0f;
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::LEFT_MARGIN, orientation, tokenLeftMargin);
@@ -1315,13 +1327,13 @@ _TokenEditPresenter::SetInitialBounds(void)
 {
        result r = E_SUCCESS;
 
-       float tokenTopMargin = 0;\r
-       float tokenHeight = 0;\r
-       float tokenMinWidth = 0;\r
-       float tokenVerticalSpacing = 0;\r
-       float tokenHorizontalSpacing = 0;\r
-       float tokenTextLeftMargin = 0;\r
-       float tokenTextRightMargin = 0;\r
+       float tokenTopMargin = 0.0f;
+       float tokenHeight = 0.0f;
+       float tokenMinWidth = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
+       float tokenHorizontalSpacing = 0.0f;
+       float tokenTextLeftMargin = 0.0f;
+       float tokenTextRightMargin = 0.0f;
        _ControlOrientation orientation = GetEditView()->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
@@ -1420,8 +1432,8 @@ _TokenEditPresenter::GetTextBounds(void) const
                SysTryReturn(NID_UI_CTRL, pToken, Rectangle(), E_SYSTEM, "[E_SYSTEM] A system error has occurred. Unable to get valid token.");
 
                _ControlOrientation orientation = __pTokenEdit->GetOrientation();
-               float tokenTextLeftMargin = 0;\r
-               float tokenTextVerticalMargin = 0;\r
+               float tokenTextLeftMargin = 0.0f;
+               float tokenTextVerticalMargin = 0.0f;
                GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_LEFT_MARGIN, orientation, tokenTextLeftMargin);
                GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_VERTICAL_SPACING, orientation, tokenTextVerticalMargin);
 
@@ -1577,12 +1589,12 @@ _TokenEditPresenter::CalculateDescriptionTextRect(const String& descriptionText)
        result r = E_SUCCESS;
 
        TextSimple* pSimpleText = null;
-       float tokenTopMargin = 0;\r
-       float tokenHeight = 0;\r
-       float tokenVerticalSpacing = 0;\r
-       float tokenTextLeftMargin = 0;\r
-       float tokenTextRightMargin = 0;\r
-       float tokenTitleWidth = 0;\r
+       float tokenTopMargin = 0.0f;
+       float tokenHeight = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
+       float tokenTextLeftMargin = 0.0f;
+       float tokenTextRightMargin = 0.0f;
+       float tokenTitleWidth = 0.0f;
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
@@ -1659,7 +1671,7 @@ _TokenEditPresenter::DrawDescriptionText(void)
 
        if (__pDescriptionTextTextObject->GetFont(0)->GetFaceName() != GetTitleFontFaceName())
        {
-               float descriptionTextSize = 0;\r
+               float descriptionTextSize = 0.0f;
                GET_SHAPE_CONFIG(TOKENEDIT::DESCRIPTION_TEXT_SIZE, _CONTROL_ORIENTATION_PORTRAIT, descriptionTextSize);
 
                pDescriptionFont = new (std::nothrow) Font();
@@ -1779,8 +1791,8 @@ _TokenEditPresenter::TrimTokenAndAdjustEllipsisAt(int index)
 {
        result r = E_SUCCESS;
 
-       float tokenTextRightMargin = 0;\r
-       float tokenMinimumSize = 0;\r
+       float tokenTextRightMargin = 0.0f;
+       float tokenMinimumSize = 0.0f;
 
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
        GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
@@ -1846,9 +1858,9 @@ _TokenEditPresenter::SetEditingTokenTextBounds(int index, bool isSetText)
 {
        result r = E_SUCCESS;
 
-       float tokenHeight = 0;\r
-       float tokenVerticalSpacing = 0;\r
-       float tokenTextLeftMargin = 0;\r
+       float tokenHeight = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
+       float tokenTextLeftMargin = 0.0f;
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HEIGHT, orientation, tokenHeight);
@@ -2223,9 +2235,9 @@ result
 _TokenEditPresenter::CheckTokenScrolling(bool scrollToCursorPosition)
 {
        bool needToScroll = false;
-       float tokenTopMargin = 0;\r
-       float tokenBottomMargin = 0;\r
-       float tokenVerticalSpacing = 0;\r
+       float tokenTopMargin = 0.0f;
+       float tokenBottomMargin = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
@@ -2321,10 +2333,10 @@ _TokenEditPresenter::AdjustFlexibleHeight(void)
 float
 _TokenEditPresenter::CalculateFlexibleHeightF(void)
 {
-       float tokenHeight = 0;\r
-       float tokenVerticalSpacing = 0;\r
-       float tokenTopMargin = 0;\r
-       float tokenBottomMargin = 0;\r
+       float tokenHeight = 0.0f;
+       float tokenVerticalSpacing = 0.0f;
+       float tokenTopMargin = 0.0f;
+       float tokenBottomMargin = 0.0f;
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
        GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HEIGHT, orientation, tokenHeight);
@@ -2383,7 +2395,7 @@ _TokenEditPresenter::DrawScrollBar(void)
                return E_SUCCESS;
        }
 
-       float tokenBottomMargin = 0;\r
+       float tokenBottomMargin = 0.0f;
        GET_SHAPE_CONFIG(TOKENEDIT::BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, tokenBottomMargin);
 
        float totalHeight = GetTextBoundsF().y + GetTextBoundsF().height - __scrollValue + tokenBottomMargin;
@@ -2850,9 +2862,9 @@ _TokenEditPresenter::OnTextCommitted(const String& commitText)
                pToken->ResetToken(GetText());
                TrimTokenAndAdjustEllipsisAt(__edittingTokenIndex);
 
-               float tokenHeight = 0;\r
-               float tokenVerticalSpacing = 0;\r
-               float tokenTextLeftMargin = 0;\r
+               float tokenHeight = 0.0f;
+               float tokenVerticalSpacing = 0.0f;
+               float tokenTextLeftMargin = 0.0f;
 
                _ControlOrientation orientation = __pTokenEdit->GetOrientation();
                GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_HEIGHT, orientation, tokenHeight);
@@ -2884,7 +2896,7 @@ _TokenEditPresenter::OnTextCommitted(const String& commitText)
                        SetCursorDisabled(false);
                }
 
-               float tokenTopMargin = 0;\r
+               float tokenTopMargin = 0.0f;
                _ControlOrientation orientation = __pTokenEdit->GetOrientation();
                GET_SHAPE_CONFIG(TOKENEDIT::TOP_MARGIN, orientation, tokenTopMargin);
 
@@ -3143,9 +3155,9 @@ _TokenEditPresenter::OnSurroundingTextDeleted(int offset, int charCount)
 
                if (pToken)
                {
-                       float tokenHeight = 0;\r
-                       float tokenVerticalSpacing = 0;\r
-                       float tokenTextLeftMargin = 0;\r
+                       float tokenHeight = 0.0f;
+                       float tokenVerticalSpacing = 0.0f;
+                       float tokenTextLeftMargin = 0.0f;
 
                        SetCursorPosition(__previousCursorPosition);
 
@@ -3337,7 +3349,7 @@ _TokenEditPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touc
                        _Scroll* pScroll = GetScrollBar();
                        if (pScroll)
                        {
-                               float tokenBottomMargin = 0;\r
+                               float tokenBottomMargin = 0.0f;
                                GET_SHAPE_CONFIG(TOKENEDIT::BOTTOM_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, tokenBottomMargin);
 
                                float totalHeight = GetTextBoundsF().y + GetTextBoundsF().height - __scrollValue + tokenBottomMargin;
@@ -3384,6 +3396,10 @@ _TokenEditPresenter::OnVisualElementAnimationFinished (const Tizen::Ui::Animatio
                __pressedTokenIndex--;
        }
 
+       if (GetTokenCount() == 0 && __animatingIndex == 0)
+       {
+               DrawText();
+       }
        __animatingIndex = -1;
        InitializeCursor();
 
@@ -3404,7 +3420,7 @@ _TokenEditPresenter::ResizeTokenAndAdjustEllipsis(int index, float value, bool i
                pToken = static_cast <_Token*>(__pTokenList->GetAt(index));
                SysTryReturn(NID_UI_CTRL, pToken != null, -1.0f, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
 
-               float tokenMinimumSize = 0;\r
+               float tokenMinimumSize = 0.0f;
 
                _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
@@ -3436,8 +3452,8 @@ _TokenEditPresenter::ResizeTokenAndAdjustEllipsis(int index, float value, bool i
                pToken = static_cast <_Token*>(__pTokenList->GetAt(index));
                SysTryReturn(NID_UI_CTRL, pToken != null, -1.0f, E_SYSTEM, "[E_SYSTEM] A system error has occurred. The _Token instance is null.");
 
-               float tokenTextLeftMargin = 0;\r
-               float tokenTextRightMargin = 0;\r
+               float tokenTextLeftMargin = 0.0f;
+               float tokenTextRightMargin = 0.0f;
 
                _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
@@ -3473,9 +3489,9 @@ _TokenEditPresenter::PickToken(int index, FloatRectangle tokenDispRect, bool isT
 {
        int tokenCount = __pTokenList->GetCount();
 
-       float tokenMinimumSize = 0;\r
-       float tokenTextLeftMargin = 0;\r
-       float tokenTextRightMargin = 0;\r
+       float tokenMinimumSize = 0.0f;
+       float tokenTextLeftMargin = 0.0f;
+       float tokenTextRightMargin = 0.0f;
 
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
 
@@ -3579,7 +3595,7 @@ _TokenEditPresenter::RepositionToken(int currentTokenIndex, float moveDistance,
 void
 _TokenEditPresenter::ShrinkTokens()
 {
-       float tokenTextRightMargin = 0;\r
+       float tokenTextRightMargin = 0.0f;
 
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
        GET_SHAPE_CONFIG(TOKENEDIT::TOKEN_TEXT_RIGHT_MARGIN, orientation, tokenTextRightMargin);
@@ -3666,7 +3682,7 @@ _TokenEditPresenter::ShrinkTokens()
 float
 _TokenEditPresenter::GetPickedTokenEndPoint(int index, Tizen::Graphics::FloatRectangle tokenDispRect)
 {
-       float tokenTextRightMargin = 0;\r
+       float tokenTextRightMargin = 0.0f;
        float endValue = 0.0f;
 
        _ControlOrientation orientation = __pTokenEdit->GetOrientation();
@@ -3856,7 +3872,7 @@ _TokenEditPresenter::ChangeInternalLayout(_ControlOrientation orientation)
 
        __scrollValue = 0.0f;
        __maxScrollValue = 0.0f;
-       float tokenBottomMargin = 0;\r
+       float tokenBottomMargin = 0.0f;
        float newScrollValue = 0.0f;
 
        FloatRectangle windowBounds = GetInitialBoundsF();
index 40b3bcb..7ba33eb 100644 (file)
@@ -321,6 +321,7 @@ public:
        void SetEditTextFilter(_IEditTextFilter* pFilter);
        virtual bool ValidatePastedText(const Tizen::Base::String& pastedText, Tizen::Base::String& replacedText);
        void SendOpaqueCommand (const Tizen::Base::String& command);
+       Tizen::Ui::Animations::_VisualElement* GetTextVisualElement(void);
 
 protected:
        void StopTitleSlidingTimer(void);