rimmed pushed a commit to branch master.

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

commit e5e2122a06c61e095076a333b518e866a96f5426
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Mon Jan 11 14:20:06 2016 +0200

    editor: add program targets API
---
 src/bin/editor/editor.h         |  7 +++++
 src/bin/editor/editor_program.c | 65 +++++++++++++++++++++++++++++++++++++++++
 src/bin/ui/property_group.c     |  1 +
 3 files changed, 73 insertions(+)

diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index 4343594..abe10ba 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -171,6 +171,7 @@ typedef enum {
    ATTRIBUTE_PROGRAM_STATE,
    ATTRIBUTE_PROGRAM_STATE2,
    ATTRIBUTE_PROGRAM_NAME,
+   ATTRIBUTE_PROGRAM_TARGET,
 } Attribute;
 
 void
@@ -704,5 +705,11 @@ editor_program_state2_set(Evas_Object *edit_object, Change 
*change, Eina_Bool me
 Eina_Bool
 editor_program_name_set(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
                         const char *name, const char *new_val);
+Eina_Bool
+editor_program_target_add(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                          const char *program_name, Eina_Stringshare *target);
+Eina_Bool
+editor_program_target_del(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                          const char *program_name, Eina_Stringshare *target);
 
 #endif /* EDITOR_H */
diff --git a/src/bin/editor/editor_program.c b/src/bin/editor/editor_program.c
index 3a51f0b..f5f45c0 100644
--- a/src/bin/editor/editor_program.c
+++ b/src/bin/editor/editor_program.c
@@ -240,3 +240,68 @@ editor_program_name_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merg
    if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, 
SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute);
    return true;
 }
+
+Eina_Bool
+editor_program_target_add(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                          const char *program_name, Eina_Stringshare *target)
+{
+   Diff *diff;
+   Attribute attribute = ATTRIBUTE_PROGRAM_TARGET;
+   assert(edit_object != NULL);
+   assert(program_name != NULL);
+   assert(target != NULL);
+   if (change)
+     {
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->redo.function = editor_program_target_add;
+        diff->redo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->redo.args.type_ss.s2 = eina_stringshare_add(target);
+        diff->undo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->undo.function = editor_program_target_del;
+        diff->undo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->undo.args.type_ss.s2 = eina_stringshare_add(target);
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (!edje_edit_program_target_add(edit_object, program_name, target))
+     return false;
+   _editor_project_changed();
+   if (!_editor_signals_blocked)
+     evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, 
&attribute);
+   return true;
+}
+
+Eina_Bool
+editor_program_target_del(Evas_Object *edit_object, Change *change, Eina_Bool 
merge,
+                          const char *program_name, Eina_Stringshare *target)
+{
+   Diff *diff;
+   Attribute attribute = ATTRIBUTE_PROGRAM_TARGET;
+   assert(edit_object != NULL);
+   assert(program_name != NULL);
+   if (change)
+     {
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->redo.function = editor_program_target_del;
+        diff->redo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->redo.args.type_ss.s2 = eina_stringshare_add(target);
+        diff->undo.type = FUNCTION_TYPE_STRING_STRING;
+        diff->undo.function = editor_program_target_add;
+        diff->undo.args.type_ss.s1 = eina_stringshare_add(program_name);
+        diff->undo.args.type_ss.s2 = eina_stringshare_add(target);
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (!edje_edit_program_target_del(edit_object, program_name, target))
+     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 4d6514a..a0e9208 100644
--- a/src/bin/ui/property_group.c
+++ b/src/bin/ui/property_group.c
@@ -909,6 +909,7 @@ _on_editor_attribute_changed(void *data,
       case ATTRIBUTE_PROGRAM_STATE:
       case ATTRIBUTE_PROGRAM_STATE2:
       case ATTRIBUTE_PROGRAM_NAME:
+      case ATTRIBUTE_PROGRAM_TARGET:
          TODO("implement");
          break;
          /* Don't add 'default:'. Compiler must warn about missing cases */

-- 


Reply via email to