diff --git a/data/themes/default.edc b/data/themes/default.edc index c07a0504..dc6019f0 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -2770,7 +2770,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target: } program { signal: "mouse,clicked,1"; source: "tabselector_ev"; - action: SIGNAL_EMIT "tabselector,show" "terminology"; + action: SIGNAL_EMIT "tabselector,go" "terminology"; } program { signal: "mouse,wheel,0,-1"; source: "tabselector_ev"; diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 23672fac..9377640c 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -53,7 +53,6 @@ lz4/lz4.c lz4/lz4.h \ md5/md5.c md5/md5.h \ utf8.c utf8.h \ win.c win.h \ -term_container.h \ utils.c utils.h \ dbus.c dbus.h \ extns.c extns.h \ diff --git a/src/bin/sel.c b/src/bin/sel.c index 0da8e45f..9f5244a1 100644 --- a/src/bin/sel.c +++ b/src/bin/sel.c @@ -6,7 +6,7 @@ #include "sel.h" #include "config.h" #include "utils.h" -#include "term_container.h" +#include "termio.h" typedef struct _Sel Sel; typedef struct _Entry Entry; @@ -41,8 +41,7 @@ struct _Sel struct _Entry { - Evas_Object *obj, *bg; - Term_Container *tc; + Evas_Object *obj, *bg, *termio; unsigned char selected : 1; unsigned char selected_before : 1; unsigned char selected_orig : 1; @@ -477,40 +476,39 @@ _label_redo(Entry *en) { const char *s; - if (!en->obj || !en->tc) - return; - s = en->tc->title; - if (!s) - s = "Terminology"; - edje_object_part_text_set(en->bg, "terminology.label", s); + if (!en->obj) return; + if (!en->termio) return; + s = termio_title_get(en->termio); + if (!s) s = termio_icon_name_get(en->termio); + if (s) edje_object_part_text_set(en->bg, "terminology.label", s); } -void -sel_entry_title_set(void *entry, const char *title) +static void +_title_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) { - Entry *en = entry; - - edje_object_part_text_set(en->bg, "terminology.label", title); + _label_redo(data); } -void -sel_entry_close(void *data) +static void +_icon_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) +{ + _label_redo(data); +} + +static void +_bell_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) { Entry *en = data; - - en->tc = NULL; + edje_object_signal_emit(en->bg, "bell", "terminology"); } -void -sel_entry_update(void *data) +static void +_entry_termio_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) { Entry *en = data; - - en->tc = evas_object_data_get(en->obj, "tc"); - if (en->tc) - { - _label_redo(en); - } + if (en->termio) evas_object_event_callback_del_full + (en->termio, EVAS_CALLBACK_DEL, _entry_termio_del_cb, en); + en->termio = NULL; } static void @@ -520,9 +518,10 @@ _entry_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi if (en->obj) evas_object_event_callback_del_full (en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en); en->obj = NULL; - /* if (en->termio) { + evas_object_event_callback_del_full(en->termio, EVAS_CALLBACK_DEL, + _entry_termio_del_cb, en); evas_object_smart_callback_del_full(en->termio, "title,change", _title_cb, en); evas_object_smart_callback_del_full(en->termio, "icon,change", @@ -531,7 +530,6 @@ _entry_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi _bell_cb, en); en->termio = NULL; } - */ } static void @@ -564,6 +562,17 @@ _smart_del(Evas_Object *obj) if (sd->autozoom_timeout) ecore_timer_del(sd->autozoom_timeout); EINA_LIST_FREE(sd->items, en) { + if (en->termio) + { + evas_object_event_callback_del_full(en->termio, EVAS_CALLBACK_DEL, + _entry_termio_del_cb, en); + evas_object_smart_callback_del_full(en->termio, "title,change", + _title_cb, en); + evas_object_smart_callback_del_full(en->termio, "icon,change", + _icon_cb, en); + evas_object_smart_callback_del_full(en->termio, "bell", + _bell_cb, en); + } if (en->obj) evas_object_event_callback_del_full (en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en); if (en->obj) evas_object_del(en->obj); @@ -660,13 +669,12 @@ sel_add(Evas_Object *parent) return obj; } -void * -sel_entry_add(Evas_Object *obj, Evas_Object *entry, - Eina_Bool selected, Eina_Bool bell, Config *config) +void +sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Bool bell, Config *config) { Sel *sd = evas_object_smart_data_get(obj); Entry *en = calloc(1, sizeof(Entry)); - if (!en) return NULL; + if (!en) return; sd->items = eina_list_append(sd->items, en); sd->config = config; en->obj = entry; @@ -695,15 +703,21 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, edje_object_message_signal_process(en->bg); } sd->interp = 1.0; - en->tc = evas_object_data_get(en->obj, "tc"); - if (en->tc) + en->termio = evas_object_data_get(en->obj, "termio"); + if (en->termio) { + evas_object_smart_callback_add(en->termio, "title,change", + _title_cb, en); + evas_object_smart_callback_add(en->termio, "icon,change", + _icon_cb, en); + evas_object_smart_callback_add(en->termio, "bell", + _bell_cb, en); _label_redo(en); + evas_object_event_callback_add(en->termio, EVAS_CALLBACK_DEL, + _entry_termio_del_cb, en); } evas_object_event_callback_add(en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en); - - return en; } void diff --git a/src/bin/sel.h b/src/bin/sel.h index f01f5453..724674dd 100644 --- a/src/bin/sel.h +++ b/src/bin/sel.h @@ -4,10 +4,7 @@ #include "config.h" Evas_Object *sel_add(Evas_Object *parent); -void *sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Bool bell, Config *config); -void sel_entry_title_set(void *entry, const char *title); -void sel_entry_close(void *entry); -void sel_entry_update(void *entry); +void sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Bool bell, Config *config); void sel_go(Evas_Object *obj); void sel_entry_selected_set(Evas_Object *obj, Evas_Object *entry, Eina_Bool keep_before); void sel_zoom(Evas_Object *obj, double zoom); diff --git a/src/bin/term_container.h b/src/bin/term_container.h deleted file mode 100644 index 383d917e..00000000 --- a/src/bin/term_container.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef _TERM_CONTAINER_H__ -#define _TERM_CONTAINER_H__ 1 - - -typedef struct _Term_Container Term_Container; -typedef struct _Term Term; -typedef struct _Win Win; -typedef struct _Sizeinfo Sizeinfo; - -struct _Sizeinfo -{ - int min_w; - int min_h; - int step_x; - int step_y; - int req_w; - int req_h; - int bg_min_w; - int bg_min_h; - int req; -}; - -typedef enum _Term_Container_Type -{ - TERM_CONTAINER_TYPE_UNKNOWN, - TERM_CONTAINER_TYPE_SOLO, - TERM_CONTAINER_TYPE_SPLIT, - TERM_CONTAINER_TYPE_TABS, - TERM_CONTAINER_TYPE_WIN -} Term_Container_Type; - -struct _Term_Container { - Term_Container_Type type; - Term_Container *parent; - Win *wn; - Evas_Object *selector_img; - const char *title; - - Term *(*term_next)(Term_Container *tc, Term_Container *child); - Term *(*term_prev)(Term_Container *tc, Term_Container *child); - Term *(*term_first)(Term_Container *tc); - Term *(*term_last)(Term_Container *tc); - Evas_Object* (*get_evas_object)(Term_Container *container); - Term *(*find_term_at_coords)(Term_Container *container, - Evas_Coord mx, Evas_Coord my); - void (*size_eval)(Term_Container *container, Sizeinfo *info); - void (*split)(Term_Container *container, const char *cmd, - Eina_Bool is_horizontal); /* TODO: only for solo, move out ? */ - void (*swallow)(Term_Container *container, Term_Container *orig, - Term_Container *new_child); - void (*focus)(Term_Container *tc, Term_Container *relative); - void (*set_title)(Term_Container *tc, Term_Container *child, const char *title); - void (*close)(Term_Container *container, Term_Container *child, - Eina_Bool refocus); -}; - -#endif diff --git a/src/bin/win.c b/src/bin/win.c index 20a6f8e4..5e482580 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -25,6 +25,7 @@ /* {{{ Structs */ +typedef struct _Term_Container Term_Container; typedef struct _Split Split; struct _Term @@ -39,6 +40,7 @@ struct _Term Evas_Object *media; Evas_Object *popmedia; Evas_Object *miniview; + //Evas_Object *sel; Evas_Object *tabcount_spacer; Eina_List *popmedia_queue; Media_Type poptype, mediatype; @@ -54,9 +56,56 @@ struct _Term unsigned char popmedia_deleted : 1; }; +typedef struct _Sizeinfo Sizeinfo; + +struct _Sizeinfo +{ + int min_w; + int min_h; + int step_x; + int step_y; + int req_w; + int req_h; + int bg_min_w; + int bg_min_h; + int req; +}; + +typedef enum _Term_Container_Type +{ + TERM_CONTAINER_TYPE_UNKNOWN, + TERM_CONTAINER_TYPE_SOLO, + TERM_CONTAINER_TYPE_SPLIT, + TERM_CONTAINER_TYPE_TABS, + TERM_CONTAINER_TYPE_WIN +} Term_Container_Type; + +typedef struct _Term_Container Term_Container; typedef struct _Solo Solo; typedef struct _Tabs Tabs; +struct _Term_Container { + Term_Container_Type type; + Term_Container *parent; + Win *wn; + + Term *(*term_next)(Term_Container *tc, Term_Container *child); + Term *(*term_prev)(Term_Container *tc, Term_Container *child); + Term *(*term_first)(Term_Container *tc); + Term *(*term_last)(Term_Container *tc); + Evas_Object* (*get_evas_object)(Term_Container *container); + Term *(*find_term_at_coords)(Term_Container *container, + Evas_Coord mx, Evas_Coord my); + void (*size_eval)(Term_Container *container, Sizeinfo *info); + void (*split)(Term_Container *container, const char *cmd, + Eina_Bool is_horizontal); /* TODO: only for solo, move out ? */ + void (*swallow)(Term_Container *container, Term_Container *orig, + Term_Container *new_child); + void (*focus)(Term_Container *tc, Term_Container *relative); + void (*set_title)(Term_Container *tc, Term_Container *child, const char *title); + void (*close)(Term_Container *container, Term_Container *child, + Eina_Bool refocus); +}; struct _Solo { Term_Container tc; @@ -68,14 +117,11 @@ struct _Tab_Item { Term_Container *tc; Elm_Object_Item *elm_item; Elm_Object_Item *separator; - void *selector_entry; }; struct _Tabs { Term_Container tc; Evas_Object *base; - Evas_Object *selector; - Evas_Object *selector_bg; Evas_Object *tabbar; Evas_Object *tabbar_spacer; Evas_Object *selector_spacer; @@ -116,7 +162,6 @@ struct _Win }; /* }}} */ - static Eina_List *wins = NULL; @@ -126,11 +171,12 @@ static Term_Container *_tabs_new(Term_Container *child, Term_Container *parent); //static void _term_resize_track_start(Term *term); //static void _split_tabcount_update(Split *sp, Term *tm); static Term * _win_focused_term_get(Win *wn); -//static Split * _split_find(Evas_Object *win, Evas_Object *term, Term **ptm); +static Split * _split_find(Evas_Object *win, Evas_Object *term, Term **ptm); static void _term_focus(Term *term); static void term_free(Term *term); //static void _split_free(Split *sp); //static void _sel_restore(Split *sp); +static void _sel_go(Split *sp, Term *term); //static void _term_resize_track_stop(Term *term); //static void _split_merge(Split *spp, Split *sp, const char *slot); //static void _term_focus_show(Split *sp, Term *term); @@ -332,8 +378,6 @@ _solo_close(Term_Container *tc, Term_Container *child EINA_UNUSED, { tc->parent->close(tc->parent, tc, refocus); - eina_stringshare_del(tc->title); - free(tc); } @@ -406,8 +450,6 @@ static void _solo_set_title(Term_Container *tc, Term_Container *child EINA_UNUSED, const char *title) { - eina_stringshare_del(tc->title); - tc->title = eina_stringshare_add(title); DBG("set title: '%s'", title); tc->parent->set_title(tc->parent, tc, title); } @@ -421,12 +463,10 @@ _solo_focus(Term_Container *tc, Term_Container *relative EINA_UNUSED) if (tc->parent == relative) { - DBG("focus from parent"); _term_focus(solo->term); } else { - DBG("focus from child"); tc->parent->focus(tc->parent, tc); } } @@ -767,10 +807,8 @@ _win_swallow(Term_Container *tc, Term_Container *orig, if (orig) { - Evas_Object *o; - - o = edje_object_part_swallow_get(base, "terminology.content"); - edje_object_part_unswallow(base, o); + edje_object_part_unswallow(base, + orig->get_evas_object(orig)); /* TODO: hide */ } edje_object_part_swallow(base, "terminology.content", @@ -788,19 +826,17 @@ _win_close(Term_Container *tc, Term_Container *child EINA_UNUSED, wn = (Win*) tc; - eina_stringshare_del(tc->title); - win_free(wn); } static void _win_focus(Term_Container *tc, Term_Container *child EINA_UNUSED) { + DBG("focus"); Win *wn; assert (tc->type == TERM_CONTAINER_TYPE_WIN); wn = (Win*) tc; - DBG("focus from child"); if (!wn->focused) elm_win_urgent_set(wn->win, EINA_FALSE); wn->focused = EINA_TRUE; @@ -816,9 +852,6 @@ _win_set_title(Term_Container *tc, Term_Container *child EINA_UNUSED, wn = (Win*) tc; - eina_stringshare_del(tc->title); - tc->title = eina_stringshare_ref(title); - DBG("set title: '%s'", title); elm_win_title_set(wn->win, title); @@ -1274,7 +1307,6 @@ _split_close(Term_Container *tc, Term_Container *child, evas_object_del(split->panes); - eina_stringshare_del(tc->title); free(tc); } @@ -1288,12 +1320,10 @@ _split_focus(Term_Container *tc, Term_Container *relative) if (tc->parent == relative) { - DBG("focus from parent"); split->last_focus->focus(split->last_focus, tc); } else { - DBG("focus from child"); split->last_focus = relative; tc->parent->focus(tc->parent, tc); } @@ -1312,11 +1342,7 @@ _split_set_title(Term_Container *tc, Term_Container *child, title, child, split->last_focus); if (child == split->last_focus) - { - eina_stringshare_del(tc->title); - tc->title = eina_stringshare_ref(title); - tc->parent->set_title(tc->parent, tc, title); - } + tc->parent->set_title(tc->parent, tc, title); } static Term_Container * @@ -1539,11 +1565,13 @@ _split_split_find(Split *sp, Evas_Object *term, Term **ptm) } return NULL; } +#endif static Split * _split_find(Evas_Object *win EINA_UNUSED, Evas_Object *term EINA_UNUSED, Term **ptm EINA_UNUSED) { /* TODO */ +#if 0 Win *wn; Eina_List *l; @@ -1551,9 +1579,11 @@ _split_find(Evas_Object *win EINA_UNUSED, Evas_Object *term EINA_UNUSED, Term ** { if (wn->win == win) return _split_split_find(wn->split, term, ptm); } +#endif return NULL; } +#if 0 static void _split_free(Split *sp) { @@ -1562,7 +1592,9 @@ _split_free(Split *sp) if (sp->panes) evas_object_del(sp->panes); free(sp); } +#endif +#if 0 static void _split_tabcount_update(Split *sp EINA_UNUSED, Term *tm EINA_UNUSED) { @@ -1933,232 +1965,9 @@ _split_merge(Split *spp, Split *sp, const char *slot) } #endif -/* }}} */ -/* {{{ Sel */ - -#if 0 -static void -_sel_restore(Split *sp EINA_UNUSED) -{ - Eina_List *l; - Term *tm; - - EINA_LIST_FOREACH(sp->terms, l, tm) - { - if (tm->unswallowed) - { -#if (EVAS_VERSION_MAJOR > 1) || (EVAS_VERSION_MINOR >= 8) - evas_object_image_source_visible_set(tm->sel, EINA_TRUE); -#endif - edje_object_part_swallow(tm->bg, "terminology.content", tm->base); - tm->unswallowed = EINA_FALSE; - evas_object_show(tm->base); - tm->sel = NULL; - } - } - evas_object_del(sp->sel); - evas_object_del(sp->sel_bg); - sp->sel = NULL; - sp->sel_bg = NULL; -} - -#endif - /* }}} */ /* {{{ Tabs */ -static void -_tabs_restore(Tabs *tabs) -{ - Eina_List *l; - Tab_Item *tab_item; - Evas_Object *o; - Term_Container *tc = (Term_Container*)tabs; - - DBG("exit: %p", tabs); - if (!tabs->selector) - return; - - EINA_LIST_FOREACH(tabs->tabs, l, tab_item) - { - tab_item->selector_entry = NULL; - } - - o = tabs->current->tc->get_evas_object(tabs->current->tc); - edje_object_part_swallow(tabs->base, "content", o); - evas_object_show(o); - evas_object_del(tabs->selector); - evas_object_del(tabs->selector_bg); - tabs->selector = NULL; - tabs->selector_bg = NULL; - tc->focus(tc, tc->parent); - - elm_toolbar_item_selected_set(tabs->current->elm_item, EINA_TRUE); -} - -static void -_tabs_selector_cb_selected(void *data, - Evas_Object *obj EINA_UNUSED, - void *info) -{ - Tabs *tabs = data; - Eina_List *l; - Tab_Item *tab_item; - /* TODO: boris */ - DBG("selected: %p info:%p", tabs, info); - - EINA_LIST_FOREACH(tabs->tabs, l, tab_item) - { - if (tab_item->tc->selector_img == info) - { - tabs->current = tab_item; - _tabs_restore(tabs); - return; - } - } - - DBG("FAIL"); -#if 0 - Split *sp = data; - Eina_List *l; - Term *tm; - - EINA_LIST_FOREACH(sp->terms, l, tm) - { - if (tm->sel == info) - { - _term_focus(tm); - _term_focus_show(sp, tm); - _sel_restore(sp); - _term_miniview_check(tm); - return; - } - } - _sel_restore(sp); - _term_focus(sp->term); - _term_focus_show(sp, sp->term); - _term_miniview_check(tm); -#endif -} - -static void -_tabs_selector_cb_exit(void *data, - Evas_Object *obj EINA_UNUSED, - void *info EINA_UNUSED) -{ - Tabs *tabs = data; - - DBG("exit: %p", tabs); - _tabs_restore(tabs); -} - -static void -_tabs_selector_cb_ending(void *data, - Evas_Object *obj EINA_UNUSED, - void *info EINA_UNUSED) -{ - Tabs *tabs = data; - /* TODO: boris */ - DBG("ending: %p", tabs); -#if 0 - Split *sp = data; - edje_object_signal_emit(sp->sel_bg, "end", "terminology"); -#endif -} - - -static void -_cb_tab_selector_show(void *data, - Evas_Object *obj EINA_UNUSED, - const char *sig EINA_UNUSED, - const char *src EINA_UNUSED) -{ - Tabs *tabs = data; - Term_Container *tc = (Term_Container *)tabs; - Eina_List *l; - int count; - double z; - Edje_Message_Int msg; - Win *wn = tc->wn; - Tab_Item *tab_item; - Evas_Object *o; - - DBG("show tabs selector: %p", tabs->selector_bg); - - /* TODO: tab count off */ - - if (tabs->selector_bg) - return; - - tabs->selector_bg = edje_object_add(evas_object_evas_get(tabs->base)); - theme_apply(tabs->selector_bg, wn->config, "terminology/sel/base"); - if (wn->config->translucent) - msg.val = wn->config->opacity; - else - msg.val = 100; - - edje_object_message_send(tabs->selector_bg, EDJE_MESSAGE_INT, 1, &msg); - edje_object_signal_emit(tabs->selector_bg, "begin", "terminology"); - - tab_item = tabs->current; - o = edje_object_part_swallow_get(tabs->base, "content"); - edje_object_part_unswallow(tabs->base, o); - evas_object_hide(o); - - tabs->selector = sel_add(wn->win); - DBG("tabs->selector: %p", tabs->selector); - EINA_LIST_FOREACH(tabs->tabs, l, tab_item) - { - Evas_Object *img; - Evas_Coord w, h; - Eina_Bool is_selected, missed_bell; - - img = evas_object_image_filled_add(evas_object_evas_get(wn->win)); - o = tab_item->tc->get_evas_object(tab_item->tc); - evas_object_lower(o); - evas_object_move(o, -9999, -9999); - evas_object_show(o); - evas_object_clip_unset(o); - evas_object_image_source_set(img, o); - evas_object_geometry_get(o, NULL, NULL, &w, &h); - evas_object_resize(img, w, h); - evas_object_data_set(img, "tc", tab_item->tc); - tab_item->tc->selector_img = img; - - is_selected = (tab_item == tabs->current); - missed_bell = EINA_FALSE; - tab_item->selector_entry = sel_entry_add(tabs->selector, img, - is_selected, - missed_bell, wn->config); - DBG("adding entry %p selected:%d img:%p selector_entry:%p", - tab_item, is_selected, img, tab_item->selector_entry); - } - edje_object_part_swallow(tabs->selector_bg, "terminology.content", - tabs->selector); - evas_object_show(tabs->selector); - - /* XXX: reswallow in parent */ - tc->parent->swallow(tc->parent, tc, tc); - evas_object_show(tabs->selector_bg); - - evas_object_smart_callback_add(tabs->selector, "selected", - _tabs_selector_cb_selected, tabs); - evas_object_smart_callback_add(tabs->selector, "exit", - _tabs_selector_cb_exit, tabs); - evas_object_smart_callback_add(tabs->selector, "ending", - _tabs_selector_cb_ending, tabs); - z = 1.0; - sel_go(tabs->selector); - count = eina_list_count(tabs->tabs); - if (count >= 1) - z = 1.0 / (sqrt(count) * 0.8); - if (z > 1.0) z = 1.0; - sel_orig_zoom_set(tabs->selector, z); - sel_zoom(tabs->selector, z); - elm_object_focus_set(tabs->selector, EINA_TRUE); -} - - static Evas_Object * _tabs_get_evas_object(Term_Container *container) { @@ -2166,10 +1975,6 @@ _tabs_get_evas_object(Term_Container *container) assert (container->type == TERM_CONTAINER_TYPE_TABS); tabs = (Tabs*)container; - DBG("evas_object: tabs->selector_bg:%p", tabs->selector_bg); - if (tabs->selector_bg) - return tabs->selector_bg; - return tabs->base; } @@ -2259,15 +2064,11 @@ _tabs_close(Term_Container *tc, Term_Container *child, count = eina_list_count(tabs->tabs); if (count == 1) { - if (tabs->selector) - _tabs_restore(tabs); - tc->parent->close(tc->parent, tc, refocus); evas_object_del(tabs->base); evas_object_del(tabs->tabbar); evas_object_del(tabs->tabbar_spacer); evas_object_del(tabs->selector_spacer); - eina_stringshare_del(tc->title); free(tc); } else @@ -2294,16 +2095,6 @@ _tabs_close(Term_Container *tc, Term_Container *child, tabs->current->tc->focus(tabs->current->tc, tc); } } - - if (tab_item->tc->selector_img) - { - Evas_Object *o; - o = tab_item->tc->selector_img; - tab_item->tc->selector_img = NULL; - evas_object_del(o); - } - - elm_object_item_del(tab_item->elm_item); elm_object_item_del(tab_item->separator); tabs->tabs = eina_list_remove_list(tabs->tabs, l); @@ -2406,20 +2197,9 @@ _tabs_swallow(Term_Container *tc, Term_Container *orig, new_child->parent = tc; - if (tabs->selector) + if (tab_item == tabs->current) { - Evas_Object *img = tab_item->tc->selector_img; - evas_object_image_source_set(img, - new_child->get_evas_object(new_child)); - evas_object_data_set(img, "tc", new_child); - sel_entry_update(tab_item->selector_entry); - } - else if (tab_item == tabs->current) - { - Evas_Object *o; - - o = edje_object_part_swallow_get(tabs->base, "content"); - edje_object_part_unswallow(tabs->base, o); + edje_object_part_unswallow(tabs->base, orig->get_evas_object(orig)); /* TODO: hide */ edje_object_part_swallow(tabs->base, "content", new_child->get_evas_object(new_child)); @@ -2441,13 +2221,11 @@ _tab_selected(void *data, assert (tc->type == TERM_CONTAINER_TYPE_TABS); tabs = (Tabs*) tc; - if (tabs->current && tab_item == tabs->current) - return; if (tabs->current) { Evas_Object *o; child = tabs->current->tc; - o = edje_object_part_swallow_get(tabs->base, "content"); + o = child->get_evas_object(child); edje_object_part_unswallow(tabs->base, o); evas_object_hide(o); child = tab_item->tc; @@ -2458,6 +2236,8 @@ _tab_selected(void *data, elm_toolbar_item_selected_set(tabs->current->elm_item, EINA_FALSE); } tabs->current = tab_item; + + tab_item->tc->focus(tab_item->tc, tc); } static Tab_Item* @@ -2588,17 +2368,14 @@ _tabs_focus(Term_Container *tc, Term_Container *relative) assert (tc->type == TERM_CONTAINER_TYPE_TABS); tabs = (Tabs*) tc; - if (tc->parent == relative) { - DBG("focus from parent"); tabs->current->tc->focus(tabs->current->tc, tc); } else { Eina_List *l; Tab_Item *tab_item; - DBG("focus from child"); l = _tab_item_find(tabs, relative); assert(l); @@ -2630,17 +2407,8 @@ _tabs_set_title(Term_Container *tc, Term_Container *child, DBG("set title: '%s' child:%p current->tc:%p", title, child, tabs->current->tc); - if (tabs->selector) - { - sel_entry_title_set(tab_item->selector_entry, title); - } - if (tab_item == tabs->current) - { - eina_stringshare_del(tc->title); - tc->title = eina_stringshare_ref(title); - tc->parent->set_title(tc->parent, tc, title); - } + tc->parent->set_title(tc->parent, tc, title); } static Term_Container * @@ -2712,8 +2480,6 @@ _tabs_new(Term_Container *child, Term_Container *parent) edje_object_signal_callback_add(tabs->base, "tabbar,show", "terminology", _cb_tabbar_show, tabs); - edje_object_signal_callback_add(tabs->base, "tabselector,show", "terminology", - _cb_tab_selector_show, tabs); return tc; @@ -2788,8 +2554,6 @@ _term_focus(Term *term) Term *term2; const char *title; - DBG("term focus"); - EINA_LIST_FOREACH(term->wn->terms, l, term2) { if (term2 != term) @@ -3179,6 +2943,16 @@ _cb_command(void *data, Evas_Object *obj EINA_UNUSED, void *event) } } +static void +_cb_tabcount_go(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED) +{ + Term *term = data; + Split *sp; + + sp = _split_find(term->wn->win, term->termio, NULL); + _sel_go(sp, term); +} + static void _cb_prev(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) { @@ -3691,7 +3465,9 @@ main_term_bg_config(Term *term) termio_theme_set(term->termio, term->bg); edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology", - _cb_popmedia_done, term); + _cb_popmedia_done, term); + edje_object_signal_callback_add(term->bg, "tabcount,go", "terminology", + _cb_tabcount_go, term); edje_object_signal_callback_add(term->bg, "tabcount,prev", "terminology", _cb_tabcount_prev, term); edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology", @@ -3988,6 +3764,8 @@ term_new(Win *wn, Config *config, const char *cmd, edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology", _cb_popmedia_done, term); + edje_object_signal_callback_add(term->bg, "tabcount,go", "terminology", + _cb_tabcount_go, term); edje_object_signal_callback_add(term->bg, "tabcount,prev", "terminology", _cb_tabcount_prev, term); edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology", @@ -4042,19 +3820,6 @@ term_new(Win *wn, Config *config, const char *cmd, /* }}} */ - -void -windows_free(void) -{ - Win *wn; - - while (wins) - { - wn = eina_list_data_get(wins); - win_free(wn); - } -} - /* {{{ Sel */ #if 0 @@ -4128,10 +3893,12 @@ _sel_cb_ending(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) Split *sp = data; edje_object_signal_emit(sp->sel_bg, "end", "terminology"); } +#endif static void _sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED) { +#if 0 Eina_List *l; Term *tm; double z; @@ -4168,7 +3935,7 @@ _sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED) evas_object_resize(img, w, h); evas_object_data_set(img, "termio", tm->term); tm->sel = img; - + sel_entry_add(sp->sel, tm->sel, (tm == sp->term), tm->missed_bell, tm->config); } @@ -4208,7 +3975,19 @@ _sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED) sel_exit(sp->sel); } elm_object_focus_set(sp->sel, EINA_TRUE); -} #endif +} /* }}} */ +void +windows_free(void) +{ + Win *wn; + + while (wins) + { + wn = eina_list_data_get(wins); + win_free(wn); + } +} + diff --git a/src/bin/win.h b/src/bin/win.h index 6a385810..541e6b67 100644 --- a/src/bin/win.h +++ b/src/bin/win.h @@ -2,7 +2,11 @@ #define _WIN_H__ 1 #include "config.h" -#include "term_container.h" + +typedef struct _Win Win; +typedef struct _Term Term; + + Eina_Bool main_term_popup_exists(const Term *term); void main_term_focus(Term *term);