forked from enlightenment/edi
settings: SHow toolbar text setting.
In the vain of every other EFL application and Enlightenment, let's start adding an insane amount of settings [sic]. In sincerity, people like or don't like it, let's make it an option.
This commit is contained in:
parent
03e8564cb4
commit
c618883960
|
@ -287,6 +287,7 @@ _edi_config_init(void)
|
|||
EDI_CONFIG_VAL(D, T, gui.tabstop, EET_T_UINT);
|
||||
EDI_CONFIG_VAL(D, T, gui.toolbar_hidden, EET_T_UCHAR);
|
||||
EDI_CONFIG_VAL(D, T, gui.toolbar_horizontal, EET_T_UCHAR);
|
||||
EDI_CONFIG_VAL(D, T, gui.toolbar_text_visible, EET_T_UCHAR);
|
||||
EDI_CONFIG_VAL(D, T, gui.internal_icons, EET_T_UCHAR);
|
||||
EDI_CONFIG_VAL(D, T, gui.tab_inserts_spaces, EET_T_UCHAR);
|
||||
|
||||
|
@ -524,6 +525,7 @@ _edi_project_config_load()
|
|||
_edi_project_config->gui.internal_icons = EINA_TRUE;
|
||||
_edi_project_config->gui.toolbar_hidden = EINA_FALSE;
|
||||
_edi_project_config->gui.toolbar_horizontal = EINA_FALSE;
|
||||
_edi_project_config->gui.toolbar_text_visible = EINA_TRUE;
|
||||
IFPCFGEND;
|
||||
|
||||
IFPCFG(0x0002);
|
||||
|
@ -688,7 +690,7 @@ _edi_project_config_panel_remove_all(void)
|
|||
count = eina_list_count(_edi_project_config->panels);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
_edi_project_config_panel_remove(0);
|
||||
_edi_project_config_panel_remove(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ struct _Edi_Project_Config
|
|||
|
||||
Eina_Bool toolbar_hidden;
|
||||
Eina_Bool toolbar_horizontal;
|
||||
Eina_Bool toolbar_text_visible;
|
||||
|
||||
Eina_Bool tab_inserts_spaces;
|
||||
} gui;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ static Evas_Object *_edi_menu_init, *_edi_menu_commit, *_edi_menu_push, *_edi_me
|
|||
static Evas_Object *_edi_menu_save, *_edi_toolbar_save;
|
||||
static Evas_Object *_edi_main_win, *_edi_main_box;
|
||||
static Evas_Object *_edi_toolbar_run, *_edi_toolbar_terminate, *_edi_toolbar_hbx, *_edi_toolbar_vbx, *_edi_toolbar_main_box;
|
||||
static Eina_Bool _edi_toolbar_is_horizontal;
|
||||
static Eina_Bool _edi_toolbar_is_horizontal, _edi_toolbar_text_visible;
|
||||
|
||||
int _edi_log_dom = -1;
|
||||
|
||||
|
@ -1340,11 +1340,15 @@ _edi_toolbar_item_add(Evas_Object *tb, const char *icon, const char *name, Evas_
|
|||
{
|
||||
Evas_Object *content;
|
||||
Elm_Object_Item *tb_it;
|
||||
const char *item_name = NULL;
|
||||
|
||||
if (_edi_project_config->gui.toolbar_text_visible)
|
||||
item_name = name;
|
||||
|
||||
if (!_edi_project_config->gui.internal_icons)
|
||||
tb_it = elm_toolbar_item_append(tb, icon, name, func, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, icon, item_name, func, NULL);
|
||||
else
|
||||
tb_it = elm_toolbar_item_append(tb, edi_theme_icon_path_get(icon), name, func, NULL);
|
||||
tb_it = elm_toolbar_item_append(tb, edi_theme_icon_path_get(icon), item_name, func, NULL);
|
||||
|
||||
content = elm_toolbar_item_object_get(tb_it);
|
||||
elm_object_tooltip_text_set(content, name);
|
||||
|
@ -1352,6 +1356,18 @@ _edi_toolbar_item_add(Evas_Object *tb, const char *icon, const char *name, Evas_
|
|||
return content;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_toolbar_text_visible_set(Eina_Bool visible)
|
||||
{
|
||||
_edi_toolbar_text_visible = visible;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_edi_toolbar_text_visible_get(void)
|
||||
{
|
||||
return _edi_toolbar_text_visible;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_toolbar_horizontal_set(Eina_Bool is_horizontal)
|
||||
{
|
||||
|
@ -1392,8 +1408,11 @@ _edi_toolbar_config_changed()
|
|||
_edi_toolbar_visible_set(!_edi_project_config->gui.toolbar_hidden);
|
||||
|
||||
// No change.
|
||||
if (_edi_project_config->gui.toolbar_horizontal == _edi_toolbar_horizontal_get())
|
||||
return;
|
||||
if ((_edi_project_config->gui.toolbar_horizontal == _edi_toolbar_horizontal_get()) &&
|
||||
(_edi_project_config->gui.toolbar_text_visible == _edi_toolbar_text_visible_get()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the existing toolbar.
|
||||
elm_box_unpack(_edi_main_box, _edi_toolbar_main_box);
|
||||
|
@ -1405,6 +1424,7 @@ _edi_toolbar_config_changed()
|
|||
|
||||
// Toolbar has changed, update current state.
|
||||
_edi_toolbar_horizontal_set(_edi_project_config->gui.toolbar_horizontal);
|
||||
_edi_toolbar_text_visible_set(_edi_project_config->gui.toolbar_text_visible);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1737,6 +1757,7 @@ edi_open(const char *inputpath)
|
|||
evas_object_data_set(win, "mainbox", vbx);
|
||||
|
||||
_edi_toolbar_horizontal_set(_edi_project_config->gui.toolbar_horizontal);
|
||||
_edi_toolbar_text_visible_set(_edi_project_config->gui.toolbar_text_visible);
|
||||
|
||||
edi_toolbar_setup();
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ _edi_settings_toolbar_hidden_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
|
||||
static void
|
||||
_edi_settings_toolbar_horizontal_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event EINA_UNUSED)
|
||||
void *event EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *check;
|
||||
|
||||
|
@ -124,6 +124,17 @@ _edi_settings_toolbar_horizontal_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
_edi_project_config_save();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_settings_toolbar_text_visible_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
||||
void *event EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *check;
|
||||
|
||||
check = (Evas_Object *)obj;
|
||||
_edi_project_config->gui.toolbar_text_visible = elm_check_state_get(check);
|
||||
_edi_project_config_save();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_settings_font_choose_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -260,7 +271,7 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
evas_object_show(label);
|
||||
|
||||
button = elm_button_add(table);
|
||||
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0); // EVAS_HINT_EXPAND);
|
||||
evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, 0);
|
||||
evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
evas_object_show(button);
|
||||
preview = _edi_settings_font_preview_add(table, _edi_project_config->font.name,
|
||||
|
@ -376,7 +387,7 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
elm_box_pack_end(box, table);
|
||||
|
||||
label = elm_label_add(table);
|
||||
elm_object_text_set(label, _("Internal Icons"));
|
||||
elm_object_text_set(label, _("Show Toolbar Text"));
|
||||
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
|
||||
elm_table_pack(table, label, 0, 6, 1, 1);
|
||||
evas_object_show(label);
|
||||
|
@ -386,14 +397,26 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.5);
|
||||
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
|
||||
evas_object_smart_callback_add(check, "changed",
|
||||
_edi_settings_internal_icons_changed_cb, NULL);
|
||||
_edi_settings_toolbar_text_visible_cb, NULL);
|
||||
evas_object_show(check);
|
||||
elm_table_pack(table, check, 1, 6, 1, 1);
|
||||
|
||||
label = elm_label_add(table);
|
||||
elm_object_text_set(label, _("Internal Icons"));
|
||||
evas_object_size_hint_align_set(label, EVAS_HINT_EXPAND, 0.5);
|
||||
elm_table_pack(table, label, 0, 7, 1, 1);
|
||||
evas_object_show(label);
|
||||
|
||||
check = elm_check_add(box);
|
||||
elm_check_state_set(check, _edi_project_config->gui.internal_icons);
|
||||
evas_object_size_hint_weight_set(check, EVAS_HINT_EXPAND, 0.5);
|
||||
evas_object_size_hint_align_set(check, EVAS_HINT_FILL, 0.0);
|
||||
evas_object_smart_callback_add(check, "changed",
|
||||
_edi_settings_internal_icons_changed_cb, NULL);
|
||||
elm_table_pack(table, check, 1, 7, 1, 1);
|
||||
evas_object_show(check);
|
||||
elm_box_pack_end(box, table);
|
||||
|
||||
|
||||
// END OF ALPHA SELECTOR
|
||||
|
||||
frame = _edi_settings_panel_create(parent, _("Editor"));
|
||||
box = elm_object_part_content_get(frame, "default");
|
||||
elm_box_pack_end(container, frame);
|
||||
|
|
Loading…
Reference in New Issue