rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=1da5fb0af41e2aa8737f82757d85aba6a3b04919
commit 1da5fb0af41e2aa8737f82757d85aba6a3b04919 Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Tue Sep 13 15:14:02 2016 +0300 editor: send struct with data from changed top-level blocks to resource manager --- src/bin/editor/editor.h | 16 +++++ src/bin/editor/editor_top_level.c | 81 ++++++++++++++++++----- src/bin/resource_manager/resource_manager_react.c | 8 +-- 3 files changed, 86 insertions(+), 19 deletions(-) diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h index 1667dd5..c2e2d7f 100644 --- a/src/bin/editor/editor.h +++ b/src/bin/editor/editor.h @@ -225,6 +225,7 @@ typedef enum { RM_ATTRIBUTE_RESOURCES_COLORCLASS_COLORS, RM_ATTRIBUTE_RESOURCES_STYLE_TAG_ADDED, RM_ATTRIBUTE_RESOURCES_STYLE_TAG_DELETED, + RM_ATTRIBUTE_RESOURCES_STYLE_TAG_CHANGED, RM_ATTRIBUTE_RESOURCES_LAST } RM_Attribute_Resources; @@ -241,6 +242,21 @@ typedef struct { Eina_Stringshare *old_value; } Editor_Attribute_Change; +typedef struct { + RM_Attribute_Resources attribute; + + Eina_Stringshare *color_class_name; + Eina_Stringshare *color_class_description; + + Eina_Stringshare *style_name; + Eina_Stringshare *tag_value; + Eina_Stringshare *tag_name; + + int r, g, b, a; + int r2, g2, b2, a2; + int r3, g3, b3, a3; +} Editor_Attribute_Resource_Change; + void _editor_project_changed(); diff --git a/src/bin/editor/editor_top_level.c b/src/bin/editor/editor_top_level.c index d87833c..ff67492 100644 --- a/src/bin/editor/editor_top_level.c +++ b/src/bin/editor/editor_top_level.c @@ -96,15 +96,24 @@ editor_color_class_description_set(Evas_Object *obj, const char *name, const cha assert(obj != NULL); assert(name != NULL); - RM_Attribute_Resources attribute = RM_ATTRIBUTE_RESOURCES_COLORCLASS_DESCRIPTION; + Editor_Attribute_Resource_Change send; + send.attribute = RM_ATTRIBUTE_RESOURCES_COLORCLASS_DESCRIPTION; + send.color_class_name = eina_stringshare_add(name); + send.color_class_description = eina_stringshare_add(description); CRIT_ON_FAIL(edje_edit_color_class_description_set(obj, name, description)); if (!editor_save(obj)) - return false; /* i hope it will never happen */ + { + eina_stringshare_del(send.color_class_name); + eina_stringshare_del(send.color_class_description); + return false; /* i hope it will never happen */ + } _editor_project_changed(); if (!_editor_signals_blocked) - evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &attribute); + evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &send); + eina_stringshare_del(send.color_class_name); + eina_stringshare_del(send.color_class_description); return true; } @@ -117,7 +126,13 @@ editor_color_class_colors_set(Evas_Object *obj, const char *name, assert(obj != NULL); assert(name != NULL); - RM_Attribute_Resources attribute = RM_ATTRIBUTE_RESOURCES_COLORCLASS_COLORS; + Editor_Attribute_Resource_Change send; + send.attribute = RM_ATTRIBUTE_RESOURCES_COLORCLASS_COLORS; + send.color_class_name = eina_stringshare_add(name); + send.r = r; send.r2 = r2; send.r3 = r3; + send.g = g; send.g2 = g2; send.g3 = g3; + send.b = b; send.b2 = b2; send.b3 = b3; + send.a = a; send.a2 = a2; send.a3 = a3; CRIT_ON_FAIL(edje_edit_color_class_colors_set(obj, name, r, g, b, a, @@ -125,10 +140,14 @@ editor_color_class_colors_set(Evas_Object *obj, const char *name, r3, g3, b3, a3)); if (!editor_save(obj)) - return false; /* i hope it will never happen */ + { + eina_stringshare_del(send.color_class_name); + return false; /* i hope it will never happen */ + } _editor_project_changed(); if (!_editor_signals_blocked) - evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &attribute); + evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &send); + eina_stringshare_del(send.color_class_name); return true; } @@ -236,13 +255,22 @@ editor_style_tag_add(Evas_Object *obj, const char *name, const char *tag) assert(name != NULL); CRIT_ON_FAIL(edje_edit_style_tag_add(obj, name, tag)); - RM_Attribute_Resources attribute = RM_ATTRIBUTE_RESOURCES_STYLE_TAG_ADDED; + Editor_Attribute_Resource_Change send; + send.attribute = RM_ATTRIBUTE_RESOURCES_STYLE_TAG_ADDED; + send.tag_name = eina_stringshare_add(tag); + send.style_name = eina_stringshare_add(name); if (!editor_save(obj)) - return false; /* i hope it will never happen */ + { + eina_stringshare_del(send.style_name); + eina_stringshare_del(send.tag_name); + return false; /* i hope it will never happen */ + } _editor_project_changed(); if (!_editor_signals_blocked) - evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &attribute); + evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &send); + eina_stringshare_del(send.style_name); + eina_stringshare_del(send.tag_name); return true; } @@ -253,13 +281,23 @@ editor_style_tag_del(Evas_Object *obj, const char *name, const char *tag) assert(name != NULL); CRIT_ON_FAIL(edje_edit_style_tag_del(obj, name, tag)); - RM_Attribute_Resources attribute = RM_ATTRIBUTE_RESOURCES_STYLE_TAG_DELETED; + Editor_Attribute_Resource_Change send; + send.attribute = RM_ATTRIBUTE_RESOURCES_STYLE_TAG_DELETED; + send.tag_name = eina_stringshare_add(tag); + send.style_name = eina_stringshare_add(name); if (!editor_save(obj)) - return false; /* i hope it will never happen */ + { + eina_stringshare_del(send.style_name); + eina_stringshare_del(send.tag_name); + return false; /* i hope it will never happen */ + } _editor_project_changed(); if (!_editor_signals_blocked) - evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &attribute); + evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_RESOURCE_ATTRIBUTE_CHANGED, &send); + + eina_stringshare_del(send.style_name); + eina_stringshare_del(send.tag_name); return true; } @@ -270,13 +308,26 @@ editor_style_tag_value_set(Evas_Object *obj, const char *name, const char *tag, assert(name != NULL); CRIT_ON_FAIL(edje_edit_style_tag_value_set(obj, name, tag, value)); - RM_Attribute_Resources attribute = RM_ATTRIBUTE_RESOURCES_STYLE_TAG_DELETED; + + Editor_Attribute_Resource_Change send; + send.attribute = RM_ATTRIBUTE_RESOURCES_STYLE_TAG_CHANGED; + send.style_name = eina_stringshare_add(name); + send.tag_name = eina_stringshare_add(tag); + send.tag_value = eina_stringshare_add(value); if (!editor_save(obj)) - return false; /* i hope it will never happen */ + { + eina_stringshare_del(send.tag_value); + eina_stringshare_del(send.tag_name); + eina_stringshare_del(send.style_name); + return false; /* i hope it will never happen */ + } _editor_project_changed(); if (!_editor_signals_blocked) - evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_ATTRIBUTE_CHANGED, &attribute); + evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_RM_ATTRIBUTE_CHANGED, &send); + eina_stringshare_del(send.tag_value); + eina_stringshare_del(send.tag_name); + eina_stringshare_del(send.style_name); return true; } diff --git a/src/bin/resource_manager/resource_manager_react.c b/src/bin/resource_manager/resource_manager_react.c index 28c4784..e1595fd 100644 --- a/src/bin/resource_manager/resource_manager_react.c +++ b/src/bin/resource_manager/resource_manager_react.c @@ -51,15 +51,15 @@ _property_resource_attribute_changed(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) { - Attribute *attr = event_info; - Attribute_Resource editor_resource = (int)*attr; - printf("Some resource attribute was changed [%d][%d] \n", (int)*attr, editor_resource); - switch ((int)*attr) + Editor_Attribute_Resource_Change *change = event_info; + RM_Attribute_Resources editor_resource = change->attribute; + switch (editor_resource) { case RM_ATTRIBUTE_RESOURCES_COLORCLASS_DESCRIPTION: case RM_ATTRIBUTE_RESOURCES_COLORCLASS_COLORS: case RM_ATTRIBUTE_RESOURCES_STYLE_TAG_ADDED: case RM_ATTRIBUTE_RESOURCES_STYLE_TAG_DELETED: + case RM_ATTRIBUTE_RESOURCES_STYLE_TAG_CHANGED: default: break; } --