summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkumar navneet <k.navneet@samsung.com>2015-04-10 14:37:10 +0900
committerChunEon Park <hermet@hermet.pe.kr>2015-04-10 14:37:11 +0900
commit152cb6212b1d513291f432d3ee755615bc5ba7db (patch)
tree7006c7e7c4e108ab80409a24126ced8622eaf629
parent07ff243d32f4d65f26fc637c73efcfe2fe7aec70 (diff)
downloadelementary-152cb6212b1d513291f432d3ee755615bc5ba7db.tar.gz
[elm_panel] Fix mirroring issue.
Summary: Issue: Mirroring of elm_panel not working correctly. Solution: Handle mirroring appropriately for animations. @fix Test Plan: Case: 1 1. Open elementary_test 2. Mirror on 3. Open scrollable panel, click on toggle button. Case: 2 1. Keep the scroller panel opened 2. Turn off Mirror Case: 3 1. Turn on mirror 2. Check direction button in non-scrollable panel. Reviewers: shilpasingh, raster, Hermet, Princekrdubey Reviewed By: shilpasingh Subscribers: poornima.srinivasan, subodh6129 Differential Revision: https://phab.enlightenment.org/D2237
-rw-r--r--AUTHORS1
-rw-r--r--data/themes/edc/elm/panel.edc116
-rw-r--r--src/lib/elm_authors.h3
-rw-r--r--src/lib/elm_panel.c173
4 files changed, 229 insertions, 64 deletions
diff --git a/AUTHORS b/AUTHORS
index 1e0a28ed2..4c6dc9a2d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -163,3 +163,4 @@ Vitalii Vorobiov <vi.vorobiov@samsung.com>
Jee-Yong Um <conr2d@gmail.com>
Ji-In Moon <jiin.moon@samsung.com>
Subodh Kumar <s7158.kumar@samsung.com>
+Kumar Navneet <k.navneet@samsung.com>
diff --git a/data/themes/edc/elm/panel.edc b/data/themes/edc/elm/panel.edc
index 7a99dbb73..ad3bb5e9a 100644
--- a/data/themes/edc/elm/panel.edc
+++ b/data/themes/edc/elm/panel.edc
@@ -391,6 +391,9 @@ group { name: "elm/panel/left/default";
images.image: "icon_arrow_up.png" COMP;
images.image: "icon_arrow_down.png" COMP;
data.item: "focus_highlight" "on";
+ script {
+ public is_rtl = 0;
+ }
parts {
part { name: "shadow"; mouse_events: 0;
description { state: "default" 0.0;
@@ -487,6 +490,10 @@ group { name: "elm/panel/left/default";
rel2.to: "elm.swallow.event";
color: 0 0 0 0;
}
+ description { state: "hidden" 0.0;
+ rel1.to: "elm.swallow.event";
+ rel2.to: "elm.swallow.event";
+ }
}
part { name: "dots"; mouse_events: 0;
description { state: "default" 0.0;
@@ -524,24 +531,78 @@ group { name: "elm/panel/left/default";
transition: DECELERATE 0.3;
target: "elm.swallow.event";
target: "base";
- target: "icn";
+ }
+ program {
+ signal: "elm,action,show"; source: "elm";
+ script {
+ if (get_int(is_rtl) == 0)
+ set_state(PART:"icn", "default", 0.0);
+ else
+ set_state(PART:"icn", "hidden", 0.0);
+ }
+ }
+ program {
+ signal: "edje,state,rtl";
+ source: "edje";
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:"elm.swallow.event", st, 30, vl);
+ if (!strcmp(st, "default"))
+ set_state(PART:"icn", "hidden", 0.0);
+ else
+ set_state(PART:"icn", "default", 0.0);
+ set_int(is_rtl, 1);
+ }
+ }
+ program {
+ signal: "edje,state,ltr";
+ source: "edje";
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:"elm.swallow.event", st, 30, vl);
+ if (!strcmp(st, "default"))
+ set_state(PART:"icn", "default", 0.0);
+ else
+ set_state(PART:"icn", "hidden", 0.0);
+ set_int(is_rtl, 0);
+ }
}
program {
signal: "elm,action,hide"; source: "elm";
action: STATE_SET "hidden" 0.0;
transition: ACCELERATE 0.3;
target: "elm.swallow.event";
- target: "icn";
+ }
+ program {
+ signal: "elm,action,hide"; source: "elm";
+ script {
+ if (get_int(is_rtl) == 0)
+ set_state(PART:"icn", "hidden", 0.0);
+ else
+ set_state(PART:"icn", "default", 0.0);
+ }
}
program { name: "hide1";
signal: "elm,action,hide"; source: "elm";
script {
new x, y, w, h;
-
- custom_state(PART:"base", "default", 0.0);
- set_state_val(PART:"base", STATE_REL1, -1.0, 0.0);
- get_geometry(PART:"elm.swallow.event", x, y, w, h);
- set_state_val(PART:"base", STATE_REL1_OFFSET, w, 0);
+ if (get_int(is_rtl) == 0)
+ {
+ custom_state(PART:"base", "default", 0.0);
+ set_state_val(PART:"base", STATE_REL1, -1.0, 0.0);
+ get_geometry(PART:"elm.swallow.event", x, y, w, h);
+ set_state_val(PART:"base", STATE_REL1_OFFSET, w, 0);
+ }
+ else
+ {
+ custom_state(PART:"base", "default", 0.0);
+ set_state_val(PART:"base", STATE_REL1, -1.0, 0.0);
+ set_state_val(PART:"base", STATE_REL2, -2.0, 1.0);
+ get_geometry(PART:"elm.swallow.event", x, y, w, h);
+ set_state_val(PART:"base", STATE_REL2_OFFSET, -w, 0);
+ }
}
after: "hide2";
}
@@ -608,7 +669,7 @@ group { name: "elm/panel/right/default";
program { name: "hide1";
script {
new x, y, w, h;
-
+
custom_state(PART:"base", "default", 0.0);
set_state_val(PART:"base", STATE_REL1, 1.0, 0.0);
set_state_val(PART:"base", STATE_REL2, 2.0, 1.0);
@@ -674,11 +735,47 @@ group { name: "elm/panel/top/default";
set_state_val(PART:"base", STATE_REL1_OFFSET, 0, h);
}
}
+ program {
+ signal: "elm,action,show"; source: "elm";
+ action: STATE_SET "default" 0.0;
+ target: "icn";
+ }
+ program {
+ signal: "edje,state,rtl";
+ source: "edje";
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:"elm.swallow.event", st, 30, vl);
+ if (!strcmp(st, "default"))
+ set_state(PART:"icn", "default", 0.0);
+ else
+ set_state(PART:"icn", "hidden", 0.0);
+ }
+ }
+ program {
+ signal: "edje,state,ltr";
+ source: "edje";
+ script {
+ new st[31];
+ new Float:vl;
+ get_state(PART:"elm.swallow.event", st, 30, vl);
+ if (!strcmp(st, "default"))
+ set_state(PART:"icn", "default", 0.0);
+ else
+ set_state(PART:"icn", "hidden", 0.0);
+ }
+ }
+ program {
+ signal: "elm,action,hide"; source: "elm";
+ action: STATE_SET "hidden" 0.0;
+ target: "icn";
+ }
}
}
group { name: "elm/panel/bottom/default";
- inherit: "elm/panel/left/default";
+ inherit: "elm/panel/top/default";
parts {
part { name: "base";
description { state: "default" 0.0;
@@ -724,7 +821,6 @@ group { name: "elm/panel/bottom/default";
program { name: "hide1";
script {
new x, y, w, h;
-
custom_state(PART:"base", "default", 0.0);
set_state_val(PART:"base", STATE_REL1, 0.0, 1.0);
set_state_val(PART:"base", STATE_REL2, 1.0, 2.0);
diff --git a/src/lib/elm_authors.h b/src/lib/elm_authors.h
index f4cf2f9e8..6c2f99672 100644
--- a/src/lib/elm_authors.h
+++ b/src/lib/elm_authors.h
@@ -160,7 +160,8 @@
* @author Jae Yong Hwang <j_yong.hwang@@samsung.com>
* @author Kabeer Khan <kabeer.khan@@samsung.com>
* @author yinsc <shouchen.yin@@samsung.com>
- * @author Subodh Kumar <s7158.kumar@samsung.com>
+ * @author Subodh Kumar <s7158.kumar@@samsung.com>
+ * @author Kumar Navneet <k.navneet@@samsung.com>
*
* Please contact <enlightenment-devel@lists.sourceforge.net> to get in
* contact with the developers and maintainers.
diff --git a/src/lib/elm_panel.c b/src/lib/elm_panel.c
index 733386fa4..4847f2efd 100644
--- a/src/lib/elm_panel.c
+++ b/src/lib/elm_panel.c
@@ -27,8 +27,10 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{SIG_LAYOUT_UNFOCUSED, ""}, /**< handled by elm_layout */
{NULL, NULL}
};
-
+static void _panel_toggle(void *, Evas_Object *, const char *,const char *);
static Eina_Bool _key_action_toggle(Evas_Object *obj, const char *params);
+static void _drawer_open(Evas_Object *, Evas_Coord , Evas_Coord , Eina_Bool );
+static void _drawer_close(Evas_Object *, Evas_Coord , Evas_Coord , Eina_Bool);
static const Elm_Action key_actions[] = {
{"toggle", _key_action_toggle},
@@ -142,33 +144,15 @@ _orient_set_do(Evas_Object *obj)
break;
case ELM_PANEL_ORIENT_LEFT:
- if (!elm_widget_mirrored_get(obj))
- {
- if (!elm_layout_theme_set
- (obj, "panel", "left", elm_widget_style_get(obj)))
- CRI("Failed to set layout!");
- }
- else
- {
- if (!elm_layout_theme_set
- (obj, "panel", "right", elm_widget_style_get(obj)))
- CRI("Failed to set layout!");
- }
+ if (!elm_layout_theme_set(obj, "panel", "left",
+ elm_widget_style_get(obj)))
+ CRI("Failed to set layout!");
break;
case ELM_PANEL_ORIENT_RIGHT:
- if (!elm_widget_mirrored_get(obj))
- {
- if (!elm_layout_theme_set
- (obj, "panel", "right", elm_widget_style_get(obj)))
- CRI("Failed to set layout!");
- }
- else
- {
- if (!elm_layout_theme_set
- (obj, "panel", "left", elm_widget_style_get(obj)))
- CRI("Failed to set layout!");
- }
+ if (!elm_layout_theme_set(obj, "panel", "right",
+ elm_widget_style_get(obj)))
+ CRI("Failed to set layout!");
break;
}
@@ -221,6 +205,7 @@ EOLIAN static Eina_Bool
_elm_panel_elm_widget_theme_apply(Eo *obj, Elm_Panel_Data *sd)
{
const char *str;
+ int w, h;
Evas_Coord minw = 0, minh = 0;
Eina_Bool int_ret = EINA_FALSE;
@@ -238,7 +223,9 @@ _elm_panel_elm_widget_theme_apply(Eo *obj, Elm_Panel_Data *sd)
elm_widget_theme_object_set(obj, sd->scr_edje, "scroller", "panel",
elm_widget_style_get(obj));
_scrollable_layout_theme_set(obj, sd);
-
+ evas_object_geometry_get(obj, NULL, NULL, &w, &h);
+ if (!sd->hidden) _drawer_open(obj, w, h, EINA_FALSE);
+ else _drawer_close(obj, w, h, EINA_FALSE);
handler_size = edje_object_data_get(sd->scr_edje, "handler_size");
if (handler_size)
sd->handler_size = (int) (elm_object_scale_get(obj)) * (atoi(handler_size));
@@ -370,7 +357,7 @@ _drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
if (sd->freeze)
{
eo_do(obj, elm_interface_scrollable_movement_block_set
- (ELM_SCROLLER_MOVEMENT_NO_BLOCK));
+ (ELM_SCROLLER_MOVEMENT_NO_BLOCK));
sd->freeze = EINA_FALSE;
elm_layout_signal_emit(sd->scr_ly, "elm,state,content,visible", "elm");
}
@@ -378,7 +365,10 @@ _drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
switch (sd->orient)
{
case ELM_PANEL_ORIENT_TOP:
+ break;
case ELM_PANEL_ORIENT_LEFT:
+ if (elm_widget_mirrored_get(obj))
+ x = w * sd->content_size_ratio;
break;
case ELM_PANEL_ORIENT_BOTTOM:
@@ -386,7 +376,8 @@ _drawer_open(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
break;
case ELM_PANEL_ORIENT_RIGHT:
- x = w * sd->content_size_ratio;
+ if (!elm_widget_mirrored_get(obj))
+ x = w * sd->content_size_ratio;
break;
}
@@ -412,13 +403,17 @@ _drawer_close(Evas_Object *obj, Evas_Coord w, Evas_Coord h, Eina_Bool anim)
break;
case ELM_PANEL_ORIENT_LEFT:
- x = w * sd->content_size_ratio;
+ if (!elm_widget_mirrored_get(obj))
+ x = w * sd->content_size_ratio;
horizontal = EINA_TRUE;
break;
case ELM_PANEL_ORIENT_BOTTOM:
break;
+
case ELM_PANEL_ORIENT_RIGHT:
+ if (elm_widget_mirrored_get(obj))
+ x = w * sd->content_size_ratio;
horizontal = EINA_TRUE;
break;
}
@@ -535,9 +530,18 @@ _state_sync(Evas_Object *obj)
eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
horizontal = EINA_TRUE;
- if (pos == 0) open = EINA_TRUE;
- else if (pos == panel_size) open = EINA_FALSE;
- else return EINA_FALSE;
+ if (!elm_widget_mirrored_get(obj))
+ {
+ if (pos == 0) open = EINA_TRUE;
+ else if (pos == panel_size) open = EINA_FALSE;
+ else return EINA_FALSE;
+ }
+ else
+ {
+ if (pos == panel_size) open = EINA_TRUE;
+ else if (pos == 0) open = EINA_FALSE;
+ else return EINA_FALSE;
+ }
break;
case ELM_PANEL_ORIENT_RIGHT:
@@ -545,9 +549,18 @@ _state_sync(Evas_Object *obj)
eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
horizontal = EINA_TRUE;
- if (pos == panel_size) open = EINA_TRUE;
- else if (pos == 0) open = EINA_FALSE;
- else return EINA_FALSE;
+ if (!elm_widget_mirrored_get(obj))
+ {
+ if (pos == 0) open = EINA_TRUE;
+ else if (pos == panel_size) open = EINA_FALSE;
+ else return EINA_FALSE;
+ }
+ else
+ {
+ if (pos == panel_size) open = EINA_TRUE;
+ else if (pos == 0) open = EINA_FALSE;
+ else return EINA_FALSE;
+ }
break;
}
@@ -649,6 +662,7 @@ _on_mouse_down(void *data,
Evas_Coord finger_size = elm_config_finger_size_get();
Evas_Coord x, y, w, h;
evas_object_geometry_get(obj, &x, &y, &w, &h);
+ Eina_Bool is_mirrored = elm_widget_mirrored_get(obj);
sd->down_x = ev->canvas.x - x;
sd->down_y = ev->canvas.y - y;
@@ -672,14 +686,16 @@ _on_mouse_down(void *data,
}
break;
case ELM_PANEL_ORIENT_LEFT:
- if ((sd->freeze) && (sd->down_x >= 0) && (sd->down_x < finger_size))
+ if ((!is_mirrored && (sd->freeze) && (sd->down_x >= 0) && (sd->down_x < finger_size)) ||
+ ((is_mirrored && (sd->freeze) && (sd->down_x <= w) && (sd->down_x > (w - finger_size)))))
{
ecore_timer_del(sd->timer);
sd->timer = ecore_timer_add(0.2, _timer_cb, obj);
}
break;
case ELM_PANEL_ORIENT_RIGHT:
- if ((sd->freeze) && (sd->down_x <= w) && (sd->down_x > (w - finger_size)))
+ if ((is_mirrored && (sd->freeze) && (sd->down_x >= 0) && (sd->down_x < finger_size)) ||
+ (!is_mirrored && (sd->freeze) && (sd->down_x <= w) && (sd->down_x > (w - finger_size))))
{
ecore_timer_del(sd->timer);
sd->timer = ecore_timer_add(0.2, _timer_cb, obj);
@@ -699,6 +715,7 @@ _on_mouse_move(void *data,
Evas_Coord x, y, w, h, cur_x, cur_y, finger_size;
evas_object_geometry_get(obj, &x, &y, &w, &h);
finger_size = elm_config_finger_size_get();
+ Eina_Bool is_mirrored = elm_widget_mirrored_get(obj);
cur_x = ev->cur.canvas.x - x;
cur_y = ev->cur.canvas.y - y;
@@ -725,7 +742,8 @@ _on_mouse_move(void *data,
}
break;
case ELM_PANEL_ORIENT_LEFT:
- if (sd->timer && ((cur_x - sd->down_x) > finger_size))
+ if ((!is_mirrored && (sd->timer) && ((cur_x - sd->down_x) > finger_size)) ||
+ ((is_mirrored) && (sd->timer) && ((sd->down_x - cur_x) > finger_size)))
{
eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
sd->freeze = EINA_FALSE;
@@ -733,7 +751,8 @@ _on_mouse_move(void *data,
}
break;
case ELM_PANEL_ORIENT_RIGHT:
- if (sd->timer && ((sd->down_x - cur_x) > finger_size))
+ if ((is_mirrored && (sd->timer) && ((cur_x - sd->down_x) > finger_size)) ||
+ (!is_mirrored && (sd->timer) && ((sd->down_x - cur_x) > finger_size)))
{
eo_do(obj, elm_interface_scrollable_freeze_set(EINA_FALSE));
sd->freeze = EINA_FALSE;
@@ -803,15 +822,31 @@ _on_mouse_up(void *data,
threshold = panel_size / 4;
eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
- if (sd->hidden)
+ if (elm_widget_mirrored_get(obj))
{
- if (pos < (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
- else _drawer_close(obj, w, h, EINA_TRUE);
+ if (sd->hidden)
+ {
+ if (pos > threshold) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
+ else
+ {
+ if (pos > (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
}
else
{
- if (pos < threshold) _drawer_open(obj, w, h, EINA_TRUE);
- else _drawer_close(obj, w, h, EINA_TRUE);
+ if (sd->hidden)
+ {
+ if (pos < (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
+ else
+ {
+ if (pos < threshold) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
}
break;
@@ -820,15 +855,31 @@ _on_mouse_up(void *data,
threshold = panel_size / 4;
eo_do(obj, elm_interface_scrollable_content_pos_get(&pos, NULL));
- if (sd->hidden)
+ if (!elm_widget_mirrored_get(obj))
{
- if (pos > threshold) _drawer_open(obj, w, h, EINA_TRUE);
- else _drawer_close(obj, w, h, EINA_TRUE);
+ if (sd->hidden)
+ {
+ if (pos > threshold) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
+ else
+ {
+ if (pos > (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
}
else
{
- if (pos > (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
- else _drawer_close(obj, w, h, EINA_TRUE);
+ if (sd->hidden)
+ {
+ if (pos < (panel_size - threshold)) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
+ else
+ {
+ if (pos < threshold) _drawer_open(obj, w, h, EINA_TRUE);
+ else _drawer_close(obj, w, h, EINA_TRUE);
+ }
}
break;
}
@@ -1237,12 +1288,28 @@ _scroll_cb(Evas_Object *obj, void *data EINA_UNUSED)
event.rel_y = (double) y / (double) ((sd->content_size_ratio) * h);
break;
case ELM_PANEL_ORIENT_LEFT:
- event.rel_x = 1 - ((double) x / (double) ((sd->content_size_ratio) * w));
- event.rel_y = 1;
+ if (!elm_widget_mirrored_get(obj))
+ {
+ event.rel_x = 1 - ((double) x / (double) ((sd->content_size_ratio) * w));
+ event.rel_y = 1;
+ }
+ else
+ {
+ event.rel_x = (double) x / (double) ((sd->content_size_ratio) * w);
+ event.rel_y = 1;
+ }
break;
case ELM_PANEL_ORIENT_RIGHT:
- event.rel_x = (double) x / (double) ((sd->content_size_ratio) * w);
- event.rel_y = 1;
+ if (elm_widget_mirrored_get(obj))
+ {
+ event.rel_x = 1 - ((double) x / (double) ((sd->content_size_ratio) * w));
+ event.rel_y = 1;
+ }
+ else
+ {
+ event.rel_x = (double) x / (double) ((sd->content_size_ratio) * w);
+ event.rel_y = 1;
+ }
break;
}
evas_object_smart_callback_call(obj, SIG_SCROLL, (void *) &event);