> > By: WooHyun Jung <wh0705.j...@samsung.com> > k-s: see some one else is motivated :)
On Wed, Dec 1, 2010 at 3:53 AM, Enlightenment SVN <no-re...@enlightenment.org> wrote: > Log: > Improve elm_colorselector readability and fix clicked entry sig emission > > 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, for about elm_entry.c , I thought that "SIG_CLICKED" was wrongly > emitted (by "MOUSE_UP" event). > I deleted mouse_up callback function (as you advised), > because this function didn't do anything by my modification. > > By: WooHyun Jung <wh0705.j...@samsung.com> > > > Author: bdilly > Date: 2010-11-30 10:53:52 -0800 (Tue, 30 Nov 2010) > New Revision: 55097 > Trac: http://trac.enlightenment.org/e/changeset/55097 > > Modified: > trunk/TMP/st/elementary/src/lib/elm_colorselector.c > trunk/TMP/st/elementary/src/lib/elm_entry.c > > Modified: trunk/TMP/st/elementary/src/lib/elm_colorselector.c > =================================================================== > --- trunk/TMP/st/elementary/src/lib/elm_colorselector.c 2010-11-30 18:51:16 > UTC (rev 55096) > +++ trunk/TMP/st/elementary/src/lib/elm_colorselector.c 2010-11-30 18:53:52 > UTC (rev 55097) > @@ -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 @@ > 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 @@ > 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 @@ > 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 @@ > 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"); > 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"); > 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 @@ > 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"); > > Modified: trunk/TMP/st/elementary/src/lib/elm_entry.c > =================================================================== > --- trunk/TMP/st/elementary/src/lib/elm_entry.c 2010-11-30 18:51:16 UTC (rev > 55096) > +++ trunk/TMP/st/elementary/src/lib/elm_entry.c 2010-11-30 18:53:52 UTC (rev > 55097) > @@ -1387,7 +1387,7 @@ > } > > 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 @@ > _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-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > ------------------------------------------------------------------------------ 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