[Eve] Implement context-sensitive toolbar.

Get rid of the "New tab" item in the tab grid, and move the feature to the toolbar. The Back, Forward, and Reload buttons will hide, and a "New tab" button will appear.

SVN revision: 52353
This commit is contained in:
Leandro Pereira 2010-09-16 22:43:12 +00:00
parent 557bb5d244
commit a1c147fa49
8 changed files with 85 additions and 190 deletions

1
TODO
View File

@ -5,7 +5,6 @@ UI
* show visual zoom indication (zoom level? some icon?)
* show page icon (listen to signal, create object, feed theme, remember to del it when done)
* change icon of Bookmarks (or name) to reflect History is there as well
* tabs/bookmarks: hide back/forward/reload? maybe hide url bar as well?
* tabs: don't reload all grid on delete (faster close of multiple tabs)
* move reload to URL bar?
* url bar: clear button?

View File

@ -23,11 +23,12 @@ images = \
bt_reload_selected.png \
bt_tab_normal.png \
bt_tab_selected.png \
bt_addtab_normal.png \
bt_addtab_selected.png \
panel-top-triangle.png \
scrollbar-bg.png \
scrollbar-knob.png \
shadow-bottom.png \
tab-add.png \
tab-bg.png \
tab-bg-selected.png \
tab-close.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -24,6 +24,12 @@
offset: (_xpos) (-TOOLBAR_ITEM_SIZE/2); \
} \
image.normal: "bt_"_button_name"_normal.png"; \
color: 255 255 255 255; \
} \
description { state: "hidden" 0.0; \
inherit: "default" 0.0; \
color: 255 255 255 0; \
visible: 0; \
} \
} \
part { name: "button-"_button_name"-selected"; \
@ -46,6 +52,7 @@
} \
image.normal: "bt_"_button_name"_selected.png"; \
color: 255 255 255 0; \
visible: 0; \
} \
description { state: "visible" 0.0; \
inherit: "default" 0.0; \
@ -96,19 +103,28 @@
color: 190 190 190 255; \
color2: 20 20 20 255; \
} \
description { state: "hidden" 0.0; \
inherit: "default" 0.0; \
visible: 0; \
color: 190 190 190 0; \
color2: 20 20 20 0; \
} \
} \
part { name: "button-"_button_name"-disable-mask"; \
type: RECT; \
mouse_events: 1; \
description { state: "default" 0.0; \
fixed: 1 1; \
visible: 0; \
} \
description { state: "masking" 0.0; \
rel1.to: "button-"_button_name"-normal"; \
rel1.offset: 0 7; \
rel2.to: "button-"_button_name"-normal"; \
fixed: 1 1; \
color: 0 0 0 0; \
visible: 0; \
} \
description { state: "masking" 0.0; \
inherit: "default" 0.0; \
color: 0 0 0 128; \
visible: 1; \
} \
} \
programs { \
@ -135,11 +151,27 @@
signal: "button,"_button_name",disable"; \
action: STATE_SET "masking" 0.0; \
target: "button-"_button_name"-disable-mask"; \
transition: ACCELERATE 0.3; \
} \
program { name: _button_name"-enable"; \
signal: "button,"_button_name",enable"; \
action: STATE_SET "default" 0.0; \
target: "button-"_button_name"-disable-mask"; \
transition: DECELERATE 0.3; \
} \
program { name: _button_name"-hide"; \
action: STATE_SET "hidden" 0.0; \
target: "button-"_button_name"-normal"; \
target: "button-"_button_name"-label"; \
target: "button-"_button_name"-disable-mask"; \
transition: ACCELERATE 0.3; \
} \
program { name: _button_name"-show"; \
action: STATE_SET "default" 0.0; \
target: "button-"_button_name"-normal"; \
target: "button-"_button_name"-label"; \
target: "button-"_button_name"-disable-mask"; \
transition: DECELERATE 0.3; \
} \
}
@ -268,6 +300,8 @@ collections {
image: "bt_reload_selected.png" COMP;
image: "bt_tab_normal.png" COMP;
image: "bt_tab_selected.png" COMP;
image: "bt_addtab_normal.png" COMP;
image: "bt_addtab_selected.png" COMP;
image: "bt_home_normal.png" COMP;
image: "bt_home_selected.png" COMP;
image: "bt_fav_normal.png" COMP;
@ -289,6 +323,8 @@ collections {
public favorited;
public panel_top_visible;
public progress_bar_visible;
public button_back_disabled;
public button_forward_disabled;
public fav_off() {
set_int(favorited, 0);
@ -320,18 +356,48 @@ collections {
if (get_int(panel_top_visible) == 1) panel_top_hide();
else panel_top_show();
}
public navigation_controls_hide() {
new state_dst[31];
new Float:state_idx;
get_state(PART:"button-back-disable-mask", state_dst, 30, state_idx);
if (strcmp(state_dst, "masking") == 0) set_int(button_back_disabled, 1);
else set_int(button_back_disabled, 0);
get_state(PART:"button-forward-disable-mask", state_dst, 30, state_idx);
if (strcmp(state_dst, "masking") == 0) set_int(button_forward_disabled, 1);
else set_int(button_forward_disabled, 0);
run_program(PROGRAM:"back-hide");
run_program(PROGRAM:"forward-hide");
run_program(PROGRAM:"reload-hide");
}
public navigation_controls_show() {
run_program(PROGRAM:"back-show");
run_program(PROGRAM:"forward-show");
run_program(PROGRAM:"reload-show");
if (get_int(button_back_disabled) == 1) run_program(PROGRAM:"back-disable");
if (get_int(button_forward_disabled) == 1) run_program(PROGRAM:"forward-disable");
}
public tab_grid_hide() {
run_program(PROGRAM:"addtab-hide");
run_program(PROGRAM:"hide-tab-grid");
set_state(PART:"button-tab-selected", "default", 0.0);
set_int(tab_grid_visible, 0);
if (get_int(more_list_visible) != 1) run_program(PROGRAM:"show-white-view-mask");
if (get_int(more_list_visible) != 1) {
run_program(PROGRAM:"show-white-view-mask");
navigation_controls_show();
}
emit("tab,hide", "");
}
public tab_grid_show() {
set_int(tab_grid_visible, 1);
if (get_int(more_list_visible) == 1) more_list_hide();
else navigation_controls_hide();
run_program(PROGRAM:"show-tab-grid");
set_state(PART:"button-tab-selected", "visible", 0.0);
run_program(PROGRAM:"addtab-show");
run_program(PROGRAM:"show-black-view-mask");
emit("tab,show", "");
}
@ -343,12 +409,16 @@ collections {
run_program(PROGRAM:"hide-more-list");
set_state(PART:"button-more-selected", "default", 0.0);
set_int(more_list_visible, 0);
if (get_int(tab_grid_visible) != 1) run_program(PROGRAM:"show-white-view-mask");
if (get_int(tab_grid_visible) != 1) {
run_program(PROGRAM:"show-white-view-mask");
navigation_controls_show();
}
emit("more,hide", "");
}
public more_list_show() {
set_int(more_list_visible, 1);
if (get_int(tab_grid_visible) == 1) tab_grid_hide();
else navigation_controls_hide();
run_program(PROGRAM:"show-more-list");
set_state(PART:"button-more-selected", "visible", 0.0);
run_program(PROGRAM:"show-black-view-mask");
@ -786,6 +856,7 @@ collections {
image.normal: "toolbar-background-bottom.png";
}
}
TOOLBAR_BUTTON("addtab", "Add Tab", TOOLBAR_POSITION(1))
TOOLBAR_BUTTON("back", "Back", TOOLBAR_POSITION(1))
TOOLBAR_BUTTON("forward", "Forward", TOOLBAR_POSITION(2))
TOOLBAR_BUTTON("reload", "Reload", TOOLBAR_POSITION(3))
@ -906,6 +977,7 @@ collections {
set_int(progress_bar_visible, 0);
set_state(PART:"view-mask", "masking-white", 0.0);
run_program(PROGRAM:"addtab-hide");
}
}
program { name: "list-back-clicked";

View File

@ -245,177 +245,3 @@ group { name: "elm/gengrid/item/default/ewebkit";
}
}
}
group { name: "elm/gengrid/item/new_page/ewebkit";
data.item: "labels" "elm.text";
data.item: "icons" "elm.swallow.icon elm.swallow.end";
images {
image: "tab-bg.png" COMP;
image: "tab-bg-selected.png" COMP;
image: "tab-add.png" COMP;
}
parts {
part {
name: "event";
repeat_events: 1;
description {
state: "default" 0.0;
}
}
part { name: "bg";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: -5 -5;
}
rel2 {
relative: 1.0 1.0;
offset: 4 4;
}
image {
normal: "tab-bg.png";
border: 28 28 20 20;
}
fill.smooth: 0;
}
}
part { name: "elm.swallow.pad";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
align: 0.0 0.5;
rel1 {
relative: 0.0 1.0;
offset: 0 -10;
}
rel2 {
to_y: "elm.text";
relative: 0.0 0.0;
offset: -1 -1;
}
}
}
part { name: "elm.swallow.icon";
clip_to: "disclip";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
align: 0.5 0.5;
rel1 {
relative: 0.0 0.0;
offset: 20 11;
}
rel2 {
to_y: "elm.text";
relative: 1.0 0.0;
offset: -24 -4;
}
}
}
part { name: "elm.swallow.end";
clip_to: "disclip";
type: SWALLOW;
description { state: "default" 0.0;
rel1 {
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
relative: 0.0 0.0;
offset: 0 0;
}
}
}
part { name: "elm.text";
clip_to: "disclip";
type: RECT;
description { state: "default" 0.0;
visible: 0;
}
}
part { name: "disclip";
type: RECT;
description { state: "default" 0.0;
rel1.to: "bg";
rel2.to: "bg";
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 255 255 255 64;
}
}
part { name: "add-img";
type: IMAGE;
description { state: "default" 0.0;
min: 23 23;
max: 23 23;
rel1 {
relative: 1.0 1.0;
offset: -54 1;
}
rel2 {
relative: 1.0 1.0;
offset: -6 -43;
}
image.normal: "tab-add.png";
}
}
part { name: "bg-selected-border";
clip_to: "disclip";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
rel1.relative: 0.0 0.0;
rel2.relative: 1.0 1.0;
color: 255 255 255 0;
image {
normal: "tab-bg-selected.png";
border: 8 8 8 8;
}
fill.smooth: 0;
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
rel1 {
relative: 0.0 0.0;
offset: 15 5;
}
rel2 {
relative: 1.0 1.0;
offset: -16 -6;
}
image {
normal: "tab-bg-selected.png";
border: 8 8 8 8;
}
}
}
}
programs {
// signal: elm,state,%s,active
// a "check" item named %s went active
// signal: elm,state,%s,passive
// a "check" item named %s went passive
// default is passive
program {
name: "go_active";
signal: "elm,state,selected";
source: "elm";
action: STATE_SET "selected" 0.0;
target: "bg-selected-border";
transition: ACCELERATE 0.1;
}
program {
name: "go_passive";
signal: "elm,state,unselected";
source: "elm";
action: STATE_SET "default" 0.0;
target: "bg-selected-border";
transition: DECELERATE 0.1;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -262,7 +262,7 @@ static More_Menu_Item more_menu_root[] =
{ ITEM_TYPE_LAST, NULL, NULL, NULL, ITEM_FLAG_NONE }
};
static Elm_Gengrid_Item_Class gic_default, gic_new_page;
static Elm_Gengrid_Item_Class gic_default;
static Eina_List *
_eina_hash_sorted_keys_get(Eina_Hash *hash, Eina_Compare_Cb compare_func)
@ -1607,7 +1607,8 @@ tab_grid_item_click(void *data, Evas_Object *obj, void *event_info)
}
static void
tab_grid_new_tab_click(void *data, Evas_Object *obj, void *event_info)
on_action_addtab(void *data, Evas_Object *o __UNUSED__,
const char *emission __UNUSED__, const char *source __UNUSED__)
{
Evas_Object *chrome = data;
Browser_Window *win = evas_object_data_get(chrome, "win");
@ -1630,8 +1631,6 @@ on_action_tab_show(void *data, Evas_Object *o __UNUSED__,
elm_gengrid_clear(grid);
elm_gengrid_item_append(grid, &gic_new_page, NULL, tab_grid_new_tab_click, chrome);
EINA_LIST_FOREACH(win->chromes, itr, itr_chrome)
{
Evas_Object *itr_view = evas_object_data_get(itr_chrome, "view");
@ -1947,10 +1946,6 @@ chrome_add(Browser_Window *win, const char *url)
gic_default.func.state_get = tab_grid_state_get;
gic_default.func.del = tab_grid_del;
memcpy(&gic_new_page, &gic_default, sizeof(gic_default));
gic_new_page.item_style = "new_page";
gic_default.item_style = "default";
edje_object_signal_callback_add(ed, "action,back", "back", on_action_back, view);
edje_object_signal_callback_add(ed, "action,forward", "forward", on_action_forward,
view);
@ -1960,6 +1955,8 @@ chrome_add(Browser_Window *win, const char *url)
view);
edje_object_signal_callback_add(ed, "action,home", "home", on_action_home,
view);
edje_object_signal_callback_add(ed, "action,addtab", "addtab", on_action_addtab,
chrome);
edje_object_signal_callback_add(ed, "action,fav_on", "", on_fav_on, view);
edje_object_signal_callback_add(ed, "action,fav_off", "", on_fav_off, view);