rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=7ba7ce25249ea2d633e74c6e5129fda3bfd7a081
commit 7ba7ce25249ea2d633e74c6e5129fda3bfd7a081 Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Thu Sep 29 18:19:04 2016 +0300 editor: add EDITOR_PART_ITEM_INDEX_INT for part_item_index_ API --- src/bin/editor/diff.c | 12 ++++++++++++ src/bin/editor/diff.h | 6 ++++++ src/bin/editor/editor.h | 30 ++++++++++++++++++++++++++++++ src/bin/editor/editor_macro.h | 41 +++++++++++++++++++++++++++++++++++++++++ src/bin/editor/editor_part.c | 11 +++++++++++ 5 files changed, 100 insertions(+) diff --git a/src/bin/editor/diff.c b/src/bin/editor/diff.c index 1917acd..82e1697 100644 --- a/src/bin/editor/diff.c +++ b/src/bin/editor/diff.c @@ -64,6 +64,8 @@ typedef Eina_Bool (* function_type_string_uint_double) (Evas_Object *, Change*, const char *, unsigned int, double); typedef Eina_Bool (* function_type_string_string_int) (Evas_Object *, Change*, Eina_Bool, Eina_Bool, const char *, const char *, int); +typedef Eina_Bool (* function_type_string_uint_int) (Evas_Object *, Change*, Eina_Bool, Eina_Bool, + const char *, unsigned int, int); typedef Eina_Bool (* function_type_string_string_ushort) (Evas_Object *, Change*, Eina_Bool, Eina_Bool, const char *, const char *, unsigned short); typedef Eina_Bool (* function_type_string_string_string) (Evas_Object *, Change*, Eina_Bool, Eina_Bool, @@ -159,6 +161,9 @@ _apply(Evas_Object *obj, Function_Info *fi) case FUNCTION_TYPE_STRING_STRING_INT: return ((function_type_string_string_int)fi->function)(obj, NULL, false, true, fi->args.type_ssi.s1, fi->args.type_ssi.s2, fi->args.type_ssi.i3); + case FUNCTION_TYPE_STRING_UINT_INT: + return ((function_type_string_uint_int)fi->function)(obj, NULL, false, true, + fi->args.type_suii.s1, fi->args.type_suii.ui2, fi->args.type_suii.i3); case FUNCTION_TYPE_STRING_STRING_USHORT: return ((function_type_string_string_ushort)fi->function)(obj, NULL, false, true, fi->args.type_ssus.s1, fi->args.type_ssus.s2, fi->args.type_ssus.us3); @@ -353,6 +358,10 @@ diff_update(Diff *diff, Diff *new_diff) eina_stringshare_ref(new_diff->redo.args.type_ssi.s1); eina_stringshare_ref(new_diff->redo.args.type_ssi.s2); break; + case FUNCTION_TYPE_STRING_UINT_INT: + eina_stringshare_del(diff->redo.args.type_suii.s1); + eina_stringshare_ref(new_diff->redo.args.type_suii.s1); + break; case FUNCTION_TYPE_STRING_STRING_USHORT: eina_stringshare_del(diff->redo.args.type_ssus.s1); eina_stringshare_del(diff->redo.args.type_ssus.s2); @@ -500,6 +509,9 @@ diff_free(Diff *diff) eina_stringshare_del(diff->redo.args.type_ssi.s1); eina_stringshare_del(diff->redo.args.type_ssi.s2); break; + case FUNCTION_TYPE_STRING_UINT_INT: + eina_stringshare_del(diff->redo.args.type_suii.s1); + break; case FUNCTION_TYPE_STRING_STRING_USHORT: eina_stringshare_del(diff->redo.args.type_ssus.s1); eina_stringshare_del(diff->redo.args.type_ssus.s2); diff --git a/src/bin/editor/diff.h b/src/bin/editor/diff.h index 318d08d..293acbc 100644 --- a/src/bin/editor/diff.h +++ b/src/bin/editor/diff.h @@ -46,6 +46,7 @@ typedef enum { FUNCTION_TYPE_STRING_STRING_DOUBLE, FUNCTION_TYPE_STRING_UINT_DOUBLE, FUNCTION_TYPE_STRING_STRING_INT, + FUNCTION_TYPE_STRING_UINT_INT, FUNCTION_TYPE_STRING_STRING_USHORT, FUNCTION_TYPE_STRING_STRING_STRING, FUNCTION_TYPE_STRING_STRING_INT_INT_INT_INT, @@ -171,6 +172,11 @@ struct _Function_Info { } type_ssi; struct { Eina_Stringshare *s1; + unsigned int ui2; + int i3; + } type_suii; + struct { + Eina_Stringshare *s1; Eina_Stringshare *s2; unsigned short us3; } type_ssus; diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h index 73aa1c6..79541cc 100644 --- a/src/bin/editor/editor.h +++ b/src/bin/editor/editor.h @@ -643,6 +643,24 @@ Eina_Bool editor_part_item_prefer_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, const char *item_name, int new_val) EINA_WARN_UNUSED_RESULT; Eina_Bool +editor_part_item_index_min_w_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_min_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_max_w_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_max_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_prefer_w_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_prefer_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool editor_part_item_align_x_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, const char *item_name, double new_val) EINA_WARN_UNUSED_RESULT; Eina_Bool @@ -679,6 +697,18 @@ Eina_Bool editor_part_item_spread_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, const char *item_name, int new_val) EINA_WARN_UNUSED_RESULT; Eina_Bool +editor_part_item_index_aspect_w_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_aspect_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_spread_w_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool +editor_part_item_index_spread_h_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index, + int new_val) EINA_WARN_UNUSED_RESULT; +Eina_Bool editor_part_item_span_col_set(Evas_Object *obj, Change *change, Eina_Bool merge, Eina_Bool apply, const char *part_name, const char *item_name, unsigned short new_val) EINA_WARN_UNUSED_RESULT; Eina_Bool diff --git a/src/bin/editor/editor_macro.h b/src/bin/editor/editor_macro.h index 92041af..5f8832d 100644 --- a/src/bin/editor/editor_macro.h +++ b/src/bin/editor/editor_macro.h @@ -678,6 +678,47 @@ editor_part_item_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_B return true; \ } +#define EDITOR_PART_ITEM_INDEX_INT(FUNC, RM_ATTRIBUTE, SAVE) \ +Eina_Bool \ +editor_part_item_index_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, \ + const char *part_name, unsigned int index, int new_val) \ +{ \ + Diff *diff; \ + Editor_Attribute_Change send; \ + send.edit_object = edit_object; \ + \ + send.attribute = RM_ATTRIBUTE; \ + assert(edit_object != NULL); \ + assert(part_name != NULL); \ + if (change) \ + { \ + int old_value = edje_edit_part_item_index_## FUNC ##_get(edit_object, part_name, index); \ + diff = mem_calloc(1, sizeof(Diff)); \ + diff->redo.type = FUNCTION_TYPE_STRING_UINT_INT; \ + diff->redo.function = editor_part_item_index_## FUNC ##_set; \ + diff->redo.args.type_suii.s1 = eina_stringshare_add(part_name); \ + diff->redo.args.type_suii.ui2 = index; \ + diff->redo.args.type_suii.i3 = new_val; \ + diff->undo.type = FUNCTION_TYPE_STRING_UINT_INT; \ + diff->undo.function = editor_part_item_index_## FUNC ##_set; \ + diff->undo.args.type_suii.s1 = eina_stringshare_add(part_name); \ + diff->undo.args.type_suii.ui2 = index; \ + diff->undo.args.type_suii.i3 = old_value; \ + if (merge) \ + change_diff_merge_add(change, diff); \ + else \ + change_diff_add(change, diff); \ + } \ + if (apply) \ + { \ + CRIT_ON_FAIL(edje_edit_part_item_index_## FUNC ##_set(edit_object, part_name, index, new_val)); \ + if (SAVE) CRIT_ON_FAIL(editor_save(edit_object)); \ + _editor_project_changed(); \ + } \ + if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_ATTRIBUTE_CHANGED, &send); \ + return true; \ +} + #define EDITOR_PART_ITEM_USHORT(FUNC, RM_ATTRIBUTE, SAVE) \ Eina_Bool \ editor_part_item_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Eina_Bool apply, \ diff --git a/src/bin/editor/editor_part.c b/src/bin/editor/editor_part.c index 191b00f..6232288 100644 --- a/src/bin/editor/editor_part.c +++ b/src/bin/editor/editor_part.c @@ -314,6 +314,17 @@ EDITOR_PART_ITEM_INT(prefer_w, RM_ATTRIBUTE_PART_ITEM_PREFER_W, false); EDITOR_PART_ITEM_INT(spread_h, RM_ATTRIBUTE_PART_ITEM_SPREAD_H, true); EDITOR_PART_ITEM_INT(spread_w, RM_ATTRIBUTE_PART_ITEM_SPREAD_W, true); +EDITOR_PART_ITEM_INDEX_INT(aspect_h, RM_ATTRIBUTE_PART_ITEM_ASPECT_H, false); +EDITOR_PART_ITEM_INDEX_INT(aspect_w, RM_ATTRIBUTE_PART_ITEM_ASPECT_W, false); +EDITOR_PART_ITEM_INDEX_INT(max_h, RM_ATTRIBUTE_PART_ITEM_MAX_H, false); +EDITOR_PART_ITEM_INDEX_INT(max_w, RM_ATTRIBUTE_PART_ITEM_MAX_W, false); +EDITOR_PART_ITEM_INDEX_INT(min_h, RM_ATTRIBUTE_PART_ITEM_MIN_H, false); +EDITOR_PART_ITEM_INDEX_INT(min_w, RM_ATTRIBUTE_PART_ITEM_MIN_W, false); +EDITOR_PART_ITEM_INDEX_INT(prefer_h, RM_ATTRIBUTE_PART_ITEM_PREFER_H, false); +EDITOR_PART_ITEM_INDEX_INT(prefer_w, RM_ATTRIBUTE_PART_ITEM_PREFER_W, false); +EDITOR_PART_ITEM_INDEX_INT(spread_h, RM_ATTRIBUTE_PART_ITEM_SPREAD_H, true); +EDITOR_PART_ITEM_INDEX_INT(spread_w, RM_ATTRIBUTE_PART_ITEM_SPREAD_W, true); + EDITOR_PART_ITEM_USHORT(span_col, RM_ATTRIBUTE_PART_ITEM_SPAN_COL, true); EDITOR_PART_ITEM_USHORT(span_row, RM_ATTRIBUTE_PART_ITEM_SPAN_ROW, true); EDITOR_PART_ITEM_USHORT(position_col, RM_ATTRIBUTE_PART_ITEM_POSITION_COL, true); --