diff --git a/data/themes/default.edc b/data/themes/default.edc index dc6019f0..c07a0504 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,go" "terminology"; + action: SIGNAL_EMIT "tabselector,show" "terminology"; } program { signal: "mouse,wheel,0,-1"; source: "tabselector_ev"; diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 9377640c..23672fac 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -53,6 +53,7 @@ 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 9f5244a1..0da8e45f 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 "termio.h" +#include "term_container.h" typedef struct _Sel Sel; typedef struct _Entry Entry; @@ -41,7 +41,8 @@ struct _Sel struct _Entry { - Evas_Object *obj, *bg, *termio; + Evas_Object *obj, *bg; + Term_Container *tc; unsigned char selected : 1; unsigned char selected_before : 1; unsigned char selected_orig : 1; @@ -476,39 +477,40 @@ _label_redo(Entry *en) { const char *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); + if (!en->obj || !en->tc) + return; + s = en->tc->title; + if (!s) + s = "Terminology"; + edje_object_part_text_set(en->bg, "terminology.label", s); } -static void -_title_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) +void +sel_entry_title_set(void *entry, const char *title) { - _label_redo(data); + Entry *en = entry; + + edje_object_part_text_set(en->bg, "terminology.label", title); } -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) +void +sel_entry_close(void *data) { Entry *en = data; - edje_object_signal_emit(en->bg, "bell", "terminology"); + + en->tc = NULL; } -static void -_entry_termio_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) +void +sel_entry_update(void *data) { Entry *en = data; - if (en->termio) evas_object_event_callback_del_full - (en->termio, EVAS_CALLBACK_DEL, _entry_termio_del_cb, en); - en->termio = NULL; + + en->tc = evas_object_data_get(en->obj, "tc"); + if (en->tc) + { + _label_redo(en); + } } static void @@ -518,10 +520,9 @@ _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", @@ -530,6 +531,7 @@ _entry_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi _bell_cb, en); en->termio = NULL; } + */ } static void @@ -562,17 +564,6 @@ _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); @@ -669,12 +660,13 @@ 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; + if (!en) return NULL; sd->items = eina_list_append(sd->items, en); sd->config = config; en->obj = entry; @@ -703,21 +695,15 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Boo edje_object_message_signal_process(en->bg); } sd->interp = 1.0; - en->termio = evas_object_data_get(en->obj, "termio"); - if (en->termio) + en->tc = evas_object_data_get(en->obj, "tc"); + if (en->tc) { - 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 724674dd..f01f5453 100644 --- a/src/bin/sel.h +++ b/src/bin/sel.h @@ -4,7 +4,10 @@ #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_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_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 new file mode 100644 index 00000000..383d917e --- /dev/null +++ b/src/bin/term_container.h @@ -0,0 +1,57 @@ +#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 5e482580..20a6f8e4 100644 --- a/src/bin/win.c +++ b/src/bin/win.c @@ -25,7 +25,6 @@ /* {{{ Structs */ -typedef struct _Term_Container Term_Container; typedef struct _Split Split; struct _Term @@ -40,7 +39,6 @@ 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; @@ -56,56 +54,9 @@ 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; @@ -117,11 +68,14 @@ 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; @@ -162,6 +116,7 @@ struct _Win }; /* }}} */ + static Eina_List *wins = NULL; @@ -171,12 +126,11 @@ 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); @@ -378,6 +332,8 @@ _solo_close(Term_Container *tc, Term_Container *child EINA_UNUSED, { tc->parent->close(tc->parent, tc, refocus); + eina_stringshare_del(tc->title); + free(tc); } @@ -450,6 +406,8 @@ 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); } @@ -463,10 +421,12 @@ _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); } } @@ -807,8 +767,10 @@ _win_swallow(Term_Container *tc, Term_Container *orig, if (orig) { - edje_object_part_unswallow(base, - orig->get_evas_object(orig)); + Evas_Object *o; + + o = edje_object_part_swallow_get(base, "terminology.content"); + edje_object_part_unswallow(base, o); /* TODO: hide */ } edje_object_part_swallow(base, "terminology.content", @@ -826,17 +788,19 @@ _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; @@ -852,6 +816,9 @@ _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); @@ -1307,6 +1274,7 @@ _split_close(Term_Container *tc, Term_Container *child, evas_object_del(split->panes); + eina_stringshare_del(tc->title); free(tc); } @@ -1320,10 +1288,12 @@ _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); } @@ -1342,7 +1312,11 @@ _split_set_title(Term_Container *tc, Term_Container *child, title, child, split->last_focus); if (child == split->last_focus) - tc->parent->set_title(tc->parent, tc, title); + { + eina_stringshare_del(tc->title); + tc->title = eina_stringshare_ref(title); + tc->parent->set_title(tc->parent, tc, title); + } } static Term_Container * @@ -1565,13 +1539,11 @@ _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; @@ -1579,11 +1551,9 @@ _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) { @@ -1592,9 +1562,7 @@ _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) { @@ -1965,9 +1933,232 @@ _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) { @@ -1975,6 +2166,10 @@ _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; } @@ -2064,11 +2259,15 @@ _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 @@ -2095,6 +2294,16 @@ _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); @@ -2197,9 +2406,20 @@ _tabs_swallow(Term_Container *tc, Term_Container *orig, new_child->parent = tc; - if (tab_item == tabs->current) + if (tabs->selector) { - edje_object_part_unswallow(tabs->base, orig->get_evas_object(orig)); + 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); /* TODO: hide */ edje_object_part_swallow(tabs->base, "content", new_child->get_evas_object(new_child)); @@ -2221,11 +2441,13 @@ _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 = child->get_evas_object(child); + o = edje_object_part_swallow_get(tabs->base, "content"); edje_object_part_unswallow(tabs->base, o); evas_object_hide(o); child = tab_item->tc; @@ -2236,8 +2458,6 @@ _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* @@ -2368,14 +2588,17 @@ _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); @@ -2407,8 +2630,17 @@ _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) - tc->parent->set_title(tc->parent, tc, title); + { + eina_stringshare_del(tc->title); + tc->title = eina_stringshare_ref(title); + tc->parent->set_title(tc->parent, tc, title); + } } static Term_Container * @@ -2480,6 +2712,8 @@ _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; @@ -2554,6 +2788,8 @@ _term_focus(Term *term) Term *term2; const char *title; + DBG("term focus"); + EINA_LIST_FOREACH(term->wn->terms, l, term2) { if (term2 != term) @@ -2943,16 +3179,6 @@ _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) { @@ -3465,9 +3691,7 @@ 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); - edje_object_signal_callback_add(term->bg, "tabcount,go", "terminology", - _cb_tabcount_go, term); + _cb_popmedia_done, 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", @@ -3764,8 +3988,6 @@ 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", @@ -3820,6 +4042,19 @@ 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 @@ -3893,12 +4128,10 @@ _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; @@ -3935,7 +4168,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); } @@ -3975,19 +4208,7 @@ _sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED) sel_exit(sp->sel); } elm_object_focus_set(sp->sel, EINA_TRUE); -#endif } +#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 541e6b67..6a385810 100644 --- a/src/bin/win.h +++ b/src/bin/win.h @@ -2,11 +2,7 @@ #define _WIN_H__ 1 #include "config.h" - -typedef struct _Win Win; -typedef struct _Term Term; - - +#include "term_container.h" Eina_Bool main_term_popup_exists(const Term *term); void main_term_focus(Term *term);