rimmed pushed a commit to branch master.

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

commit c36e43dad9b150d658fff44d34ccf0dd64c1e321
Author: Vitalii Vorobiov <vi.vorob...@samsung.com>
Date:   Thu Sep 29 18:35:40 2016 +0300

    editor: add editor_part_item_index_source_set function
---
 src/bin/editor/diff.c        | 15 ++++++++++++++
 src/bin/editor/diff.h        |  6 ++++++
 src/bin/editor/editor.h      |  4 ++++
 src/bin/editor/editor_part.c | 48 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 73 insertions(+)

diff --git a/src/bin/editor/diff.c b/src/bin/editor/diff.c
index 4f85a34..2161fb3 100644
--- a/src/bin/editor/diff.c
+++ b/src/bin/editor/diff.c
@@ -72,6 +72,8 @@ typedef Eina_Bool (* function_type_string_uint_ushort) 
(Evas_Object *, Change*,
                                                         const char *, unsigned 
int, unsigned short);
 typedef Eina_Bool (* function_type_string_string_string) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
                                                           const char *, const 
char *, const char *);
+typedef Eina_Bool (* function_type_string_uint_string) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
+                                                        const char *, unsigned 
int, const char *);
 typedef Eina_Bool (* function_type_string_string_int_int_int_int) (Evas_Object 
*, Change*, Eina_Bool, Eina_Bool,
                                                                    const char 
*, const char *, int, int, int, int);
 typedef Eina_Bool (* function_type_string_edjeeditselectmode) (Evas_Object *, 
Change*, Eina_Bool, Eina_Bool,
@@ -175,6 +177,9 @@ _apply(Evas_Object *obj, Function_Info *fi)
       case FUNCTION_TYPE_STRING_STRING_STRING:
          return ((function_type_string_string_string)fi->function)(obj, NULL, 
false, true,
                   fi->args.type_sss.s1, fi->args.type_sss.s2, 
fi->args.type_sss.s3);
+      case FUNCTION_TYPE_STRING_UINT_STRING:
+         return ((function_type_string_uint_string)fi->function)(obj, NULL, 
false, true,
+                  fi->args.type_suis.s1, fi->args.type_suis.ui2, 
fi->args.type_suis.s3);
       case FUNCTION_TYPE_STRING_STRING_INT_INT_INT_INT:
          return 
((function_type_string_string_int_int_int_int)fi->function)(obj, NULL, false, 
true,
                   fi->args.type_ssiiii.s1, fi->args.type_ssiiii.s2, 
fi->args.type_ssiiii.i3, fi->args.type_ssiiii.i4, fi->args.type_ssiiii.i5, 
fi->args.type_ssiiii.i6);
@@ -385,6 +390,12 @@ diff_update(Diff *diff, Diff *new_diff)
          eina_stringshare_ref(new_diff->redo.args.type_sss.s2);
          eina_stringshare_ref(new_diff->redo.args.type_sss.s3);
          break;
+      case FUNCTION_TYPE_STRING_UINT_STRING:
+         eina_stringshare_del(diff->redo.args.type_suis.s1);
+         eina_stringshare_del(diff->redo.args.type_suis.s3);
+         eina_stringshare_ref(new_diff->redo.args.type_suis.s1);
+         eina_stringshare_ref(new_diff->redo.args.type_suis.s3);
+         break;
       case FUNCTION_TYPE_STRING_STRING_INT_INT_INT_INT:
          eina_stringshare_del(diff->redo.args.type_ssiiii.s1);
          eina_stringshare_del(diff->redo.args.type_ssiiii.s2);
@@ -533,6 +544,10 @@ diff_free(Diff *diff)
          eina_stringshare_del(diff->redo.args.type_sss.s2);
          eina_stringshare_del(diff->redo.args.type_sss.s3);
          break;
+      case FUNCTION_TYPE_STRING_UINT_STRING:
+         eina_stringshare_del(diff->redo.args.type_suis.s1);
+         eina_stringshare_del(diff->redo.args.type_suis.s3);
+         break;
       case FUNCTION_TYPE_STRING_STRING_INT_INT_INT_INT:
          eina_stringshare_del(diff->redo.args.type_ssiiii.s1);
          eina_stringshare_del(diff->redo.args.type_ssiiii.s2);
diff --git a/src/bin/editor/diff.h b/src/bin/editor/diff.h
index 45e844d..74c1d18 100644
--- a/src/bin/editor/diff.h
+++ b/src/bin/editor/diff.h
@@ -50,6 +50,7 @@ typedef enum {
    FUNCTION_TYPE_STRING_STRING_USHORT,
    FUNCTION_TYPE_STRING_UINT_USHORT,
    FUNCTION_TYPE_STRING_STRING_STRING,
+   FUNCTION_TYPE_STRING_UINT_STRING,
    FUNCTION_TYPE_STRING_STRING_INT_INT_INT_INT,
    FUNCTION_TYPE_STRING_EDJEEDITSELECTMODE,
    FUNCTION_TYPE_STRING_EDJEEDITENTRYMODE,
@@ -193,6 +194,11 @@ struct _Function_Info {
       } type_sss;
       struct {
          Eina_Stringshare *s1;
+         unsigned int ui2;
+         Eina_Stringshare *s3;
+      } type_suis;
+      struct {
+         Eina_Stringshare *s1;
          Eina_Stringshare *s2;
          int i3;
          int i4;
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index 61ad0e3..457b63a 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -235,6 +235,7 @@ typedef struct {
    Eina_Stringshare *group_name;
    Eina_Stringshare *part_name;
    Eina_Stringshare *item_name;
+   unsigned int item_index;
    Eina_Stringshare *state_name;
    Eina_Stringshare *program_name;
    double state_value;
@@ -736,6 +737,9 @@ Eina_Bool
 editor_part_item_source_set(Evas_Object *obj, Change *change, Eina_Bool merge, 
Eina_Bool apply, const char *part_name, const char *item_name,
       const char * new_val) EINA_WARN_UNUSED_RESULT;
 Eina_Bool
+editor_part_item_index_source_set(Evas_Object *edit_object, Change *change, 
Eina_Bool merge, Eina_Bool apply,
+                                  const char *part_name, unsigned int index, 
const char *new_val) EINA_WARN_UNUSED_RESULT;
+Eina_Bool
 editor_part_item_aspect_mode_set(Evas_Object *obj, Change *change, Eina_Bool 
merge, Eina_Bool apply, const char *part_name, const char *item_name,
       Edje_Aspect_Control new_val) EINA_WARN_UNUSED_RESULT;
 Eina_Bool
diff --git a/src/bin/editor/editor_part.c b/src/bin/editor/editor_part.c
index fbf7d4d..1915184 100644
--- a/src/bin/editor/editor_part.c
+++ b/src/bin/editor/editor_part.c
@@ -385,6 +385,54 @@ editor_part_item_source_set(Evas_Object *edit_object, 
Change *change, Eina_Bool
    return true;
 }
 
+Eina_Bool
+editor_part_item_index_source_set(Evas_Object *edit_object, Change *change, 
Eina_Bool merge, Eina_Bool apply,
+                                  const char *part_name, unsigned int index, 
const char *new_val)
+{
+   Diff *diff;
+   Editor_Attribute_Change send;
+   send.edit_object = edit_object;
+
+   assert(edit_object != NULL);
+   assert(part_name != NULL);
+   Eina_Stringshare *old_value = 
edje_edit_part_item_index_source_get(edit_object, part_name, index);
+   send.attribute = RM_ATTRIBUTE_PART_ITEM_SOURCE;
+   send.part_name = eina_stringshare_add(part_name);
+   send.item_index = index;
+   send.old_value = eina_stringshare_add(old_value);
+   send.value = eina_stringshare_add(new_val);
+   if (change)
+     {
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_UINT_STRING;
+        diff->redo.function = editor_part_item_source_set;
+        diff->redo.args.type_suis.s1 = eina_stringshare_add(part_name);
+        diff->redo.args.type_suis.ui2 = index;
+        diff->redo.args.type_suis.s3 = eina_stringshare_add(new_val);
+        diff->undo.type = FUNCTION_TYPE_STRING_UINT_STRING;
+        diff->undo.function = editor_part_item_source_set;
+        diff->undo.args.type_suis.s1 = eina_stringshare_add(part_name);
+        diff->undo.args.type_suis.ui2 = index;
+        diff->undo.args.type_suis.s3 = 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_source_set(edit_object, 
part_name, index, new_val));
+        CRIT_ON_FAIL(editor_save(edit_object));
+        _editor_project_changed();
+        CRIT_ON_FAIL(editor_save(edit_object));
+        if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_RM_ATTRIBUTE_CHANGED, &send);
+     }
+   eina_stringshare_del(part_name);
+   eina_stringshare_del(old_value);
+   eina_stringshare_del(new_val);
+   return true;
+}
+
 /* PADDINGS */
 
 Eina_Bool

-- 


Reply via email to