Font accessibility changes
authorrahul.dutt <rahul.dutt@samsung.com>
Mon, 17 Jun 2013 11:03:41 +0000 (16:33 +0530)
committerrahul.dutt <rahul.dutt@samsung.com>
Mon, 17 Jun 2013 11:03:41 +0000 (16:33 +0530)
Change-Id: Ib6b4bc1b773f6822cb1aab8c2a100b94fb03c758

inc/GlDropDownCustomItem.h
inc/GlRadioCustomItem.h
inc/GlSettingMainForm.h
inc/GlSettingToggleCustomItem.h
src/GlAlbumListForm.cpp
src/GlDropDownCustomItem.cpp
src/GlRadioCustomItem.cpp
src/GlSettingMainForm.cpp
src/GlSettingToggleCustomItem.cpp

index 7d6481e..2d1c118 100644 (file)
@@ -38,12 +38,12 @@ public:
        DropDownCustomItem(void);
        virtual ~DropDownCustomItem(void);
 
-       result Construct(int width);
+       result Construct(int width , int height);
 
        DropDownItemState GetCurState(void) const;
        Tizen::Base::String GetMainText(void) const;
        Tizen::Base::String GetSubText(void) const;
-       result Make(void);
+       result Make(int fontsize, int itemHeight);
        void SetCurState(const DropDownItemState);
        void SetMainText(const Tizen::Base::String& text);
        void SetSubText(const Tizen::Base::String& text);
index f6abfa5..c22b810 100644 (file)
@@ -36,7 +36,7 @@ public:
 
        Tizen::Base::String GetText(void) const;
        bool GetSelected(void) const;
-       result Make(void);
+       result Make(int fontSize);
        void SetText(const Tizen::Base::String& text);
        void SetSelected(const bool selectedValue);
 
index ebfe00c..37947e8 100644 (file)
@@ -60,6 +60,8 @@ class SettingMainForm
        , public Tizen::Ui::Controls::IGroupedListViewItemProvider
        , public Tizen::Ui::Controls::IFormBackEventListener
        , public Tizen::Ui::Scenes::ISceneEventListener
