rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=a6eaf0bc5ac40f61c26a10ed31879f8a51fc4665
commit a6eaf0bc5ac40f61c26a10ed31879f8a51fc4665 Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Tue Jun 7 14:08:40 2016 +0300 editor/property: refactor map color point for more flexible value change --- src/bin/editor/diff.c | 13 --------- src/bin/editor/diff.h | 11 ------- src/bin/editor/editor.h | 18 ++++++++++-- src/bin/editor/editor_macro.h | 48 +++++++++++++++++++++++++++++++ src/bin/editor/editor_states.c | 52 +++------------------------------- src/bin/ui/property/property_group.c | 46 +++++++++++++++++++++++++----- src/bin/ui/property/property_private.h | 3 +- 7 files changed, 108 insertions(+), 83 deletions(-) diff --git a/src/bin/editor/diff.c b/src/bin/editor/diff.c index 20b39d5..d544a4d 100644 --- a/src/bin/editor/diff.c +++ b/src/bin/editor/diff.c @@ -110,9 +110,6 @@ _apply(Evas_Object *obj, Function_Info *fi) case FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT: return ((function_type_string_string_double_int_int_int_int)fi->function)(obj, NULL, false, true, fi->args.type_ssdiiii.s1, fi->args.type_ssdiiii.s2, fi->args.type_ssdiiii.d3, fi->args.type_ssdiiii.i4, fi->args.type_ssdiiii.i5, fi->args.type_ssdiiii.i6, fi->args.type_ssdiiii.i7); - case FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT_INT: - return ((function_type_string_string_double_int_int_int_int_int)fi->function)(obj, NULL, false, true, - fi->args.type_ssdiiiii.s1, fi->args.type_ssdiiiii.s2, fi->args.type_ssdiiiii.d3, fi->args.type_ssdiiiii.i4, fi->args.type_ssdiiiii.i5, fi->args.type_ssdiiiii.i6, fi->args.type_ssdiiiii.i7, fi->args.type_ssdiiiii.i8); case FUNCTION_TYPE_STRING_STRING_DOUBLE_UCHAR: return ((function_type_string_string_double_uchar)fi->function)(obj, NULL, false, true, fi->args.type_ssduc.s1, fi->args.type_ssduc.s2, fi->args.type_ssduc.d3, fi->args.type_ssduc.uc4); @@ -262,12 +259,6 @@ diff_update(Diff *diff, Diff *new_diff) eina_stringshare_ref(new_diff->redo.args.type_ssdiiii.s1); eina_stringshare_ref(new_diff->redo.args.type_ssdiiii.s2); break; - case FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT_INT: - eina_stringshare_del(diff->redo.args.type_ssdiiiii.s1); - eina_stringshare_del(diff->redo.args.type_ssdiiiii.s2); - eina_stringshare_ref(new_diff->redo.args.type_ssdiiiii.s1); - eina_stringshare_ref(new_diff->redo.args.type_ssdiiiii.s2); - break; case FUNCTION_TYPE_STRING_STRING_DOUBLE_UCHAR: eina_stringshare_del(diff->redo.args.type_ssduc.s1); eina_stringshare_del(diff->redo.args.type_ssduc.s2); @@ -431,10 +422,6 @@ diff_free(Diff *diff) eina_stringshare_del(diff->redo.args.type_ssdiiii.s1); eina_stringshare_del(diff->redo.args.type_ssdiiii.s2); break; - case FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT_INT: - eina_stringshare_del(diff->redo.args.type_ssdiiiii.s1); - eina_stringshare_del(diff->redo.args.type_ssdiiiii.s2); - break; case FUNCTION_TYPE_STRING_STRING_DOUBLE_UCHAR: eina_stringshare_del(diff->redo.args.type_ssduc.s1); eina_stringshare_del(diff->redo.args.type_ssduc.s2); diff --git a/src/bin/editor/diff.h b/src/bin/editor/diff.h index b8d4d11..c488071 100644 --- a/src/bin/editor/diff.h +++ b/src/bin/editor/diff.h @@ -31,7 +31,6 @@ typedef enum { FUNCTION_TYPE_STRING_STRING_DOUBLE_STRING, FUNCTION_TYPE_STRING_STRING_DOUBLE_STRING_DOUBLE, FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT, - FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT_INT, FUNCTION_TYPE_STRING_STRING_DOUBLE_UCHAR, FUNCTION_TYPE_STRING_EDJEPARTTYPE, FUNCTION_TYPE_STRING_EDJETEXTEFFECT, @@ -109,16 +108,6 @@ struct _Function_Info { Eina_Stringshare *s1; Eina_Stringshare *s2; double d3; - int i4; - int i5; - int i6; - int i7; - int i8; - } type_ssdiiiii; - struct { - Eina_Stringshare *s1; - Eina_Stringshare *s2; - double d3; unsigned char uc4; } type_ssduc; struct { diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h index b43969c..fb3c69c 100644 --- a/src/bin/editor/editor.h +++ b/src/bin/editor/editor.h @@ -174,7 +174,10 @@ typedef enum { ATTRIBUTE_STATE_MAP_ROTATION_X, ATTRIBUTE_STATE_MAP_ROTATION_Y, ATTRIBUTE_STATE_MAP_ROTATION_Z, - ATTRIBUTE_STATE_MAP_POINT_COLOR, + ATTRIBUTE_STATE_MAP_POINT_COLOR_1, + ATTRIBUTE_STATE_MAP_POINT_COLOR_2, + ATTRIBUTE_STATE_MAP_POINT_COLOR_3, + ATTRIBUTE_STATE_MAP_POINT_COLOR_4, ATTRIBUTE_PROGRAM_TRANSITION_TYPE, ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT, ATTRIBUTE_PROGRAM_ACTION, @@ -900,8 +903,17 @@ Eina_Bool editor_state_map_rotation_z_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, const char *state_name, double state_val, double n4) EINA_WARN_UNUSED_RESULT; Eina_Bool -editor_state_map_point_color_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, - const char *part_name, const char *state_name, double state_val, int idx, int n4, int n5, int n6, int n7) EINA_WARN_UNUSED_RESULT; +editor_state_map_point_color_1_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, + const char *part_name, const char *state_name, double state_val, int n4, int n5, int n6, int n7) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_state_map_point_color_2_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, + const char *part_name, const char *state_name, double state_val, int n4, int n5, int n6, int n7) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_state_map_point_color_3_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, + const char *part_name, const char *state_name, double state_val, int n4, int n5, int n6, int n7) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_state_map_point_color_4_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, + const char *part_name, const char *state_name, double state_val, int n4, int n5, int n6, int n7) EINA_WARN_UNUSED_RESULT; Eina_Bool editor_state_map_rotation_center_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, const char *state_name, double state_val, const char * new_val) EINA_WARN_UNUSED_RESULT; diff --git a/src/bin/editor/editor_macro.h b/src/bin/editor/editor_macro.h index d3f9dce..05b5736 100644 --- a/src/bin/editor/editor_macro.h +++ b/src/bin/editor/editor_macro.h @@ -288,6 +288,54 @@ editor_state_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool return true; \ } +#define EDITOR_STATE_INT_INT_INT_INT_INT(FUNC, REAL_FUNC, ATTRIBUTE, NUMBER) \ +Eina_Bool \ +editor_state_## FUNC ##_## NUMBER ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, \ + const char *part_name, const char *state_name, double state_val, int n4, int n5, int n6, int n7) \ +{ \ + Diff *diff; \ + int o4, o5, o6, o7; \ + Attribute attribute = ATTRIBUTE ##_## NUMBER; \ + assert(edit_object != NULL); \ + assert(part_name != NULL); \ + assert(state_name != NULL); \ + if (change) \ + { \ + edje_edit_state_## REAL_FUNC ##_get(edit_object, part_name, state_name, state_val, NUMBER - 1, &o4, &o5, &o6, &o7); \ + diff = mem_calloc(1, sizeof(Diff)); \ + diff->redo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT; \ + diff->redo.function = editor_state_## FUNC ##_## NUMBER ##_set; \ + diff->redo.args.type_ssdiiii.s1 = eina_stringshare_add(part_name); \ + diff->redo.args.type_ssdiiii.s2 = eina_stringshare_add(state_name); \ + diff->redo.args.type_ssdiiii.d3 = state_val; \ + diff->redo.args.type_ssdiiii.i4 = n4; \ + diff->redo.args.type_ssdiiii.i5 = n5; \ + diff->redo.args.type_ssdiiii.i6 = n6; \ + diff->redo.args.type_ssdiiii.i7 = n7; \ + diff->undo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT; \ + diff->undo.function = editor_state_## FUNC ##_## NUMBER ##_set; \ + diff->undo.args.type_ssdiiii.s1 = eina_stringshare_add(part_name); \ + diff->undo.args.type_ssdiiii.s2 = eina_stringshare_add(state_name); \ + diff->undo.args.type_ssdiiii.d3 = state_val; \ + diff->undo.args.type_ssdiiii.i4 = o4; \ + diff->undo.args.type_ssdiiii.i5 = o5; \ + diff->undo.args.type_ssdiiii.i6 = o6; \ + diff->undo.args.type_ssdiiii.i7 = o7; \ + if (merge) \ + change_diff_merge_add(change, diff); \ + else \ + change_diff_add(change, diff); \ + } \ + if (apply) \ + { \ + if (!edje_edit_state_## REAL_FUNC ##_set(edit_object, part_name, state_name, state_val, NUMBER - 1, n4, n5, n6, n7)) \ + return false; \ + _editor_project_changed(); \ + if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute); \ + } \ + return true; \ +} + #define EDITOR_STATE_UCHAR(FUNC, ATTRIBUTE) \ Eina_Bool \ editor_state_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, \ diff --git a/src/bin/editor/editor_states.c b/src/bin/editor/editor_states.c index a281f71..423f3d4 100644 --- a/src/bin/editor/editor_states.c +++ b/src/bin/editor/editor_states.c @@ -308,54 +308,10 @@ editor_state_map_rotation_z_set(Evas_Object *edit_object, Change *change, Eina_B return true; } -Eina_Bool -editor_state_map_point_color_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, - const char *part_name, const char *state_name, double state_val, int idx, int n4, int n5, int n6, int n7) -{ - Diff *diff; - int o4, o5, o6, o7; - Attribute attribute = ATTRIBUTE_STATE_MAP_POINT_COLOR; - assert(edit_object != NULL); - assert(part_name != NULL); - assert(state_name != NULL); - if (change) - { - edje_edit_state_map_point_color_get(edit_object, part_name, state_name, state_val, idx, &o4, &o5, &o6, &o7); - diff = mem_calloc(1, sizeof(Diff)); - diff->redo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT_INT; - diff->redo.function = editor_state_map_point_color_set; - diff->redo.args.type_ssdiiiii.s1 = eina_stringshare_add(part_name); - diff->redo.args.type_ssdiiiii.s2 = eina_stringshare_add(state_name); - diff->redo.args.type_ssdiiiii.d3 = state_val; - diff->redo.args.type_ssdiiiii.i4 = n4; - diff->redo.args.type_ssdiiiii.i5 = n5; - diff->redo.args.type_ssdiiiii.i6 = n6; - diff->redo.args.type_ssdiiiii.i7 = n7; - diff->redo.args.type_ssdiiiii.i8 = idx; - diff->undo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_INT_INT_INT_INT_INT; - diff->undo.function = editor_state_map_point_color_set; - diff->undo.args.type_ssdiiiii.s1 = eina_stringshare_add(part_name); - diff->undo.args.type_ssdiiiii.s2 = eina_stringshare_add(state_name); - diff->undo.args.type_ssdiiiii.d3 = state_val; - diff->undo.args.type_ssdiiiii.i4 = o4; - diff->undo.args.type_ssdiiiii.i5 = o5; - diff->undo.args.type_ssdiiiii.i6 = o6; - diff->undo.args.type_ssdiiiii.i7 = o7; - diff->undo.args.type_ssdiiiii.i8 = idx; - if (merge) - change_diff_merge_add(change, diff); - else - change_diff_add(change, diff); - } - if (apply) - { - if (!edje_edit_state_map_point_color_set(edit_object, part_name, state_name, state_val, idx, n4, n5, n6, n7)) - return false; - _editor_project_changed(); - if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute); - } - return true; -} +EDITOR_STATE_INT_INT_INT_INT_INT(map_point_color, map_point_color, ATTRIBUTE_STATE_MAP_POINT_COLOR, 1) +EDITOR_STATE_INT_INT_INT_INT_INT(map_point_color, map_point_color, ATTRIBUTE_STATE_MAP_POINT_COLOR, 2) +EDITOR_STATE_INT_INT_INT_INT_INT(map_point_color, map_point_color, ATTRIBUTE_STATE_MAP_POINT_COLOR, 3) +EDITOR_STATE_INT_INT_INT_INT_INT(map_point_color, map_point_color, ATTRIBUTE_STATE_MAP_POINT_COLOR, 4) TODO("Fix edje_edit API") //EDITOR_STATE_STRING(box_layout, ATTRIBUTE_STATE_BOX_LAYOUT) diff --git a/src/bin/ui/property/property_group.c b/src/bin/ui/property/property_group.c index c6b065a..c3691ba 100644 --- a/src/bin/ui/property/property_group.c +++ b/src/bin/ui/property/property_group.c @@ -544,7 +544,8 @@ _subitems_get(Property_Attribute *pa) APPEND(PROPERTY_GROUP_ITEM_STATE_MAP_ROTATION_X); APPEND(PROPERTY_GROUP_ITEM_STATE_MAP_ROTATION_Y); APPEND(PROPERTY_GROUP_ITEM_STATE_MAP_ROTATION_Z); - APPEND(PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR); + APPEND(PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR_12); + APPEND(PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR_34); break; case PROPERTY_GROUP_ITEM_STATE_POSITION_REL1_TITLE: APPEND(PROPERTY_GROUP_ITEM_STATE_POSITION_REL1_TO_X); @@ -848,7 +849,10 @@ _init_cb(Property_Attribute *pa, Property_Action *action) case ATTRIBUTE_STATE_MAP_ROTATION_X: case ATTRIBUTE_STATE_MAP_ROTATION_Y: case ATTRIBUTE_STATE_MAP_ROTATION_Z: - case ATTRIBUTE_STATE_MAP_POINT_COLOR: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_1: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_2: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_3: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_4: break; case ATTRIBUTE_STATE_TEXT_SIZE: elm_spinner_min_max_set(action->control, 1, 9999); @@ -2188,7 +2192,10 @@ _update_cb(Property_Attribute *pa, Property_Action *action) case ATTRIBUTE_STATE_MAP_ROTATION_X: case ATTRIBUTE_STATE_MAP_ROTATION_Y: case ATTRIBUTE_STATE_MAP_ROTATION_Z: - case ATTRIBUTE_STATE_MAP_POINT_COLOR: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_1: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_2: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_3: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_4: break; default: TODO("remove default case after all attributes will be added"); @@ -2913,7 +2920,10 @@ _start_cb(Property_Attribute *pa, Property_Action *action) case ATTRIBUTE_STATE_MAP_ROTATION_X: case ATTRIBUTE_STATE_MAP_ROTATION_Y: case ATTRIBUTE_STATE_MAP_ROTATION_Z: - case ATTRIBUTE_STATE_MAP_POINT_COLOR: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_1: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_2: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_3: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_4: break; default: TODO("remove default case after all attributes will be added"); @@ -3798,7 +3808,10 @@ _change_cb(Property_Attribute *pa, Property_Action *action) case ATTRIBUTE_STATE_MAP_ROTATION_X: case ATTRIBUTE_STATE_MAP_ROTATION_Y: case ATTRIBUTE_STATE_MAP_ROTATION_Z: - case ATTRIBUTE_STATE_MAP_POINT_COLOR: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_1: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_2: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_3: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_4: break; default: TODO("remove default case after all attributes will be added"); @@ -4059,7 +4072,10 @@ _stop_cb(Property_Attribute *pa, Property_Action *action) case ATTRIBUTE_STATE_MAP_ROTATION_X: case ATTRIBUTE_STATE_MAP_ROTATION_Y: case ATTRIBUTE_STATE_MAP_ROTATION_Z: - case ATTRIBUTE_STATE_MAP_POINT_COLOR: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_1: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_2: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_3: + case ATTRIBUTE_STATE_MAP_POINT_COLOR_4: break; default: TODO("remove default case after all attributes will be added"); @@ -4483,7 +4499,23 @@ _init_items() _action1(&IT, NULL, NULL, PROPERTY_CONTROL_SPINNER, ATTRIBUTE_STATE_MAP_ROTATION_Z, _("rotation (in degrees) around the Z axis of the part considering the center set")); break; - case PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR: + case PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR_12: + IT.name = "Color Points"; + _action1(&IT, "1:", NULL, PROPERTY_CONTROL_COLOR, ATTRIBUTE_STATE_MAP_POINT_COLOR_1, + _("Set the color of a vertex in the map.<br>" + "This control changes Left-Top point of a part")); + _action2(&IT, "2:", NULL, PROPERTY_CONTROL_COLOR, ATTRIBUTE_STATE_MAP_POINT_COLOR_2, + _("Set the color of a vertex in the map.<br>" + "This control changes Right-Top point of a part")); + break; + case PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR_34: + IT.name = ""; + _action1(&IT, "3:", NULL, PROPERTY_CONTROL_COLOR, ATTRIBUTE_STATE_MAP_POINT_COLOR_3, + _("Set the color of a vertex in the map.<br>" + "This control changes Left-Bottom point of a part")); + _action2(&IT, "4:", NULL, PROPERTY_CONTROL_COLOR, ATTRIBUTE_STATE_MAP_POINT_COLOR_4, + _("Set the color of a vertex in the map.<br>" + "This control changes Right-Bottom point of a part")); break; /* part text */ case PROPERTY_GROUP_ITEM_PART_TEXT_EFFECT: diff --git a/src/bin/ui/property/property_private.h b/src/bin/ui/property/property_private.h index e3bf482..9c1bcb2 100644 --- a/src/bin/ui/property/property_private.h +++ b/src/bin/ui/property/property_private.h @@ -291,7 +291,8 @@ typedef enum { PROPERTY_GROUP_ITEM_STATE_MAP_ROTATION_X, PROPERTY_GROUP_ITEM_STATE_MAP_ROTATION_Y, PROPERTY_GROUP_ITEM_STATE_MAP_ROTATION_Z, - PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR, + PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR_12, + PROPERTY_GROUP_ITEM_STATE_MAP_POINT_COLOR_34, PROPERTY_GROUP_ITEM_PART_ITEM_TITLE, PROPERTY_GROUP_ITEM_PART_ITEM_NAME, --