rimmed pushed a commit to branch master.

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

commit a072adfe459603c1b5d197c6a58b072bf7a54f3b
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Tue Jan 5 18:02:35 2016 +0200

    editor: add editor_program_action_set method
---
 src/bin/editor/banned_edje_edit_api.h |  2 +-
 src/bin/editor/editor.h               |  6 +++++-
 src/bin/editor/editor_program.c       | 32 ++++++++++++++++++++++++++++++++
 src/bin/ui/property_group.c           |  1 +
 4 files changed, 39 insertions(+), 2 deletions(-)

diff --git a/src/bin/editor/banned_edje_edit_api.h 
b/src/bin/editor/banned_edje_edit_api.h
index cd6fbd9..55e4ff8 100644
--- a/src/bin/editor/banned_edje_edit_api.h
+++ b/src/bin/editor/banned_edje_edit_api.h
@@ -238,7 +238,7 @@
 //#pragma GCC poison edje_edit_program_signal_set
 //#pragma GCC poison edje_edit_program_in_from_set
 //#pragma GCC poison edje_edit_program_in_range_set
-//#pragma GCC poison edje_edit_program_action_set
+#pragma GCC poison edje_edit_program_action_set
 //#pragma GCC poison edje_edit_program_target_add
 //#pragma GCC poison edje_edit_program_target_del
 //#pragma GCC poison edje_edit_program_targets_clear
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index b3002d5..bd132c2 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -146,7 +146,8 @@ typedef enum {
    ATTRIBUTE_PART_CURSOR_MODE,
    ATTRIBUTE_STATE_FILL_TYPE,
    ATTRIBUTE_PROGRAM_TRANSITION_TYPE,
-   ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT
+   ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT,
+   ATTRIBUTE_PROGRAM_ACTION
 } Attribute;
 
 void
@@ -608,5 +609,8 @@ editor_program_transition_type_set(Evas_Object 
*edit_object, Change *change, Ein
 Eina_Bool
 editor_program_transition_from_current_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merge,
                                            const char *program, Eina_Bool 
new_val);
+Eina_Bool
+editor_program_action_set(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                          const char *program, Edje_Action_Type new_val);
 
 #endif /* EDITOR_H */
diff --git a/src/bin/editor/editor_program.c b/src/bin/editor/editor_program.c
index c5c3ea8..f982e6b 100644
--- a/src/bin/editor/editor_program.c
+++ b/src/bin/editor/editor_program.c
@@ -117,3 +117,35 @@ editor_program_transition_from_current_set(Evas_Object 
*edit_object, Change *cha
    if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute);
    return true;
 }
+
+Eina_Bool
+editor_program_action_set(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                          const char *program, Edje_Action_Type new_val)
+{
+   Diff *diff;
+   Attribute attribute = ATTRIBUTE_PROGRAM_ACTION;
+   assert(edit_object != NULL);
+   assert(program != NULL);
+   if (change)
+     {
+        Edje_Action_Type old_value = edje_edit_program_action_get(edit_object, 
program);
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_EDJEACTIONTYPE;
+        diff->redo.function = editor_program_action_set;
+        diff->redo.args.type_seat.s1 = eina_stringshare_add(program);
+        diff->redo.args.type_seat.eat2 = new_val;
+        diff->undo.type = FUNCTION_TYPE_STRING_EDJEACTIONTYPE;
+        diff->undo.function = editor_program_action_set;
+        diff->undo.args.type_seat.s1 = eina_stringshare_add(program);
+        diff->undo.args.type_seat.eat2 = old_value;
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (!edje_edit_program_action_set(edit_object, program, new_val))
+     return false;
+   _editor_project_changed();
+   if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute);
+   return true;
+}
diff --git a/src/bin/ui/property_group.c b/src/bin/ui/property_group.c
index c57174b..6d9359d 100644
--- a/src/bin/ui/property_group.c
+++ b/src/bin/ui/property_group.c
@@ -885,6 +885,7 @@ _on_editor_attribute_changed(void *data,
          break;
       case ATTRIBUTE_PROGRAM_TRANSITION_TYPE:
       case ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT:
+      case ATTRIBUTE_PROGRAM_ACTION:
          TODO("implement");
          break;
          /* Don't add 'default:'. Compiler must warn about missing cases */

-- 


Reply via email to