rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=58649dc842b9f74b7004e63ff7a3a23a00f3c5a0
commit 58649dc842b9f74b7004e63ff7a3a23a00f3c5a0 Author: Vyacheslav Reutskiy <[email protected]> Date: Thu Dec 3 14:42:45 2015 +0200 editor: do save after changes align or padding for container Need to do the save for editing object, because edje edit not recalculate the box and table after change attributes align or padding. Change-Id: Ia9159e79e5bddb034ad1515ef1cc7076c0299830 --- src/bin/editor/editor_macro.h | 79 ++++++++++++++++++++++++++++++++++++++++++ src/bin/editor/editor_states.c | 9 +++-- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/src/bin/editor/editor_macro.h b/src/bin/editor/editor_macro.h index 805a963..8f1e012 100644 --- a/src/bin/editor/editor_macro.h +++ b/src/bin/editor/editor_macro.h @@ -510,3 +510,82 @@ editor_state_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute); \ return true; \ } + +TODO("delete macro _SAVE after fix issue in the edje_edit") +#define EDITOR_STATE_INT_SAVE(FUNC, ATTRIBUTE) \ +Eina_Bool \ +editor_state_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, \ + const char *part_name, const char *state_name, double state_val, int new_val) \ +{ \ + Diff *diff; \ + Attribute attribute = ATTRIBUTE; \ + assert(edit_object != NULL); \ + assert(part_name != NULL); \ + assert(state_name != NULL); \ + if (change) \ + { \ + int old_value = edje_edit_state_## FUNC ##_get(edit_object, part_name, state_name, state_val); \ + diff = mem_calloc(1, sizeof(Diff)); \ + diff->redo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_INT; \ + diff->redo.function = editor_state_## FUNC ##_set; \ + diff->redo.args.type_ssdi.s1 = eina_stringshare_add(part_name); \ + diff->redo.args.type_ssdi.s2 = eina_stringshare_add(state_name); \ + diff->redo.args.type_ssdi.d3 = state_val; \ + diff->redo.args.type_ssdi.i4 = new_val; \ + diff->undo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_INT; \ + diff->undo.function = editor_state_## FUNC ##_set; \ + diff->undo.args.type_ssdi.s1 = eina_stringshare_add(part_name); \ + diff->undo.args.type_ssdi.s2 = eina_stringshare_add(state_name); \ + diff->undo.args.type_ssdi.d3 = state_val; \ + diff->undo.args.type_ssdi.i4 = old_value; \ + if (merge) \ + change_diff_merge_add(change, diff); \ + else \ + change_diff_add(change, diff); \ + } \ + if (!edje_edit_state_## FUNC ##_set(edit_object, part_name, state_name, state_val, new_val)) \ + return false; \ + editor_save(edit_object); \ + _editor_project_changed(); \ + if (!_editor_signals_blocked) evas_object_smart_callback_call(ap.win, SIGNAL_EDITOR_ATTRIBUTE_CHANGED, &attribute); \ + return true; \ +} + +#define EDITOR_STATE_DOUBLE_SAVE(FUNC, ATTRIBUTE) \ +Eina_Bool \ +editor_state_## FUNC ##_set(Evas_Object *edit_object, Change *change, Eina_Bool merge, \ + const char *part_name, const char *state_name, double state_val, double new_val) \ +{ \ + Diff *diff; \ + Attribute attribute = ATTRIBUTE; \ + assert(edit_object != NULL); \ + assert(part_name != NULL); \ + assert(state_name != NULL); \ + if (change) \ + { \ + double old_value = edje_edit_state_## FUNC ##_get(edit_object, part_name, state_name, state_val); \ + diff = mem_calloc(1, sizeof(Diff)); \ + diff->redo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_DOUBLE; \ + diff->redo.function = editor_state_## FUNC ##_set; \ + diff->redo.args.type_ssdd.s1 = eina_stringshare_add(part_name); \ + diff->redo.args.type_ssdd.s2 = eina_stringshare_add(state_name); \ + diff->redo.args.type_ssdd.d3 = state_val; \ + diff->redo.args.type_ssdd.d4 = new_val; \ + diff->undo.type = FUNCTION_TYPE_STRING_STRING_DOUBLE_DOUBLE; \ + diff->undo.function = editor_state_## FUNC ##_set; \ + diff->undo.args.type_ssdd.s1 = eina_stringshare_add(part_name); \ + diff->undo.args.type_ssdd.s2 = eina_stringshare_add(state_name); \ + diff->undo.args.type_ssdd.d3 = state_val; \ + diff->undo.args.type_ssdd.d4 = old_value; \ + if (merge) \ + change_diff_merge_add(change, diff); \ + else \ + change_diff_add(change, diff); \ + } \ + if (!edje_edit_state_## FUNC ##_set(edit_object, part_name, state_name, state_val, new_val)) \ + return false; \ + editor_save(edit_object); \ + _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/editor/editor_states.c b/src/bin/editor/editor_states.c index 08f1504..0d36ee1 100644 --- a/src/bin/editor/editor_states.c +++ b/src/bin/editor/editor_states.c @@ -47,8 +47,8 @@ EDITOR_STATE_DOUBLE(fill_size_relative_y, ATTRIBUTE_STATE_FILL_SIZE_RELATIVE_Y) EDITOR_STATE_INT(fill_size_offset_x, ATTRIBUTE_STATE_FILL_SIZE_OFFSET_X) EDITOR_STATE_INT(fill_size_offset_y, ATTRIBUTE_STATE_FILL_SIZE_OFFSET_Y) -EDITOR_STATE_DOUBLE(container_align_x, ATTRIBUTE_STATE_CONTAINER_ALIGN_X) -EDITOR_STATE_DOUBLE(container_align_y, ATTRIBUTE_STATE_CONTAINER_ALIGN_Y) +EDITOR_STATE_DOUBLE_SAVE(container_align_x, ATTRIBUTE_STATE_CONTAINER_ALIGN_X) +EDITOR_STATE_DOUBLE_SAVE(container_align_y, ATTRIBUTE_STATE_CONTAINER_ALIGN_Y) EDITOR_STATE_DOUBLE(minmul_h, ATTRIBUTE_STATE_MINMUL_H) EDITOR_STATE_DOUBLE(minmul_w, ATTRIBUTE_STATE_MINMUL_W) @@ -183,9 +183,8 @@ EDITOR_STATE_UCHAR(fill_type, ATTRIBUTE_STATE_FILL_TYPE) EDITOR_STATE_UCHAR(aspect_pref, ATTRIBUTE_STATE_ASPECT_PREF) EDITOR_STATE_UCHAR(table_homogeneous, ATTRIBUTE_STATE_TABLE_HOMOGENEOUS) - -EDITOR_STATE_INT(container_padding_x, ATTRIBUTE_STATE_CONTAINER_PADING_X) -EDITOR_STATE_INT(container_padding_y, ATTRIBUTE_STATE_CONTAINER_PADING_Y) +EDITOR_STATE_INT_SAVE(container_padding_x, ATTRIBUTE_STATE_CONTAINER_PADING_X) +EDITOR_STATE_INT_SAVE(container_padding_y, ATTRIBUTE_STATE_CONTAINER_PADING_Y) Eina_Bool editor_state_reset(Evas_Object *edit_object, Change *change, Eina_Bool merge __UNUSED__, --