+       , public Tizen::System::ISettingEventListener
+
 {
 public:
        SettingMainForm(void);
@@ -93,6 +95,8 @@ public:
        virtual void OnSceneDeactivated(const Tizen::Ui::Scenes::SceneId& currentSceneId,
                        const Tizen::Ui::Scenes::SceneId& nextSceneId);
 
+       virtual void OnSettingChanged(Tizen::Base::String& key);
+
        class SettingItemInfo
        {
        public:
index 0b2af4a..39df99b 100644 (file)
@@ -79,7 +79,7 @@ public:
         * @exception   E_SYSTEM                        A system error has occurred.
         *
         */
-       result Make(void);
+       result Make(int fontSize);
 
        /**
         * @brief The method used to set the text of CustomItem
index e04444d..dc4c9ec 100644 (file)
@@ -218,7 +218,6 @@ AlbumListForm::InitializeFooter(void)
                            __pOptionMenu = new (std::nothrow) OptionMenu();
                            __pOptionMenu->Construct();
                            __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"),IDA_FOOTER_EDIT);
-                           __pOptionMenu->AddItem(ResourceManager::GetString(L"IDS_COM_HEADER_EDIT"), IDA_FOOTER_EDIT);
                            __pOptionMenu->SetShowState(false);
                            __pOptionMenu->AddActionEventListener(*this);
                            SetFormMenuEventListener(this);
index bf0cfbf..433c04d 100644 (file)
@@ -46,10 +46,10 @@ DropDownCustomItem::~DropDownCustomItem(void)
 }
 
 result
-DropDownCustomItem::Construct(int width)
+DropDownCustomItem::Construct(int width , int height)
 {
        __width = width;
-       __height = 140;
+       __height = height + 28 ;
        Dimension dim(__width, __height);
        result r = CustomItem::Construct(dim, LIST_ANNEX_STYLE_NORMAL);
        return r;
@@ -80,15 +80,20 @@ DropDownCustomItem::GetSubText(void) const
 }
 
 result
-DropDownCustomItem::Make(void)
+DropDownCustomItem::Make(int fontsize, int itemHeight)
 {
        AppLogDebug("DropDownCustomItem::Make entered");
 
+       int xMargin = 26;
+       int yMargin = 22;
+       int subTextHeight = 42 ;
+       int mainTextHeight = itemHeight - yMargin - subTextHeight ;
+
        Tizen::Graphics::Bitmap* pDropperBitmapNormal = null;
 
-       AddElement(Rectangle(26, 22, __width - 126, 54), IDA_FORMAT_MAIN_STRING,__mainText, 44,
+       AddElement(Rectangle(xMargin, yMargin, __width - 126, mainTextHeight ), IDA_FORMAT_MAIN_STRING,__mainText, fontsize,
                        CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT, CUSTOM_COLOR_TRANSPARENT);
-       AddElement(Rectangle(26, 76, __width - 126, 42), IDA_FORMAT_SUB_STRING,__subText, 34, CUSTOM_COLOR_GREY,
+       AddElement(Rectangle(xMargin, yMargin + mainTextHeight , __width - 126, subTextHeight), IDA_FORMAT_SUB_STRING,__subText, 34, CUSTOM_COLOR_GREY,
                        CUSTOM_COLOR_GREY,CUSTOM_COLOR_GREY);
 
        AppResource* pAppResource = UiApp::GetInstance()->GetAppResource();
index 2ad2eac..572891f 100644 (file)
@@ -70,7 +70,7 @@ RadioCustomItem::GetText(void) const
 }
 
 result
-RadioCustomItem::Make(void)
+RadioCustomItem::Make(int fontSize)
 {
        result r = E_FAILURE;
        Color textColor = CUSTOM_COLOR_LISTVIEW_TEXT2;
@@ -93,7 +93,7 @@ RadioCustomItem::Make(void)
                AppLogDebug("RadioCustomItem::the text is %ls", __text.GetPointer());
 
                r = AddElement(Rectangle(26 + pBitmap->GetWidth() + 10, 5, __width - 26 - 10 - pBitmap->GetWidth(),
-                               __height), IDA_FORMAT_STRING, __text, 40, textColor, textColor, textColor, true);
+                               __height), IDA_FORMAT_STRING, __text, fontSize , textColor, textColor, textColor, true);
                delete pBitmap;
        }
        TryCatch(!IsFailed(r),,"RadioCustomItem::the value is %s",GetErrorMessage(r));
index efe7551..e829eef 100644 (file)
@@ -72,6 +72,7 @@ SettingMainForm::OnInitializing(void)
 {
        AppLogDebug("ENTER");
        __pPresentationModel = SettingPresentationModel::GetInstance();
+       SettingInfo::AddSettingEventListener(*this);
 
        InitializeSettingValues();
 
@@ -436,10 +437,50 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
        effectiveIndex = effectiveIndex + itemIndex;
        AppLogDebug("SettingMainForm::CreateItem --> groupIndex : %d, itemIndex: %d itemWidth: %d effectiveIndex %d", groupIndex, itemIndex, itemWidth, effectiveIndex);
 
+       String fontSizeStr;
+       int fontSize = 0;
+       int itemHeight = 0;
+       int defaultHeight = 112 ;
+       int defaultFontSize = 44 ;
+
+       SettingInfo::GetValue("http://tizen.org/setting/font.size", fontSizeStr);
+       AppLog("the font value is %S",fontSizeStr.GetPointer());
+
+       if(fontSizeStr == "medium")
+       {
+               fontSize = 44;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "huge")
+       {
+               fontSize =  81;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "giant")
+       {
+               fontSize = 98;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "small")
+       {
+               fontSize = 36;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else if(fontSizeStr == "large")
+       {
+               fontSize = 64;
+               itemHeight = defaultHeight + ( fontSize - defaultFontSize);
+       }
+       else
+       {
+               fontSize = 44;
+       }
+
+
        if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_TOGGLE)
        {
                SettingToggleCustomItem* pItem = new (std::nothrow) SettingToggleCustomItem();
-               r = pItem->Construct(itemWidth, 112);
+               r = pItem->Construct(itemWidth, itemHeight);
 
                if (IsFailed(r))
                {
@@ -456,14 +497,14 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
 
                pItem->SetText(settingInfo[effectiveIndex].titleText);
-               pItem->Make();
+               pItem->Make(fontSize);
 
                return pItem;
        }
        else if (settingInfo[effectiveIndex].itemType == ITEM_TYPE_DROPDOWN)
        {
                DropDownCustomItem* pItem = new (std::nothrow) DropDownCustomItem();
-               r = pItem->Construct(itemWidth);
+               r = pItem->Construct(itemWidth,itemHeight);
                if (IsFailed(r))
                {
                        delete pItem;
@@ -484,7 +525,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                        pItem->SetCurState(DROP_DOWN_ITEM_STATE_CLOSED);
                }
 
-               r = pItem->Make();
+               r = pItem->Make(fontSize,itemHeight);
 
                if (IsFailed(r))
                {
@@ -513,7 +554,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                }
                else
                {
-                       pItem->Construct(itemWidth, 112);
+                       pItem->Construct(itemWidth, itemHeight);
                }
 
                pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, ITEM_RADIO_ITEM_BACKGROUND_COLOR);
@@ -523,7 +564,7 @@ SettingMainForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
                AppLogDebug("effectiveIndex %d SettingInfo[effectiveIndex].isSelected %d", effectiveIndex, settingInfo[effectiveIndex].isSelected);
 
                pItem->SetSelected(settingInfo[effectiveIndex].isSelected);
-               pItem->Make();
+               pItem->Make(fontSize);
 
                return pItem;
        }
@@ -735,3 +776,15 @@ SettingMainForm::SettingItemInfo::SettingItemInfo(void)
        , isSelected(false)
 {
 }
+
+
+void
+SettingMainForm::OnSettingChanged(String& key)
+{
+       AppLogDebug("ENTER");
+       if (key == L"http://tizen.org/setting/font.size")
+       {
+               __pList->UpdateList();
+       }
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
index 9d403ea..94c0bc3 100644 (file)
@@ -68,15 +68,14 @@ SettingToggleCustomItem::GetText(void) const
 }
 
 result
-SettingToggleCustomItem::Make(void)
+SettingToggleCustomItem::Make(int fontSize)
 {
        const Color textColor = CUSTOM_COLOR_TRANSPARENT;
        const Color pressedTextColor = CUSTOM_COLOR_TRANSPARENT;
        const int X_Margin = 26;
        const int Y_Margin = 26;
-       const int textSize = 40;
 
-       AddElement(Rectangle(X_Margin, Y_Margin, __width - 60, 60), IDA_FORMAT_STRING, __text, textSize, textColor, pressedTextColor, pressedTextColor, true);
+       AddElement(Rectangle(X_Margin, Y_Margin, __width - 60, __height - 2* Y_Margin), IDA_FORMAT_STRING, __text, fontSize, textColor, pressedTextColor, pressedTextColor, true);
 
        return E_SUCCESS;
 }