rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=85ff85e3db95b1c00e06dadfa807bd5185e0f966
commit 85ff85e3db95b1c00e06dadfa807bd5185e0f966 Author: Vitalii Vorobiov <vi.vorob...@samsung.com> Date: Tue Nov 3 15:31:58 2015 +0200 Property: unselect property on different tab (not group tab) click --- src/bin/common/signals.h | 8 ++++++ src/bin/ui/property.c | 75 +++++++++++++++++++++++++++++++++++++++++------- src/bin/ui/tabs.c | 25 ++++++++++++---- 3 files changed, 92 insertions(+), 16 deletions(-) diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h index 6c6fb66..9161096 100644 --- a/src/bin/common/signals.h +++ b/src/bin/common/signals.h @@ -201,6 +201,14 @@ typedef struct { #define SIGNAL_PROJECT_CLOSED "SIGNAL_PROJECT_CLOSED" /** + * emited when NOT editor tab and NOT group tab is clicked. + * eventinfo - NULL + * + * @ingroup Window + */ +#define SIGNAL_DIFFERENT_TAB_CLICKED "SIGNAL_DIFFERENT_TAB_CLICKED" + +/** * emited when image editor tab is clicked. * eventinfo - NULL * diff --git a/src/bin/ui/property.c b/src/bin/ui/property.c index f3c5d7d..8d4971c 100644 --- a/src/bin/ui/property.c +++ b/src/bin/ui/property.c @@ -25,7 +25,7 @@ #define EFL_BETA_API_SUPPORT #define EFL_EO_API_SUPPORT -#include "property_group.h" +#include "property_private.h" #include "property_macros.h" #include "main_window.h" #include "string_common.h" @@ -44,13 +44,13 @@ Prop_Data *pd = evas_object_data_get(property, PROP_DATA); \ assert(pd != NULL); -/* - * Callback is added for frames at property box to correct scroller - * work while each frame would be expanded/collapsed - */ -#define FRAME_PROPERTY_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE, SCROLLER) \ -FRAME_ADD(PARENT, FRAME, AUTOCOLLAPSE, TITLE) \ -evas_object_smart_callback_add(FRAME, "clicked", _on_frame_click, SCROLLER); +/* enum for identifying current property + (group's, image's, sound's or other kind of peroperty) */ +enum _Property_Type { + PROPERTY, + IMAGE_PROPERTY +}; +typedef enum _Property_Type Property_Type; struct _Prop_Data { @@ -59,10 +59,51 @@ struct _Prop_Data Evas_Object *sound_property; Evas_Object *colorclass_property; Evas_Object *layout; + + Property_Type type; }; typedef struct _Prop_Data Prop_Data; static void +_on_different_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); + + /* hide everything */ + evas_object_hide(pd->group_property); + evas_object_hide(pd->image_property); + + pd->type = PROPERTY; +} + +static void +_on_image_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->image_property); + evas_object_hide(pd->group_property); + evas_object_show(pd->image_property); + + pd->type = IMAGE_PROPERTY; +} + +static void _on_tab_changed(void *data, Evas_Object *obj __UNUSED__, void *event_info) @@ -75,11 +116,23 @@ _on_tab_changed(void *data, if (!group) { - ui_property_group_unset(pd->group_property); + if (pd->type == PROPERTY) + 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 tab, + we need to remove it from there and set group property in there */ + if (pd->type == IMAGE_PROPERTY) + { + elm_object_content_unset(pd->layout); + elm_object_content_set(pd->layout, pd->group_property); + evas_object_hide(pd->image_property); + } ui_property_group_set(pd->group_property, group); + pd->type = PROPERTY; + if (!group->current_part) return; ui_property_part_set(pd->group_property, group->current_part); ui_property_part_state_set(pd->group_property, group->current_part); @@ -100,12 +153,12 @@ ui_property_add(Evas_Object *parent) elm_object_content_set(pd->layout, pd->group_property); evas_object_data_set(pd->layout, PROP_DATA, pd); - /* pd->image_property = ui_property_image_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_DIFFERENT_TAB_CLICKED, _on_different_clicked, pd->layout); return pd->layout; } diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c index dc390e1..f7b7a94 100644 --- a/src/bin/ui/tabs.c +++ b/src/bin/ui/tabs.c @@ -131,15 +131,30 @@ _content_set(void *data, ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_STYLE_ONLY, true); if (toolbar_item == tabs.menu.item_sound) - tabs_menu_tab_open(TAB_SOUND_EDITOR); + { + tabs_menu_tab_open(TAB_SOUND_EDITOR); + evas_object_smart_callback_call(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, NULL); + } else if (toolbar_item == tabs.menu.item_text) - tabs_menu_tab_open(TAB_STYLE_EDITOR); + { + tabs_menu_tab_open(TAB_STYLE_EDITOR); + evas_object_smart_callback_call(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, NULL); + } else if (toolbar_item == tabs.menu.item_image) - tabs_menu_tab_open(TAB_IMAGE_EDITOR); + { + tabs_menu_tab_open(TAB_IMAGE_EDITOR); + evas_object_smart_callback_call(ap.win, SIGNAL_IMAGE_EDITOR_TAB_CLICKED, NULL); + } else if (toolbar_item == tabs.menu.item_colorclass) - tabs_menu_tab_open(TAB_COLORCLASS_EDITOR); + { + tabs_menu_tab_open(TAB_COLORCLASS_EDITOR); + evas_object_smart_callback_call(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, NULL); + } else - tabs_menu_tab_open(TAB_LAST); + { + tabs_menu_tab_open(TAB_LAST); + evas_object_smart_callback_call(ap.win, SIGNAL_DIFFERENT_TAB_CLICKED, NULL); + } } /* call 'tab,changed' on tab click, and sent Group accociated with clicked --