rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=2d5763498b749b7e4e3f48b1549e8c61a655414b
commit 2d5763498b749b7e4e3f48b1549e8c61a655414b Author: Andrii Kroitor <[email protected]> Date: Thu Oct 29 16:26:15 2015 +0200 editor: add resetters for state bool functions --- src/bin/editor/default.c | 29 +++++++++++++++++++++++++++++ src/bin/editor/default.h | 26 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/bin/editor/default.c b/src/bin/editor/default.c index e07c822..097ab54 100644 --- a/src/bin/editor/default.c +++ b/src/bin/editor/default.c @@ -97,3 +97,32 @@ EDITOR_STATE_INT_RESET(fill_size_offset_x, -1, -1) EDITOR_STATE_INT_RESET(fill_size_offset_y, -1, -1) EDITOR_STATE_INT_RESET(container_padding_x, 0, 0) EDITOR_STATE_INT_RESET(container_padding_y, 0, 0) + +#define EDITOR_BOOL_DEFAULT_CHECK(FUNC, PROTO_ARGS, ARGS, DEF_VAL) \ +Eina_Bool \ +editor_##FUNC##_default_is(Evas_Object *edit_object, PROTO_ARGS) \ +{ \ + assert(edit_object != NULL); \ + Eina_Bool val = edje_edit_##FUNC##_get(edit_object, ARGS); \ + return val == DEF_VAL; \ +} + +#define EDITOR_BOOL_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_BOOL_RESET(FUNC, DEF_VAL, RESET_VAL) \ +EDITOR_BOOL_DEFAULT_CHECK(state_##FUNC, EDITOR_STATE_ARGS_PROTO, EDITOR_STATE_ARGS, DEF_VAL) \ +EDITOR_BOOL_RESET(state_##FUNC, EDITOR_STATE_ARGS_PROTO, EDITOR_STATE_ARGS, RESET_VAL) + +EDITOR_STATE_BOOL_RESET(fixed_h, false, false) +EDITOR_STATE_BOOL_RESET(fixed_w, false, false) +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) diff --git a/src/bin/editor/default.h b/src/bin/editor/default.h index e99cc71..4f269b6 100644 --- a/src/bin/editor/default.h +++ b/src/bin/editor/default.h @@ -145,4 +145,30 @@ Eina_Bool editor_container_padding_y_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); Eina_Bool editor_container_padding_y_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); + + +Eina_Bool +editor_fixed_h_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_fixed_h_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_fixed_w_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_fixed_w_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_fill_smooth_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_fill_smooth_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_visible_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_visible_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_container_min_h_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_container_min_h_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_container_min_v_default_is(Evas_Object *edit_object, const char *part_name, const char *state_name, double state_val); +Eina_Bool +editor_container_min_v_reset(Evas_Object *edit_object, Change *change, const char *part_name, const char *state_name, double state_val); #endif /* DEFAULT_H */ --
