rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=ca86a2c45a470e5ae86950c18b776fb9b22c10d1

commit ca86a2c45a470e5ae86950c18b776fb9b22c10d1
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Thu Oct 29 14:47:41 2015 +0200

    editor: add resetters for state double functions
---
 src/bin/Makefile.am      |  1 +
 src/bin/editor/default.c | 63 +++++++++++++++++++++++++++++++++
 src/bin/editor/default.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)

diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 4e55a3d..b3d7e8c 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -19,6 +19,7 @@ libete_a_SOURCES = \
 ../../src/bin/editor/diff.c \
 ../../src/bin/editor/change.c \
 ../../src/bin/editor/new_history.c \
+../../src/bin/editor/default.c \
 ../../src/bin/editor/editor_general.c \
 ../../src/bin/editor/editor_group.c \
 ../../src/bin/editor/editor_part.c \
diff --git a/src/bin/editor/default.c b/src/bin/editor/default.c
new file mode 100644
index 0000000..677bee8
--- /dev/null
+++ b/src/bin/editor/default.c
@@ -0,0 +1,63 @@
+/*
+ * Edje Theme Editor
+ * Copyright (C) 2013-2015 Samsung Electronics.
+ *
+ * This file is part of Edje Theme Editor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; If not, see www.gnu.org/licenses/lgpl.html.
+ */
+
+#include "default.h"
+
+#define EDITOR_STATE_ARGS_PROTO const char *part_name, const char *state_name, 
double state_val
+#define EDITOR_STATE_ARGS part_name, state_name, state_val
+
+#define EDITOR_DOUBLE_DEFAULT_CHECK(FUNC, PROTO_ARGS, ARGS, DEF_VAL) \
+Eina_Bool \
+editor_##FUNC##_default_is(Evas_Object *edit_object, PROTO_ARGS) \
+{ \
+   assert(edit_object != NULL); \
+   double val = edje_edit_##FUNC##_get(edit_object, ARGS); \
+   return !(fabs(val - DEF_VAL) > DBL_EPSILON); \
+}
+
+#define EDITOR_DOUBLE_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_DOUBLE_RESET(FUNC, DEF_VAL, RESET_VAL) \
+EDITOR_DOUBLE_DEFAULT_CHECK(state_##FUNC, EDITOR_STATE_ARGS_PROTO, 
EDITOR_STATE_ARGS, DEF_VAL) \
+EDITOR_DOUBLE_RESET(state_##FUNC, EDITOR_STATE_ARGS_PROTO, EDITOR_STATE_ARGS, 
RESET_VAL)
+
+EDITOR_STATE_DOUBLE_RESET(rel1_relative_x, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(rel2_relative_x, 1.0, 1.0)
+EDITOR_STATE_DOUBLE_RESET(rel1_relative_y, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(rel2_relative_y, 1.0, 1.0)
+EDITOR_STATE_DOUBLE_RESET(align_x, 0.5, 0.5)
+EDITOR_STATE_DOUBLE_RESET(align_y, 0.5, 0.5)
+EDITOR_STATE_DOUBLE_RESET(aspect_min, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(aspect_max, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(fill_origin_relative_x, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(fill_origin_relative_y, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(fill_size_relative_x, 1.0, 1.0)
+EDITOR_STATE_DOUBLE_RESET(fill_size_relative_y, 1.0, 1.0)
+EDITOR_STATE_DOUBLE_RESET(container_align_x, 0.5, 0.5)
+EDITOR_STATE_DOUBLE_RESET(container_align_y, 0.5, 0.5)
+EDITOR_STATE_DOUBLE_RESET(minmul_h, 0.0, 0.0)
+EDITOR_STATE_DOUBLE_RESET(minmul_w, 0.0, 0.0)
+
diff --git a/src/bin/editor/default.h b/src/bin/editor/default.h
new file mode 100644
index 0000000..4acb55a
--- /dev/null
+++ b/src/bin/editor/default.h
@@ -0,0 +1,90 @@
+/*
+ * Edje Theme Editor
+ * Copyright (C) 2013-2015 Samsung Electronics.
+ *
+ * This file is part of Edje Theme Editor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; If not, see www.gnu.org/licenses/lgpl.html.
+ */
+
+#ifndef DEFAULT_H
+#define DEFAULT_H
+
+#include "eflete.h"
+#include "editor.h"
+
+Eina_Bool
+editor_rel1_relative_x_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel1_relative_x_reset(Evas_Object *edit_object, Change *change, const 
char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel1_relative_y_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel1_relative_y_reset(Evas_Object *edit_object, Change *change, const 
char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel2_relative_x_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel2_relative_x_reset(Evas_Object *edit_object, Change *change, const 
char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel2_relative_y_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_rel2_relative_y_reset(Evas_Object *edit_object, Change *change, const 
char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_align_x_default_is(Evas_Object *edit_object, const char *part_name, 
const char *state_name, double state_val);
+Eina_Bool
+editor_align_x_reset(Evas_Object *edit_object, Change *change, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_align_y_default_is(Evas_Object *edit_object, const char *part_name, 
const char *state_name, double state_val);
+Eina_Bool
+editor_align_y_reset(Evas_Object *edit_object, Change *change, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_aspect_min_default_is(Evas_Object *edit_object, const char *part_name, 
const char *state_name, double state_val);
+Eina_Bool
+editor_aspect_min_reset(Evas_Object *edit_object, Change *change, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_aspect_max_default_is(Evas_Object *edit_object, const char *part_name, 
const char *state_name, double state_val);
+Eina_Bool
+editor_aspect_max_reset(Evas_Object *edit_object, Change *change, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_origin_relative_x_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_origin_relative_x_reset(Evas_Object *edit_object, Change *change, 
const char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_origin_relative_y_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_origin_relative_y_reset(Evas_Object *edit_object, Change *change, 
const char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_size_relative_x_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_size_relative_x_reset(Evas_Object *edit_object, Change *change, 
const char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_size_relative_y_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_fill_size_relative_y_reset(Evas_Object *edit_object, Change *change, 
const char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_container_align_x_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_container_align_x_reset(Evas_Object *edit_object, Change *change, const 
char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_container_align_y_default_is(Evas_Object *edit_object, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_container_align_y_reset(Evas_Object *edit_object, Change *change, const 
char *part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_minmul_h_default_is(Evas_Object *edit_object, const char *part_name, 
const char *state_name, double state_val);
+Eina_Bool
+editor_minmul_h_reset(Evas_Object *edit_object, Change *change, const char 
*part_name, const char *state_name, double state_val);
+Eina_Bool
+editor_minmul_w_default_is(Evas_Object *edit_object, const char *part_name, 
const char *state_name, double state_val);
+Eina_Bool
+editor_minmul_w_reset(Evas_Object *edit_object, Change *change, const char 
*part_name, const char *state_name, double state_val);
+#endif /* DEFAULT_H */

-- 


Reply via email to