rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=6f3450559d98cc4768a98407d24bc32d593782c4

commit 6f3450559d98cc4768a98407d24bc32d593782c4
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Thu Sep 29 18:09:24 2016 +0300

    editor: EDITOR_PART_ITEM_INDEX_DOUBLE macro for part_item_index API
---
 src/bin/editor/diff.c         | 14 +++++++++++++-
 src/bin/editor/diff.h         |  6 ++++++
 src/bin/editor/editor.h       | 12 ++++++++++++
 src/bin/editor/editor_macro.h | 41 +++++++++++++++++++++++++++++++++++++++++
 src/bin/editor/editor_part.c  |  5 +++++
 5 files changed, 77 insertions(+), 1 deletion(-)

diff --git a/src/bin/editor/diff.c b/src/bin/editor/diff.c
index 31765f0..1917acd 100644
--- a/src/bin/editor/diff.c
+++ b/src/bin/editor/diff.c
@@ -53,13 +53,15 @@ typedef Eina_Bool (* function_type_string) (Evas_Object *, 
Change*, Eina_Bool, E
 typedef Eina_Bool (* function_type_string_string_edjeaspectcontrol) 
(Evas_Object *, Change*, Eina_Bool, Eina_Bool,
                                                                      const 
char *, const char *, Edje_Aspect_Control);
 typedef Eina_Bool (* function_type_string_uint_edjeaspectcontrol) (Evas_Object 
*, Change*, Eina_Bool, Eina_Bool,
-                                                                     const 
char *, unsigned int index, Edje_Aspect_Control);
+                                                                     const 
char *, unsigned int, Edje_Aspect_Control);
 typedef Eina_Bool (* function_type_string_edjeparttype) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
                                                          const char *, 
Edje_Part_Type);
 typedef Eina_Bool (* function_type_string_edjepartcopy) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
                                                          const char *, const 
char *);
 typedef Eina_Bool (* function_type_string_string_double) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
                                                           const char *, const 
char *, double);
+typedef Eina_Bool (* function_type_string_uint_double) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
+                                                        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_string_ushort) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
@@ -151,6 +153,9 @@ _apply(Evas_Object *obj, Function_Info *fi)
       case FUNCTION_TYPE_STRING_STRING_DOUBLE:
          return ((function_type_string_string_double)fi->function)(obj, NULL, 
false, true,
                   fi->args.type_ssd.s1, fi->args.type_ssd.s2, 
fi->args.type_ssd.d3);
+      case FUNCTION_TYPE_STRING_UINT_DOUBLE:
+         return ((function_type_string_uint_double)fi->function)(obj, NULL, 
false, true,
+                  fi->args.type_suid.s1, fi->args.type_suid.ui2, 
fi->args.type_suid.d3);
       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);
@@ -338,6 +343,10 @@ diff_update(Diff *diff, Diff *new_diff)
          eina_stringshare_ref(new_diff->redo.args.type_ssd.s1);
          eina_stringshare_ref(new_diff->redo.args.type_ssd.s2);
          break;
+      case FUNCTION_TYPE_STRING_UINT_DOUBLE:
+         eina_stringshare_del(diff->redo.args.type_suid.s1);
+         eina_stringshare_ref(new_diff->redo.args.type_suid.s1);
+         break;
       case FUNCTION_TYPE_STRING_STRING_INT:
          eina_stringshare_del(diff->redo.args.type_ssi.s1);
          eina_stringshare_del(diff->redo.args.type_ssi.s2);
@@ -484,6 +493,9 @@ diff_free(Diff *diff)
          eina_stringshare_del(diff->redo.args.type_ssd.s1);
          eina_stringshare_del(diff->redo.args.type_ssd.s2);
          break;
+      case FUNCTION_TYPE_STRING_UINT_DOUBLE:
+         eina_stringshare_del(diff->redo.args.type_suid.s1);
+         break;
       case FUNCTION_TYPE_STRING_STRING_INT:
          eina_stringshare_del(diff->redo.args.type_ssi.s1);
          eina_stringshare_del(diff->redo.args.type_ssi.s2);
