Hello ~
I modified my patch.
The reason for modifying about elm_colorselector can be "readability".
Each bar in the colorselector has its own color type (like hue, saturation,
...)
So I thought it will be better, if I added enum for each color type.
And about elm_entry,
I deleted mouse_up callback function (as you advised),
because this function didn't do anything by my modification.
Thanks.
-----Original Message-----
From: Bruno Dilly [mailto:bdi...@profusion.mobi]
Sent: Wednesday, November 24, 2010 11:35 PM
To: WooHyun Jung
Cc: enlightenment-devel@lists.sourceforge.net
Subject: Re: [E-devel] [PATCH] Some modifications about elm_colorselector.c
and elm_entry.c
On Wed, Nov 24, 2010 at 11:44 AM, WooHyun Jung <wh0705.j...@samsung.com>
wrote:
> Hello. I'm WooHyun Jung.
>
>
>
> I modified some codes of elm_colorselector.c .
Hey WooHyun,
would you matter to explain me why are you proposing the following
change, please?
@@ -604,9 +635,25 @@ _add_colorbar(Evas_Object *obj)
wd->cp[i] = ELM_NEW(Colorselector_Data);
wd->cp[i]->parent = obj;
- wd->cp[i]->colorselector_num = i;
-
- /* load colorbar area */
+ wd->cp[i]->color_type = i;
+ switch(i)
+ {
+ case 0 :
+ wd->cp[i]->color_type = HUE;
+ break;
+ case 1 :
+ wd->cp[i]->color_type = SATURATION;
+ break;
+ case 2 :
+ wd->cp[i]->color_type = LIGHTNESS;
+ break;
+ case 3 :
+ wd->cp[i]->color_type = ALPHA;
+ break;
+ default :
+ break;
+ }
+ /* load colorbar area */
It's insider a for (i = 0; i < 4; i++).
Basically you are doing
wd->cp[0]->color_type = 0;
then "i" will match case 0 and:
wd->cp[0]->color_type = 0 (HUE) once again...
Or maybe I'm missing something.
>
> And , for about elm_entry.c , I thought that "SIG_CLICKED" was wrongly
> emitted (by "MOUSE_UP" event).
If you are proposing to use _signal_mouse_clicked instead of
_signal_mouse_up your patch should remove this function. Don't leave
dead code, please.
Thank you
>
> So I changed it.
>
>
>
> Please check attached patch file.
>
> Thanks.
>
>
>
----------------------------------------------------------------------------
--
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
>
Index: elm_colorselector.c
===================================================================
--- elm_colorselector.c (revision 55060)
+++ elm_colorselector.c (working copy)
@@ -14,8 +14,22 @@
#define LIG_STEP 256.0
#define ALP_STEP 256.0
+typedef enum _Button_State
+{
+ BUTTON_RELEASED,
+ L_BUTTON_PRESSED,
+ R_BUTTON_PRESSED
+} Button_State;
+
+typedef enum _Color_Type
+{
+ HUE,
+ SATURATION,
+ LIGHTNESS,
+ ALPHA
+} Color_Type;
+
typedef struct _Colorselector_Data Colorselector_Data;
-
struct _Colorselector_Data
{
Evas_Object *parent;
@@ -26,12 +40,11 @@ struct _Colorselector_Data
Evas_Object *bg_rect;
Evas_Object *arrow;
Evas_Object *touch_area;
- int colorselector_num;
- int button_state;
+ Color_Type color_type;
+ Button_State button_state;
};
typedef struct _Widget_Data Widget_Data;
-
struct _Widget_Data
{
Evas_Object *base;
@@ -46,13 +59,6 @@ struct _Widget_Data
Ecore_Timer *mv_timer;
};
-typedef enum
-{
- BUTTON_RELEASED,
- L_BUTTON_PRESSED,
- R_BUTTON_PRESSED
-} Button_State;
-
static const char *widtype = NULL;
static void _del_hook(Evas_Object *obj);
@@ -317,9 +323,9 @@ _draw_rects(void *data, double x)
Widget_Data *wd = elm_widget_data_get(cp->parent);
double one_six = 1.0 / 6.0;
- switch (cp->colorselector_num)
+ switch (cp->color_type)
{
- case 0:
+ case HUE:
wd->h = 360.0 * x;
if (x < one_six)
@@ -377,26 +383,25 @@ _draw_rects(void *data, double x)
wd->a);
break;
- case 1:
+ case SATURATION:
wd->s = 1.0 - x;
_color_with_saturation(wd);
evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
break;
- case 2:
+ case LIGHTNESS:
wd->l = x;
_color_with_lightness(wd);
evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
break;
- case 3:
+ case ALPHA:
wd->a = 255.0 * x;
evas_object_color_set(wd->cp[3]->arrow, wd->er, wd->eg, wd->eb, wd->a);
break;
default:
break;
-
}
_hsl_to_rgb(wd);
}
@@ -502,10 +507,23 @@ _left_button_down_cb(void *data, Evas *e __UNUSED_
"left_button");
edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y);
- if (!cp->colorselector_num) x -= 1.0 / HUE_STEP;
- else if (cp->colorselector_num == 1) x -= 1.0 / SAT_STEP;
- else if (cp->colorselector_num == 2) x -= 1.0 / LIG_STEP;
- else if (cp->colorselector_num == 3) x -= 1.0 / ALP_STEP;
+ switch(cp->color_type)
+ {
+ case HUE :
+ x -= 1.0 / HUE_STEP;
+ break;
+ case SATURATION :
+ x -= 1.0 / SAT_STEP;
+ break;
+ case LIGHTNESS :
+ x -= 1.0 / LIG_STEP;
+ break;
+ case ALPHA :
+ x -= 1.0 / ALP_STEP;
+ break;
+ default :
+ break;
+ }
if (x < 0.0) x = 0.0;
@@ -528,10 +546,23 @@ _right_button_down_cb(void *data, Evas *e __UNUSED
"right_button");
edje_object_part_drag_value_get(cp->colorbar, "elm.arrow", &x, &y);
- if (!cp->colorselector_num) x += 1.0 / HUE_STEP;
- else if (cp->colorselector_num == 1) x += 1.0 / SAT_STEP;
- else if (cp->colorselector_num == 2) x += 1.0 / LIG_STEP;
- else if (cp->colorselector_num == 3) x += 1.0 / ALP_STEP;
+ switch(cp->color_type)
+ {
+ case HUE :
+ x += 1.0 / HUE_STEP;
+ break;
+ case SATURATION :
+ x += 1.0 / SAT_STEP;
+ break;
+ case LIGHTNESS :
+ x += 1.0 / LIG_STEP;
+ break;
+ case ALPHA :
+ x += 1.0 / ALP_STEP;
+ break;
+ default :
+ break;
+ }
if (x > 1.0) x = 1.0;
@@ -602,11 +633,25 @@ _add_colorbar(Evas_Object *obj)
for (i = 0; i < 4; i++)
{
wd->cp[i] = ELM_NEW(Colorselector_Data);
-
wd->cp[i]->parent = obj;
- wd->cp[i]->colorselector_num = i;
-
- /* load colorbar area */
+ switch(i)
+ {
+ case 0 :
+ wd->cp[i]->color_type = HUE;
+ break;
+ case 1 :
+ wd->cp[i]->color_type = SATURATION;
+ break;
+ case 2 :
+ wd->cp[i]->color_type = LIGHTNESS;
+ break;
+ case 3 :
+ wd->cp[i]->color_type = ALPHA;
+ break;
+ default :
+ break;
+ }
+ /* load colorbar area */
wd->cp[i]->colorbar = edje_object_add(e);
_elm_theme_object_set(obj, wd->cp[i]->colorbar, "colorselector", "base",
"default");
Index: elm_entry.c
===================================================================
--- elm_entry.c (revision 55060)
+++ elm_entry.c (working copy)
@@ -1387,7 +1387,7 @@ _signal_mouse_down(void *data, Evas_Object *obj __
}
static void
-_signal_mouse_up(void *data, Evas_Object *obj __UNUSED__, const char *emission
__UNUSED__, const char *source __UNUSED__)
+_signal_mouse_clicked(void *data, Evas_Object *obj __UNUSED__, const char
*emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
@@ -1624,8 +1624,8 @@ elm_entry_add(Evas_Object *parent)
_signal_key_enter, obj);
edje_object_signal_callback_add(wd->ent, "mouse,down,1", "elm.text",
_signal_mouse_down, obj);
- edje_object_signal_callback_add(wd->ent, "mouse,up,1", "elm.text",
- _signal_mouse_up, obj);
+ edje_object_signal_callback_add(wd->ent, "mouse,clicked,1", "elm.text",
+ _signal_mouse_clicked, obj);
edje_object_signal_callback_add(wd->ent, "mouse,down,1,double", "elm.text",
_signal_mouse_double, obj);
edje_object_part_text_set(wd->ent, "elm.text", "");
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel