Do this better

This commit is contained in:
Alastair Poole 2018-08-01 23:23:44 +01:00
parent ab8baa1c22
commit 21f29302cb
2 changed files with 27 additions and 6 deletions

View File

@ -1488,7 +1488,7 @@ Evas_Object *edi_main_win_get(void)
Eina_Bool Eina_Bool
edi_open(const char *inputpath) edi_open(const char *inputpath)
{ {
Evas_Object *win, *hbx, *vbx, *tb, *content; Evas_Object *table, *win, *bg, *hbx, *vbx, *tb, *content;
char *winname; char *winname;
char *path; char *path;
@ -1513,14 +1513,29 @@ edi_open(const char *inputpath)
evas_object_smart_callback_add(win, "delete,request", _edi_exit, NULL); evas_object_smart_callback_add(win, "delete,request", _edi_exit, NULL);
evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _edi_resize_cb, NULL); evas_object_event_callback_add(win, EVAS_CALLBACK_RESIZE, _edi_resize_cb, NULL);
table = elm_table_add(win);
evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(table);
hbx = elm_box_add(win); hbx = elm_box_add(win);
_edi_main_box = hbx; _edi_main_box = hbx;
elm_box_horizontal_set(hbx, EINA_TRUE); elm_box_horizontal_set(hbx, EINA_TRUE);
evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_weight_set(hbx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(hbx, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_win_resize_object_add(win, hbx);
evas_object_show(hbx); evas_object_show(hbx);
bg = elm_bg_add(win);
evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_show(bg);
elm_win_resize_object_add(win, table);
elm_table_pack(table, bg, 0, 0, 1, 1);
elm_table_pack(table, hbx, 0, 0, 1, 1);
evas_object_data_set(win, "background", bg);
evas_object_data_set(win, "mainbox", hbx);
edi_theme_window_alpha_set(); edi_theme_window_alpha_set();
tb = edi_toolbar_setup(hbx); tb = edi_toolbar_setup(hbx);

View File

@ -11,24 +11,30 @@
#include "edi_private.h" #include "edi_private.h"
static Eina_List *_edi_themes = NULL; static Eina_List *_edi_themes = NULL;
// we are hooking into Efl for now... // we are hooking into Efl for now...
Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj); Efl_Ui_Theme_Apply efl_ui_widget_theme_apply(Eo *obj);
void void
edi_theme_window_alpha_set(void) edi_theme_window_alpha_set(void)
{ {
Evas_Object *win; Evas_Object *win, *bg, *mainbox;
Eina_Bool enabled = _edi_project_config->gui.translucent; Eina_Bool enabled = _edi_project_config->gui.translucent;
win = edi_main_win_get(); win = edi_main_win_get();
elm_win_alpha_set(win, enabled); elm_win_alpha_set(win, enabled);
bg = evas_object_data_get(win, "background");
if (enabled) if (enabled)
efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, _edi_project_config->gui.alpha); efl_gfx_color_set(bg, 95, 95, 95, _edi_project_config->gui.alpha);
else else
efl_gfx_color_set(efl_part(win, "background"), 64, 64, 64, 255); efl_gfx_color_set(bg, 95, 95, 95, 255);
mainbox = evas_object_data_get(win, "mainbox");
if (enabled)
efl_gfx_color_set(mainbox, 255, 255, 255, _edi_project_config->gui.alpha);
else
efl_gfx_color_set(mainbox, 255, 255, 255, 255);
} }
void edi_theme_elm_code_alpha_set(Evas_Object *obj) void edi_theme_elm_code_alpha_set(Evas_Object *obj)