only show tabselector if tabcount > 1

This commit is contained in:
Boris Faure 2014-11-29 23:02:38 +01:00
parent 9abf95c981
commit a85dc5be9d
2 changed files with 50 additions and 28 deletions

View File

@ -2447,10 +2447,23 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
rel2.to: "content";
}
}
part { name: "tabcount_clip"; type: RECT;
description { state: "default" 0.0;
color: 255 255 255 0;
visible: 0;
}
description { state: "on" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
rel1.to: "content";
rel2.to: "content";
}
}
part { name: "terminology.tabmissed.label"; type: TEXT; mouse_events: 0;
effect: GLOW;
scale: 1;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabcount.label";
@ -2476,7 +2489,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "terminology.tabmissed.ev"; type: RECT; repeat_events: 1;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabmissed.label";
@ -2487,7 +2500,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
part { name: "terminology.tabcount.label"; type: TEXT; mouse_events: 0;
effect: GLOW;
scale: 1;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabselector.spacer";
@ -2512,7 +2525,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "terminology.tabcount.ev"; type: RECT; repeat_events: 1;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabcount.label";
@ -2521,7 +2534,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_glow_r0";
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "tabselector_r0";
rel2.to: "tabselector_r0";
@ -2539,7 +2552,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_glow_r1";
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "tabselector_r1";
rel2.to: "tabselector_r1";
@ -2557,7 +2570,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_glow_r2";
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "tabselector_r2";
rel2.to: "tabselector_r2";
@ -2575,7 +2588,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_glow_r3";
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "tabselector_r3";
rel2.to: "tabselector_r3";
@ -2593,7 +2606,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_r0"; type: RECT;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "terminology.tabselector.spacer";
rel2.to: "terminology.tabselector.spacer";
@ -2607,7 +2620,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_r1"; type: RECT;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "terminology.tabselector.spacer";
rel2.to: "terminology.tabselector.spacer";
@ -2621,7 +2634,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_r2"; type: RECT;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "terminology.tabselector.spacer";
rel2.to: "terminology.tabselector.spacer";
@ -2635,7 +2648,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_r3"; type: RECT;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
rel1.to: "terminology.tabselector.spacer";
rel2.to: "terminology.tabselector.spacer";
@ -2649,7 +2662,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "terminology.tabselector.spacer"; type: SWALLOW;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabbar.spacer";
@ -2661,7 +2674,7 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
}
}
part { name: "tabselector_ev"; type: RECT; repeat_events: 1;
clip_to: "tabcontrols_clip";
clip_to: "tabcount_clip";
description { state: "default" 0.0;
fixed: 1 1;
rel1.to: "terminology.tabselector.spacer";
@ -2865,25 +2878,17 @@ target: "0.clip"; target: "1.clip"; target: "2.clip"; target: "3.clip"; target:
target: "tabcontrols_clip";
}
program {
signal: "tabmissed,off"; source: "terminology";
signal: "tabcount,off"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "terminology.tabmissed.label";
target: "tabcount_clip";
}
program {
signal: "tabmissed,on"; source: "terminology";
action: STATE_SET "over" 0.0;
transition: DECELERATE 0.2;
target: "terminology.tabmissed.label";
after: "tabmissed2";
signal: "tabcount,on"; source: "terminology";
action: STATE_SET "on" 0.0;
transition: DECELERATE 0.5;
target: "tabcount_clip";
}
program { name: "tabmissed2";
signal: "tabmissed,on"; source: "terminology";
action: STATE_SET "default" 0.0;
transition: DECELERATE 3.0;
target: "terminology.tabmissed.label";
}
}
}

View File

@ -84,6 +84,7 @@ struct _Tabs {
Evas_Object *selector_spacer;
Eina_List *tabs;
Tab_Item *current;
unsigned char tabbar_shown : 1;
};
struct _Split
@ -2429,6 +2430,9 @@ _tabs_close(Term_Container *tc, Term_Container *child,
count--;
snprintf(buf, sizeof(buf), "%i", count);
edje_object_part_text_set(tabs->base, "terminology.tabcount.label", buf);
if (eina_list_count(tabs->tabs) == 1 && !tabs->tabbar_shown)
edje_object_signal_emit(tabs->base, "tabcount,off", "terminology");
}
}
@ -2634,6 +2638,9 @@ _tab_new_cb(void *data,
tab_item_new(tabs, tc_new);
tc_new->focus(tc_new, tc_parent);
if (!tabs->tabbar_shown)
edje_object_signal_emit(tabs->base, "tabcount,on", "terminology");
}
static void
@ -2643,9 +2650,11 @@ _cb_tabbar_show(void *data, Evas_Object *obj EINA_UNUSED,
Tabs *tabs = data;
DBG("show");
tabs->tabbar_shown = EINA_TRUE;
edje_object_signal_emit(tabs->base, "tabbar,on", "terminology");
edje_object_signal_emit(tabs->base, "tabcontrols,off", "terminology");
edje_object_signal_emit(tabs->base, "tabcount,off", "terminology");
edje_object_part_swallow(tabs->base, "terminology.tabbar", tabs->box);
evas_object_show(tabs->box);
}
@ -2697,8 +2706,14 @@ _tabs_hide_cb(void *data,
edje_object_signal_emit(tabs->base, "tabbar,off", "terminology");
edje_object_signal_emit(tabs->base, "tabcontrols,on", "terminology");
if (eina_list_count(tabs->tabs) > 1)
edje_object_signal_emit(tabs->base, "tabcount,on", "terminology");
else
edje_object_signal_emit(tabs->base, "tabcount,off", "terminology");
edje_object_part_unswallow(tabs->base, tabs->box);
evas_object_hide(tabs->box);
tabs->tabbar_shown = EINA_FALSE;
}
static void
@ -2913,6 +2928,8 @@ _tabs_new(Term_Container *child, Term_Container *parent)
edje_object_signal_callback_add(tabs->base, "tabselector,show", "terminology",
_cb_tab_selector_show, tabs);
tabs->tabbar_shown = EINA_TRUE;
if (((parent->type == TERM_CONTAINER_TYPE_WIN) &&
wn->config->hide_top_tabbar) ||
(parent->type != TERM_CONTAINER_TYPE_WIN))