--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <setting-font-font-size.h>
+
+typedef struct {
+ const char* key_font_name;
+ int font_size;
+} settings_font_size_table;
+
+static char* result_str_arr[] = {"Small","Normal","Large","Huge","Giant"};
+static const settings_font_size_table font_size_table[] = {
+ {"IDS_EMAIL_POP_GIANT_M_TEXTSIZE", SYSTEM_SETTINGS_FONT_SIZE_GIANT},
+ {"IDS_EMAIL_OPT_HUGE_M_TEXTSIZE", SYSTEM_SETTINGS_FONT_SIZE_HUGE},
+ {"IDS_ST_BODY_TEXTSTYLE_LARGE", SYSTEM_SETTINGS_FONT_SIZE_LARGE},
+ {"IDS_ST_BODY_NORMAL_T_PROFILE", SYSTEM_SETTINGS_FONT_SIZE_NORMAL},
+ {"IDS_ST_BODY_SMALL_M_TEXTSIZE", SYSTEM_SETTINGS_FONT_SIZE_SMALL},
+ {NULL, 0}
+ };
+
+
+
+#define STR_FONT_SIZE_CHANGING "Changing font size in Accessibility settings"\
+ " overrides font size of each application"
+
+static void __setting_font_font_size_click_softkey_back_cb(void *data, Evas_Object * obj, void *event_info);
+
+static int setting_font_font_size_create(void *cb);
+static int setting_font_font_size_destroy(void *cb);
+static int setting_font_font_size_update(void *cb);
+static int setting_font_font_size_cleanup(void *cb);
+
+setting_view setting_view_font_font_size = {
+ .create = setting_font_font_size_create,
+ .destroy = setting_font_font_size_destroy,
+ .update = setting_font_font_size_update,
+ .cleanup = setting_font_font_size_cleanup,
+};
+
+/* ***************************************************
+**
+** basic func
+**
+** **************************************************/
+
+static int setting_font_font_size_create(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ //error check
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ SettingFontUG *ad = (SettingFontUG *) cb;
+ Evas_Object *scroller;
+
+ retvm_if(ad->win_main_layout == NULL, SETTING_DRAW_ERR_FAIL_LOAD_EDJ,
+ "win_main_layout is NULL");
+
+ if (ad->view_to_load == &setting_view_font_font_size) {
+ ad->ly_main = setting_create_layout_navi_bar_genlist(ad->win_main_layout,
+ ad->win_get,
+ _("IDS_ST_MBODY_FONT_SIZE"),
+ _("IDS_COM_BODY_BACK"), NULL,
+ __setting_font_font_size_click_softkey_back_cb, NULL,
+ ad, &scroller, &ad->navibar);
+ } else {
+ setting_push_layout_navi_bar_genlist(ad->win_main_layout,
+ ad->win_get,
+ _("IDS_ST_MBODY_FONT_SIZE"),
+ _("IDS_COM_BODY_BACK"),
+ NULL,
+ __setting_font_font_size_click_softkey_back_cb,
+ NULL,
+ ad, &scroller, ad->navibar);
+ }
+ ad->size_rdg = elm_radio_add(scroller);
+ elm_radio_state_value_set(ad->size_rdg, -1);
+ Elm_Object_Item *item =
+ elm_genlist_item_append(scroller, &(ad->itc_seperator), NULL, NULL,
+ ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ int idx = 0;
+ Setting_GenGroupItem_Data *item_data;
+ while(font_size_table[idx].key_font_name) {
+ item_data = setting_create_Gendial_field_1radio(scroller, &(ad->itc_1text_1icon_2),
+ setting_font_font_size_list_mouse_up_cb,
+ ad->size_rdg,
+ SWALLOW_Type_1RADIO_1LABLE,
+ ad->size_rdg, font_size_table[idx].font_size,
+ font_size_table[idx].key_font_name,
+ NULL);
+ if(item_data) {
+ item_data->userdata = ad;
+ } else {
+ SETTING_TRACE_ERROR("item_data is null");
+ return SETTING_RETURN_FAIL;
+ }
+ idx++;
+ }
+
+ setting_create_Gendial_field_def(scroller, &(ad->itc_bg_1icon), NULL,
+ ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
+ NULL, NULL, 0, STR_FONT_SIZE_CHANGING, NULL,
+ NULL);
+
+ //update check status
+ setting_update_chk_status(ad->size_rdg, INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE);
+ setting_view_font_font_size.is_create = 1;
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_font_font_size_destroy(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ //error check
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ SettingFontUG *ad = (SettingFontUG *) cb;
+
+ if (ad->popup) {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+
+ if (ad->view_to_load == &setting_view_font_font_size) {
+ if (ad->ly_main) {
+ evas_object_del(ad->ly_main);
+ ad->ly_main = NULL;
+ }
+ } else {
+ elm_naviframe_item_pop(ad->navibar);
+ }
+ setting_view_font_font_size.is_create = 0;
+
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_font_font_size_update(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_font_font_size_cleanup(void *cb)
+{
+ //error check
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+ setting_font_font_size_destroy(cb);
+
+ return SETTING_RETURN_SUCCESS;
+}
+
+/* ***************************************************
+**
+** general func
+**
+** **************************************************/
+
+/* ***************************************************
+**
+** call back func
+**
+** **************************************************/
+
+static void __setting_font_font_size_click_softkey_back_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ //error check
+ ret_if(data == NULL);
+ SettingFontUG *ad = (SettingFontUG *) data;
+
+ if (ad->view_to_load == &setting_view_font_font_size) {
+
+ int err = 0;
+ int value = 0;
+ int ret = setting_get_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, &value, &err);
+ setting_retm_if(ret != 0, "fail to get vconf");
+
+ service_h svc;
+ if (service_create(&svc)) return;
+
+ service_add_extra_data(svc, "category", "FontSize");
+ service_add_extra_data(svc, "FontSize", result_str_arr[value]);
+
+ SETTING_TRACE(" SERVICE_ADD_EXTRA : %s %s","category", "FontSize");
+ SETTING_TRACE(" SERVICE_ADD_EXTRA : %s %s","FontSize", result_str_arr[value]);
+
+ ug_send_result(ad->ug, svc);
+ service_destroy(svc);
+
+ ug_destroy_me(ad->ug);
+ } else {
+ setting_view_change(&setting_view_font_font_size, &setting_view_font_main, ad);
+ }
+}
+
+/**
+ * font-popup
+ */
+#if DISABLED_CODE
+static void __font_size_ask_reboot_resp_cb(void *data, Evas_Object * obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ ret_if(!data);
+ Setting_GenGroupItem_Data *list_item = data;
+ int response_type = btn_type(obj);
+ ret_if(!list_item->userdata);
+ SettingFontUG *ad = (SettingFontUG *)list_item->userdata;
+
+ int err = -1;
+ int ret = -1;
+ if (POPUP_RESPONSE_OK == response_type) {
+ //set_font_dpi(list_item->chk_status);
+ ret = setting_set_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, list_item->chk_status, &err);
+ setting_retm_if(ret == -1, "Failed to set vconf");
+
+ font_size_set();
+
+ if (ad->view_to_load == &setting_view_font_font_size) {
+ // B/S occurs if UG quit without calling redraw handler
+ // ug_destroy_me(ad->ug);
+ } else {
+ setting_view_change(&setting_view_font_font_size, &setting_view_font_main, ad);
+ }
+ } else if (POPUP_RESPONSE_CANCEL == response_type) {
+ int old_value = -1;
+ ret = setting_get_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, &old_value, &err);
+ elm_radio_value_set(list_item->rgd, old_value);
+ }
+
+ if (ad->popup) {
+ evas_object_del(ad->popup);
+ ad->popup = NULL;
+ }
+ SETTING_TRACE_END;
+}
+#endif
+static void setting_font_font_size_list_mouse_up_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ /* error check */
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(item, 0);
+ Setting_GenGroupItem_Data *list_item =
+ (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
+
+ setting_retm_if(data == NULL, "Data parameter is NULL");
+ Evas_Object *radio = data;
+ elm_radio_value_set(radio, list_item->chk_status);
+ int err = 0;
+ int ret = 0;
+ int old_value = -1;
+ ret = setting_get_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, &old_value, &err);
+
+ if (old_value == list_item->chk_status) return;
+
+#if DISABLED_CODE
+ SettingFontUG *ad = (SettingFontUG *)list_item->userdata;
+
+ Evas_Object *popup = setting_create_popup_with_btn(list_item, (Evas_Object *)ug_get_window(),
+ NULL, SETTING_FONT_SIZE_ASK,
+ __font_size_ask_reboot_resp_cb,
+ 0, 2, _("IDS_COM_SK_YES"),_("IDS_COM_SK_NO"));
+ ret_if(!list_item->userdata);
+ ad->popup = popup;
+#else
+ ret = setting_set_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, list_item->chk_status, &err);
+ setting_retm_if(ret == -1, "Failed to set vconf");
+
+ font_size_set();
+#endif
+}
+
return list;
}
-void __setting_font_main_launch_ug_destroy_cb(ui_gadget_h ug, void *priv)
-{
- SETTING_TRACE_BEGIN;
- /* if(ug) ug_destroy(ug); */
- /* restore the '<-' button on the navigate bar */
- retm_if(priv == NULL, "priv is NULL");
- SettingFontUG *ad = (SettingFontUG *) priv;
- if (ug) {
- ug_destroy(ug);
- }
- Elm_Object_Item *navi_it = elm_naviframe_top_item_get(ad->navibar);
- retm_if(navi_it == NULL, "navi_it is NULL");
- Evas_Object *back_btn = elm_object_item_part_content_get(navi_it, "prev_btn");
-
- if (back_btn != NULL) {
- elm_object_style_set(back_btn, NAVI_BACK_BUTTON_STYLE); /* take into effect */
- }
-
- // update font size item
- int value = -1;
- int err = -1;
- int ret = setting_get_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, &value, &err);
- retm_if(ret != 0, "get vconf failed");
-
- if (ad->font_size) {
- G_FREE(ad->font_size->sub_desc);
- ad->font_size->sub_desc = g_strdup(__setting_font_main_get_font_size(value));
-
- elm_object_item_data_set(ad->font_size->item, ad->font_size);
- elm_genlist_item_update(ad->font_size->item);
- }
-}
-
-void __setting_font_main_launch_ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
-{
- SETTING_TRACE_BEGIN;
- retm_if(priv == NULL, "priv is NULL");
- SettingFontUG *ad = (SettingFontUG *) priv;
- Evas_Object *base = NULL;
- base = (Evas_Object *) ug_get_layout(ug);
- retm_if(base == NULL, "base is NULL");
-
- switch (mode) {
- case UG_MODE_FULLVIEW:
- evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(ad->win_get, base);
- evas_object_show(base);
- break;
- default:
- break;
- }
- SETTING_TRACE_END;
-}
-
-
-static void __setting_font_main_launch_ug(void *data)
-{
- SETTING_TRACE_BEGIN;
- /* error check */
- retm_if(data == NULL, "Data parameter is NULL");
-
- SettingFontUG *ad = (SettingFontUG *) data;
-
- service_h svc;
- if (service_create(&svc)) {
- return;
- }
-
- service_add_extra_data(svc, "caller", "font_size");
-
- struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
- if (!cbs) {
- SETTING_TRACE_ERROR("calloc failed");
- service_destroy(svc);
- return;
- }
- cbs->layout_cb = __setting_font_main_launch_ug_layout_cb;
- cbs->result_cb = NULL;
- cbs->destroy_cb = __setting_font_main_launch_ug_destroy_cb;
- cbs->priv = (void *)ad;
-
- ui_gadget_h ug = ug_create(ad->ug, "setting-accessibility-efl", UG_MODE_FULLVIEW, svc, cbs);
- if (NULL == ug) { /* error handling */
- SETTING_TRACE_ERROR("NULL == ug");
- }
-
- //bundle_free(b);
- service_destroy(svc);
- FREE(cbs);
-}
-
static void __setting_font_main_genlist_sel_cb(void *data, Evas_Object * obj, void *event_info)
{
//error check
SettingFontUG *ad = (SettingFontUG *)data;
if (ad->font_size == list_item) {
- __setting_font_main_launch_ug(ad);
+ setting_view_change(&setting_view_font_main, &setting_view_font_font_size, ad);
}
}
SETTING_TRACE_ERROR("get vconf failed");
}
-
-
ad->font_size = setting_create_Gendial_field_def(ad->genlist, &(ad->itc_2text_2),
__setting_font_main_genlist_sel_cb,
ad, SWALLOW_Type_INVALID, NULL,
if (ad->ly_main != NULL) {
evas_object_show(ad->ly_main);
+ int value = -1;
+ int err = -1;
+ int ret = setting_get_int_slp_key(INT_SLP_SETTING_ACCESSIBILITY_FONT_SIZE, &value, &err);
+ if (ret != 0) {
+ SETTING_TRACE_ERROR("get vconf failed");
+ }
+
+ if (ad->font_size) {
+ G_FREE(ad->font_size->sub_desc);
+ ad->font_size->sub_desc = (char *)g_strdup(__setting_font_main_get_font_size(value));
+ elm_object_item_data_set(ad->font_size->item, ad->font_size);
+ elm_genlist_item_update(ad->font_size->item);
+ }
+
setting_font_update_vconf_key(ad, SETTING_VCONF_INT_TYPE,
INT_SLP_SETTING_LCD_TIMEOUT_NORMAL);
}
#define UG_MODULE_API __attribute__ ((visibility("default")))
#endif
+setting_view *__get_font_view_to_load(void *data,service_h service)
+{
+ SETTING_TRACE_BEGIN;
+ setting_retvm_if((!data), NULL, "data is NULL");
+ SettingFontUG *fontUG = (SettingFontUG *)data;
+
+ setting_view_node_table_intialize();
+
+ char *category = NULL;
+ service_get_extra_data(service, "category", &category);
+
+ if (0 == safeStrCmp(category, "FontType")) {
+ SETTING_TRACE("LAUNCHED BY APP-CONTROL MODE");
+ fontUG->viewmode = FONT_SEL_VIEW_APPCONTROL;
+ // here
+ setting_view_node_table_register(&setting_view_font_font_size, &setting_view_font_main);
+ setting_view_node_table_register(&setting_view_font_main, NULL);
+ return &setting_view_font_main;
+ } else if (0 == safeStrCmp(category, "FontSize")) {
+ SETTING_TRACE("category = %s", category);
+ setting_view_node_table_register(&setting_view_font_font_size, NULL);
+ return &setting_view_font_font_size;
+ }else {
+ SETTING_TRACE("HERE ?? <<<<< ");
+ fontUG->viewmode = FONT_SIZE_AND_FONT_SEL_UG; // set default
+ setting_view_node_table_register(&setting_view_font_font_size, &setting_view_font_main);
+ setting_view_node_table_register(&setting_view_font_main, NULL);
+ return &setting_view_font_main;
+ }
+}
+
static void setting_font_ug_cb_resize(void *data, Evas *e, Evas_Object *obj,
void *event_info)
{
setting_create_Gendial_itc("dialogue/2text.3/expandable", &(fontUG->itc_2text_3_parent));
setting_create_Gendial_itc("dialogue/1text.1icon/expandable2", &(fontUG->itc_1icon_1text_sub));
setting_create_Gendial_itc("dialogue/2text.3", &(fontUG->itc_2text_2));
- setting_create_Gendial_itc("dialogue/1text.1icon.2", &(fontUG->itc_1text_1icon_2));
+ setting_create_Gendial_itc("dialogue/1text.1icon.6", &(fontUG->itc_1text_1icon_2));
setting_create_Gendial_itc("dialogue/title", &(fontUG->itc_group_item));
setting_create_Gendial_itc("multiline/1text", &(fontUG->itc_bg_1icon));
// view type checking
+ fontUG->view_to_load = __get_font_view_to_load(fontUG, service);
+ setting_retvm_if(NULL == fontUG->view_to_load, NULL, "NULL == fontUG->view_to_load");
- char *category = NULL;
- service_get_extra_data(service, "category", &category);
-
- if (0 == safeStrCmp(category, "FontType")) {
- SETTING_TRACE("LAUNCHED BY APP-CONTROL MODE");
- fontUG->viewmode = FONT_SEL_VIEW_APPCONTROL;
- // here
- setting_view_create(&setting_view_font_main, (void *)fontUG);
- } else {
- SETTING_TRACE("HERE ?? <<<<< ");
- fontUG->viewmode = FONT_SIZE_AND_FONT_SEL_UG; // set default
- /* creating a view. */
- setting_view_create(&setting_view_font_main, (void *)fontUG);
- }
-
+ setting_view_node_set_cur_view(fontUG->view_to_load);
+ setting_view_create(fontUG->view_to_load, (void *)fontUG);
/* creating a view. */
//setting_view_create(&setting_view_font_main, (void *)fontUG);
fontUG->ug = ug;
/* delete the allocated objects. */
- setting_view_destroy(&setting_view_font_main, fontUG);
+ if (fontUG->view_to_load == &setting_view_font_font_size) {
+ setting_view_destroy(&setting_view_font_font_size, fontUG);
+ } else {
+ setting_view_destroy(&setting_view_font_font_size, fontUG);
+ setting_view_destroy(&setting_view_font_main, fontUG);
+ }
+
if (NULL != ug_get_layout(fontUG->ug)) {
evas_object_hide((Evas_Object *) ug_get_layout(fontUG->ug));
evas_object_del((Evas_Object *) ug_get_layout(fontUG->ug));