rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=6e9dfdccb3c1944ef762af1ad56f3da72b391f4b
commit 6e9dfdccb3c1944ef762af1ad56f3da72b391f4b Author: Andrii Kroitor <an.kroi...@samsung.com> Date: Fri Oct 30 13:33:16 2015 +0200 editor: add resetters for state string functions --- src/bin/editor/default.c | 38 ++++++++++++++++++++++++++++++++++++++ src/bin/editor/default.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/src/bin/editor/default.c b/src/bin/editor/default.c index 097ab54..d714753 100644 --- a/src/bin/editor/default.c +++ b/src/bin/editor/default.c @@ -126,3 +126,41 @@ EDITOR_STATE_BOOL_RESET(fill_smooth, true, true) EDITOR_STATE_BOOL_RESET(visible, true, true) EDITOR_STATE_BOOL_RESET(container_min_h, false, false) EDITOR_STATE_BOOL_RESET(container_min_v, false, false) + +#define EDITOR_NULL_STRING_DEFAULT_CHECK(FUNC, PROTO_ARGS, ARGS) \ +Eina_Bool \ +editor_##FUNC##_default_is(Evas_Object *edit_object, PROTO_ARGS) \ +{ \ + Eina_Bool res; \ + assert(edit_object != NULL); \ + Eina_Stringshare *val = edje_edit_##FUNC##_get(edit_object, ARGS); \ + if (val != NULL) \ + { \ + res = val == NULL; \ + eina_stringshare_del(val); \ + } \ + else \ + res = true; \ + return res; \ +} + +#define EDITOR_NULL_STRING_RESET(FUNC, PROTO_ARGS, ARGS, RESET_VAL) \ +Eina_Bool \ +editor_##FUNC##_reset(Evas_Object *edit_object, Change *change, PROTO_ARGS) \ +{ \ + assert(edit_object != NULL); \ + if (!editor_##FUNC##_default_is(edit_object, ARGS)) return true; \ + return editor_##FUNC##_set(edit_object, change, false, ARGS, RESET_VAL); \ +} + +#define EDITOR_STATE_NULL_STRING_RESET(FUNC, RESET_VAL) \ +EDITOR_NULL_STRING_DEFAULT_CHECK(state_##FUNC, EDITOR_STATE_ARGS_PROTO, EDITOR_STATE_ARGS) \ +EDITOR_NULL_STRING_RESET(state_##FUNC, EDITOR_STATE_ARGS_PROTO, EDITOR_STATE_ARGS, RESET_VAL) + +EDITOR_STATE_NULL_STRING_RESET(rel1_to_x, NULL) +EDITOR_STATE_NULL_STRING_RESET(rel1_to_y, NULL) +EDITOR_STATE_NULL_STRING_RESET(rel2_to_x, NULL) +EDITOR_STATE_NULL_STRING_RESET(rel2_to_y, NULL) +EDITOR_STATE_NULL_STRING_RESET(proxy_source, NULL) +EDITOR_STATE_NULL_STRING_RESET(color_class, NULL) +EDITOR_STATE_NULL_STRING_RESET(image, "") diff --git a/src/bin/editor/default.h b/src/bin/editor/default.h index 3067c5f..73959cb 100644 --- a/src/bin/editor/default.h +++ b/src/bin/editor/default.h @@ -171,4 +171,34 @@ Eina_Bool editor_state_container_min_v_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); Eina_Bool editor_state_container_min_v_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); + + +Eina_Bool +editor_state_rel1_to_x_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel1_to_x_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel1_to_y_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel1_to_y_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel2_to_x_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel2_to_x_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel2_to_y_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_rel2_to_y_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_proxy_source_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_proxy_source_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_color_class_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_color_class_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_image_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_state_image_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); #endif /* DEFAULT_H */ --