rimmed pushed a commit to branch master.

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

commit 44fdc9172ecd85d6f7d45eb7f3e1e310a3aa59f6
Author: Mykola Solyanko <m.solya...@samsung.com>
Date:   Tue Nov 17 10:34:36 2015 +0200

    property: add style property UI
---
 src/bin/Makefile.am           |   1 +
 src/bin/common/signals.h      |   9 ++
 src/bin/ui/property.c         |  46 ++++++-
 src/bin/ui/property_private.h |   3 +
 src/bin/ui/property_style.c   | 277 ++++++++++++++++++++++++++++++++++++++++++
 src/bin/ui/tabs.c             |   2 +-
 6 files changed, 331 insertions(+), 7 deletions(-)

diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 934fe95..d4d40f8 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -65,6 +65,7 @@ libete_a_SOURCES = \
 ../../src/bin/ui/property_group.c \
 ../../src/bin/ui/property_image.c \
 ../../src/bin/ui/property_sound.c \
+../../src/bin/ui/property_style.c \
 ../../src/bin/ui/blocks/ui_widget_list.c \
 ../../src/bin/ui/blocks/ui_signal_list.c \
 ../../src/bin/ui/blocks/ui_states_list.c \
diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index 8ea23fe..9f93b7b 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -244,4 +244,13 @@ typedef struct {
  */
 #define SIGNAL_SOUND_SELECTED "SIGNAL_SOUND_SELECTED"
 
+ /**
+ * emited when style editor tab is clicked.
+ * eventinfo - NULL
+ *
+ * @ingroup Window
+ */
+#define SIGNAL_STYLE_EDITOR_TAB_CLICKED "SIGNAL_STYLE_EDITOR_TAB_CLICKED"
+
+
 #endif /* SIGNALS_H*/
diff --git a/src/bin/ui/property.c b/src/bin/ui/property.c
index 26a8dd6..87b579f 100644
--- a/src/bin/ui/property.c
+++ b/src/bin/ui/property.c
@@ -78,7 +78,8 @@ _on_frame_click(void *data,
 enum _Property_Type {
    PROPERTY,
    IMAGE_PROPERTY,
-   SOUND_PROPERTY
+   SOUND_PROPERTY,
+   STYLE_PROPERTY
 };
 typedef enum _Property_Type Property_Type;
 
@@ -87,6 +88,7 @@ struct _Prop_Data
    Evas_Object *group_property;
    Evas_Object *image_property;
    Evas_Object *sound_property;
+   Evas_Object *style_property;
    Evas_Object *colorclass_property;
    Evas_Object *layout;
 
@@ -110,6 +112,7 @@ _on_different_clicked(void *data,
    evas_object_hide(pd->group_property);
    evas_object_hide(pd->image_property);
    evas_object_hide(pd->sound_property);
+   evas_object_hide(pd->style_property);
 
    pd->type = PROPERTY;
 }
@@ -128,8 +131,9 @@ _on_image_editor_clicked(void *data,
    elm_object_content_unset(pd->layout);
    elm_object_content_set(pd->layout, pd->image_property);
    evas_object_hide(pd->group_property);
-   evas_object_show(pd->image_property);
    evas_object_hide(pd->sound_property);
+   evas_object_hide(pd->style_property);
+   evas_object_show(pd->image_property);
 
    pd->type = IMAGE_PROPERTY;
 }
@@ -149,12 +153,34 @@ _on_sound_editor_clicked(void *data,
    elm_object_content_set(pd->layout, pd->sound_property);
    evas_object_hide(pd->group_property);
    evas_object_hide(pd->image_property);
+   evas_object_hide(pd->style_property);
    evas_object_show(pd->sound_property);
 
    pd->type = SOUND_PROPERTY;
 }
 
 static void
+_on_style_editor_clicked(void *data,
+                         Evas_Object *obj __UNUSED__,
+                         void *event_info __UNUSED__)
+{
+   Evas_Object *property = data;
+   PROP_DATA_GET()
+
+   assert(pd != NULL);
+
+   ui_property_group_unset(pd->group_property);
+   elm_object_content_unset(pd->layout);
+   elm_object_content_set(pd->layout, pd->style_property);
+   evas_object_hide(pd->group_property);
+   evas_object_hide(pd->image_property);
+   evas_object_hide(pd->sound_property);
+   evas_object_show(pd->style_property);
+
+   pd->type = STYLE_PROPERTY;
+}
+
+static void
 _on_tab_changed(void *data,
                 Evas_Object *obj __UNUSED__,
                 void *event_info)
@@ -168,18 +194,25 @@ _on_tab_changed(void *data,
    if (!group)
      {
         if (pd->type == PROPERTY)
-          ui_property_group_unset(pd->group_property);
+          {
+            elm_object_content_unset(pd->layout);
+            ui_property_group_unset(pd->group_property);
+          }
         return;
      }
    /* it has group here, and group's tab was clicked,
-      but if previous tab was image_property or sound_property tab,
+      but if previous tab was image_property, sound_property, style_property 
tab,
       we need to remove it from there and set group property in there */
-   if ((pd->type == IMAGE_PROPERTY) || (pd->type == SOUND_PROPERTY))
+   if (pd->type == IMAGE_PROPERTY ||
+       pd->type == STYLE_PROPERTY ||
+       pd->type == SOUND_PROPERTY ||
+       pd->type == PROPERTY)
      {
         elm_object_content_unset(pd->layout);
         elm_object_content_set(pd->layout, pd->group_property);
         evas_object_hide(pd->image_property);
         evas_object_hide(pd->sound_property);
+        evas_object_hide(pd->style_property);
      }
    ui_property_group_set(pd->group_property, group);
 
@@ -207,11 +240,12 @@ ui_property_add(Evas_Object *parent)
 
    pd->image_property = ui_property_image_add(pd->layout);
    pd->sound_property = ui_property_sound_add(pd->layout);
-
+   pd->style_property = ui_property_style_add(pd->layout);
    /* register global callbacks */
    evas_object_smart_callback_add(ap.win, SIGNAL_TAB_CHANGED, _on_tab_changed, 
pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_IMAGE_EDITOR_TAB_CLICKED, 
_on_image_editor_clicked, pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_SOUND_EDITOR_TAB_CLICKED, 
_on_sound_editor_clicked, pd->layout);
+   evas_object_smart_callback_add(ap.win, SIGNAL_STYLE_EDITOR_TAB_CLICKED, 
_on_style_editor_clicked, pd->layout);
    evas_object_smart_callback_add(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, 
_on_different_clicked, pd->layout);
 
    return pd->layout;
diff --git a/src/bin/ui/property_private.h b/src/bin/ui/property_private.h
index 5ada7f3..f43543e 100644
--- a/src/bin/ui/property_private.h
+++ b/src/bin/ui/property_private.h
@@ -61,4 +61,7 @@ _on_frame_click(void *data,
 Evas_Object *
 ui_property_sound_add(Evas_Object *parent);
 
+Evas_Object *
+ui_property_style_add(Evas_Object *parent);
+
 #endif /* UI_PROPERTY_1_H */
diff --git a/src/bin/ui/property_style.c b/src/bin/ui/property_style.c
new file mode 100644
index 0000000..267f846
--- /dev/null
+++ b/src/bin/ui/property_style.c
@@ -0,0 +1,277 @@
+/*
+ * Edje Theme Editor
+ * Copyright (C) 2013-2014 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 "property_private.h"
+#include "property_macros.h"
+
+struct _Style_Prop_Data
+{
+   Evas_Object *box;
+   Evas_Object *font_name;
+   Evas_Object *font_style;
+   Evas_Object *font_color;
+   Evas_Object *font_weight;
+   Evas_Object *font_size;
+   Evas_Object *hor_align;
+   Evas_Object *vert_align;
+   Evas_Object *left_margin;
+   Evas_Object *right_margin;
+   Evas_Object *tab_stops;
+   Evas_Object *line_size;
+   Evas_Object *relative_size;
+   Evas_Object *replace_ellisis;
+   Evas_Object *check_psw;
+   Evas_Object *check_color;
+   Evas_Object *bg_color;
+   Evas_Object *style;
+   Evas_Object *outer_gl_color;
+   Evas_Object *inner_gl_color;
+   Evas_Object *check_s_color;
+   Evas_Object *s_color;
+   Evas_Object *check_unline;
+   Evas_Object *outer_color_singl;
+   Evas_Object *outer_color_double;
+};
+typedef struct _Style_Prop_Data Style_Prop_Data;
+
+#define ADD_1SWALLOW_ITEM(TEXT, BOX, OBJECT, ITEM, TYPE_OBJECT) \
+{ \
+   PROPERTY_ITEM_ADD(BOX, TEXT, "1swallow"); \
+   TYPE_OBJECT##_ADD(BOX, OBJECT); \
+   elm_layout_content_set(ITEM, "elm.swallow.content", OBJECT); \
+   elm_box_pack_end(BOX, ITEM); \
+}
+
+#define ADD_COLOR_ELEMENT(OBJECT, ITEM, LAYOUT) \
+   OBJECT = elm_layout_add(ITEM); \
+   elm_layout_theme_set(OBJECT, "layout", "property", "color"); \
+   evas_object_size_hint_weight_set(OBJECT,  EVAS_HINT_EXPAND, 
EVAS_HINT_EXPAND); \
+   evas_object_size_hint_align_set(OBJECT, EVAS_HINT_FILL, EVAS_HINT_FILL); \
+   LAYOUT = elm_layout_add(ITEM); \
+   elm_layout_theme_set(LAYOUT, "image", "color", "color_set"); \
+   elm_layout_content_set(OBJECT, NULL, LAYOUT);
+
+static void
+_prop_text_color_add(const char *text, Evas_Object *box, Evas_Object *object)
+{
+   Evas_Object *layout;
+   PROPERTY_ITEM_ADD(box, text, "1swallow_subtext")
+   ADD_COLOR_ELEMENT(object, item, layout)
+   elm_layout_content_set(item, NULL, object);
+   elm_box_pack_end(box, item);
+}
+
+static void
+_prop_text_2color_add(const char *text,
+                      Evas_Object *box,
+                      Evas_Object *object_left,
+                      Evas_Object *object_right)
+{
+   Evas_Object *layout;
+   PROPERTY_ITEM_ADD(box, text, "2swallow")
+
+   ADD_COLOR_ELEMENT(object_left, item, layout)
+   elm_layout_content_set(item, NULL, object_left);
+   ADD_COLOR_ELEMENT(object_right, item, layout)
+   elm_layout_content_set(item, NULL, object_right);
+
+   elm_layout_content_set(item, "swallow.content1", object_left);
+   elm_layout_content_set(item, "swallow.content2", object_right);
+
+   elm_box_pack_end(box, item);
+}
+
+static void
+_prop_spin_add(const char *text,
+               const char *LS,
+               const char *RS,
+               Evas_Object *box,
+               Evas_Object *object)
+{
+   PROPERTY_ITEM_ADD(box, text, "2swallow")
+   SPINNER_ADD(item, object, 0, 0, 0, true)
+
+   elm_layout_content_set(item, "swallow.content1", object);
+   elm_layout_text_set(item, "label.swallow1.start", LS);
+   elm_layout_text_set(item, "label.swallow1.end", RS);
+
+   elm_box_pack_end(box, item);
+}
+
+static void
+_add_1check_color_item(const char *text,
+                       Evas_Object *box,
+                       Evas_Object *object_left,
+                       Evas_Object *object_right)
+{
+   Evas_Object *layout;
+   PROPERTY_ITEM_ADD(box, text, "2swallow")
+   CHECK_ADD(item, object_left)
+
+   ADD_COLOR_ELEMENT(object_right, item, layout)
+
+   elm_layout_content_set(item, "swallow.content1", object_left);
+   elm_layout_content_set(item, "swallow.content2", object_right);
+
+   elm_box_pack_end(box, item);
+}
+
+static void
+_add_1check_2button_item(const char *text,
+                         Evas_Object *box,
+                         Evas_Object *object_left)
+{
+   Evas_Object *segment_ctrl;
+
+   PROPERTY_ITEM_ADD(box, text, "2swallow")
+   CHECK_ADD(item, object_left)
+
+   SEGMENT_CONTROL_ADD(item, segment_ctrl)
+   elm_segment_control_item_add(segment_ctrl, NULL, "single");
+   elm_segment_control_item_add(segment_ctrl, NULL, "double");
+
+   elm_layout_content_set(item, "swallow.content1", object_left);
+   elm_layout_content_set(item, "swallow.content2", segment_ctrl);
+
+   elm_box_pack_end(box, item);
+}
+
+static Evas_Object *
+_add_text_frame(Style_Prop_Data *pd)
+{
+   Evas_Object *frame_text, *box_frame;
+
+   FRAME_ADD(pd->box, frame_text, true, _("Text"))
+
+   BOX_ADD(frame_text, box_frame, EINA_FALSE, EINA_FALSE);
+   elm_box_padding_set(box_frame, 6, 0);
+   elm_object_content_set(frame_text, box_frame);
+
+   ADD_1SWALLOW_ITEM(_("Font name:"), box_frame, pd->font_name, item, 
EWE_COMBOBOX);
+   ADD_1SWALLOW_ITEM(_("Font style:"), box_frame, pd->font_style, item, 
EWE_COMBOBOX);
+   ADD_1SWALLOW_ITEM(_(""), box_frame, pd->font_weight, item, EWE_COMBOBOX);
+
+   _prop_text_color_add(_("Color:"), box_frame, pd->font_color);
+   _prop_spin_add(_("Size:"), _(""), _("px"), box_frame, pd->font_size);
+
+   return frame_text;
+}
+
+static Evas_Object *
+_add_position_frame(Style_Prop_Data *pd)
+{
+   Evas_Object *frame_position, *box_frame;
+
+   FRAME_ADD(pd->box, frame_position, true, _("Positioning option"))
+
+   BOX_ADD(frame_position, box_frame, EINA_FALSE, EINA_FALSE);
+   elm_box_padding_set(box_frame, 6, 0);
+   elm_object_content_set(frame_position, box_frame);
+
+   ADD_1SWALLOW_ITEM(_("Horizontal align:"), box_frame, pd->hor_align, item, 
EWE_COMBOBOX);
+   ADD_1SWALLOW_ITEM(_("Vertical align:"), box_frame, pd->vert_align, item, 
EWE_COMBOBOX);
+   _prop_spin_add(_("Margin:"), _("left"), _("px"), box_frame, 
pd->left_margin);
+   _prop_spin_add(_(""), _("Right"), _("px"), box_frame, pd->right_margin);
+
+   return frame_position;
+}
+
+static Evas_Object *
+_add_text_format_frame(Style_Prop_Data *pd)
+{
+   Evas_Object *frame_text_format, *box_frame;
+
+   FRAME_ADD(pd->box, frame_text_format, true, _("Text format"))
+
+   BOX_ADD(frame_text_format, box_frame, EINA_FALSE, EINA_FALSE);
+   elm_box_padding_set(box_frame, 6, 0);
+   elm_object_content_set(frame_text_format, box_frame);
+
+   _prop_spin_add(_("Text tabstops:"), _(""), _("px"), box_frame, 
pd->tab_stops);
+   _prop_spin_add(_("Line size:"), _(""), _("px"), box_frame, pd->line_size);
+   _add_1check_color_item(_("Background color"), box_frame, pd->check_color, 
pd->bg_color);
+   ADD_1SWALLOW_ITEM(_("Password field:"), box_frame, pd->check_psw, item, 
CHECK);
+   _prop_spin_add(_("Replace overflow characters with ellisis:"), _(""), 
_(""), box_frame, pd->replace_ellisis);
+   _prop_spin_add(_("Line relative size:"), _(""), _("px"), box_frame, 
pd->relative_size);
+
+   return frame_text_format;
+}
+
+static Evas_Object *
+add_glow_shadow_frame(Style_Prop_Data *pd)
+{
+   Evas_Object *frame_glow, *box_frame;
+
+   FRAME_ADD(pd->box, frame_glow, true, _("Glow & Shadow"))
+
+   BOX_ADD(frame_glow, box_frame, EINA_FALSE, EINA_FALSE);
+   elm_object_content_set(frame_glow, box_frame);
+
+   elm_box_padding_set(box_frame, 6, 0);
+
+   ADD_1SWALLOW_ITEM(_("Style:"), box_frame, pd->style, item, EWE_COMBOBOX);
+   _prop_text_color_add(_("Outer glow color:"), box_frame, pd->outer_gl_color);
+   _prop_text_color_add(_("Inner glow color:"), box_frame, pd->inner_gl_color);
+
+   return frame_glow;
+}
+
+static Evas_Object *
+add_lines_frame(Style_Prop_Data *pd)
+{
+   Evas_Object *frame_lines, *box_frame;
+
+   FRAME_ADD(pd->box, frame_lines, true, _("Lines"))
+
+   BOX_ADD(frame_lines, box_frame, EINA_FALSE, EINA_FALSE);
+   elm_object_content_set(frame_lines, box_frame);
+
+   _add_1check_color_item(_("Strikethrough color"), box_frame, 
pd->check_s_color, pd->s_color);
+   _add_1check_2button_item(_("Underline"), box_frame, pd->check_unline);
+   _prop_text_2color_add(_("Underline color:"), box_frame, 
pd->outer_color_singl, pd->outer_color_double);
+   elm_box_padding_set(box_frame, 6, 0);
+
+   return frame_lines;
+}
+
+Evas_Object *
+ui_property_style_add(Evas_Object *parent)
+{
+   Style_Prop_Data *pd;
+   Evas_Object *scroller;
+
+   assert(parent != NULL);
+
+   pd = mem_calloc(1, sizeof(Style_Prop_Data));
+
+   SCROLLER_ADD(parent, scroller);
+
+   BOX_ADD(scroller, pd->box, EINA_FALSE, EINA_FALSE);
+   elm_box_align_set(pd->box, 0.5, 0.0);
+   elm_object_content_set(scroller, pd->box);
+
+   elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_AUTO, 
ELM_SCROLLER_POLICY_AUTO);
+
+   elm_box_pack_end(pd->box, _add_text_frame(pd));
+   elm_box_pack_end(pd->box, _add_position_frame(pd));
+   elm_box_pack_end(pd->box, _add_text_format_frame(pd));
+   elm_box_pack_end(pd->box, add_glow_shadow_frame(pd));
+   elm_box_pack_end(pd->box, add_lines_frame(pd));
+
+   return scroller;
+}
\ No newline at end of file
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index 3f57159..60301e2 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -131,7 +131,7 @@ _content_set(void *data,
         else if (toolbar_item == tabs.menu.item_text)
           {
              tabs_menu_tab_open(TAB_STYLE_EDITOR);
-             evas_object_smart_callback_call(ap.win, 
SIGNAL_DIFFERENT_TAB_CLICKED, NULL);
+             evas_object_smart_callback_call(ap.win, 
SIGNAL_STYLE_EDITOR_TAB_CLICKED, NULL);
           }
         else if (toolbar_item == tabs.menu.item_image)
           {

-- 


Reply via email to