rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=07682f3a443b1e55d919ceab65f57b55bbaaec47
commit 07682f3a443b1e55d919ceab65f57b55bbaaec47 Author: Vitalii Vorobiov <[email protected]> Date: Tue Apr 19 19:31:52 2016 +0300 popup: remove old colorsel and apply new one just everywhere --- po/POTFILES.in | 1 - src/bin/Makefile.am | 3 - src/bin/eflete.c | 8 --- src/bin/eflete.h | 12 ---- src/bin/ui/dialogs/colorsel.c | 123 -------------------------------- src/bin/ui/dialogs/colorsel.h | 127 ---------------------------------- src/bin/ui/property_color.c | 1 - src/bin/ui/property_demo_program.c | 1 - src/bin/ui/property_demo_swallow.c | 34 +++------ src/bin/ui/property_group.c | 1 - src/bin/ui/property_style.c | 37 +++------- tests/Makefile.am | 3 +- tests/test_eflete/colorselector_get.c | 73 ------------------- tests/test_eflete/test_eflete.c | 2 - tests/test_eflete/test_eflete.h | 2 - 15 files changed, 21 insertions(+), 407 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index f5dd16f..ff7ede5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -8,7 +8,6 @@ src/bin/logger/logger.c src/bin/project_manager/group_manager.c src/bin/project_manager/project_manager.c src/bin/ui/cursor.c -src/bin/ui/dialogs/colorsel.c src/bin/ui/editors/animator.c src/bin/ui/editors/animator_program_editor.c src/bin/ui/editors/animator_program_sequence.c diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 141e05e..ca0ccd8 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -36,7 +36,6 @@ includesub_HEADERS = \ ui/property_private.h \ ui/tabs.h \ ui/tabs_private.h \ - ui/dialogs/colorsel.h \ ui/live_view/demo.h \ ui/live_view/live_widget.h \ ui/live_view/live_widgets.h \ @@ -85,7 +84,6 @@ libete_a_SOURCES = \ ../../src/bin/ui/shortcuts/shortcuts.c \ ../../src/bin/ui/style_manager.c \ ../../src/bin/ui/sound_manager.c \ -../../src/bin/ui/dialogs/colorsel.c \ ../../src/bin/ui/project_navigator.c \ ../../src/bin/ui/image_manager.c \ ../../src/bin/ui/colorclass_manager.c \ @@ -165,7 +163,6 @@ eflete_CPPFLAGS = \ -I${top_srcdir}/src/bin/ui/shortcuts \ -I${top_srcdir}/src/bin/ui/container \ -I${top_srcdir}/src/bin/ui/blocks \ --I${top_srcdir}/src/bin/ui/dialogs \ -I${top_srcdir}/src/bin/ui/editors \ -I${top_srcdir}/src/bin/ui/notification \ -I${top_srcdir}/src/bin/ui/workspace \ diff --git a/src/bin/eflete.c b/src/bin/eflete.c index 9d7ac65..9dff2b6 100644 --- a/src/bin/eflete.c +++ b/src/bin/eflete.c @@ -19,7 +19,6 @@ #include "eflete.h" #include "main_window.h" -#include "colorsel.h" #include "shortcuts.h" #include "config.h" #ifdef _WIN32 @@ -30,13 +29,6 @@ App_Data ap; static Eina_Bool do_block = true; -Evas_Object * -colorselector_get(void) -{ - if (!ap.colorsel) ap.colorsel = colorselector_add(ap.win); - return ap.colorsel; -} - void eflete_main_loop_begin(void) { diff --git a/src/bin/eflete.h b/src/bin/eflete.h index b3a2953..e20e6a6 100644 --- a/src/bin/eflete.h +++ b/src/bin/eflete.h @@ -91,8 +91,6 @@ struct _App_Data TODO("Burn popup variable"); Evas_Object *popup; Evas_Object *splash; - Evas_Object *colorsel; /**< global colorselector. the one colorselector for - application. */ Evas_Object *statusbar; /**< The statusbar object, which contain some items */ struct { Evas_Object *left; @@ -173,16 +171,6 @@ eflete_main_loop_begin(void); void eflete_main_loop_quit(void); -/** - * Get the colorselector object pointer. - * The colorselector one for the entire application. - * - * @return pointer to colorselector. - * @ingroup Eflete - */ -Evas_Object * -colorselector_get(void); - #define GET_IMAGE(IMG, PARENT, NAME) \ { \ IMG = edje_object_add(PARENT); \ diff --git a/src/bin/ui/dialogs/colorsel.c b/src/bin/ui/dialogs/colorsel.c deleted file mode 100644 index 43ac613..0000000 --- a/src/bin/ui/dialogs/colorsel.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * 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 "colorsel.h" - -static void -_on_changed(void *data, - Evas_Object *obj __UNUSED__, - void *event_info) -{ - Evas_Object *ctxpopup = (Evas_Object *)data; - - assert(ctxpopup != NULL); - - evas_object_smart_callback_call(ctxpopup, "color,changed", event_info); -} - -static void -_on_item_selected(void *data, - Evas_Object *obj __UNUSED__, - void *event_info) -{ - Evas_Object *ctxpopup = (Evas_Object *)data; - - assert(ctxpopup != NULL); - - evas_object_smart_callback_call(ctxpopup, "palette,item,selected", event_info); -} - -static void -_on_item_longpressed(void *data, - Evas_Object *obj __UNUSED__, - void *event_info) -{ - Evas_Object *ctxpopup = (Evas_Object *)data; - - assert(ctxpopup != NULL); - - evas_object_smart_callback_call(ctxpopup, "palette,item,longpressed", event_info); -} - -static void -_on_key_down(void *data __UNUSED__, - Evas *e __UNUSED__, - Evas_Object *obj, - void *event_info) -{ - Evas_Event_Key_Down *ev = (Evas_Event_Key_Down *)event_info; - if (strcmp(ev->keyname, "Escape") == 0) - evas_object_smart_callback_call(obj, "dismissed", NULL); -} - -Evas_Object * -colorselector_add(Evas_Object *parent) -{ - Evas_Object *ctxpopup, *colorsel; - - assert(parent != NULL); - - ctxpopup = elm_ctxpopup_add(parent); - elm_object_style_set(ctxpopup, "colorsel"); - colorsel = elm_colorselector_add(ctxpopup); - elm_colorselector_mode_set(colorsel, ELM_COLORSELECTOR_ALL); - elm_object_content_set(ctxpopup, colorsel); - - evas_object_event_callback_add(ctxpopup, EVAS_CALLBACK_KEY_DOWN, _on_key_down, NULL); - evas_object_smart_callback_add(colorsel, "changed", _on_changed, ctxpopup); - evas_object_smart_callback_add(colorsel, "color,item,selected", _on_item_selected, ctxpopup); - evas_object_smart_callback_add(colorsel, "color,item,longpressed", _on_item_longpressed, ctxpopup); - - evas_object_hide(ctxpopup); - return ctxpopup; -} - -void -colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a) -{ - Evas_Object *colorsel; - - assert(obj != NULL); - - colorsel = elm_object_content_get(obj); - - assert(colorsel != NULL); - - elm_colorselector_color_set(colorsel, r, g, b, a); -} - -void -colorselector_color_get(Evas_Object *obj, int *r, int *g, int *b, int *a) -{ - Evas_Object *colorsel; - int rc, gc, bc, ac; - - assert(obj != NULL); - - colorsel = elm_object_content_get(obj); - - assert(colorsel != NULL); - - elm_colorselector_color_get(colorsel, &rc, &gc, &bc, &ac); - - if (r) *r = rc; - if (g) *g = gc; - if (b) *b = bc; - if (a) *a = ac; -} diff --git a/src/bin/ui/dialogs/colorsel.h b/src/bin/ui/dialogs/colorsel.h deleted file mode 100644 index 5d49c6d..0000000 --- a/src/bin/ui/dialogs/colorsel.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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. - */ - -/** - * @defgroup Colorsel Color selector - * - * A ColorSelector is a color selection widget. It allows application to set a - * series of colors.It also allows to load/save colors from/to config with a - * unique identifier, by default, the colors are loaded/saved from/to config - * using "default" identifier. The colors can be picked by user from the color - * set by clicking on individual color item on the palette or by selecting it - * from selector. - * - * This widget is combined of ctxpopup and colorselector widgets. This widget - * can be added ONLY to window. - * - * This widget emits the following signals, besides the ones sent from Layout: - * @li "dissmised" - * @li "color,changed" - When the color value changes on selector event_info is NULL. - * @li "palette,item,selected" - When user clicks on color item. The event_info - * parameter of the callback will be the selected color item. - * @li "palette,item,longpressed" - When user long presses on color item. The - * event info parameter of the callback contains selected color item. - * - */ - -#include "eflete.h" - -/** - * Add a new colorselector to the parent to application window. - * - * @param parent The parent object. - * - * @return The new object or NULL if it cannot be created. - * - * @note Only the window can be parent to colorselector, in the another case - * behavior is undefined. - * - * @ingroup Colorsel - */ -Evas_Object * -colorselector_add(Evas_Object *parent); - -/** - * Set color to colorselector. - * - * @param obj Colorselector object, - * @param r r-value of color, - * @param g g-value of color, - * @param b b-value of color, - * @param a a-value of color. - * - * @ingroup Colorsel - */ -void -colorselector_color_set(Evas_Object *obj, int r, int g, int b, int a); - -/** - * Get current color from colorselector. - * - * @param obj Colorselector object, - * @param r integer pointer for r-value of color, - * @param g integer pointer for g-value of color, - * @param b integer pointer for b-value of color, - * @param a integer pointer for a-value of color. - * - * @ingroup Colorsel - */ -void -colorselector_color_get(Evas_Object *obj, int *r, int *g, int *b, int *a); - -/** - * @warning NOT IMPLEMENTED - * Get a list of saved paletts name. - * - * @param obj Colorselector object. - * - * @return The list of paletts names or NULL, if not saved pallets. - * - * @ingroup Colorsel - */ -Eina_List * -colorsector_palettes_get(Evas_Object *obj); - -/** - * @warning NOT IMPLEMENTED - * Save the current palett colors. - * - * @param obj Colorselector object. - * @param name The name of saved palette. - * - * @return EINA_TRUE if the palatte be saved, EINA_FALSE otherwise. - * - * @ingroup Colorsel - */ -Eina_Bool -colorselector_palette_save(Evas_Object *obj, const char *name); - -/** - * @warning NOT IMPLEMENTED - * Load the palette by name and set the pallet to colorselector. - * - * @param obj Colorselector object, - * @param name The name of palette, that will be loaded. - * - * @return EINA_TRUE if the palatte be loaded, EINA_FALSE otherwise. - * - * @ingroup Colorsel - */ -Eina_Bool -colorselector_palette_load(Evas_Object *obj, const char *name); diff --git a/src/bin/ui/property_color.c b/src/bin/ui/property_color.c index 5ea6bc2..a3353c7 100644 --- a/src/bin/ui/property_color.c +++ b/src/bin/ui/property_color.c @@ -19,7 +19,6 @@ #include "property_private.h" #include "main_window.h" -#include "colorsel.h" #include "property_macros.h" #include "project_manager.h" diff --git a/src/bin/ui/property_demo_program.c b/src/bin/ui/property_demo_program.c index bd78320..6564766 100644 --- a/src/bin/ui/property_demo_program.c +++ b/src/bin/ui/property_demo_program.c @@ -22,7 +22,6 @@ #include "main_window.h" #include "history.h" #include "validator.h" -#include "colorsel.h" #include "project_manager.h" #define DEMO_PROGRAM_PROP_DATA "program_prop_data" diff --git a/src/bin/ui/property_demo_swallow.c b/src/bin/ui/property_demo_swallow.c index b9a6314..a1288ae 100644 --- a/src/bin/ui/property_demo_swallow.c +++ b/src/bin/ui/property_demo_swallow.c @@ -22,7 +22,6 @@ #include "main_window.h" #include "history.h" #include "validator.h" -#include "colorsel.h" #include "project_manager.h" #define DEMO_SWALLOW_PROP_DATA "image_prop_data" @@ -195,7 +194,7 @@ _on_rectangle_color_change(void *data, { int r, g, b, a; Demo_Swallow_Prop_Data *pd = (Demo_Swallow_Prop_Data *)data; - colorselector_color_get(obj, &r, &g, &b, &a); + elm_colorselector_color_get(obj, &r, &g, &b, &a); evas_color_argb_premul(a, &r, &g, &b); @@ -210,40 +209,29 @@ _on_rectangle_color_change(void *data, evas_object_smart_callback_call(ap.win, SIGNAL_DEMO_SWALLOW_SET, pd->part); } -static void -_on_rectangle_color_dismissed(void *data, +static Eina_Bool +_on_rectangle_color_dismissed(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) { - Demo_Swallow_Prop_Data *pd = (Demo_Swallow_Prop_Data *)data; - evas_object_smart_callback_del_full(obj, "color,changed", - _on_rectangle_color_change, pd); - evas_object_smart_callback_del_full(obj, "palette,item,selected", - _on_rectangle_color_change, pd); - evas_object_smart_callback_del_full(obj, "dismissed", - _on_rectangle_color_dismissed, pd); evas_object_hide(obj); + return true; } static void _on_color_clicked(void *data, - Evas_Object *obj, + Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__) { - int x, y; int r, g, b, a; - Evas_Object *colorsel; Demo_Swallow_Prop_Data *pd = (Demo_Swallow_Prop_Data *)data; - colorsel = colorselector_get(); + assert(pd != NULL); + evas_object_color_get(pd->color_obj, &r, &g, &b, &a); - colorselector_color_set(colorsel, r, g, b, a); - evas_object_smart_callback_add(colorsel, "color,changed", - _on_rectangle_color_change, pd); - evas_object_smart_callback_add(colorsel, "dismissed", - _on_rectangle_color_dismissed, pd); - evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); - evas_object_move(colorsel, x, y); - evas_object_show(colorsel); + popup_colorselector_helper(pd->color_obj, + _on_rectangle_color_dismissed, + _on_rectangle_color_change, + pd, r, g, b, a); } static Evas_Object * diff --git a/src/bin/ui/property_group.c b/src/bin/ui/property_group.c index 97a0ce2..d697d4a 100644 --- a/src/bin/ui/property_group.c +++ b/src/bin/ui/property_group.c @@ -33,7 +33,6 @@ #include "group_navigator.h" #include "change.h" #include "project_manager.h" -#include "colorsel.h" #define GROUP_PROP_DATA "group_prop_data" diff --git a/src/bin/ui/property_style.c b/src/bin/ui/property_style.c index c201f89..f445ba8 100644 --- a/src/bin/ui/property_style.c +++ b/src/bin/ui/property_style.c @@ -24,7 +24,6 @@ #include "property_private.h" #include "property_macros.h" #include "main_window.h" -#include "colorsel.h" #include "project_manager.h" #include "validator.h" @@ -680,31 +679,23 @@ _on_##VALUE##_change(void *data, \ const char *value; \ Style_Prop_Data *pd = (Style_Prop_Data *)data; \ assert(pd != NULL); \ - Evas_Object *color; \ - color = evas_object_data_get(obj, "color"); \ - colorselector_color_get(obj, &r, &g, &b, &a); \ + elm_colorselector_color_get(obj, &r, &g, &b, &a); \ value = eina_stringshare_printf("#%02x%02x%02x%02x", r, g, b, a); \ _tag_parse(pd, value, TAG); \ - evas_object_color_set(color, r*a/255, g*a/255, b*a/255, a); \ + evas_object_color_set(pd->VALUE, r*a/255, g*a/255, b*a/255, a); \ _style_edit_update(pd); \ eina_stringshare_del(value); \ editor_save(ap.project->global_object); \ TODO("Remove this line once edje_edit API would be added into Editor Module and saving would work properly") \ ap.project->changed = true; \ } \ -static void \ -_on_##VALUE##_dismissed(void *data, \ +static Eina_Bool \ +_on_##VALUE##_dismissed(void *data __UNUSED__, \ Evas_Object *obj, \ void *event_info __UNUSED__) \ { \ - Style_Prop_Data *pd = (Style_Prop_Data *)data; \ - assert(pd != NULL); \ - evas_object_smart_callback_del_full(obj, "color,changed", \ - _on_##VALUE##_change, pd); \ - evas_object_smart_callback_del_full(obj, "palette,item,selected", \ - _on_##VALUE##_change, pd); \ - evas_object_data_del(obj, "color"); \ evas_object_hide(obj); \ + return true; \ } \ static void \ _on_##VALUE##_clicked(void *data, \ @@ -712,24 +703,14 @@ _on_##VALUE##_clicked(void *data, \ Evas_Object *obj, \ void *event_info __UNUSED__) \ { \ - int x, y; \ int r, g, b, a; \ Style_Prop_Data *pd = (Style_Prop_Data *)data; \ assert(pd != NULL); \ - Evas_Object *colorsel; \ - colorsel = colorselector_get(); \ - evas_object_data_set(colorsel, "color", obj); \ evas_object_color_get(obj, &r, &g, &b, &a); \ - colorselector_color_set(colorsel, r, g, b, a); \ - evas_object_smart_callback_add(colorsel, "color,changed", \ - _on_##VALUE##_change, pd); \ - evas_object_smart_callback_add(colorsel, "palette,item,selected", \ - _on_##VALUE##_change, pd); \ - evas_object_smart_callback_add(colorsel, "dismissed", \ - _on_##VALUE##_dismissed, pd); \ - evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); \ - evas_object_move(colorsel, x, y); \ - evas_object_show(colorsel); \ + popup_colorselector_helper(pd->VALUE, \ + _on_##VALUE##_dismissed, \ + _on_##VALUE##_change, \ + pd, r, g, b, a); \ } CALLBACKS_COLOR_ADD(font_color, "color") diff --git a/tests/Makefile.am b/tests/Makefile.am index a6d43c5..2e357a2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -126,8 +126,7 @@ ewe_combobox_test_LDADD = ${LD} eflete_test_SOURCES = \ ../tests/test_eflete/test_eflete.c \ ../tests/test_eflete/app_init.c \ -../tests/test_eflete/app_shutdown.c \ -../tests/test_eflete/colorselector_get.c +../tests/test_eflete/app_shutdown.c eflete_test_CFLAGS = ${FLAGS} eflete_test_LDADD = ${LD} diff --git a/tests/test_eflete/colorselector_get.c b/tests/test_eflete/colorselector_get.c deleted file mode 100644 index eda9ad9..0000000 --- a/tests/test_eflete/colorselector_get.c +++ /dev/null @@ -1,73 +0,0 @@ -/** - * 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 "test_eflete.h" - -/** - * @addtogroup eflete_test - * @{ - * @addtogroup colorselector_get - * @{ - * eflete - * <TABLE> - * @} - */ - -/** - * @addtogroup colorselector_get - * @{ - * <tr> - * <td>colorselector_get</td> - * <td>colorselector_get_test_p</td> - * <td> - * @precondition - * @step 1 Initialize elementary library. - * @step 2 initialize application with app_init() function - * @step 3 Create application data structure. - * @step 4 create main window - * - * @procedure - * @step 1 call colorselector_get - * @step 2 check returned pointer - * </td> - * <td>void</td> - * <td>Not NULL object</td> - * </tr> - * @} - */ -EFLETE_TEST (colorselector_get_test_p) -{ - elm_init(0,0); - app_init(); - config_load(); - ui_main_window_add(); - - ck_assert_msg(colorselector_get() != NULL, "Colorselector not exist"); - - elm_shutdown(); -} -END_TEST - -/** - * @addtogroup colorselector_get - * @{ - * </TABLE> - * @} - * @} - */ diff --git a/tests/test_eflete/test_eflete.c b/tests/test_eflete/test_eflete.c index e161c56..a330a3b 100644 --- a/tests/test_eflete/test_eflete.c +++ b/tests/test_eflete/test_eflete.c @@ -28,8 +28,6 @@ Suite* test_suite (void) { tcase_add_test(tcase, app_shutdown_test_p1); tcase_add_test(tcase, app_shutdown_test_p2); - tcase_add_test(tcase, colorselector_get_test_p); - suite_add_tcase(suite, tcase); return suite; } diff --git a/tests/test_eflete/test_eflete.h b/tests/test_eflete/test_eflete.h index 6bf0912..b388044 100644 --- a/tests/test_eflete/test_eflete.h +++ b/tests/test_eflete/test_eflete.h @@ -30,5 +30,3 @@ void app_init_test_p(int); void app_shutdown_test_p1(int); void app_shutdown_test_p2(int); - -void colorselector_get_test_p(int); --
