rimmed pushed a commit to branch master.

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

commit 08a226451307c93e833aaece47824754a59369ca
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Tue Jan 5 17:35:53 2016 +0200

    editor: add program transition methods
---
 src/bin/Makefile.am             |   1 +
 src/bin/editor/editor.h         |  17 ++++++
 src/bin/editor/editor_program.c | 119 ++++++++++++++++++++++++++++++++++++++++
 src/bin/ui/property_group.c     |   4 ++
 4 files changed, 141 insertions(+)

diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 86e4941..a32a123 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -24,6 +24,7 @@ libete_a_SOURCES = \
 ../../src/bin/editor/editor_part.c \
 ../../src/bin/editor/editor_states.c \
 ../../src/bin/editor/editor_text.c \
+../../src/bin/editor/editor_program.c \
 ../../src/bin/ui/history_ui.c \
 ../../src/bin/ui/group_navigator.c \
 ../../src/bin/ui/demo_group.c \
diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h
index a1a160c..b3002d5 100644
--- a/src/bin/editor/editor.h
+++ b/src/bin/editor/editor.h
@@ -145,6 +145,8 @@ typedef enum {
    ATTRIBUTE_PART_POINTER_MODE,
    ATTRIBUTE_PART_CURSOR_MODE,
    ATTRIBUTE_STATE_FILL_TYPE,
+   ATTRIBUTE_PROGRAM_TRANSITION_TYPE,
+   ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT
 } Attribute;
 
 void
@@ -592,4 +594,19 @@ Eina_Bool
 editor_part_effect_set(Evas_Object *obj, Change *change, Eina_Bool merge, 
const char *part_name,
       Edje_Text_Effect new_val);
 
+/* programs */
+Edje_Tween_Mode
+editor_program_transition_type_get(Evas_Object *edit_object, const char 
*program);
+#define edje_edit_program_transition_type_get 
editor_program_transition_type_get
+Eina_Bool
+editor_program_transition_from_current_get(Evas_Object *edit_object, const 
char *program);
+#define edje_edit_program_transition_from_current_get 
editor_program_transition_from_current_get
+
+Eina_Bool
+editor_program_transition_type_set(Evas_Object *edit_object, Change *change, 
Eina_Bool merge,
+                                   const char *program, Edje_Tween_Mode 
new_val);
+Eina_Bool
+editor_program_transition_from_current_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merge,
+                                           const char *program, Eina_Bool 
new_val);
+
 #endif /* EDITOR_H */
diff --git a/src/bin/editor/editor_program.c b/src/bin/editor/editor_program.c
new file mode 100644
index 0000000..c5c3ea8
--- /dev/null
+++ b/src/bin/editor/editor_program.c
@@ -0,0 +1,119 @@
+/*
+ * Edje Theme Editor
+ * Copyright (C) 2013-2016 Samsung Electronics.
+ *
+ * This file is part of Edje Theme Editor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; If not, see www.gnu.org/licenses/lgpl.html.
+ */
+
+#define ALLOW_DIRECT_EDJE_EDIT_CALLS
+#include "editor.h"
+#include "editor_macro.h"
+#include "change.h"
+#include "diff.h"
+
+extern int _editor_signals_blocked;
+
+Edje_Tween_Mode
+editor_program_transition_type_get(Evas_Object *edit_object, const char 
*program)
+{
+   assert(edit_object != NULL);
+   assert(program != NULL);
+
+   return edje_edit_program_transition_get(edit_object, program) & 
EDJE_TWEEN_MODE_MASK;
+}
+
+Eina_Bool
+editor_program_transition_from_current_get(Evas_Object *edit_object, const 
char *program)
+{
+   assert(edit_object != NULL);
+   assert(program != NULL);
+
+   return edje_edit_program_transition_get(edit_object, program) & 
EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
+}
+
+Eina_Bool
+editor_program_transition_type_set(Evas_Object *edit_object, Change *change, 
Eina_Bool merge,
+                                   const char *program, Edje_Tween_Mode 
new_val)
+{
+   Diff *diff;
+   Attribute attribute = ATTRIBUTE_PROGRAM_TRANSITION_TYPE;
+
+   assert(edit_object != NULL);
+   assert(program != NULL);
+   assert(new_val < EDJE_TWEEN_MODE_LAST);
+
+   if (change)
+     {
+        Edje_Tween_Mode old_value = 
editor_program_transition_type_get(edit_object, program);
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_EDJETWEENMODE;
+        diff->redo.function = editor_program_transition_type_set;
+        diff->redo.args.type_setm.s1 = eina_stringshare_add(program);
+        diff->redo.args.type_setm.etm2 = new_val;
+        diff->undo.type = FUNCTION_TYPE_STRING_EDJETWEENMODE;
+        diff->undo.function = editor_program_transition_type_set;
+        diff->undo.args.type_setm.s1 = eina_stringshare_add(program);
+        diff->undo.args.type_setm.etm2 = old_value;
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   if (editor_program_transition_from_current_get(edit_object, program))
+      new_val = new_val | EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
+   if (!edje_edit_program_transition_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;
+}
+
+Eina_Bool
+editor_program_transition_from_current_set(Evas_Object *edit_object, Change 
*change, Eina_Bool merge,
+                                           const char *program, Eina_Bool 
new_val)
+{
+   Diff *diff;
+   Edje_Tween_Mode mode;
+   Attribute attribute = ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT;
+
+   assert(edit_object != NULL);
+   assert(program != NULL);
+
+   if (change)
+     {
+        Eina_Bool old_value = 
editor_program_transition_from_current_get(edit_object, program);
+        diff = mem_calloc(1, sizeof(Diff));
+        diff->redo.type = FUNCTION_TYPE_STRING_BOOL;
+        diff->redo.function = editor_program_transition_from_current_set;
+        diff->redo.args.type_sb.s1 = eina_stringshare_add(program);
+        diff->redo.args.type_sb.b2 = new_val;
+        diff->undo.type = FUNCTION_TYPE_STRING_BOOL;
+        diff->undo.function = editor_program_transition_from_current_set;
+        diff->undo.args.type_sb.s1 = eina_stringshare_add(program);
+        diff->undo.args.type_sb.b2 = old_value;
+        if (merge)
+          change_diff_merge_add(change, diff);
+        else
+          change_diff_add(change, diff);
+     }
+   mode = editor_program_transition_type_get(edit_object, program);
+   if (new_val)
+     mode = mode | EDJE_TWEEN_MODE_OPT_FROM_CURRENT;
+   if (!edje_edit_program_transition_set(edit_object, program, mode))
+     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 6ebb3cf..c57174b 100644
--- a/src/bin/ui/property_group.c
+++ b/src/bin/ui/property_group.c
@@ -883,6 +883,10 @@ _on_editor_attribute_changed(void *data,
       case ATTRIBUTE_STATE_IMAGE_TWEEN:
          prop_item_state_image_tween_update(pd->attributes.state_image.tween, 
pd);
          break;
+      case ATTRIBUTE_PROGRAM_TRANSITION_TYPE:
+      case ATTRIBUTE_PROGRAM_TRANSITION_FROM_CURRENT:
+         TODO("implement");
+         break;
          /* Don't add 'default:'. Compiler must warn about missing cases */
      }
 }

-- 


Reply via email to