From fc1fae8eb0395d0f13aadf7330d6b268e24961ca Mon Sep 17 00:00:00 2001 From: cnook Date: Fri, 3 Jun 2011 07:16:39 +0000 Subject: [PATCH] From: cnook Subject: Re: [E-devel] [Patch][CtxPopup] Add Arrow on the drag-able area of Base Dear Mr. Hermet, Hello, I have attached more accurate patch based on latest elementary. The last patch already there. All your review items are reflected on the attached patch. Please review this again, sorry for any inconvenient. SVN revision: 59911 --- legacy/elementary/data/themes/default.edc | 28 ++------- legacy/elementary/src/lib/elc_ctxpopup.c | 72 ++++++++--------------- 2 files changed, 28 insertions(+), 72 deletions(-) diff --git a/legacy/elementary/data/themes/default.edc b/legacy/elementary/data/themes/default.edc index 1084d3945c..e996959c0b 100644 --- a/legacy/elementary/data/themes/default.edc +++ b/legacy/elementary/data/themes/default.edc @@ -7980,7 +7980,7 @@ collections { } } } - part { name: "elm.swallow.arrowUp"; + part { name: "elm.swallow.arrow_up"; type: SWALLOW; mouse_events: 0; scale: 1; @@ -7994,14 +7994,9 @@ collections { min: 40 40; fixed: 1 1; visible: 1; - align: 0.5 1; - rel2 { - relative: 1 0; - to: "arrow_area_up"; - } } } - part { name: "elm.swallow.arrowDown"; + part { name: "elm.swallow.arrow_down"; type: SWALLOW; mouse_events: 0; scale: 1; @@ -8015,14 +8010,9 @@ collections { min: 40 40; fixed: 1 1; visible: 1; - align: 0.5 0; - rel1 { - relative: 1 1; - to: "arrow_area_down"; - } } } - part { name: "elm.swallow.arrowLeft"; + part { name: "elm.swallow.arrow_left"; type: SWALLOW; mouse_events: 0; scale: 1; @@ -8036,14 +8026,9 @@ collections { min: 40 40; fixed: 1 1; visible: 1; - align: 1 0.5; - rel2 { - relative: 0 1; - to: "arrow_area_left"; - } } } - part { name: "elm.swallow.arrowRight"; + part { name: "elm.swallow.arrow_right"; type: SWALLOW; mouse_events: 0; scale: 1; @@ -8057,11 +8042,6 @@ collections { min: 40 40; fixed: 1 1; visible: 1; - align: 0 0.5; - rel1 { - relative: 1 0; - to: "arrow_area_right"; - } } } part { name: "base"; diff --git a/legacy/elementary/src/lib/elc_ctxpopup.c b/legacy/elementary/src/lib/elc_ctxpopup.c index 14b4f7c1e5..bd1b78704c 100644 --- a/legacy/elementary/src/lib/elc_ctxpopup.c +++ b/legacy/elementary/src/lib/elc_ctxpopup.c @@ -484,79 +484,55 @@ _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir) { case ELM_CTXPOPUP_DIRECTION_LEFT: edje_object_signal_emit(wd->arrow, "elm,state,left", "elm"); - - // if user does not use dragable part - arrow_size.y = (y - (arrow_size.h * 0.5)); - arrow_size.x = x; - - edje_object_part_swallow(wd->base, "elm.swallow.arrowLeft", wd->arrow); + edje_object_part_swallow(wd->base, "elm.swallow.arrow_left", wd->arrow); if (base_size.h > 0) { - if (y - base_size.y < 0) y = 0; - else if (y > base_size.y + base_size.h) y = base_size.h; - else y = y - base_size.y; - edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowLeft", 0.5, - (double) (y) / (double) (base_size.h)); + if (y < (arrow_size.h * 0.5) + base_size.y) y = 0; + else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5)) y = base_size.h - arrow_size.h; + else y = y - base_size.y - (arrow_size.h * 0.5); + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_left", 0.5, + (double) (y) / (double) (base_size.h - arrow_size.h)); } break; case ELM_CTXPOPUP_DIRECTION_RIGHT: edje_object_signal_emit(wd->arrow, "elm,state,right", "elm"); - - // if user does not use dragable part - arrow_size.y = (y - (arrow_size.h * 0.5)); - arrow_size.x = (x - arrow_size.w); - - edje_object_part_swallow(wd->base, "elm.swallow.arrowRight", wd->arrow); + edje_object_part_swallow(wd->base, "elm.swallow.arrow_right", wd->arrow); if (base_size.h > 0) { - if (y -base_size.y < 0) y = 0; - else if (y > base_size.y + base_size.h) y = base_size.h; - else y = y - base_size.y; - edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowRight", 0.5, - (double) (y) / (double) (base_size.h)); + if (y < (arrow_size.h * 0.5) + base_size.y) y = 0; + else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5)) y = base_size.h - arrow_size.h; + else y = y - base_size.y - (arrow_size.h * 0.5); + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_right", 0.5, + (double) (y) / (double) (base_size.h - arrow_size.h)); } break; case ELM_CTXPOPUP_DIRECTION_UP: edje_object_signal_emit(wd->arrow, "elm,state,top", "elm"); - - // if user does not use dragable part - arrow_size.x = (x - (arrow_size.w * 0.5)); - arrow_size.y = y; - - edje_object_part_swallow(wd->base, "elm.swallow.arrowUp", wd->arrow); + edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow); if (base_size.w > 0) { - if (x - base_size.x < 0) x = 0; - else if (x > base_size.x + base_size.w) x = base_size.w; - else x = x - base_size.x; - edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowUp", - (double) (x) / (double) (base_size.w), 0.5); + if (x < (arrow_size.w * 0.5) + base_size.x) x = 0; + else if (x > base_size.x + base_size.w - (arrow_size.w * 0.5)) x = base_size.w - arrow_size.w; + else x = x - base_size.x - (arrow_size.w * 0.5); + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_up", + (double) (x) / (double) (base_size.w - arrow_size.w), 0.5); } break; case ELM_CTXPOPUP_DIRECTION_DOWN: edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm"); - - // if user does not use dragable part - arrow_size.x = (x - (arrow_size.w * 0.5)); - arrow_size.y = (y - arrow_size.h); - - edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm"); - edje_object_part_swallow(wd->base, "elm.swallow.arrowDown", wd->arrow); + edje_object_part_swallow(wd->base, "elm.swallow.arrow_down", wd->arrow); if (base_size.w > 0) { - if (x - base_size.x < 0) x = 0; - else if (x > base_size.x + base_size.w) x = base_size.w; - else x = x - base_size.x; - edje_object_part_drag_value_set(wd->base, "elm.swallow.arrowDown", - (double) (x) / (double) (base_size.w), 0.5); + if (x < (arrow_size.w * 0.5) + base_size.x) x = 0; + else if (x > base_size.x + base_size.w - (arrow_size.w * 0.5)) x = base_size.w - arrow_size.w; + else x = x - base_size.x - (arrow_size.w * 0.5); + edje_object_part_drag_value_set(wd->base, "elm.swallow.arrow_down", + (double) (x) / (double) (base_size.w - arrow_size.w), 0.5); } break; default: break; } - - // if user does not use dragable part - evas_object_move(wd->arrow, arrow_size.x, arrow_size.y); } static void