win: use elm_layout for the base objects

terminology-1.5
Boris Faure 4 years ago
parent 5c0167c5e1
commit 3c12162dcf
  1. 26
      src/bin/utils.c
  2. 1
      src/bin/utils.h
  3. 109
      src/bin/win.c
  4. 1
      src/bin/win.h

@ -49,6 +49,32 @@ theme_apply(Evas_Object *edje, const Config *config, const char *group)
return EINA_FALSE;
}
Eina_Bool
theme_apply_elm(Evas_Object *layout, const Config *config, const char *group)
{
const char *errmsg;
Evas_Object *edje;
EINA_SAFETY_ON_NULL_RETURN_VAL(layout, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(config, EINA_FALSE);
EINA_SAFETY_ON_NULL_RETURN_VAL(group, EINA_FALSE);
if (elm_layout_file_set(layout, config_theme_path_get(config), group))
return EINA_TRUE;
edje = elm_layout_edje_get(layout);
errmsg = edje_load_error_str(edje_object_load_error_get(edje));
INF("Cannot find theme: file=%s group=%s error='%s', trying default...",
config_theme_path_get(config), group, errmsg);
if (elm_layout_file_set(layout, config_theme_path_default_get(config), group))
return EINA_TRUE;
errmsg = edje_load_error_str(edje_object_load_error_get(edje));
ERR(_("Could not load any theme for group=%s: %s"), group, errmsg);
return EINA_FALSE;
}
Eina_Bool
theme_apply_default(Evas_Object *edje, const Config *config, const char *group)
{

@ -5,6 +5,7 @@
#include "config.h"
Eina_Bool theme_apply(Evas_Object *edje, const Config *config, const char *group);
Eina_Bool theme_apply_elm(Evas_Object *edje, const Config *config, const char *group);
Eina_Bool theme_apply_default(Evas_Object *edje, const Config *config, const char *group);
void theme_reload(Evas_Object *edje);
void theme_auto_reload_enable(Evas_Object *edje);

@ -385,11 +385,11 @@ _solo_bell(Term_Container *tc,
if (!tc->wn->config->disable_visual_bell)
{
edje_object_signal_emit(term->bg, "bell", "terminology");
edje_object_signal_emit(term->base, "bell", "terminology");
elm_layout_signal_emit(term->base, "bell", "terminology");
if (tc->wn->config->bell_rings)
{
edje_object_signal_emit(term->bg, "bell,ring", "terminology");
edje_object_signal_emit(term->base, "bell,ring", "terminology");
elm_layout_signal_emit(term->base, "bell,ring", "terminology");
}
}
tc->parent->bell(tc->parent, tc);
@ -419,7 +419,7 @@ _solo_unfocus(Term_Container *tc, Term_Container *relative)
if (!term->config->disable_focus_visuals)
{
edje_object_signal_emit(term->bg, "focus,out", "terminology");
edje_object_signal_emit(term->base, "focus,out", "terminology");
elm_layout_signal_emit(term->base, "focus,out", "terminology");
}
}
@ -454,12 +454,12 @@ _solo_focus(Term_Container *tc, Term_Container *relative)
if (term->config->disable_focus_visuals)
{
edje_object_signal_emit(term->bg, "focused,set", "terminology");
edje_object_signal_emit(term->base, "focused,set", "terminology");
elm_layout_signal_emit(term->base, "focused,set", "terminology");
}
else
{
edje_object_signal_emit(term->bg, "focus,in", "terminology");
edje_object_signal_emit(term->base, "focus,in", "terminology");
elm_layout_signal_emit(term->base, "focus,in", "terminology");
}
if (term->wn->cmdbox)
elm_object_focus_set(term->wn->cmdbox, EINA_FALSE);
@ -574,7 +574,7 @@ _cb_win_focus_in(void *data,
if (!term->config->disable_focus_visuals)
{
edje_object_signal_emit(term->bg, "focus,out", "terminology");
edje_object_signal_emit(term->base, "focus,out", "terminology");
elm_layout_signal_emit(term->base, "focus,out", "terminology");
}
}
term = term_mouse;
@ -624,8 +624,6 @@ _win_is_focused(Win *wn)
int win_term_set(Win *wn, Term *term)
{
Term_Container *tc_win = NULL, *tc_child = NULL;
Evas_Object *base = win_base_get(wn);
Evas *evas = evas_object_evas_get(base);
tc_child = _solo_new(term, wn);
if (!tc_child)
@ -635,7 +633,7 @@ int win_term_set(Win *wn, Term *term)
tc_win->swallow(tc_win, NULL, tc_child);
_cb_size_hint(term, evas, term->termio, NULL);
_cb_size_hint(term, NULL, term->termio, NULL);
return 0;
@ -645,12 +643,6 @@ bad:
}
Evas_Object *
win_base_get(const Win *wn)
{
return wn->base;
}
Config *
win_config_get(const Win *wn)
{
@ -673,13 +665,14 @@ static void
_win_trans(Win *wn, Term *term, Eina_Bool trans)
{
Edje_Message_Int msg;
Evas_Object *edje = elm_layout_edje_get(term->base);
if (term->config->translucent)
msg.val = term->config->opacity;
else
msg.val = 100;
edje_object_message_send(term->bg, EDJE_MESSAGE_INT, 1, &msg);
edje_object_message_send(term->base, EDJE_MESSAGE_INT, 1, &msg);
edje_object_message_send(edje, EDJE_MESSAGE_INT, 1, &msg);
if (trans)
{
@ -949,24 +942,21 @@ _win_swallow(Term_Container *tc, Term_Container *orig,
Term_Container *new_child)
{
Win *wn;
Evas_Object *base;
Evas_Object *o;
assert (tc->type == TERM_CONTAINER_TYPE_WIN);
wn = (Win*) tc;
base = win_base_get(wn);
DBG("orig:%p", orig);
if (orig)
{
o = orig->get_evas_object(orig);
edje_object_part_unswallow(base, o);
elm_layout_content_unset(wn->base, "terminology.content");
}
o = new_child->get_evas_object(new_child);
edje_object_part_swallow(base, "terminology.content", o);
elm_layout_content_set(wn->base, "terminology.content", o);
evas_object_show(o);
new_child->parent = tc;
@ -1124,8 +1114,6 @@ _win_split(Term_Container *tc, Term_Container *child,
Term_Container *tc_split, *tc_solo_new;
char *wdir = NULL;
char buf[PATH_MAX];
Evas_Object *base;
Evas_Object *o;
// copy the current path to wdir if we should change the directory,
// passing wdir NULL otherwise:
@ -1144,9 +1132,7 @@ _win_split(Term_Container *tc, Term_Container *child,
tc_solo_new = _solo_new(tm_new, wn);
evas_object_data_set(tm_new->termio, "sizedone", tm_new->termio);
base = win_base_get(wn);
o = child->get_evas_object(child);
edje_object_part_unswallow(base, o);
elm_layout_content_unset(wn->base, "terminology.content");
tc_split = _split_new(child, tc_solo_new, is_horizontal);
@ -1686,8 +1672,8 @@ win_new(const char *name, const char *role, const char *title,
elm_win_resize_object_add(wn->win, o);
evas_object_show(o);
wn->base = o = edje_object_add(evas_object_evas_get(wn->win));
theme_apply(o, config, "terminology/base");
wn->base = o = elm_layout_add(wn->win);
theme_apply_elm(o, config, "terminology/base");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_content_set(wn->conform, o);
@ -2429,10 +2415,11 @@ _cb_size_hint(void *data,
{
Term *term = data;
Evas_Coord mw, mh, rw, rh, w = 0, h = 0;
Evas_Object *edje_base = elm_layout_edje_get(term->base);
evas_object_size_hint_min_get(obj, &mw, &mh);
evas_object_size_hint_request_get(obj, &rw, &rh);
edje_object_size_min_calc(term->base, &w, &h);
edje_object_size_min_calc(edje_base, &w, &h);
evas_object_size_hint_min_set(term->base, w, h);
edje_object_size_min_calc(term->bg, &w, &h);
evas_object_size_hint_min_set(term->bg, w, h);
@ -3753,8 +3740,10 @@ _set_trans(Config *config, Evas_Object *bg, Evas_Object *base)
if (bg)
edje_object_message_send(bg, EDJE_MESSAGE_INT, 1, &msg);
if (base)
edje_object_message_send(base, EDJE_MESSAGE_INT, 1, &msg);
if (base) {
Evas_Object *edje = elm_layout_edje_get(base);
edje_object_message_send(edje, EDJE_MESSAGE_INT, 1, &msg);
}
}
static void
@ -4976,8 +4965,9 @@ _cb_cmd_activated(void *data,
Term *term;
Term_Container *tc;
if (wn->cmdbox) elm_object_focus_set(wn->cmdbox, EINA_FALSE);
edje_object_signal_emit(wn->base, "cmdbox,hide", "terminology");
if (wn->cmdbox)
elm_object_focus_set(wn->cmdbox, EINA_FALSE);
elm_layout_signal_emit(wn->base, "cmdbox,hide", "terminology");
tc = (Term_Container *) wn;
term = tc->focused_term_get(tc);
if (wn->cmdbox) cmd = (char *)elm_entry_entry_get(wn->cmdbox);
@ -5007,8 +4997,9 @@ _cb_cmd_aborted(void *data,
{
Win *wn = data;
if (wn->cmdbox) elm_object_focus_set(wn->cmdbox, EINA_FALSE);
edje_object_signal_emit(wn->base, "cmdbox,hide", "terminology");
if (wn->cmdbox)
elm_object_focus_set(wn->cmdbox, EINA_FALSE);
elm_layout_signal_emit(wn->base, "cmdbox,hide", "terminology");
if (wn->cmdbox_focus_timer)
{
ecore_timer_del(wn->cmdbox_focus_timer);
@ -5055,7 +5046,7 @@ _cb_cmd_hints_changed(void *data,
if (wn->cmdbox)
{
evas_object_show(wn->cmdbox);
edje_object_part_swallow(wn->base, "terminology.cmdbox", wn->cmdbox);
elm_layout_content_set(wn->base, "terminology.cmdbox", wn->cmdbox);
}
}
@ -5088,9 +5079,9 @@ _cb_cmdbox(void *data,
evas_object_smart_callback_add(o, "changed,user", _cb_cmd_changed, wn);
evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_cb_cmd_hints_changed, wn);
edje_object_part_swallow(wn->base, "terminology.cmdbox", o);
elm_layout_content_set(wn->base, "terminology.cmdbox", o);
}
edje_object_signal_emit(term->wn->base, "cmdbox,show", "terminology");
elm_layout_signal_emit(term->wn->base, "cmdbox,show", "terminology");
elm_entry_entry_set(term->wn->cmdbox, "");
evas_object_show(term->wn->cmdbox);
if (term->wn->cmdbox_focus_timer)
@ -5120,7 +5111,7 @@ _cb_media_del(void *data,
if (term->bg)
{
edje_object_signal_emit(term->bg, "media,off", "terminology");
edje_object_signal_emit(term->base, "media,off", "terminology");
elm_layout_signal_emit(term->base, "media,off", "terminology");
}
if (!config) return;
if (config->temporary)
@ -5148,26 +5139,26 @@ _term_media_update(Term *term, const Config *config)
MEDIA_BG, type);
evas_object_event_callback_add(o, EVAS_CALLBACK_DEL,
_cb_media_del, term);
edje_object_part_swallow(term->base, "terminology.background", o);
elm_layout_content_set(term->base, "terminology.background", o);
evas_object_show(o);
term->mediatype = type;
switch (type)
{
case MEDIA_TYPE_IMG:
edje_object_signal_emit(term->bg, "media,image", "terminology");
edje_object_signal_emit(term->base, "media,image", "terminology");
elm_layout_signal_emit(term->base, "media,image", "terminology");
break;
case MEDIA_TYPE_SCALE:
edje_object_signal_emit(term->bg, "media,scale", "terminology");
edje_object_signal_emit(term->base, "media,scale", "terminology");
elm_layout_signal_emit(term->base, "media,scale", "terminology");
break;
case MEDIA_TYPE_EDJE:
edje_object_signal_emit(term->bg, "media,edje", "terminology");
edje_object_signal_emit(term->base, "media,edje", "terminology");
elm_layout_signal_emit(term->base, "media,edje", "terminology");
break;
case MEDIA_TYPE_MOV:
edje_object_signal_emit(term->bg, "media,movie", "terminology");
edje_object_signal_emit(term->base, "media,movie", "terminology");
elm_layout_signal_emit(term->base, "media,movie", "terminology");
break;
case MEDIA_TYPE_UNKNOWN:
default:
@ -5182,7 +5173,7 @@ _term_media_update(Term *term, const Config *config)
EVAS_CALLBACK_DEL,
_cb_media_del);
edje_object_signal_emit(term->bg, "media,off", "terminology");
edje_object_signal_emit(term->base, "media,off", "terminology");
elm_layout_signal_emit(term->base, "media,off", "terminology");
evas_object_del(term->media);
term->media = NULL;
}
@ -5384,7 +5375,7 @@ _term_bg_config(Term *term)
_cb_tab_close, term);
edje_object_signal_callback_add(term->bg, "tab,title", "terminology",
_cb_tab_title, term);
edje_object_part_swallow(term->base, "terminology.content", term->termio);
elm_layout_content_set(term->base, "terminology.content", term->termio);
edje_object_part_swallow(term->bg, "terminology.content", term->base);
edje_object_part_swallow(term->bg, "terminology.miniview", term->miniview);
if (term->popmedia)
@ -5410,24 +5401,24 @@ _term_bg_config(Term *term)
}
if (term->media)
{
edje_object_part_swallow(term->base, "terminology.background", term->media);
elm_layout_content_set(term->base, "terminology.background", term->media);
switch (term->mediatype)
{
case MEDIA_TYPE_IMG:
edje_object_signal_emit(term->bg, "media,image", "terminology");
edje_object_signal_emit(term->base, "media,image", "terminology");
elm_layout_signal_emit(term->base, "media,image", "terminology");
break;
case MEDIA_TYPE_SCALE:
edje_object_signal_emit(term->bg, "media,scale", "terminology");
edje_object_signal_emit(term->base, "media,scale", "terminology");
elm_layout_signal_emit(term->base, "media,scale", "terminology");
break;
case MEDIA_TYPE_EDJE:
edje_object_signal_emit(term->bg, "media,edje", "terminology");
edje_object_signal_emit(term->base, "media,edje", "terminology");
elm_layout_signal_emit(term->base, "media,edje", "terminology");
break;
case MEDIA_TYPE_MOV:
edje_object_signal_emit(term->bg, "media,movie", "terminology");
edje_object_signal_emit(term->base, "media,movie", "terminology");
elm_layout_signal_emit(term->base, "media,movie", "terminology");
break;
case MEDIA_TYPE_UNKNOWN:
default:
@ -5441,12 +5432,12 @@ _term_bg_config(Term *term)
if (term->config->disable_focus_visuals)
{
edje_object_signal_emit(term->bg, "focused,set", "terminology");
edje_object_signal_emit(term->base, "focused,set", "terminology");
elm_layout_signal_emit(term->base, "focused,set", "terminology");
}
else
{
edje_object_signal_emit(term->bg, "focus,in", "terminology");
edje_object_signal_emit(term->base, "focus,in", "terminology");
elm_layout_signal_emit(term->base, "focus,in", "terminology");
}
if (term->wn->cmdbox)
elm_object_focus_set(term->wn->cmdbox, EINA_FALSE);
@ -5468,8 +5459,8 @@ _cb_tabregion_change(void *data,
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
evas_object_size_hint_min_set(term->tab_region_base, w, h);
edje_object_part_swallow(term->base, "terminology.tabregion",
term->tab_region_base);
elm_layout_content_set(term->base, "terminology.tabregion",
term->tab_region_base);
}
static void
@ -5486,7 +5477,7 @@ _term_tabregion_setup(Term *term)
term->tab_region_base = o = evas_object_rectangle_add(evas_object_evas_get(term->bg));
evas_object_color_set(o, 0, 0, 0, 0);
edje_object_part_swallow(term->base, "terminology.tabregion", o);
elm_layout_content_set(term->base, "terminology.tabregion", o);
}
static void
@ -5612,8 +5603,8 @@ term_new(Win *wn, Config *config, const char *cmd,
term->hold = hold;
term->config = config;
term->base = o = edje_object_add(canvas);
theme_apply(o, term->config, "terminology/core");
term->base = o = elm_layout_add(wn->win);
theme_apply_elm(o, term->config, "terminology/core");
evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_fill_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -5664,7 +5655,7 @@ term_new(Win *wn, Config *config, const char *cmd,
evas_object_size_hint_fill_set(o, 0, EVAS_HINT_FILL);
evas_object_event_callback_add(o, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_cb_size_hint, term);
edje_object_part_swallow(term->base, "terminology.content", o);
elm_layout_content_set(term->base, "terminology.content", o);
edje_object_part_swallow(term->bg, "terminology.content", term->base);
edje_object_part_swallow(term->bg, "terminology.miniview", term->miniview);
evas_object_smart_callback_add(o, "options", _cb_options, term);

@ -40,7 +40,6 @@ int win_term_set(Win *wn, Term *term);
Eina_List *
terms_from_win_object(Evas_Object *win);
Evas_Object *win_base_get(const Win *wn);
Evas_Object *win_evas_object_get(const Win *win);
Eina_List * win_terms_get(const Win *wn);
Config *win_config_get(const Win *wn);

Loading…
Cancel
Save