rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=1cc0d166b420a6ebd9f6952ab4e7abb552ff1b3a
commit 1cc0d166b420a6ebd9f6952ab4e7abb552ff1b3a Author: Andrii Kroitor <[email protected]> Date: Tue Oct 6 14:05:06 2015 +0300 property: use editor api for colors --- src/bin/editor/editor.h | 13 +++++++++++++ src/bin/ui/property.c | 13 ++++++++----- src/bin/ui/property_macros.h | 33 ++++++++++++++++++++------------- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h index e74a65b..77857b2 100644 --- a/src/bin/editor/editor.h +++ b/src/bin/editor/editor.h @@ -372,6 +372,19 @@ Eina_Bool editor_state_color_class_set(Evas_Object *obj, Change *change, Eina_Bool merge, const char *part_name, const char *state_name, double state_val, const char * new_val); +Eina_Bool +editor_state_color_set(Evas_Object *obj, Change *change, Eina_Bool merge, const char *part_name, const char *state_name, double state_val, + int r, int g, int b, int a); + +Eina_Bool +editor_state_color2_set(Evas_Object *obj, Change *change, Eina_Bool merge, const char *part_name, const char *state_name, double state_val, + int r, int g, int b, int a); + +Eina_Bool +editor_state_color3_set(Evas_Object *obj, Change *change, Eina_Bool merge, const char *part_name, const char *state_name, double state_val, + int r, int g, int b, int a); + + /* Part */ Eina_Bool diff --git a/src/bin/ui/property.c b/src/bin/ui/property.c index 3192153..909f768 100644 --- a/src/bin/ui/property.c +++ b/src/bin/ui/property.c @@ -1829,8 +1829,8 @@ prop_state_color_class_add(Evas_Object *parent, Prop_Data *pd) STATE_ATTR_1COMBOBOX_LIST_CALLBACK(TEXT, SUB, VALUE, TYPE, DESCRIPTION) \ STATE_ATTR_1COMBOBOX_LIST_ADD(TEXT, SUB, VALUE, MEMBER, LIST, TOOLTIP) -#define STATE_ATTR_COLOR(TEXT, SUB, VALUE, MEMBER, TOOLTIP) \ - STATE_ATTR_COLOR_CALLBACK(SUB, VALUE, MEMBER) \ +#define STATE_ATTR_COLOR(TEXT, SUB, VALUE, MEMBER, TOOLTIP, DESCRIPTION) \ + STATE_ATTR_COLOR_CALLBACK(SUB, VALUE, MEMBER, DESCRIPTION) \ STATE_ATTR_COLOR_LIST_UPDATE(SUB, VALUE, MEMBER) \ STATE_ATTR_COLOR_ADD(TEXT, SUB, VALUE, MEMBER, TOOLTIP) @@ -1888,7 +1888,8 @@ STATE_ATTR_2SPINNER(_("multiplier"), state, minmul_w, minmul_h, state, 0.0, 9999 1, double, _("multiplier w changed from %f to %f"), _("multiplier h changed from %f to %f")) -STATE_ATTR_COLOR(_("color"), state, color, state, _("Part main color")) +STATE_ATTR_COLOR(_("color"), state, color, state, _("Part main color"), + _("color changed to [%d %d %d %d]")) STATE_ATTR_SOURCE_UPDATE(state, proxy_source, state, EDJE_PART_TYPE_SPACER, !=) STATE_ATTR_COMBOBOX(_("proxy source"), state, proxy_source, state, @@ -2352,8 +2353,10 @@ STATE_ATTR_2CHECK(_("fit"), state_text, fit_x, fit_y, state_text, "w:", "", "h:" _("Resize the text for it to fit in it's container by Y axis"), _("fit_x changed to %s"), _("fit_y changed to %s")) -STATE_ATTR_COLOR(_("shadow color"), state, color2, state_text, NULL) -STATE_ATTR_COLOR(_("outline color"), state, color3, state_text, NULL) +STATE_ATTR_COLOR(_("shadow color"), state, color2, state_text, NULL, + _("shadow color changed to [%d %d %d %d]")) +STATE_ATTR_COLOR(_("outline color"), state, color3, state_text, NULL, + _("outline color changed [%d %d %d %d]")) STATE_ATTR_SOURCE_UPDATE(state_text, source, state_text, EDJE_PART_TYPE_TEXT, ==) STATE_ATTR_COMBOBOX(_("source"), state_text, source, state_text, diff --git a/src/bin/ui/property_macros.h b/src/bin/ui/property_macros.h index f3d9b83..9f09d9b 100644 --- a/src/bin/ui/property_macros.h +++ b/src/bin/ui/property_macros.h @@ -1556,30 +1556,26 @@ prop_##SUB##_##VALUE##_update(Prop_Data *pd) \ * * @ingroup Property_Macro */ -#define STATE_ATTR_COLOR_CALLBACK(SUB, VALUE, MEMBER) \ +#define STATE_ATTR_COLOR_CALLBACK(SUB, VALUE, MEMBER, DESCRIPTION) \ static void \ _on_##MEMBER##_##VALUE##_change(void *data, \ Evas_Object *obj, \ void *event_info __UNUSED__) \ { \ int r, g, b, a; \ - int old_r, old_g, old_b, old_a; \ Prop_Data *pd = (Prop_Data *)data; \ - edje_edit_##SUB##_##VALUE##_get(pd->group->edit_object, pd->part->name, \ - pd->part->current_state->parsed_name, \ - pd->part->current_state->parsed_val, \ - &old_r, &old_g, &old_b, &old_a); \ + assert(pd->change != NULL); \ colorselector_color_get(obj, &r, &g, &b, &a); \ - if (!edje_edit_##SUB##_##VALUE##_set(pd->group->edit_object, pd->part->name, \ - pd->part->current_state->parsed_name, \ - pd->part->current_state->parsed_val, \ - r, g, b, a))\ + if (!editor_##SUB##_##VALUE##_set(pd->group->edit_object, pd->change, true, \ + pd->part->name, \ + pd->part->current_state->parsed_name, \ + pd->part->current_state->parsed_val, \ + r, g, b, a))\ { \ ERR("edje_edit_"#SUB"_"#VALUE"_set failed"); \ abort(); \ } \ evas_object_color_set(pd->attributes.MEMBER.VALUE##_obj, r*a/255, g*a/255, b*a/255, a); \ - /*project_changed(false);*/ \ evas_object_smart_callback_call(ap.win, SIGNAL_PROPERTY_ATTRIBUTE_CHANGED, NULL); \ } \ static void \ @@ -1587,13 +1583,24 @@ _on_##MEMBER##_##VALUE##_dismissed(void *data, \ Evas_Object *obj, \ void *event_info __UNUSED__) \ { \ + int r, g, b, a; \ Prop_Data *pd = (Prop_Data *)data; \ + assert(pd->change != NULL); \ evas_object_smart_callback_del_full(obj, "color,changed", \ _on_##MEMBER##_##VALUE##_change, pd); \ evas_object_smart_callback_del_full(obj, "palette,item,selected", \ _on_##MEMBER##_##VALUE##_change, pd); \ evas_object_smart_callback_del_full(obj, "dismissed", \ _on_##MEMBER##_##VALUE##_dismissed, pd); \ + edje_edit_##SUB##_##VALUE##_get(pd->group->edit_object, pd->part->name, \ + pd->part->current_state->parsed_name, \ + pd->part->current_state->parsed_val, \ + &r, &g, &b, &a); \ + Eina_Stringshare *msg = eina_stringshare_printf(DESCRIPTION, r, g, b, a); \ + change_description_set(pd->change, msg); \ + eina_stringshare_del(msg); \ + history_change_add(pd->group->history, pd->change); \ + pd->change = NULL; \ evas_object_hide(obj); \ } \ static void \ @@ -1606,13 +1613,13 @@ _on_##MEMBER##_##VALUE##_clicked(void *data, \ int r, g, b, a; \ Evas_Object *colorsel; \ Prop_Data *pd = (Prop_Data *)data; \ + assert(pd->change == NULL); \ colorsel = colorselector_get(); \ + pd->change = change_add(NULL); \ evas_object_color_get(pd->attributes.MEMBER.VALUE##_obj, &r, &g, &b, &a); \ colorselector_color_set(colorsel, r, g, b, a); \ evas_object_smart_callback_add(colorsel, "color,changed", \ _on_##MEMBER##_##VALUE##_change, pd); \ - evas_object_smart_callback_add(colorsel, "palette,item,selected", \ - _on_##MEMBER##_##VALUE##_change, pd); \ evas_object_smart_callback_add(colorsel, "dismissed", \ _on_##MEMBER##_##VALUE##_dismissed, pd); \ evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); \ --
