Toolbar: Change position on-the-fly.
Move, hide and show the toolbar as and when config settings change.
This commit is contained in:
parent
9daae59a0f
commit
74ce34f773
|
@ -55,8 +55,13 @@ 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;
|
||||
|
||||
int _edi_log_dom = -1;
|
||||
|
||||
static void
|
||||
edi_toolbar_setup(void);
|
||||
|
||||
static void
|
||||
_edi_active_process_icons_set(Eina_Bool active)
|
||||
{
|
||||
|
@ -1338,6 +1343,61 @@ _edi_toolbar_item_add(Evas_Object *tb, const char *icon, const char *name, Evas_
|
|||
return content;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_toolbar_horizontal_set(Eina_Bool is_horizontal)
|
||||
{
|
||||
_edi_toolbar_is_horizontal = is_horizontal;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_edi_toolbar_horizontal_get()
|
||||
{
|
||||
return _edi_toolbar_is_horizontal;
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_toolbar_visible_set(Eina_Bool visible)
|
||||
{
|
||||
elm_box_unpack(_edi_main_box, _edi_toolbar_main_box);
|
||||
|
||||
if (visible)
|
||||
{
|
||||
evas_object_show(_edi_toolbar_main_box);
|
||||
evas_object_show(_edi_toolbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_hide(_edi_toolbar_main_box);
|
||||
evas_object_hide(_edi_toolbar);
|
||||
}
|
||||
|
||||
if (visible)
|
||||
{
|
||||
elm_box_pack_start(_edi_main_box, _edi_toolbar_main_box);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_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;
|
||||
|
||||
// Remove the existing toolbar.
|
||||
elm_box_unpack(_edi_main_box, _edi_toolbar_main_box);
|
||||
evas_object_del(_edi_toolbar);
|
||||
|
||||
// Create our toolbar.
|
||||
edi_toolbar_setup();
|
||||
elm_box_recalculate(_edi_main_box);
|
||||
|
||||
// Toolbar has changed, update current state.
|
||||
_edi_toolbar_horizontal_set(_edi_project_config->gui.toolbar_horizontal);
|
||||
}
|
||||
|
||||
static void
|
||||
edi_toolbar_setup(void)
|
||||
{
|
||||
|
@ -1470,34 +1530,12 @@ _edi_resize_cb(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj,
|
|||
_edi_project_config_save();
|
||||
}
|
||||
|
||||
static void
|
||||
_edi_toolbar_visible_set(Eina_Bool visible)
|
||||
{
|
||||
elm_box_unpack(_edi_main_box, _edi_toolbar_main_box);
|
||||
|
||||
if (visible)
|
||||
{
|
||||
evas_object_show(_edi_toolbar_main_box);
|
||||
evas_object_show(_edi_toolbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
evas_object_hide(_edi_toolbar_main_box);
|
||||
evas_object_hide(_edi_toolbar);
|
||||
}
|
||||
|
||||
if (visible)
|
||||
{
|
||||
elm_box_pack_start(_edi_main_box, _edi_toolbar_main_box);
|
||||
}
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_edi_config_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
||||
{
|
||||
edi_theme_window_alpha_set();
|
||||
|
||||
_edi_toolbar_visible_set(!_edi_project_config->gui.toolbar_hidden);
|
||||
_edi_toolbar_config_changed();
|
||||
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
@ -1682,6 +1720,8 @@ edi_open(const char *inputpath)
|
|||
evas_object_data_set(win, "background", bg);
|
||||
evas_object_data_set(win, "mainbox", vbx);
|
||||
|
||||
_edi_toolbar_horizontal_set( _edi_project_config->gui.toolbar_horizontal);
|
||||
|
||||
edi_toolbar_setup();
|
||||
|
||||
_edi_menu_setup(win);
|
||||
|
|
|
@ -373,13 +373,6 @@ _edi_settings_display_create(Evas_Object *parent)
|
|||
_edi_settings_toolbar_horizontal_cb, NULL);
|
||||
elm_table_pack(table, check, 1, 5, 1, 1);
|
||||
evas_object_show(check);
|
||||
|
||||
label = elm_label_add(table);
|
||||
elm_object_text_set(label, _("(Requires Restart)"));
|
||||
evas_object_size_hint_align_set(label, 0.2, EVAS_HINT_EXPAND);
|
||||
elm_table_pack(table, label, 1, 5, 1, 1);
|
||||
evas_object_show(label);
|
||||
|
||||
elm_box_pack_end(box, table);
|
||||
|
||||
label = elm_label_add(table);
|
||||
|
|
Loading…
Reference in New Issue