summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2014-11-23 23:47:09 +0100
committerBoris Faure <billiob@gmail.com>2014-11-29 22:05:19 +0100
commit4fd9c9d1785438adeb15cc1b6661e42408273d81 (patch)
treeca07ef4c32fe9068848834278b4758b2e6eeeb97
parentfd6ce546ed4fb853210e12e2a125ebdcc7e7b430 (diff)
the tab selector is back!
-rw-r--r--data/themes/default.edc2
-rw-r--r--src/bin/Makefile.am1
-rw-r--r--src/bin/sel.c84
-rw-r--r--src/bin/sel.h5
-rw-r--r--src/bin/term_container.h57
-rw-r--r--src/bin/win.c417
-rw-r--r--src/bin/win.h6
7 files changed, 418 insertions, 154 deletions
diff --git a/data/themes/default.edc b/data/themes/default.edc
index dc6019f..c07a050 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:
2770 } 2770 }
2771 program { 2771 program {
2772 signal: "mouse,clicked,1"; source: "tabselector_ev"; 2772 signal: "mouse,clicked,1"; source: "tabselector_ev";
2773 action: SIGNAL_EMIT "tabselector,go" "terminology"; 2773 action: SIGNAL_EMIT "tabselector,show" "terminology";
2774 } 2774 }
2775 program { 2775 program {
2776 signal: "mouse,wheel,0,-1"; source: "tabselector_ev"; 2776 signal: "mouse,wheel,0,-1"; source: "tabselector_ev";
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 9377640..23672fa 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -53,6 +53,7 @@ lz4/lz4.c lz4/lz4.h \
53md5/md5.c md5/md5.h \ 53md5/md5.c md5/md5.h \
54utf8.c utf8.h \ 54utf8.c utf8.h \
55win.c win.h \ 55win.c win.h \
56term_container.h \
56utils.c utils.h \ 57utils.c utils.h \
57dbus.c dbus.h \ 58dbus.c dbus.h \
58extns.c extns.h \ 59extns.c extns.h \
diff --git a/src/bin/sel.c b/src/bin/sel.c
index 9f5244a..0da8e45 100644
--- a/src/bin/sel.c
+++ b/src/bin/sel.c
@@ -6,7 +6,7 @@
6#include "sel.h" 6#include "sel.h"
7#include "config.h" 7#include "config.h"
8#include "utils.h" 8#include "utils.h"
9#include "termio.h" 9#include "term_container.h"
10 10
11typedef struct _Sel Sel; 11typedef struct _Sel Sel;
12typedef struct _Entry Entry; 12typedef struct _Entry Entry;
@@ -41,7 +41,8 @@ struct _Sel
41 41
42struct _Entry 42struct _Entry
43{ 43{
44 Evas_Object *obj, *bg, *termio; 44 Evas_Object *obj, *bg;
45 Term_Container *tc;
45 unsigned char selected : 1; 46 unsigned char selected : 1;
46 unsigned char selected_before : 1; 47 unsigned char selected_before : 1;
47 unsigned char selected_orig : 1; 48 unsigned char selected_orig : 1;
@@ -476,39 +477,40 @@ _label_redo(Entry *en)
476{ 477{
477 const char *s; 478 const char *s;
478 479
479 if (!en->obj) return; 480 if (!en->obj || !en->tc)
480 if (!en->termio) return; 481 return;
481 s = termio_title_get(en->termio); 482 s = en->tc->title;
482 if (!s) s = termio_icon_name_get(en->termio); 483 if (!s)
483 if (s) edje_object_part_text_set(en->bg, "terminology.label", s); 484 s = "Terminology";
485 edje_object_part_text_set(en->bg, "terminology.label", s);
484} 486}
485 487
486static void 488void
487_title_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) 489sel_entry_title_set(void *entry, const char *title)
488{ 490{
489 _label_redo(data); 491 Entry *en = entry;
490}
491 492
492static void 493 edje_object_part_text_set(en->bg, "terminology.label", title);
493_icon_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED)
494{
495 _label_redo(data);
496} 494}
497 495
498static void 496void
499_bell_cb(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) 497sel_entry_close(void *data)
500{ 498{
501 Entry *en = data; 499 Entry *en = data;
502 edje_object_signal_emit(en->bg, "bell", "terminology"); 500
501 en->tc = NULL;
503} 502}
504 503
505static void 504void
506_entry_termio_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED) 505sel_entry_update(void *data)
507{ 506{
508 Entry *en = data; 507 Entry *en = data;
509 if (en->termio) evas_object_event_callback_del_full 508
510 (en->termio, EVAS_CALLBACK_DEL, _entry_termio_del_cb, en); 509 en->tc = evas_object_data_get(en->obj, "tc");
511 en->termio = NULL; 510 if (en->tc)
511 {
512 _label_redo(en);
513 }
512} 514}
513 515
514static void 516static void
@@ -518,10 +520,9 @@ _entry_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
518 if (en->obj) evas_object_event_callback_del_full 520 if (en->obj) evas_object_event_callback_del_full
519 (en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en); 521 (en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en);
520 en->obj = NULL; 522 en->obj = NULL;
523 /*
521 if (en->termio) 524 if (en->termio)
522 { 525 {
523 evas_object_event_callback_del_full(en->termio, EVAS_CALLBACK_DEL,
524 _entry_termio_del_cb, en);
525 evas_object_smart_callback_del_full(en->termio, "title,change", 526 evas_object_smart_callback_del_full(en->termio, "title,change",
526 _title_cb, en); 527 _title_cb, en);
527 evas_object_smart_callback_del_full(en->termio, "icon,change", 528 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
530 _bell_cb, en); 531 _bell_cb, en);
531 en->termio = NULL; 532 en->termio = NULL;
532 } 533 }
534 */
533} 535}
534 536
535static void 537static void
@@ -562,17 +564,6 @@ _smart_del(Evas_Object *obj)
562 if (sd->autozoom_timeout) ecore_timer_del(sd->autozoom_timeout); 564 if (sd->autozoom_timeout) ecore_timer_del(sd->autozoom_timeout);
563 EINA_LIST_FREE(sd->items, en) 565 EINA_LIST_FREE(sd->items, en)
564 { 566 {
565 if (en->termio)
566 {
567 evas_object_event_callback_del_full(en->termio, EVAS_CALLBACK_DEL,
568 _entry_termio_del_cb, en);
569 evas_object_smart_callback_del_full(en->termio, "title,change",
570 _title_cb, en);
571 evas_object_smart_callback_del_full(en->termio, "icon,change",
572 _icon_cb, en);
573 evas_object_smart_callback_del_full(en->termio, "bell",
574 _bell_cb, en);
575 }
576 if (en->obj) evas_object_event_callback_del_full 567 if (en->obj) evas_object_event_callback_del_full
577 (en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en); 568 (en->obj, EVAS_CALLBACK_DEL, _entry_del_cb, en);
578 if (en->obj) evas_object_del(en->obj); 569 if (en->obj) evas_object_del(en->obj);
@@ -669,12 +660,13 @@ sel_add(Evas_Object *parent)
669 return obj; 660 return obj;
670} 661}
671 662
672void 663void *
673sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Bool bell, Config *config) 664sel_entry_add(Evas_Object *obj, Evas_Object *entry,
665 Eina_Bool selected, Eina_Bool bell, Config *config)
674{ 666{
675 Sel *sd = evas_object_smart_data_get(obj); 667 Sel *sd = evas_object_smart_data_get(obj);
676 Entry *en = calloc(1, sizeof(Entry)); 668 Entry *en = calloc(1, sizeof(Entry));
677 if (!en) return; 669 if (!en) return NULL;
678 sd->items = eina_list_append(sd->items, en); 670 sd->items = eina_list_append(sd->items, en);
679 sd->config = config; 671 sd->config = config;
680 en->obj = entry; 672 en->obj = entry;
@@ -703,21 +695,15 @@ sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Boo
703 edje_object_message_signal_process(en->bg); 695 edje_object_message_signal_process(en->bg);
704 } 696 }
705 sd->interp = 1.0; 697 sd->interp = 1.0;
706 en->termio = evas_object_data_get(en->obj, "termio"); 698 en->tc = evas_object_data_get(en->obj, "tc");
707 if (en->termio) 699 if (en->tc)
708 { 700 {
709 evas_object_smart_callback_add(en->termio, "title,change",
710 _title_cb, en);
711 evas_object_smart_callback_add(en->termio, "icon,change",
712 _icon_cb, en);
713 evas_object_smart_callback_add(en->termio, "bell",
714 _bell_cb, en);
715 _label_redo(en); 701 _label_redo(en);
716 evas_object_event_callback_add(en->termio, EVAS_CALLBACK_DEL,
717 _entry_termio_del_cb, en);
718 } 702 }
719 evas_object_event_callback_add(en->obj, EVAS_CALLBACK_DEL, 703 evas_object_event_callback_add(en->obj, EVAS_CALLBACK_DEL,
720 _entry_del_cb, en); 704 _entry_del_cb, en);
705
706 return en;
721} 707}
722 708
723void 709void
diff --git a/src/bin/sel.h b/src/bin/sel.h
index 724674d..f01f545 100644
--- a/src/bin/sel.h
+++ b/src/bin/sel.h
@@ -4,7 +4,10 @@
4#include "config.h" 4#include "config.h"
5 5
6Evas_Object *sel_add(Evas_Object *parent); 6Evas_Object *sel_add(Evas_Object *parent);
7void sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Bool bell, Config *config); 7void *sel_entry_add(Evas_Object *obj, Evas_Object *entry, Eina_Bool selected, Eina_Bool bell, Config *config);
8void sel_entry_title_set(void *entry, const char *title);
9void sel_entry_close(void *entry);
10void sel_entry_update(void *entry);
8void sel_go(Evas_Object *obj); 11void sel_go(Evas_Object *obj);
9void sel_entry_selected_set(Evas_Object *obj, Evas_Object *entry, Eina_Bool keep_before); 12void sel_entry_selected_set(Evas_Object *obj, Evas_Object *entry, Eina_Bool keep_before);
10void sel_zoom(Evas_Object *obj, double zoom); 13void 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 0000000..383d917
--- /dev/null
+++ b/src/bin/term_container.h
@@ -0,0 +1,57 @@
1#ifndef _TERM_CONTAINER_H__
2#define _TERM_CONTAINER_H__ 1
3
4
5typedef struct _Term_Container Term_Container;
6typedef struct _Term Term;
7typedef struct _Win Win;
8typedef struct _Sizeinfo Sizeinfo;
9
10struct _Sizeinfo
11{
12 int min_w;
13 int min_h;
14 int step_x;
15 int step_y;
16 int req_w;
17 int req_h;
18 int bg_min_w;
19 int bg_min_h;
20 int req;
21};
22
23typedef enum _Term_Container_Type
24{
25 TERM_CONTAINER_TYPE_UNKNOWN,
26 TERM_CONTAINER_TYPE_SOLO,
27 TERM_CONTAINER_TYPE_SPLIT,
28 TERM_CONTAINER_TYPE_TABS,
29 TERM_CONTAINER_TYPE_WIN
30} Term_Container_Type;
31
32struct _Term_Container {
33 Term_Container_Type type;
34 Term_Container *parent;
35 Win *wn;
36 Evas_Object *selector_img;
37 const char *title;
38
39 Term *(*term_next)(Term_Container *tc, Term_Container *child);
40 Term *(*term_prev)(Term_Container *tc, Term_Container *child);
41 Term *(*term_first)(Term_Container *tc);
42 Term *(*term_last)(Term_Container *tc);
43 Evas_Object* (*get_evas_object)(Term_Container *container);
44 Term *(*find_term_at_coords)(Term_Container *container,
45 Evas_Coord mx, Evas_Coord my);
46 void (*size_eval)(Term_Container *container, Sizeinfo *info);
47 void (*split)(Term_Container *container, const char *cmd,
48 Eina_Bool is_horizontal); /* TODO: only for solo, move out ? */
49 void (*swallow)(Term_Container *container, Term_Container *orig,
50 Term_Container *new_child);
51 void (*focus)(Term_Container *tc, Term_Container *relative);
52 void (*set_title)(Term_Container *tc, Term_Container *child, const char *title);
53 void (*close)(Term_Container *container, Term_Container *child,
54 Eina_Bool refocus);
55};
56
57#endif
diff --git a/src/bin/win.c b/src/bin/win.c
index 5e48258..20a6f8e 100644
--- a/src/bin/win.c
+++ b/src/bin/win.c
@@ -25,7 +25,6 @@
25 25
26/* {{{ Structs */ 26/* {{{ Structs */
27 27
28typedef struct _Term_Container Term_Container;
29typedef struct _Split Split; 28typedef struct _Split Split;
30 29
31struct _Term 30struct _Term
@@ -40,7 +39,6 @@ struct _Term
40 Evas_Object *media; 39 Evas_Object *media;
41 Evas_Object *popmedia; 40 Evas_Object *popmedia;
42 Evas_Object *miniview; 41 Evas_Object *miniview;
43 //Evas_Object *sel;
44 Evas_Object *tabcount_spacer; 42 Evas_Object *tabcount_spacer;
45 Eina_List *popmedia_queue; 43 Eina_List *popmedia_queue;
46 Media_Type poptype, mediatype; 44 Media_Type poptype, mediatype;
@@ -56,56 +54,9 @@ struct _Term
56 unsigned char popmedia_deleted : 1; 54 unsigned char popmedia_deleted : 1;
57}; 55};
58 56
59typedef struct _Sizeinfo Sizeinfo;
60
61struct _Sizeinfo
62{
63 int min_w;
64 int min_h;
65 int step_x;
66 int step_y;
67 int req_w;
68 int req_h;
69 int bg_min_w;
70 int bg_min_h;
71 int req;
72};
73
74typedef enum _Term_Container_Type
75{
76 TERM_CONTAINER_TYPE_UNKNOWN,
77 TERM_CONTAINER_TYPE_SOLO,
78 TERM_CONTAINER_TYPE_SPLIT,
79 TERM_CONTAINER_TYPE_TABS,
80 TERM_CONTAINER_TYPE_WIN
81} Term_Container_Type;
82
83typedef struct _Term_Container Term_Container;
84typedef struct _Solo Solo; 57typedef struct _Solo Solo;
85typedef struct _Tabs Tabs; 58typedef struct _Tabs Tabs;
86 59
87struct _Term_Container {
88 Term_Container_Type type;
89 Term_Container *parent;
90 Win *wn;
91
92 Term *(*term_next)(Term_Container *tc, Term_Container *child);
93 Term *(*term_prev)(Term_Container *tc, Term_Container *child);
94 Term *(*term_first)(Term_Container *tc);
95 Term *(*term_last)(Term_Container *tc);
96 Evas_Object* (*get_evas_object)(Term_Container *container);
97 Term *(*find_term_at_coords)(Term_Container *container,
98 Evas_Coord mx, Evas_Coord my);
99 void (*size_eval)(Term_Container *container, Sizeinfo *info);
100 void (*split)(Term_Container *container, const char *cmd,
101 Eina_Bool is_horizontal); /* TODO: only for solo, move out ? */
102 void (*swallow)(Term_Container *container, Term_Container *orig,
103 Term_Container *new_child);
104 void (*focus)(Term_Container *tc, Term_Container *relative);
105 void (*set_title)(Term_Container *tc, Term_Container *child, const char *title);
106 void (*close)(Term_Container *container, Term_Container *child,
107 Eina_Bool refocus);
108};
109 60
110struct _Solo { 61struct _Solo {
111 Term_Container tc; 62 Term_Container tc;
@@ -117,11 +68,14 @@ struct _Tab_Item {
117 Term_Container *tc; 68 Term_Container *tc;
118 Elm_Object_Item *elm_item; 69 Elm_Object_Item *elm_item;
119 Elm_Object_Item *separator; 70 Elm_Object_Item *separator;
71 void *selector_entry;
120}; 72};
121 73
122struct _Tabs { 74struct _Tabs {
123 Term_Container tc; 75 Term_Container tc;
124 Evas_Object *base; 76 Evas_Object *base;
77 Evas_Object *selector;
78 Evas_Object *selector_bg;
125 Evas_Object *tabbar; 79 Evas_Object *tabbar;
126 Evas_Object *tabbar_spacer; 80 Evas_Object *tabbar_spacer;
127 Evas_Object *selector_spacer; 81 Evas_Object *selector_spacer;
@@ -162,6 +116,7 @@ struct _Win
162}; 116};
163 117
164/* }}} */ 118/* }}} */
119
165static Eina_List *wins = NULL; 120static Eina_List *wins = NULL;
166 121
167 122
@@ -171,12 +126,11 @@ static Term_Container *_tabs_new(Term_Container *child, Term_Container *parent);
171//static void _term_resize_track_start(Term *term); 126//static void _term_resize_track_start(Term *term);
172//static void _split_tabcount_update(Split *sp, Term *tm); 127//static void _split_tabcount_update(Split *sp, Term *tm);
173static Term * _win_focused_term_get(Win *wn); 128static Term * _win_focused_term_get(Win *wn);
174static Split * _split_find(Evas_Object *win, Evas_Object *term, Term **ptm); 129//static Split * _split_find(Evas_Object *win, Evas_Object *term, Term **ptm);
175static void _term_focus(Term *term); 130static void _term_focus(Term *term);
176static void term_free(Term *term); 131static void term_free(Term *term);
177//static void _split_free(Split *sp); 132//static void _split_free(Split *sp);
178//static void _sel_restore(Split *sp); 133//static void _sel_restore(Split *sp);
179static void _sel_go(Split *sp, Term *term);
180//static void _term_resize_track_stop(Term *term); 134//static void _term_resize_track_stop(Term *term);
181//static void _split_merge(Split *spp, Split *sp, const char *slot); 135//static void _split_merge(Split *spp, Split *sp, const char *slot);
182//static void _term_focus_show(Split *sp, Term *term); 136//static void _term_focus_show(Split *sp, Term *term);
@@ -378,6 +332,8 @@ _solo_close(Term_Container *tc, Term_Container *child EINA_UNUSED,
378{ 332{
379 tc->parent->close(tc->parent, tc, refocus); 333 tc->parent->close(tc->parent, tc, refocus);
380 334
335 eina_stringshare_del(tc->title);
336
381 free(tc); 337 free(tc);
382} 338}
383 339
@@ -450,6 +406,8 @@ static void
450_solo_set_title(Term_Container *tc, Term_Container *child EINA_UNUSED, 406_solo_set_title(Term_Container *tc, Term_Container *child EINA_UNUSED,
451 const char *title) 407 const char *title)
452{ 408{
409 eina_stringshare_del(tc->title);
410 tc->title = eina_stringshare_add(title);
453 DBG("set title: '%s'", title); 411 DBG("set title: '%s'", title);
454 tc->parent->set_title(tc->parent, tc, title); 412 tc->parent->set_title(tc->parent, tc, title);
455} 413}
@@ -463,10 +421,12 @@ _solo_focus(Term_Container *tc, Term_Container *relative EINA_UNUSED)
463 421
464 if (tc->parent == relative) 422 if (tc->parent == relative)
465 { 423 {
424 DBG("focus from parent");
466 _term_focus(solo->term); 425 _term_focus(solo->term);
467 } 426 }
468 else 427 else
469 { 428 {
429 DBG("focus from child");
470 tc->parent->focus(tc->parent, tc); 430 tc->parent->focus(tc->parent, tc);
471 } 431 }
472} 432}
@@ -807,8 +767,10 @@ _win_swallow(Term_Container *tc, Term_Container *orig,
807 767
808 if (orig) 768 if (orig)
809 { 769 {
810 edje_object_part_unswallow(base, 770 Evas_Object *o;
811 orig->get_evas_object(orig)); 771
772 o = edje_object_part_swallow_get(base, "terminology.content");
773 edje_object_part_unswallow(base, o);
812 /* TODO: hide */ 774 /* TODO: hide */
813 } 775 }
814 edje_object_part_swallow(base, "terminology.content", 776 edje_object_part_swallow(base, "terminology.content",
@@ -826,17 +788,19 @@ _win_close(Term_Container *tc, Term_Container *child EINA_UNUSED,
826 788
827 wn = (Win*) tc; 789 wn = (Win*) tc;
828 790
791 eina_stringshare_del(tc->title);
792
829 win_free(wn); 793 win_free(wn);
830} 794}
831 795
832static void 796static void
833_win_focus(Term_Container *tc, Term_Container *child EINA_UNUSED) 797_win_focus(Term_Container *tc, Term_Container *child EINA_UNUSED)
834{ 798{
835 DBG("focus");
836 Win *wn; 799 Win *wn;
837 assert (tc->type == TERM_CONTAINER_TYPE_WIN); 800 assert (tc->type == TERM_CONTAINER_TYPE_WIN);
838 801
839 wn = (Win*) tc; 802 wn = (Win*) tc;
803 DBG("focus from child");
840 804
841 if (!wn->focused) elm_win_urgent_set(wn->win, EINA_FALSE); 805 if (!wn->focused) elm_win_urgent_set(wn->win, EINA_FALSE);
842 wn->focused = EINA_TRUE; 806 wn->focused = EINA_TRUE;
@@ -852,6 +816,9 @@ _win_set_title(Term_Container *tc, Term_Container *child EINA_UNUSED,
852 816
853 wn = (Win*) tc; 817 wn = (Win*) tc;
854 818
819 eina_stringshare_del(tc->title);
820 tc->title = eina_stringshare_ref(title);
821
855 DBG("set title: '%s'", title); 822 DBG("set title: '%s'", title);
856 823
857 elm_win_title_set(wn->win, title); 824 elm_win_title_set(wn->win, title);
@@ -1307,6 +1274,7 @@ _split_close(Term_Container *tc, Term_Container *child,
1307 1274
1308 evas_object_del(split->panes); 1275 evas_object_del(split->panes);
1309 1276
1277 eina_stringshare_del(tc->title);
1310 free(tc); 1278 free(tc);
1311} 1279}
1312 1280
@@ -1320,10 +1288,12 @@ _split_focus(Term_Container *tc, Term_Container *relative)
1320 1288
1321 if (tc->parent == relative) 1289 if (tc->parent == relative)
1322 { 1290 {
1291 DBG("focus from parent");
1323 split->last_focus->focus(split->last_focus, tc); 1292 split->last_focus->focus(split->last_focus, tc);
1324 } 1293 }
1325 else 1294 else
1326 { 1295 {
1296 DBG("focus from child");
1327 split->last_focus = relative; 1297 split->last_focus = relative;
1328 tc->parent->focus(tc->parent, tc); 1298 tc->parent->focus(tc->parent, tc);
1329 } 1299 }
@@ -1342,7 +1312,11 @@ _split_set_title(Term_Container *tc, Term_Container *child,
1342 title, child, split->last_focus); 1312 title, child, split->last_focus);
1343 1313
1344 if (child == split->last_focus) 1314 if (child == split->last_focus)
1345 tc->parent->set_title(tc->parent, tc, title); 1315 {
1316 eina_stringshare_del(tc->title);
1317 tc->title = eina_stringshare_ref(title);
1318 tc->parent->set_title(tc->parent, tc, title);
1319 }
1346} 1320}
1347 1321
1348static Term_Container * 1322static Term_Container *
@@ -1565,13 +1539,11 @@ _split_split_find(Split *sp, Evas_Object *term, Term **ptm)
1565 } 1539 }
1566 return NULL; 1540 return NULL;
1567} 1541}
1568#endif
1569 1542
1570static Split * 1543static Split *
1571_split_find(Evas_Object *win EINA_UNUSED, Evas_Object *term EINA_UNUSED, Term **ptm EINA_UNUSED) 1544_split_find(Evas_Object *win EINA_UNUSED, Evas_Object *term EINA_UNUSED, Term **ptm EINA_UNUSED)
1572{ 1545{
1573 /* TODO */ 1546 /* TODO */
1574#if 0
1575 Win *wn; 1547 Win *wn;
1576 Eina_List *l; 1548 Eina_List *l;
1577 1549
@@ -1579,11 +1551,9 @@ _split_find(Evas_Object *win EINA_UNUSED, Evas_Object *term EINA_UNUSED, Term **
1579 { 1551 {
1580 if (wn->win == win) return _split_split_find(wn->split, term, ptm); 1552 if (wn->win == win) return _split_split_find(wn->split, term, ptm);
1581 } 1553 }
1582#endif
1583 return NULL; 1554 return NULL;
1584} 1555}
1585 1556
1586#if 0
1587static void 1557static void
1588_split_free(Split *sp) 1558_split_free(Split *sp)
1589{ 1559{
@@ -1592,9 +1562,7 @@ _split_free(Split *sp)
1592 if (sp->panes) evas_object_del(sp->panes); 1562 if (sp->panes) evas_object_del(sp->panes);
1593 free(sp); 1563 free(sp);
1594} 1564}
1595#endif
1596 1565
1597#if 0
1598static void 1566static void
1599_split_tabcount_update(Split *sp EINA_UNUSED, Term *tm EINA_UNUSED) 1567_split_tabcount_update(Split *sp EINA_UNUSED, Term *tm EINA_UNUSED)
1600{ 1568{
@@ -1966,8 +1934,231 @@ _split_merge(Split *spp, Split *sp, const char *slot)
1966#endif 1934#endif
1967 1935
1968/* }}} */ 1936/* }}} */
1937/* {{{ Sel */
1938
1939#if 0
1940static void
1941_sel_restore(Split *sp EINA_UNUSED)
1942{
1943 Eina_List *l;
1944 Term *tm;
1945
1946 EINA_LIST_FOREACH(sp->terms, l, tm)
1947 {
1948 if (tm->unswallowed)
1949 {
1950#if (EVAS_VERSION_MAJOR > 1) || (EVAS_VERSION_MINOR >= 8)
1951 evas_object_image_source_visible_set(tm->sel, EINA_TRUE);
1952#endif
1953 edje_object_part_swallow(tm->bg, "terminology.content", tm->base);
1954 tm->unswallowed = EINA_FALSE;
1955 evas_object_show(tm->base);
1956 tm->sel = NULL;
1957 }
1958 }
1959 evas_object_del(sp->sel);
1960 evas_object_del(sp->sel_bg);
1961 sp->sel = NULL;
1962 sp->sel_bg = NULL;
1963}
1964
1965#endif
1966
1967/* }}} */
1969/* {{{ Tabs */ 1968/* {{{ Tabs */
1970 1969
1970static void
1971_tabs_restore(Tabs *tabs)
1972{
1973 Eina_List *l;
1974 Tab_Item *tab_item;
1975 Evas_Object *o;
1976 Term_Container *tc = (Term_Container*)tabs;
1977
1978 DBG("exit: %p", tabs);
1979 if (!tabs->selector)
1980 return;
1981
1982 EINA_LIST_FOREACH(tabs->tabs, l, tab_item)
1983 {
1984 tab_item->selector_entry = NULL;
1985 }
1986
1987 o = tabs->current->tc->get_evas_object(tabs->current->tc);
1988 edje_object_part_swallow(tabs->base, "content", o);
1989 evas_object_show(o);
1990 evas_object_del(tabs->selector);
1991 evas_object_del(tabs->selector_bg);
1992 tabs->selector = NULL;
1993 tabs->selector_bg = NULL;
1994 tc->focus(tc, tc->parent);
1995
1996 elm_toolbar_item_selected_set(tabs->current->elm_item, EINA_TRUE);
1997}
1998
1999static void
2000_tabs_selector_cb_selected(void *data,
2001 Evas_Object *obj EINA_UNUSED,
2002 void *info)
2003{
2004 Tabs *tabs = data;
2005 Eina_List *l;
2006 Tab_Item *tab_item;
2007 /* TODO: boris */
2008 DBG("selected: %p info:%p", tabs, info);
2009
2010 EINA_LIST_FOREACH(tabs->tabs, l, tab_item)
2011 {
2012 if (tab_item->tc->selector_img == info)
2013 {
2014 tabs->current = tab_item;
2015 _tabs_restore(tabs);
2016 return;
2017 }
2018 }
2019
2020 DBG("FAIL");
2021#if 0
2022 Split *sp = data;
2023 Eina_List *l;
2024 Term *tm;
2025
2026 EINA_LIST_FOREACH(sp->terms, l, tm)
2027 {
2028 if (tm->sel == info)
2029 {
2030 _term_focus(tm);
2031 _term_focus_show(sp, tm);
2032 _sel_restore(sp);
2033 _term_miniview_check(tm);
2034 return;
2035 }
2036 }
2037 _sel_restore(sp);
2038 _term_focus(sp->term);
2039 _term_focus_show(sp, sp->term);
2040 _term_miniview_check(tm);
2041#endif
2042}
2043
2044static void
2045_tabs_selector_cb_exit(void *data,
2046 Evas_Object *obj EINA_UNUSED,
2047 void *info EINA_UNUSED)
2048{
2049 Tabs *tabs = data;
2050
2051 DBG("exit: %p", tabs);
2052 _tabs_restore(tabs);
2053}
2054
2055static void
2056_tabs_selector_cb_ending(void *data,
2057 Evas_Object *obj EINA_UNUSED,
2058 void *info EINA_UNUSED)
2059{
2060 Tabs *tabs = data;
2061 /* TODO: boris */
2062 DBG("ending: %p", tabs);
2063#if 0
2064 Split *sp = data;
2065 edje_object_signal_emit(sp->sel_bg, "end", "terminology");
2066#endif
2067}
2068
2069
2070static void
2071_cb_tab_selector_show(void *data,
2072 Evas_Object *obj EINA_UNUSED,
2073 const char *sig EINA_UNUSED,
2074 const char *src EINA_UNUSED)
2075{
2076 Tabs *tabs = data;
2077 Term_Container *tc = (Term_Container *)tabs;
2078 Eina_List *l;
2079 int count;
2080 double z;
2081 Edje_Message_Int msg;
2082 Win *wn = tc->wn;
2083 Tab_Item *tab_item;
2084 Evas_Object *o;
2085
2086 DBG("show tabs selector: %p", tabs->selector_bg);
2087
2088 /* TODO: tab count off */
2089
2090 if (tabs->selector_bg)
2091 return;
2092
2093 tabs->selector_bg = edje_object_add(evas_object_evas_get(tabs->base));
2094 theme_apply(tabs->selector_bg, wn->config, "terminology/sel/base");
2095 if (wn->config->translucent)
2096 msg.val = wn->config->opacity;
2097 else
2098 msg.val = 100;
2099
2100 edje_object_message_send(tabs->selector_bg, EDJE_MESSAGE_INT, 1, &msg);
2101 edje_object_signal_emit(tabs->selector_bg, "begin", "terminology");
2102
2103 tab_item = tabs->current;
2104 o = edje_object_part_swallow_get(tabs->base, "content");
2105 edje_object_part_unswallow(tabs->base, o);
2106 evas_object_hide(o);
2107
2108 tabs->selector = sel_add(wn->win);
2109 DBG("tabs->selector: %p", tabs->selector);
2110 EINA_LIST_FOREACH(tabs->tabs, l, tab_item)
2111 {
2112 Evas_Object *img;
2113 Evas_Coord w, h;
2114 Eina_Bool is_selected, missed_bell;
2115
2116 img = evas_object_image_filled_add(evas_object_evas_get(wn->win));
2117 o = tab_item->tc->get_evas_object(tab_item->tc);
2118 evas_object_lower(o);
2119 evas_object_move(o, -9999, -9999);
2120 evas_object_show(o);
2121 evas_object_clip_unset(o);
2122 evas_object_image_source_set(img, o);
2123 evas_object_geometry_get(o, NULL, NULL, &w, &h);
2124 evas_object_resize(img, w, h);
2125 evas_object_data_set(img, "tc", tab_item->tc);
2126 tab_item->tc->selector_img = img;
2127
2128 is_selected = (tab_item == tabs->current);
2129 missed_bell = EINA_FALSE;
2130 tab_item->selector_entry = sel_entry_add(tabs->selector, img,
2131 is_selected,
2132 missed_bell, wn->config);
2133 DBG("adding entry %p selected:%d img:%p selector_entry:%p",
2134 tab_item, is_selected, img, tab_item->selector_entry);
2135 }
2136 edje_object_part_swallow(tabs->selector_bg, "terminology.content",
2137 tabs->selector);
2138 evas_object_show(tabs->selector);
2139
2140 /* XXX: reswallow in parent */
2141 tc->parent->swallow(tc->parent, tc, tc);
2142 evas_object_show(tabs->selector_bg);
2143
2144 evas_object_smart_callback_add(tabs->selector, "selected",
2145 _tabs_selector_cb_selected, tabs);
2146 evas_object_smart_callback_add(tabs->selector, "exit",
2147 _tabs_selector_cb_exit, tabs);
2148 evas_object_smart_callback_add(tabs->selector, "ending",
2149 _tabs_selector_cb_ending, tabs);
2150 z = 1.0;
2151 sel_go(tabs->selector);
2152 count = eina_list_count(tabs->tabs);
2153 if (count >= 1)
2154 z = 1.0 / (sqrt(count) * 0.8);
2155 if (z > 1.0) z = 1.0;
2156 sel_orig_zoom_set(tabs->selector, z);
2157 sel_zoom(tabs->selector, z);
2158 elm_object_focus_set(tabs->selector, EINA_TRUE);
2159}
2160
2161
1971static Evas_Object * 2162static Evas_Object *
1972_tabs_get_evas_object(Term_Container *container) 2163_tabs_get_evas_object(Term_Container *container)
1973{ 2164{
@@ -1975,6 +2166,10 @@ _tabs_get_evas_object(Term_Container *container)
1975 assert (container->type == TERM_CONTAINER_TYPE_TABS); 2166 assert (container->type == TERM_CONTAINER_TYPE_TABS);
1976 tabs = (Tabs*)container; 2167 tabs = (Tabs*)container;
1977 2168
2169 DBG("evas_object: tabs->selector_bg:%p", tabs->selector_bg);
2170 if (tabs->selector_bg)
2171 return tabs->selector_bg;
2172
1978 return tabs->base; 2173 return tabs->base;
1979} 2174}
1980 2175
@@ -2064,11 +2259,15 @@ _tabs_close(Term_Container *tc, Term_Container *child,
2064 count = eina_list_count(tabs->tabs); 2259 count = eina_list_count(tabs->tabs);
2065 if (count == 1) 2260 if (count == 1)
2066 { 2261 {
2262 if (tabs->selector)
2263 _tabs_restore(tabs);
2264
2067 tc->parent->close(tc->parent, tc, refocus); 2265 tc->parent->close(tc->parent, tc, refocus);
2068 evas_object_del(tabs->base); 2266 evas_object_del(tabs->base);
2069 evas_object_del(tabs->tabbar); 2267 evas_object_del(tabs->tabbar);
2070 evas_object_del(tabs->tabbar_spacer); 2268 evas_object_del(tabs->tabbar_spacer);
2071 evas_object_del(tabs->selector_spacer); 2269 evas_object_del(tabs->selector_spacer);
2270 eina_stringshare_del(tc->title);
2072 free(tc); 2271 free(tc);
2073 } 2272 }
2074 else 2273 else
@@ -2095,6 +2294,16 @@ _tabs_close(Term_Container *tc, Term_Container *child,
2095 tabs->current->tc->focus(tabs->current->tc, tc); 2294 tabs->current->tc->focus(tabs->current->tc, tc);
2096 } 2295 }
2097 } 2296 }
2297
2298 if (tab_item->tc->selector_img)
2299 {
2300 Evas_Object *o;
2301 o = tab_item->tc->selector_img;
2302 tab_item->tc->selector_img = NULL;
2303 evas_object_del(o);
2304 }
2305
2306
2098 elm_object_item_del(tab_item->elm_item); 2307 elm_object_item_del(tab_item->elm_item);
2099 elm_object_item_del(tab_item->separator); 2308 elm_object_item_del(tab_item->separator);
2100 tabs->tabs = eina_list_remove_list(tabs->tabs, l); 2309 tabs->tabs = eina_list_remove_list(tabs->tabs, l);
@@ -2197,9 +2406,20 @@ _tabs_swallow(Term_Container *tc, Term_Container *orig,
2197 2406
2198 new_child->parent = tc; 2407 new_child->parent = tc;
2199 2408
2200 if (tab_item == tabs->current) 2409 if (tabs->selector)
2201 { 2410 {
2202 edje_object_part_unswallow(tabs->base, orig->get_evas_object(orig)); 2411 Evas_Object *img = tab_item->tc->selector_img;
2412 evas_object_image_source_set(img,
2413 new_child->get_evas_object(new_child));
2414 evas_object_data_set(img, "tc", new_child);
2415 sel_entry_update(tab_item->selector_entry);
2416 }
2417 else if (tab_item == tabs->current)
2418 {
2419 Evas_Object *o;
2420
2421 o = edje_object_part_swallow_get(tabs->base, "content");
2422 edje_object_part_unswallow(tabs->base, o);
2203 /* TODO: hide */ 2423 /* TODO: hide */
2204 edje_object_part_swallow(tabs->base, "content", 2424 edje_object_part_swallow(tabs->base, "content",
2205 new_child->get_evas_object(new_child)); 2425 new_child->get_evas_object(new_child));
@@ -2221,11 +2441,13 @@ _tab_selected(void *data,
2221 assert (tc->type == TERM_CONTAINER_TYPE_TABS); 2441 assert (tc->type == TERM_CONTAINER_TYPE_TABS);
2222 tabs = (Tabs*) tc; 2442 tabs = (Tabs*) tc;
2223 2443
2444 if (tabs->current && tab_item == tabs->current)
2445 return;
2224 if (tabs->current) 2446 if (tabs->current)
2225 { 2447 {
2226 Evas_Object *o; 2448 Evas_Object *o;
2227 child = tabs->current->tc; 2449 child = tabs->current->tc;
2228 o = child->get_evas_object(child); 2450 o = edje_object_part_swallow_get(tabs->base, "content");
2229 edje_object_part_unswallow(tabs->base, o); 2451 edje_object_part_unswallow(tabs->base, o);
2230 evas_object_hide(o); 2452 evas_object_hide(o);
2231 child = tab_item->tc; 2453 child = tab_item->tc;
@@ -2236,8 +2458,6 @@ _tab_selected(void *data,
2236 elm_toolbar_item_selected_set(tabs->current->elm_item, EINA_FALSE); 2458 elm_toolbar_item_selected_set(tabs->current->elm_item, EINA_FALSE);
2237 } 2459 }
2238 tabs->current = tab_item; 2460 tabs->current = tab_item;
2239
2240 tab_item->tc->focus(tab_item->tc, tc);
2241} 2461}
2242 2462
2243static Tab_Item* 2463static Tab_Item*
@@ -2368,14 +2588,17 @@ _tabs_focus(Term_Container *tc, Term_Container *relative)
2368 assert (tc->type == TERM_CONTAINER_TYPE_TABS); 2588 assert (tc->type == TERM_CONTAINER_TYPE_TABS);
2369 tabs = (Tabs*) tc; 2589 tabs = (Tabs*) tc;
2370 2590
2591
2371 if (tc->parent == relative) 2592 if (tc->parent == relative)
2372 { 2593 {
2594 DBG("focus from parent");
2373 tabs->current->tc->focus(tabs->current->tc, tc); 2595 tabs->current->tc->focus(tabs->current->tc, tc);
2374 } 2596 }
2375 else 2597 else
2376 { 2598 {
2377 Eina_List *l; 2599 Eina_List *l;
2378 Tab_Item *tab_item; 2600 Tab_Item *tab_item;
2601 DBG("focus from child");
2379 2602
2380 l = _tab_item_find(tabs, relative); 2603 l = _tab_item_find(tabs, relative);
2381 assert(l); 2604 assert(l);
@@ -2407,8 +2630,17 @@ _tabs_set_title(Term_Container *tc, Term_Container *child,
2407 DBG("set title: '%s' child:%p current->tc:%p", 2630 DBG("set title: '%s' child:%p current->tc:%p",
2408 title, child, tabs->current->tc); 2631 title, child, tabs->current->tc);
2409 2632
2633 if (tabs->selector)
2634 {
2635 sel_entry_title_set(tab_item->selector_entry, title);
2636 }
2637
2410 if (tab_item == tabs->current) 2638 if (tab_item == tabs->current)
2411 tc->parent->set_title(tc->parent, tc, title); 2639 {
2640 eina_stringshare_del(tc->title);
2641 tc->title = eina_stringshare_ref(title);
2642 tc->parent->set_title(tc->parent, tc, title);
2643 }
2412} 2644}
2413 2645
2414static Term_Container * 2646static Term_Container *
@@ -2480,6 +2712,8 @@ _tabs_new(Term_Container *child, Term_Container *parent)
2480 2712
2481 edje_object_signal_callback_add(tabs->base, "tabbar,show", "terminology", 2713 edje_object_signal_callback_add(tabs->base, "tabbar,show", "terminology",
2482 _cb_tabbar_show, tabs); 2714 _cb_tabbar_show, tabs);
2715 edje_object_signal_callback_add(tabs->base, "tabselector,show", "terminology",
2716 _cb_tab_selector_show, tabs);
2483 2717
2484 2718
2485 return tc; 2719 return tc;
@@ -2554,6 +2788,8 @@ _term_focus(Term *term)
2554 Term *term2; 2788 Term *term2;
2555 const char *title; 2789 const char *title;
2556 2790
2791 DBG("term focus");
2792
2557 EINA_LIST_FOREACH(term->wn->terms, l, term2) 2793 EINA_LIST_FOREACH(term->wn->terms, l, term2)
2558 { 2794 {
2559 if (term2 != term) 2795 if (term2 != term)
@@ -2944,16 +3180,6 @@ _cb_command(void *data, Evas_Object *obj EINA_UNUSED, void *event)
2944} 3180}
2945 3181
2946static void 3182static void
2947_cb_tabcount_go(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
2948{
2949 Term *term = data;
2950 Split *sp;
2951
2952 sp = _split_find(term->wn->win, term->termio, NULL);
2953 _sel_go(sp, term);
2954}
2955
2956static void
2957_cb_prev(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED) 3183_cb_prev(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
2958{ 3184{
2959 Term *term = data; 3185 Term *term = data;
@@ -3465,9 +3691,7 @@ main_term_bg_config(Term *term)
3465 3691
3466 termio_theme_set(term->termio, term->bg); 3692 termio_theme_set(term->termio, term->bg);
3467 edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology", 3693 edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology",
3468 _cb_popmedia_done, term); 3694 _cb_popmedia_done, term);
3469 edje_object_signal_callback_add(term->bg, "tabcount,go", "terminology",
3470 _cb_tabcount_go, term);
3471 edje_object_signal_callback_add(term->bg, "tabcount,prev", "terminology", 3695 edje_object_signal_callback_add(term->bg, "tabcount,prev", "terminology",
3472 _cb_tabcount_prev, term); 3696 _cb_tabcount_prev, term);
3473 edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology", 3697 edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology",
@@ -3764,8 +3988,6 @@ term_new(Win *wn, Config *config, const char *cmd,
3764 3988
3765 edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology", 3989 edje_object_signal_callback_add(term->bg, "popmedia,done", "terminology",
3766 _cb_popmedia_done, term); 3990 _cb_popmedia_done, term);
3767 edje_object_signal_callback_add(term->bg, "tabcount,go", "terminology",
3768 _cb_tabcount_go, term);
3769 edje_object_signal_callback_add(term->bg, "tabcount,prev", "terminology", 3991 edje_object_signal_callback_add(term->bg, "tabcount,prev", "terminology",
3770 _cb_tabcount_prev, term); 3992 _cb_tabcount_prev, term);
3771 edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology", 3993 edje_object_signal_callback_add(term->bg, "tabcount,next", "terminology",
@@ -3820,6 +4042,19 @@ term_new(Win *wn, Config *config, const char *cmd,
3820 4042
3821 4043
3822/* }}} */ 4044/* }}} */
4045
4046void
4047windows_free(void)
4048{
4049 Win *wn;
4050
4051 while (wins)
4052 {
4053 wn = eina_list_data_get(wins);
4054 win_free(wn);
4055 }
4056}
4057
3823/* {{{ Sel */ 4058/* {{{ Sel */
3824 4059
3825#if 0 4060#if 0
@@ -3893,12 +4128,10 @@ _sel_cb_ending(void *data, Evas_Object *obj EINA_UNUSED, void *info EINA_UNUSED)
3893 Split *sp = data; 4128 Split *sp = data;
3894 edje_object_signal_emit(sp->sel_bg, "end", "terminology"); 4129 edje_object_signal_emit(sp->sel_bg, "end", "terminology");
3895} 4130}
3896#endif
3897 4131
3898static void 4132static void
3899_sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED) 4133_sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED)
3900{ 4134{
3901#if 0
3902 Eina_List *l; 4135 Eina_List *l;
3903 Term *tm; 4136 Term *tm;
3904 double z; 4137 double z;
@@ -3935,7 +4168,7 @@ _sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED)
3935 evas_object_resize(img, w, h); 4168 evas_object_resize(img, w, h);
3936 evas_object_data_set(img, "termio", tm->term); 4169 evas_object_data_set(img, "termio", tm->term);
3937 tm->sel = img; 4170 tm->sel = img;
3938 4171
3939 sel_entry_add(sp->sel, tm->sel, (tm == sp->term), 4172 sel_entry_add(sp->sel, tm->sel, (tm == sp->term),
3940 tm->missed_bell, tm->config); 4173 tm->missed_bell, tm->config);
3941 } 4174 }
@@ -3975,19 +4208,7 @@ _sel_go(Split *sp EINA_UNUSED, Term *term EINA_UNUSED)
3975 sel_exit(sp->sel); 4208 sel_exit(sp->sel);
3976 } 4209 }
3977 elm_object_focus_set(sp->sel, EINA_TRUE); 4210 elm_object_focus_set(sp->sel, EINA_TRUE);
3978#endif
3979} 4211}
4212#endif
3980/* }}} */ 4213/* }}} */
3981 4214
3982void
3983windows_free(void)
3984{
3985 Win *wn;
3986
3987 while (wins)
3988 {
3989 wn = eina_list_data_get(wins);
3990 win_free(wn);
3991 }
3992}
3993
diff --git a/src/bin/win.h b/src/bin/win.h
index 541e6b6..6a38581 100644
--- a/src/bin/win.h
+++ b/src/bin/win.h
@@ -2,11 +2,7 @@
2#define _WIN_H__ 1 2#define _WIN_H__ 1
3 3
4#include "config.h" 4#include "config.h"
5 5#include "term_container.h"
6typedef struct _Win Win;
7typedef struct _Term Term;
8
9
10 6
11Eina_Bool main_term_popup_exists(const Term *term); 7Eina_Bool main_term_popup_exists(const Term *term);
12void main_term_focus(Term *term); 8void main_term_focus(Term *term);