From cf5671be43b419d24bd7403676f732e548435770 Mon Sep 17 00:00:00 2001 From: SungHee Kim Date: Fri, 26 Apr 2013 23:23:16 +0900 Subject: [PATCH] [N_SE-36513]Even if _FastScroll bounds are smaller than the popup size of _FastScroll, it will be displayed well. Change-Id: Ic318da9162d046c6831079740617b32cef786b7b Signed-off-by: SungHee Kim --- src/ui/controls/FUiCtrl_FastScrollIndex.cpp | 116 ++++++++++++++---------- src/ui/controls/FUiCtrl_FastScrollPresenter.cpp | 12 ++- 2 files changed, 75 insertions(+), 53 deletions(-) diff --git a/src/ui/controls/FUiCtrl_FastScrollIndex.cpp b/src/ui/controls/FUiCtrl_FastScrollIndex.cpp index 9e84e06..fe4ba90 100644 --- a/src/ui/controls/FUiCtrl_FastScrollIndex.cpp +++ b/src/ui/controls/FUiCtrl_FastScrollIndex.cpp @@ -148,74 +148,92 @@ result _FastScrollIndex::SetOmissionIndex(int indexCountMax) { int childCount = GetChildCount(); - int maxOmissionSlot = (indexCountMax - 1) / 2; - int omissionCount = childCount - indexCountMax; - int omittedNum = childCount - indexCountMax; - int additionalOmittedNum = 0; - int additionalOmissionStartIndex = 0; - if (maxOmissionSlot > 0) - { - omittedNum = (omissionCount / maxOmissionSlot) + 1; - additionalOmittedNum = (omissionCount % maxOmissionSlot); - additionalOmissionStartIndex = ((maxOmissionSlot - additionalOmittedNum) / 2); - } - - int i = 0; - int j = 0; - result r = E_SUCCESS; Tizen::Base::String omissionText(L"."); + result r = E_SUCCESS; + int i = 0; - if ((indexCountMax % 2) == 0) - { - r = AddChildIndex(GetChildIndex(i), true); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add child index."); - i++; - j++; - } - - while (i < childCount) + if (indexCountMax == 0) { - r = AddChildIndex(GetChildIndex(i), true); + r = AddChildIndex(&omissionText, null, true); SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add child index."); - i++; - j++; + _FastScrollIndex* pOmissionBaseIndex = GetChildIndex(i, true); + SysTryReturnResult(NID_UI_CTRL, pOmissionBaseIndex, GetLastResult(), "Failed to get the child index."); + pOmissionBaseIndex->SetOmitted(true); - if (i >= childCount) + for (int k = 0; k < childCount; k++) { - break; + pOmissionBaseIndex->AddOmissionChildIndex(GetChildIndex(i + k)); } + } + else + { + int maxOmissionSlot = (indexCountMax - 1) / 2; + int omissionCount = childCount - indexCountMax; + int omittedNum = childCount - indexCountMax; + int additionalOmittedNum = 0; + int additionalOmissionStartIndex = 0; + if (maxOmissionSlot > 0) + { + omittedNum = (omissionCount / maxOmissionSlot) + 1; + additionalOmittedNum = (omissionCount % maxOmissionSlot); + additionalOmissionStartIndex = ((maxOmissionSlot - additionalOmittedNum) / 2); + } + + int j = 0; - int omittedCount = omittedNum; - if ((additionalOmissionStartIndex < 0) && (additionalOmittedNum > 0)) + if ((indexCountMax % 2) == 0) { - omittedCount += 1; - additionalOmittedNum--; + r = AddChildIndex(GetChildIndex(i), true); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add child index."); + i++; + j++; } - if (omittedCount < 2) + while (i < childCount) { - if ((i % 2) > 0) + r = AddChildIndex(GetChildIndex(i), true); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add child index."); + + i++; + j++; + + if (i >= childCount) { - additionalOmissionStartIndex--; + break; } - continue; - } - r = AddChildIndex(&omissionText, null, true); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add child index."); + int omittedCount = omittedNum; + if ((additionalOmissionStartIndex < 0) && (additionalOmittedNum > 0)) + { + omittedCount += 1; + additionalOmittedNum--; + } - _FastScrollIndex* pOmissionBaseIndex = GetChildIndex(j, true); - SysTryReturnResult(NID_UI_CTRL, pOmissionBaseIndex, GetLastResult(), "Failed to get the child index."); - pOmissionBaseIndex->SetOmitted(true); - j++; - additionalOmissionStartIndex--; + if (omittedCount < 2) + { + if ((i % 2) > 0) + { + additionalOmissionStartIndex--; + } + continue; + } - for (int k = 0; k < omittedCount; k++) - { - pOmissionBaseIndex->AddOmissionChildIndex(GetChildIndex(i + k)); + r = AddChildIndex(&omissionText, null, true); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Failed to add child index."); + + _FastScrollIndex* pOmissionBaseIndex = GetChildIndex(j, true); + SysTryReturnResult(NID_UI_CTRL, pOmissionBaseIndex, GetLastResult(), "Failed to get the child index."); + pOmissionBaseIndex->SetOmitted(true); + j++; + additionalOmissionStartIndex--; + + for (int k = 0; k < omittedCount; k++) + { + pOmissionBaseIndex->AddOmissionChildIndex(GetChildIndex(i + k)); + } + i += omittedCount; } - i += omittedCount; } SetIndexType(FAST_SCROLL_INDEX_TYPE_OMISSION); diff --git a/src/ui/controls/FUiCtrl_FastScrollPresenter.cpp b/src/ui/controls/FUiCtrl_FastScrollPresenter.cpp index 0882d4f..e4406da 100644 --- a/src/ui/controls/FUiCtrl_FastScrollPresenter.cpp +++ b/src/ui/controls/FUiCtrl_FastScrollPresenter.cpp @@ -1682,9 +1682,9 @@ _FastScrollPopupView::DrawPopupIndexVe(int indexLevel, const _FastScrollIndex* p FloatRectangle bounds(veBounds.x, veBounds.y, veBounds.width, veBounds.height); float indexHeight = bounds.height / FASTSCROLL_POPUPINDEX_COUNT; - if (indexHeight < __viewConfig.__popupTextSize) + if (indexHeight < __viewConfig.__indexTextSize) { - indexHeight = __viewConfig.__popupTextSize; + indexHeight = __viewConfig.__indexTextSize; } FloatRectangle indexRect(0.0f, 0.0f, bounds.width, indexHeight); @@ -2168,6 +2168,7 @@ void _FastScrollPresenter::OnDraw(void) { // draw index views + bool availableTextSize = (__fastScroll.GetBoundsF().height >= __pViewConfig->__popupTextSize); int indexViewCount = GetIndexViewCount(); for (int i = 0; i < indexViewCount; i++) { @@ -2182,7 +2183,10 @@ _FastScrollPresenter::OnDraw(void) // draw the popup view if (__pPopupView && i <= __focusedIndexLevel) { - r = SetFontInfo(FONT_STYLE_PLAIN, __pViewConfig->__popupTextSize); + if (availableTextSize) + { + r = SetFontInfo(FONT_STYLE_PLAIN, __pViewConfig->__popupTextSize); + } SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Failed to set font.", GetErrorMessage(r)); __pPopupView->OnDraw(i, pIndexView->GetBaseIndex(), pIndexView->GetSelectedIndexInOmittedIndex()); } @@ -2714,7 +2718,7 @@ _FastScrollPresenter::SelectOnIndexViews(const FloatPoint& point, bool animation if (pSelectedIndex) { int childCount = pSelectedIndex->GetChildCount(); - if (childCount > 0) + if (childCount > 0 && (pSelectedIndex->GetOmitted() == false)) { _FastScrollIndexView* pSelectedIndexView = GetIndexView(selectedIndexLevel + 1); if (pSelectedIndexView) -- 2.7.4