diff --git a/src/bin/editor/diff.h b/src/bin/editor/diff.h
index bbd373f..318d08d 100644
--- a/src/bin/editor/diff.h
+++ b/src/bin/editor/diff.h
@@ -44,6 +44,7 @@ typedef enum {
    FUNCTION_TYPE_STRING_STRING_EDJEASPECTCONTROL,
    FUNCTION_TYPE_STRING_UINT_EDJEASPECTCONTROL,
    FUNCTION_TYPE_STRING_STRING_DOUBLE,
+   FUNCTION_TYPE_STRING_UINT_DOUBLE,
    FUNCTION_TYPE_STRING_STRING_INT,
    FUNCTION_TYPE_STRING_STRING_USHORT,
    FUNCTION_TYPE_STRING_STRING_STRING,
@@ -160,6 +161,11 @@ struct _Function_Info {
       } type_ssd;
       struct {
          Eina_Stringshare *s1;
+         unsigned int ui2;
+         double d3;
+      } type_suid;
+      struct {
+         Eina_Stringshare *s1;
          Eina_Stringshare *s2;
          int i3;
       } type_ssi;
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index e245362..73aa1c6 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -655,6 +655,18 @@ Eina_Bool
 editor_part_item_weight_y_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
+editor_part_item_index_align_x_set(Evas_Object *obj, Change *change, Eina_Bool 
merge, Eina_Bool apply, const char *part_name, unsigned int index,
+      double new_val) EINA_WARN_UNUSED_RESULT;
+Eina_Bool
+editor_part_item_index_align_y_set(Evas_Object *obj, Change *change, Eina_Bool 
merge, Eina_Bool apply, const char *part_name, unsigned int index,
+      double new_val) EINA_WARN_UNUSED_RESULT;
+Eina_Bool
+editor_part_item_index_weight_x_set(Evas_Object *obj, Change *change, 
Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index,
+      double new_val) EINA_WARN_UNUSED_RESULT;
+Eina_Bool
+editor_part_item_index_weight_y_set(Evas_Object *obj, Change *change, 
Eina_Bool merge, Eina_Bool apply, const char *part_name, unsigned int index,
+      double new_val) EINA_WARN_UNUSED_RESULT;
+Eina_Bool
 editor_part_item_aspect_w_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
diff --git a/src/bin/editor/editor_macro.h b/src/bin/editor/editor_macro.h
index 3718c4f..92041af 100644
--- a/src/bin/editor/editor_macro.h
+++ b/src/bin/editor/editor_macro.h
@@ -595,6 +595,47 @@ editor_part_item_## FUNC ##_set(Evas_Object *edit_object, 
Change *change, Eina_B
    return true; \
 }
 
+#define EDITOR_PART_ITEM_INDEX_DOUBLE(FUNC, RM_ATTRIBUTE) \
+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, double 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) \
+     { \
+        double 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_DOUBLE; \
+        diff->redo.function = editor_part_item_index_## FUNC ##_set; \
+        diff->redo.args.type_suid.s1 = eina_stringshare_add(part_name); \
+        diff->redo.args.type_suid.ui2 = index; \
+        diff->redo.args.type_suid.d3 = new_val; \
+        diff->undo.type = FUNCTION_TYPE_STRING_UINT_DOUBLE; \
+        diff->undo.function = editor_part_item_index_## FUNC ##_set; \
+        diff->undo.args.type_suid.s1 = eina_stringshare_add(part_name); \
+        diff->undo.args.type_suid.ui2 = index; \
+        diff->undo.args.type_suid.d3 = 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)); \
+       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_INT(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 980cf85..191b00f 100644
--- a/src/bin/editor/editor_part.c
+++ b/src/bin/editor/editor_part.c
@@ -298,6 +298,11 @@ EDITOR_PART_ITEM_DOUBLE(align_y, 
RM_ATTRIBUTE_PART_ITEM_ALIGN_Y);
 EDITOR_PART_ITEM_DOUBLE(weight_x, RM_ATTRIBUTE_PART_ITEM_WEIGHT_X);
 EDITOR_PART_ITEM_DOUBLE(weight_y, RM_ATTRIBUTE_PART_ITEM_WEIGHT_Y);
 
+EDITOR_PART_ITEM_INDEX_DOUBLE(align_x, RM_ATTRIBUTE_PART_ITEM_ALIGN_X);
+EDITOR_PART_ITEM_INDEX_DOUBLE(align_y, RM_ATTRIBUTE_PART_ITEM_ALIGN_Y);
+EDITOR_PART_ITEM_INDEX_DOUBLE(weight_x, RM_ATTRIBUTE_PART_ITEM_WEIGHT_X);
+EDITOR_PART_ITEM_INDEX_DOUBLE(weight_y, RM_ATTRIBUTE_PART_ITEM_WEIGHT_Y);
+
 EDITOR_PART_ITEM_INT(aspect_h, RM_ATTRIBUTE_PART_ITEM_ASPECT_H, false);
 EDITOR_PART_ITEM_INT(aspect_w, RM_ATTRIBUTE_PART_ITEM_ASPECT_W, false);
 EDITOR_PART_ITEM_INT(max_h, RM_ATTRIBUTE_PART_ITEM_MAX_H, false);

-- 


Reply via email to