theme: redo scroller theme of elm

Summary:
this was a little bit weird. There was a script that did what we already
do in C and pass it on via signals, however, there was also somewhere a
bug in this script, the arrow was not getting enabled, even if the
position is not completly max and not completly min, the problem here
was that the numbers that are passed to edje are not 100% correct (I
think they got somehwere on the way casted to an int).

With this commit we just use the signals from c in the theme and replace
the theme, this should also make everything a bit easier on the
mainloop, as a single movement of the scroller does not schedule 10
timers anymore.

ref T4918

Reviewers: zmike, eagleeye, woohyun

Reviewed By: zmike

Subscribers: zmike, cedric, #reviewers, #committers

Tags: #efl

Maniphest Tasks: T4918

Differential Revision: https://phab.enlightenment.org/D9906
This commit is contained in:
Marcel Hollerbach 2019-10-25 14:04:39 -04:00 committed by Mike Blumenkrantz
parent 6abba55b5c
commit a23b545249
1 changed files with 50 additions and 127 deletions

View File

@ -34,91 +34,9 @@ group { name: "elm/scroller/base/default";
images.image: "sym_left_dark_normal.png" COMP; images.image: "sym_left_dark_normal.png" COMP;
images.image: "sym_right_dark_normal.png" COMP; images.image: "sym_right_dark_normal.png" COMP;
data.item: "focus_highlight" "on"; data.item: "focus_highlight" "on";
script {
public loop_x, loop_y;
public action_on_pos_vbar(val) {
new x, y , w, h, x1, y1 , w1, h1;
get_geometry(PART:"y_vbar_up", x,y,w, h);
get_geometry(PART:"y_vbar_up_mapper", x1,y1,w1, h1);
if(((y1 <= y) && (y <= (y1 + h1))) && (0 == get_int(loop_y)))
{
set_state(PART:"arrow1_vbar", "hidden", 0.0);
set_state(PART:"sb_vbar_a1", "hidden", 0.0);
}
else
{
set_state(PART:"arrow1_vbar", "default", 0.0);
set_state(PART:"sb_vbar_a1", "default", 0.0);
}
get_geometry(PART:"y_vbar_down", x,y,w, h);
get_geometry(PART:"y_vbar_down_mapper", x1,y1,w1, h1);
if(((y1 <= (y + h)) && ((y+ h) <= (y1 + h1))) && (0 == get_int(loop_y)))
{
set_state(PART:"arrow2_vbar", "hidden", 0.0);
set_state(PART:"sb_vbar_a2", "hidden", 0.0);
}
else
{
set_state(PART:"arrow2_vbar", "default", 0.0);
set_state(PART:"sb_vbar_a2", "default", 0.0);
}
if(val < 10)
timer(0.1,"action_on_pos_vbar", val+1);
}
public action_on_pos_hbar(val) {
new x, y , w, h, x1, y1 , w1, h1;
get_geometry(PART:"x_hbar_left", x,y,w, h);
get_geometry(PART:"x_hbar_left_mapper", x1,y1,w1, h1);
if(((x1 <= x) && (x <= (x1 + w1))) && (0 == get_int(loop_x)))
{
set_state(PART:"arrow1_hbar", "hidden", 0.0);
set_state(PART:"sb_hbar_a1", "hidden", 0.0);
}
else
{
set_state(PART:"arrow1_hbar", "default", 0.0);
set_state(PART:"sb_hbar_a1", "default", 0.0);
}
get_geometry(PART:"x_hbar_right", x,y,w, h);
get_geometry(PART:"x_hbar_right_mapper", x1,y1,w1, h1);
if(((x1 <= (x + w)) && ((x + w) <= (x1 + w1))) && (0 == get_int(loop_x)))
{
set_state(PART:"arrow2_hbar", "hidden", 0.0);
set_state(PART:"sb_hbar_a2", "hidden", 0.0);
}
else
{
set_state(PART:"arrow2_hbar", "default", 0.0);
set_state(PART:"sb_hbar_a2", "default", 0.0);
}
if(val < 10)
timer(0.1,"action_on_pos_hbar", val+1);
}
}
parts { parts {
program {
signal: "load"; source: "";
script {
emit("reload", "elm");
action_on_pos_vbar(0);
action_on_pos_hbar(0);
}
}
// vert bar //////////////////////////////////////////////////////////////// // vert bar ////////////////////////////////////////////////////////////////
part { name: "sb_vbar_show"; type: RECT; part { name: "sb_vbar_show"; type: RECT;
description { state: "default" 0.0; description { state: "default" 0.0;
@ -321,7 +239,6 @@ group { name: "elm/scroller/base/default";
target: "y_vbar_down"; target: "y_vbar_down";
target: "arrow1_vbar_indent"; target: "arrow1_vbar_indent";
target: "arrow2_vbar_indent"; target: "arrow2_vbar_indent";
after: "check_pos_vbar";
} }
program { program {
signal: "elm,action,hide,vbar"; source: "elm"; signal: "elm,action,hide,vbar"; source: "elm";
@ -340,11 +257,13 @@ group { name: "elm/scroller/base/default";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_vbar_a1";//ok signal: "mouse,down,1*"; source: "sb_vbar_a1";//ok
filter: "sb_vbar_a1" "default";
action: STATE_SET "clicked" 0.0; action: STATE_SET "clicked" 0.0;
target: "arrow1_vbar"; target: "arrow1_vbar";
after: "anim1_up"; after: "anim1_up";
} }
program { name: "anim1_up"; program { name: "anim1_up";
filter: "sb_vbar_a1" "default";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
transition: LINEAR 0.1; transition: LINEAR 0.1;
target: "arrow1_vbar"; target: "arrow1_vbar";
@ -356,11 +275,13 @@ group { name: "elm/scroller/base/default";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_vbar_a2";//ok signal: "mouse,down,1*"; source: "sb_vbar_a2";//ok
filter: "sb_vbar_a2" "default";
action: STATE_SET "clicked" 0.0; action: STATE_SET "clicked" 0.0;
target: "arrow2_vbar"; target: "arrow2_vbar";
after: "anim1_down"; after: "anim1_down";
} }
program { name: "anim1_down"; program { name: "anim1_down";
filter: "sb_vbar_a2" "default";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
transition: LINEAR 0.1; transition: LINEAR 0.1;
target: "arrow2_vbar"; target: "arrow2_vbar";
@ -372,40 +293,40 @@ group { name: "elm/scroller/base/default";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_vbar_p1"; signal: "mouse,down,1*"; source: "sb_vbar_p1";
filter: "sb_vbar_a1" "default";
action: DRAG_VAL_PAGE 0.0 -1.0; action: DRAG_VAL_PAGE 0.0 -1.0;
target: "elm.dragable.vbar"; target: "elm.dragable.vbar";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_vbar_p2"; signal: "mouse,down,1*"; source: "sb_vbar_p2";
filter: "sb_vbar_a2" "default";
action: DRAG_VAL_PAGE 0.0 1.0; action: DRAG_VAL_PAGE 0.0 1.0;
target: "elm.dragable.vbar"; target: "elm.dragable.vbar";
} }
program { program {
signal: "elm,action,scroll"; source: "elm"; signal: "elm,action,show,up"; source: "elm";
script { action: STATE_SET "default" 0.0;
action_on_pos_vbar(10); target: "arrow1_vbar";
} target: "sb_vbar_a1";
} }
program { name: "check_pos_vbar"; program {
script { signal: "elm,action,hide,up"; source: "elm";
action_on_pos_vbar(10); action: STATE_SET "hidden" 0.0;
} target: "arrow1_vbar";
target: "sb_vbar_a1";
} }
program { name: "loop_set_vbar"; program {
signal: "elm,loop_y,set"; source: "elm"; signal: "elm,action,show,down"; source: "elm";
script { action: STATE_SET "default" 0.0;
set_int(loop_y, 1); target: "arrow2_vbar";
action_on_pos_vbar(10); target: "sb_vbar_a2";
}
} }
program { name: "loop_unset_vbar"; program {
signal: "elm,loop_y,unset"; source: "elm"; signal: "elm,action,hide,down"; source: "elm";
script { action: STATE_SET "hidden" 0.0;
set_int(loop_y, 0); target: "arrow2_vbar";
action_on_pos_vbar(10); target: "sb_vbar_a2";
}
} }
// horiz bar ///////////////////////////////////////////////////////////// // horiz bar /////////////////////////////////////////////////////////////
part { name: "sb_hbar_show"; type: RECT; part { name: "sb_hbar_show"; type: RECT;
description { state: "default" 0.0; description { state: "default" 0.0;
@ -608,7 +529,6 @@ group { name: "elm/scroller/base/default";
target: "x_hbar_right"; target: "x_hbar_right";
target: "arrow1_hbar_indent"; target: "arrow1_hbar_indent";
target: "arrow2_hbar_indent"; target: "arrow2_hbar_indent";
after: "check_pos_hbar";
} }
program { program {
signal: "elm,action,hide,hbar"; source: "elm"; signal: "elm,action,hide,hbar"; source: "elm";
@ -627,11 +547,13 @@ group { name: "elm/scroller/base/default";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_hbar_a1"; signal: "mouse,down,1*"; source: "sb_hbar_a1";
filter: "sb_hbar_a1" "default";
action: STATE_SET "clicked" 0.0; action: STATE_SET "clicked" 0.0;
target: "arrow1_hbar"; target: "arrow1_hbar";
after: "anim1_left"; after: "anim1_left";
} }
program { name: "anim1_left"; program { name: "anim1_left";
filter: "sb_hbar_a1" "default";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
transition: LINEAR 0.1; transition: LINEAR 0.1;
target: "arrow1_hbar"; target: "arrow1_hbar";
@ -643,11 +565,13 @@ group { name: "elm/scroller/base/default";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_hbar_a2"; signal: "mouse,down,1*"; source: "sb_hbar_a2";
filter: "sb_hbar_a2" "default";
action: STATE_SET "clicked" 0.0; action: STATE_SET "clicked" 0.0;
target: "arrow2_hbar"; target: "arrow2_hbar";
after: "anim2_left"; after: "anim2_left";
} }
program { name: "anim2_left"; program { name: "anim2_left";
filter: "sb_hbar_a2" "default";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
transition: LINEAR 0.1; transition: LINEAR 0.1;
target: "arrow2_hbar"; target: "arrow2_hbar";
@ -659,40 +583,39 @@ group { name: "elm/scroller/base/default";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_hbar_p1"; signal: "mouse,down,1*"; source: "sb_hbar_p1";
filter: "sb_hbar_a1" "default";
action: DRAG_VAL_PAGE -1.0 0.0; action: DRAG_VAL_PAGE -1.0 0.0;
target: "elm.dragable.hbar"; target: "elm.dragable.hbar";
after: "check_pos_hbar";
} }
program { program {
signal: "mouse,down,1*"; source: "sb_hbar_p2"; signal: "mouse,down,1*"; source: "sb_hbar_p2";
filter: "sb_hbar_a2" "default";
action: DRAG_VAL_PAGE 1.0 0.0; action: DRAG_VAL_PAGE 1.0 0.0;
target: "elm.dragable.hbar"; target: "elm.dragable.hbar";
after: "check_pos_hbar";
} }
program { program {
signal: "elm,action,scroll"; source: "elm"; signal: "elm,action,show,left"; source: "elm";
script { action: STATE_SET "default" 0.0;
action_on_pos_hbar(10); target: "arrow1_hbar";
} target: "sb_hbar_a1";
} }
program { name: "check_pos_hbar"; program {
script { signal: "elm,action,hide,left"; source: "elm";
action_on_pos_hbar(10); action: STATE_SET "hidden" 0.0;
} target: "arrow1_hbar";
target: "sb_hbar_a1";
} }
program { name: "loop_set_hbar"; program {
signal: "elm,loop_x,set"; source: "elm"; signal: "elm,action,show,right"; source: "elm";
script { action: STATE_SET "default" 0.0;
set_int(loop_x, 1); target: "arrow2_hbar";
action_on_pos_hbar(10); target: "sb_hbar_a2";
}
} }
program { name: "loop_unset_hbar"; program {
signal: "elm,loop_x,unset"; source: "elm"; signal: "elm,action,hide,right"; source: "elm";
script { action: STATE_SET "hidden" 0.0;
set_int(loop_x, 0); target: "arrow2_hbar";
action_on_pos_hbar(10); target: "sb_hbar_a2";
}
} }
part { name: "bg"; type: RECT; part { name: "bg"; type: RECT;
description { state: "default" 0.0; description { state: "default" 0.0;