rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=568f7a47a070f065922ba6b48e952a2712dbeb99
commit 568f7a47a070f065922ba6b48e952a2712dbeb99 Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Mon Sep 12 16:43:49 2016 +0300 resource_manager2: update resources when PART_SOURCE param is changed --- src/bin/editor/editor.h | 1 + src/bin/editor/editor_macro.h | 8 +++++--- src/bin/resource_manager/resource_manager_react.c | 18 +++++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/bin/editor/editor.h b/src/bin/editor/editor.h index ca833cf..34f7cbc 100644 --- a/src/bin/editor/editor.h +++ b/src/bin/editor/editor.h @@ -235,6 +235,7 @@ typedef struct { Eina_Stringshare *part_name; Eina_Stringshare *item_name; Eina_Stringshare *value; + Eina_Stringshare *old_value; } Editor_Attribute_Change; diff --git a/src/bin/editor/editor_macro.h b/src/bin/editor/editor_macro.h index fb86222..cd1e6a0 100644 --- a/src/bin/editor/editor_macro.h +++ b/src/bin/editor/editor_macro.h @@ -470,13 +470,14 @@ editor_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, Diff *diff; \ Editor_Attribute_Change send; \ send.attribute = RM_ATTRIBUTE; \ - send.part_name = eina_stringshare_add(name); \ - send.value = eina_stringshare_add(new_val); \ assert(edit_object != NULL); \ assert(name != NULL); \ + Eina_Stringshare *old_value = edje_edit_## REAL_FUNC ##_get(edit_object, name); \ + send.part_name = eina_stringshare_add(name); \ + send.value = eina_stringshare_add(new_val); \ + send.old_value = eina_stringshare_add(old_value); \ if (change) \ { \ - Eina_Stringshare *old_value = edje_edit_## REAL_FUNC ##_get(edit_object, name); \ diff = mem_calloc(1, sizeof(Diff)); \ diff->redo.type = FUNCTION_TYPE_STRING_STRING; \ diff->redo.function = editor_## FUNC ##_set; \ @@ -499,6 +500,7 @@ editor_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, } \ eina_stringshare_del(send.part_name); \ eina_stringshare_del(send.value); \ + eina_stringshare_del(send.old_value); \ return true; \ } diff --git a/src/bin/resource_manager/resource_manager_react.c b/src/bin/resource_manager/resource_manager_react.c index 3248707..905b98f 100644 --- a/src/bin/resource_manager/resource_manager_react.c +++ b/src/bin/resource_manager/resource_manager_react.c @@ -66,7 +66,7 @@ _property_resource_attribute_changed(void *data __UNUSED__, } static void -_property_attribute_changed(void *data __UNUSED__, +_property_attribute_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info) { @@ -89,9 +89,12 @@ _property_attribute_changed(void *data __UNUSED__, ** > expand editor (top blocks like image, sound, etc) not supported ** *********************************************************************** ***********************************************************************/ + Resource2 *part, *source, *old_source; Editor_Attribute_Change *change = (Editor_Attribute_Change *)event_info; Attribute editor_resource = (int)change->attribute; + Project *pro = (Project *)data; + Group2 *group = _get_current_group2(pro); switch ((int)change->attribute) { @@ -223,6 +226,19 @@ _property_attribute_changed(void *data __UNUSED__, case RM_ATTRIBUTE_PART_ITEM_PADDING_BOTTOM: break; case RM_ATTRIBUTE_PART_GROUP_SOURCE: + part = resource_manager_find(group->parts, change->part_name); + + if (change->old_value) + { + old_source = resource_manager_find(pro->RM.groups, change->old_value); + _resource_usage_resource_del(part, old_source); + } + + if (change->value) + { + source = resource_manager_find(pro->RM.groups, change->value); + _resource_usage_resource_add(part, source); + } break; default: break; --