rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=35bf97d5f981c832a2d35943121b15ca6deca6b9
commit 35bf97d5f981c832a2d35943121b15ca6deca6b9 Author: Andrii Kroitor <an.kroi...@samsung.com> Date: Thu Dec 24 15:04:45 2015 +0200 refactor: remove old dialogs --- po/POTFILES.in | 3 - src/bin/Makefile.am | 3 - src/bin/ui/dialogs/item_dialog.c | 219 ---------------------- src/bin/ui/dialogs/item_dialog.h | 48 ----- src/bin/ui/dialogs/part_dialog.c | 254 ------------------------- src/bin/ui/dialogs/part_dialog.h | 50 ----- src/bin/ui/dialogs/style_dialog.c | 380 -------------------------------------- src/bin/ui/dialogs/style_dialog.h | 46 ----- src/bin/ui/main_window.h | 3 - 9 files changed, 1006 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 7b115d1..1336c29 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,9 +14,6 @@ src/bin/ui/container/container.c src/bin/ui/cursor.c src/bin/ui/dialogs/about_window.c src/bin/ui/dialogs/colorsel.c -src/bin/ui/dialogs/item_dialog.c -src/bin/ui/dialogs/part_dialog.c -src/bin/ui/dialogs/style_dialog.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 f2e59ad..ca4b683 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -45,11 +45,8 @@ libete_a_SOURCES = \ ../../src/bin/ui/editors/animator.c \ ../../src/bin/ui/editors/animator_program_editor.c \ ../../src/bin/ui/editors/animator_program_sequence.c \ -../../src/bin/ui/dialogs/part_dialog.c \ -../../src/bin/ui/dialogs/style_dialog.c \ ../../src/bin/ui/dialogs/about_window.c \ ../../src/bin/ui/dialogs/colorsel.c \ -../../src/bin/ui/dialogs/item_dialog.c \ ../../src/bin/ui/modal_window/modal_window.c \ ../../src/bin/ui/project_navigator.c \ ../../src/bin/ui/tabs.c \ diff --git a/src/bin/ui/dialogs/item_dialog.c b/src/bin/ui/dialogs/item_dialog.c deleted file mode 100644 index dff8853..0000000 --- a/src/bin/ui/dialogs/item_dialog.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * 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. - */ -#define EO_BETA_API -#define EFL_BETA_API_SUPPORT -#define EFL_EO_API_SUPPORT - -#include "item_dialog.h" - -static Evas_Object *entry, *combobox, *btn_add; -static Elm_Validator_Regexp *name_validator = NULL; - -static void -_job_popup_close(void *data __UNUSED__) -{ - assert(name_validator != NULL); - - Evas_Object *markup = elm_object_content_get(ap.popup); - Evas_Object *proxy_preview = elm_object_part_content_unset(markup, "preview.swallow"); - Evas_Object *group_preview = elm_object_part_content_unset(markup, "origin.swallow"); - - elm_validator_regexp_free(name_validator); - name_validator = NULL; - - eina_file_map_free(ap.project->mmap_file, group_preview); - evas_object_del(group_preview); - evas_object_del(proxy_preview); - evas_object_del(ap.popup); - - ap.popup = NULL; - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, false); -} - -static void -_on_button_add_clicked(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - - Part *part = evas_object_data_get(ap.popup, "PART"); - - assert(entry != NULL); - assert(combobox != NULL); - assert(part != NULL); - - Ewe_Combobox_Item *item = NULL; - - if (elm_entry_is_empty(entry)) - { - NOTIFY_WARNING(_("Item name can not be empty!")) - return; - } - - item = ewe_combobox_select_item_get(combobox); - - if (item->index == 0) - { - NOTIFY_WARNING(_("Source is not selected! Please select source for item.")) - return; - } - - edje_edit_string_list_free(part->items); - part->items = edje_edit_part_items_list_get(ap.project->current_style->obj, part->name); - ui_widget_list_part_items_refresh(ui_block_widget_list_get(), part, true); - - workspace_edit_object_recalc(ap.workspace); - //project_changed(false); - ecore_job_add(_job_popup_close, NULL); -} - -static void -_on_button_cancel_clicked(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - ecore_job_add(_job_popup_close, data); -} - -static void -_on_item_source_change(void *data, - Evas_Object *obj, - void *event_info) -{ - Evas_Object *markup = (Evas_Object *)data; - Ewe_Combobox_Item *item = (Ewe_Combobox_Item *)event_info; - - assert(markup != NULL); - - Evas_Object *proxy_preview = elm_object_part_content_unset(markup, "preview.swallow"); - Evas_Object *group_preview = elm_object_part_content_unset(markup, "origin.swallow"); - - if (!group_preview) - group_preview = edje_object_add(evas_object_evas_get(obj)); - else - eina_file_map_free(ap.project->mmap_file, group_preview); - - edje_object_mmap_set(group_preview, ap.project->mmap_file, item->title); - evas_object_size_hint_min_set(group_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(group_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_align_set(group_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_max_set(group_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_part_content_set(markup, "origin.swallow", group_preview); - evas_object_show(group_preview); - if (!proxy_preview) - { - proxy_preview = evas_object_image_filled_add(evas_object_evas_get(obj)); - evas_object_size_hint_min_set(proxy_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(proxy_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_max_set(proxy_preview, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_image_scale_hint_set(proxy_preview, EVAS_IMAGE_SCALE_HINT_STATIC); - evas_object_image_content_hint_set(proxy_preview, EVAS_IMAGE_CONTENT_HINT_STATIC); - elm_object_part_content_set(markup, "preview.swallow", proxy_preview); - evas_object_show(proxy_preview); - } - evas_object_image_source_set(proxy_preview, group_preview); - evas_object_image_smooth_scale_set(proxy_preview, true); - evas_object_image_source_visible_set(proxy_preview, false); - evas_object_image_source_clip_set(proxy_preview, false); - - return; -} - -static void -_validation(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - if ((elm_validator_regexp_status_get(name_validator) != ELM_REG_NOERROR) || - (ewe_combobox_select_item_get(combobox)->index == 0)) - elm_object_disabled_set(btn_add, true); - else - elm_object_disabled_set(btn_add, false); -} - -Evas_Object * -item_dialog_add(Part *part) -{ - Evas_Object *box, *item, *button; - Eina_List *collections = NULL, *l = NULL; - Eina_Stringshare *group = NULL; - Evas_Object *markup = NULL; - - assert(ap.workspace != NULL); - assert(part != NULL); - assert(name_validator == NULL); - - name_validator = elm_validator_regexp_new(NAME_REGEX, NULL); - - ap.popup = elm_popup_add(ap.win_layout); - elm_object_part_text_set(ap.popup, "title,text", _("Add new item")); - elm_popup_orient_set(ap.popup, ELM_POPUP_ORIENT_CENTER); - - markup = elm_layout_add(ap.popup); - elm_layout_theme_set(markup, "layout", "dialog", "item"); - evas_object_size_hint_weight_set(markup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(markup); - - BOX_ADD(ap.popup, box, false, false); - - LAYOUT_PROP_ADD(box, _("Name:"), "property", "1swallow") - ENTRY_ADD(item, entry, true); - eo_do(entry, eo_event_callback_add(ELM_ENTRY_EVENT_VALIDATE, elm_validator_regexp_helper, name_validator)); - evas_object_smart_callback_add(entry, "changed", _validation, NULL); - elm_object_part_text_set(entry, "guide", _("Type a item name.")); - elm_object_part_content_set(item, "elm.swallow.content", entry); - elm_box_pack_end(box, item); - - LAYOUT_PROP_ADD(box, _("Source:"), "property", "1swallow") - EWE_COMBOBOX_ADD(item, combobox) - ewe_combobox_item_add(combobox, _("None")); - ewe_combobox_select_item_set(combobox, 0); - - collections = edje_file_collection_list(ap.project->dev); - collections = eina_list_sort(collections, eina_list_count(collections), sort_cb); - EINA_LIST_FOREACH(collections, l, group) - { - if (group != ap.project->current_style->full_group_name) - ewe_combobox_item_add(combobox, group); - } - edje_file_collection_list_free(collections); - - elm_object_part_content_set(item, "elm.swallow.content", combobox); - evas_object_smart_callback_add(combobox, "selected", _on_item_source_change, markup); - evas_object_smart_callback_add(combobox, "selected", _validation, NULL); - elm_box_pack_end(box, item); - elm_object_part_content_set(markup, "items.swallow", box); - elm_object_content_set(ap.popup, markup); - - evas_object_data_set(ap.popup, "PART", part); - - BUTTON_ADD(ap.popup, btn_add, _("Add")); - evas_object_smart_callback_add (btn_add, "clicked", _on_button_add_clicked, NULL); - elm_object_part_content_set(ap.popup, "button1", btn_add); - elm_object_disabled_set(btn_add, true); - - BUTTON_ADD(ap.popup, button, _("Cancel")); - evas_object_smart_callback_add(button, "clicked", _on_button_cancel_clicked, NULL); - elm_object_part_content_set(ap.popup, "button2", button); - - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, true); - evas_object_show(ap.popup); - elm_object_focus_set(entry, true); - return ap.popup; -} diff --git a/src/bin/ui/dialogs/item_dialog.h b/src/bin/ui/dialogs/item_dialog.h deleted file mode 100644 index 53a8836..0000000 --- a/src/bin/ui/dialogs/item_dialog.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 ITEM_DIALOG_H -#define ITEM_DIALOG_H - -/** - * @defgroup Item_Dialog Item_Dialog - * @ingroup Dialogs - * - * Show dialog window for add new item into container part (TABLE, BOX). - * This dialog provide ability to set name for new item and choise source group. - * Choised source load into preview area. - */ - -#include "eflete.h" -#include "common_macro.h" -#include "string_common.h" -#include "main_window.h" - -/** - * Add new dialog for input params of creating item: name and value. - * - * @param ap The App_Data struct pointer. - * @return Pointer to popup object. - * - * @ingroup Item_Dialog - */ -Evas_Object * -item_dialog_add(Part *part); - -#endif /* ITEM_DIALOG_H */ diff --git a/src/bin/ui/dialogs/part_dialog.c b/src/bin/ui/dialogs/part_dialog.c deleted file mode 100644 index 0e60fdf..0000000 --- a/src/bin/ui/dialogs/part_dialog.c +++ /dev/null @@ -1,254 +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. - */ -#define EO_BETA_API -#define EFL_BETA_API_SUPPORT -#define EFL_EO_API_SUPPORT - -#include "part_dialog.h" -#include "string_common.h" - -#define ENTRY_IS_EMPTY \ - const char *str = elm_entry_entry_get(entry); \ - if (elm_entry_is_empty(entry)) \ - { \ - NOTIFY_WARNING(_("Part name can not be empty")) \ - return; \ - } \ - if (edje_edit_part_exist(ap.project->current_style->obj, str)) \ - { \ - NOTIFY_WARNING(_("Can't add the part %s, part with the same name already exists"), str) \ - return; \ - } - -static Evas_Object *entry; -static Elm_Validator_Regexp *name_validator = NULL; - -static void -_job_popup_del(void *data __UNUSED__) -{ - assert(name_validator != NULL); - - elm_validator_regexp_free(name_validator); - name_validator = NULL; - evas_object_del(ap.popup); - ap.popup = NULL; - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, false); -} - -static void -_cancel_clicked(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - ecore_job_add(_job_popup_del, data); -} - -#define WORKSPACE_PART_ADD(TYPE, DATA) \ - /*Evas_Object *workspace = ap.workspace;*/ \ - ENTRY_IS_EMPTY \ - /* Style *style = NULL; */ \ - /*const char *name = elm_entry_entry_get(entry); */\ - /*if (workspace_edit_object_part_add(workspace, name, TYPE, DATA))*/ \ - /* ui_widget_list_part_add(widget_list, style, name);*/ \ - evas_object_del(ap.popup); \ - ap.popup = NULL; \ - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, false); \ - ecore_job_add(_job_popup_del, data); \ - /*project_changed(true);*/ - -static void -_swallow_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_SWALLOW, NULL) -} - -static void -_txtblock_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_TEXTBLOCK, NULL) -} - -static void -_group_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_GROUP, NULL) -} - -static void -_spacer_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_SPACER, NULL) -} - -static void -_proxy_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_PROXY, NULL) -} - - -static void -_txt_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_TEXT, NULL) -} - -static void -_rect_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_RECTANGLE, NULL) -} - -static void -_table_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_TABLE, NULL) -} - -static void -_box_add_on_click(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - WORKSPACE_PART_ADD(EDJE_PART_TYPE_BOX, NULL) -} - -static void -_on_image_editor_done(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info) -{ - char *selected = (char *)event_info; - if (!selected) return; - WORKSPACE_PART_ADD(EDJE_PART_TYPE_IMAGE, selected) -} - -static void -_on_state_image_choose(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *ei __UNUSED__) -{ - Evas_Object *img_edit; - - - ENTRY_IS_EMPTY - evas_object_hide(ap.popup); /* popup is delete in WORKSPACE_PART_ADD */ - img_edit = image_editor_window_add(SINGLE); - evas_object_smart_callback_add(img_edit, SIG_IMAGE_SELECTED, _on_image_editor_done, NULL); -} - -Evas_Object * -part_dialog_add(void) -{ - Evas_Object *win, *workspace, *widget_list; - Evas_Object *box, *button, *bt_no; - Eina_Stringshare *title; - Style *style = NULL; - - assert(ap.project != NULL); - - win = ap.win; - workspace = ap.workspace; - widget_list = ui_block_widget_list_get(); - - assert(win != NULL); - assert(workspace != NULL); - assert(widget_list != NULL); - assert(name_validator == NULL); - - name_validator = elm_validator_regexp_new(NAME_REGEX, NULL); - - //style = workspace_edit_object_get(workspace); - ap.popup = elm_popup_add(ap.win); - title = eina_stringshare_printf(_("Add new part to group \"%s\""), style->name); - elm_object_part_text_set(ap.popup, "title,text", title); - - BOX_ADD(ap.popup, box, EINA_FALSE, EINA_TRUE); - ENTRY_ADD(box, entry, EINA_TRUE); - eo_do(entry, eo_event_callback_add(ELM_ENTRY_EVENT_VALIDATE, elm_validator_regexp_helper, name_validator)); - elm_object_part_text_set(entry, "guide", _("Type the new part new.")); - evas_object_show(entry); - elm_box_pack_end(box, entry); - - BUTTON_ADD(box, button, _("Rectangle")); - evas_object_smart_callback_add(button, "clicked", _rect_add_on_click, NULL); - elm_box_pack_end(box, button); - BUTTON_ADD(box, button, _("Text")); - evas_object_smart_callback_add(button, "clicked", _txt_add_on_click, NULL); - elm_box_pack_end(box, button); - BUTTON_ADD(box, button, _("Image")); - evas_object_smart_callback_add(button, "clicked", _on_state_image_choose, NULL); - elm_box_pack_end(box, button); - BUTTON_ADD(box, button, _("Swallow")); - evas_object_smart_callback_add(button, "clicked", _swallow_add_on_click, NULL); - elm_box_pack_end(box, button); - BUTTON_ADD(box, button, _("Textblock")); - evas_object_smart_callback_add(button, "clicked", _txtblock_add_on_click, NULL); - elm_box_pack_end(box, button); - - BUTTON_ADD(box, button, _("Group")); - evas_object_smart_callback_add(button, "clicked", _group_add_on_click, NULL); - elm_box_pack_end(box, button); - - BUTTON_ADD(box, button, _("Spacer")); - evas_object_smart_callback_add(button, "clicked", _spacer_add_on_click, NULL); - elm_box_pack_end(box, button); - - BUTTON_ADD(box, button, _("Proxy")); - evas_object_smart_callback_add(button, "clicked", _proxy_add_on_click, NULL); - elm_box_pack_end(box, button); - - BUTTON_ADD(box, button, _("Table")); - evas_object_smart_callback_add(button, "clicked", _table_add_on_click, NULL); - elm_box_pack_end(box, button); - - BUTTON_ADD(box, button, _("Box")); - evas_object_smart_callback_add(button, "clicked", _box_add_on_click, NULL); - elm_box_pack_end(box, button); - - elm_object_content_set(ap.popup, box); - BUTTON_ADD(box, bt_no, _("Cancel")); - evas_object_smart_callback_add (bt_no, "clicked", _cancel_clicked, NULL); - elm_object_part_content_set(ap.popup, "button1", bt_no); - - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, true); - - evas_object_show(ap.popup); - elm_object_focus_set(entry, true); - - eina_stringshare_del(title); - return ap.popup; -} -#undef ENTRY_IS_EMPTY diff --git a/src/bin/ui/dialogs/part_dialog.h b/src/bin/ui/dialogs/part_dialog.h deleted file mode 100644 index 51cdcd4..0000000 --- a/src/bin/ui/dialogs/part_dialog.h +++ /dev/null @@ -1,50 +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. - */ - -#ifndef PART_DIALOG_H -#define PART_DIALOG_H - -/** - * @defgroup New_Part_Dialog New_Part_Dialog - * @ingroup Dialogs - * - * Show dialog window for choise part type. - */ - -#include "eflete.h" -#include "main_window.h" -#include "widget_manager.h" -#include "modal_window.h" -#include "widget_macro.h" -#include "image_editor.h" - -/** - * Add new dialog for choise part type add inwin object. - * - * @param parent The parent object. Its must be layout of main window - * object. - * @param groupspace The groupspace layout pointer. - * @return Pointer to inwin object. - * - * @ingroup New_Part_Dialog - */ -Evas_Object * -part_dialog_add(void); - -#endif /* PART_DIALOG_H */ diff --git a/src/bin/ui/dialogs/style_dialog.c b/src/bin/ui/dialogs/style_dialog.c deleted file mode 100644 index 24fef12..0000000 --- a/src/bin/ui/dialogs/style_dialog.c +++ /dev/null @@ -1,380 +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. - */ -#define EO_BETA_API -#define EFL_BETA_API_SUPPORT -#define EFL_EO_API_SUPPORT - -#include "style_dialog.h" -#include "common_macro.h" -#include "string_common.h" - -static Evas_Object *entry_class; -static Evas_Object *entry_style; -static Evas_Object *btn_add; -static Elm_Validator_Regexp *class_validator = NULL; -static Elm_Validator_Regexp *style_validator = NULL; - -TODO("outdated function because of eina_inlist of classes. Nope!") -static void -_reload_classes(Eina_Inlist *classes __UNUSED__) -{ -/* - Evas_Object *gl_classes = NULL; - const Evas_Object *nf = NULL; - Elm_Object_Item *eoi = NULL; - Ewe_Tabs_Item *class_tab = NULL; - Evas_Object *tabs = NULL; - - assert(classes != NULL); - - tabs = ui_block_widget_list_get(); - class_tab = ewe_tabs_active_item_get(tabs); - nf = ewe_tabs_item_content_get(tabs, class_tab); - eoi = elm_naviframe_top_item_get(nf); - gl_classes = elm_object_item_part_content_get(eoi, NULL); - - ui_widget_list_class_data_reload(gl_classes, classes); -*/ -} - -static void -_job_popup_close(void *data __UNUSED__) -{ - - elm_validator_regexp_free(class_validator); - elm_validator_regexp_free(style_validator); - class_validator = NULL; - style_validator = NULL; - evas_object_del(ap.popup); - ap.popup = NULL; - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, false); -} - -static void -_popup_close_cb(void *data, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - ecore_job_add(_job_popup_close, data); -} - -static void -_on_popup_btn_yes(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *ei __UNUSED__) -{ - Eina_Stringshare *style_name = NULL; - Eina_Stringshare *class_name = NULL; - Eina_Stringshare *full_name = NULL; - - Widget *dest_wdg = NULL; - Class *dest_class = NULL; - Style *dest_style = NULL; - - Widget *source_wdg = NULL; - Class *source_class = NULL; - Style *source_style = NULL; - - Widget *widget = NULL; - Style *style = NULL; - - Eina_Inlist *l =NULL; - Eina_List *styles = NULL; - - Evas_Object *widget_list = NULL, *eoi = NULL; - Style *_style_find = NULL; - -/* Evas_Object *tabs = NULL; */ - const Evas_Object *nf = NULL; - Elm_Object_Item *nf_item = NULL; -TODO("Ewe_Tabs should be removed... Everything is changed now") -/* Ewe_Tabs_Item *current_tab_item = NULL; */ - -#define STRING_CLEAR\ - eina_stringshare_del(style_name);\ - eina_stringshare_del(class_name);\ - - - widget = ui_widget_from_ap_get(); - - assert(widget != NULL); - - style_name = eina_stringshare_add(elm_entry_entry_get(entry_style)); - class_name = eina_stringshare_add(elm_entry_entry_get(entry_class)); - - full_name = eina_stringshare_printf("elm/%s/%s/%s", widget->name, class_name, - style_name); - - if (wm_style_object_find(ap.project->widgets, full_name)) - { - NOTIFY_WARNING(_("[%s] alredy exist. Type another style name."), - full_name); - STRING_CLEAR; - eina_stringshare_del(full_name); - return; - } - - EINA_INLIST_FOREACH_SAFE(ap.project->widgets, l, source_wdg) - { - if (!strcmp(source_wdg->name, widget->name)) break; - } - - if (!source_wdg) - { - NOTIFY_ERROR(_("Sorry, there are no templates for [%s]"), widget->name); - ecore_job_add(_job_popup_close, NULL); - STRING_CLEAR; - eina_stringshare_del(full_name); - return; - } - EINA_INLIST_FOREACH_SAFE(ap.project->widgets, l, dest_wdg) - { - if (!strcmp(dest_wdg->name, widget->name)) break; - } - - if (!dest_wdg) - { - STRING_CLEAR; - eina_stringshare_del(full_name); - return; - } - - /* Trying search same class in template with default style */ - EINA_INLIST_FOREACH_SAFE(source_wdg->classes, l, source_class) - { - if (!strcmp(source_class->name, class_name)) - { - EINA_INLIST_FOREACH_SAFE(source_class->styles, l, source_style) - { - if (!strcmp(source_style->name, "default")) break; - source_style = NULL; - } - break; - } - source_class = NULL; - } - - /* If not found same class in template, trying search base/default style - * for widget.*/ - if (!source_class) - { - EINA_INLIST_FOREACH_SAFE(source_wdg->classes, l, source_class) - { - if (!strcmp(source_class->name, "base")) - { - EINA_INLIST_FOREACH_SAFE(source_class->styles, l, source_style) - { - if (!strcmp(source_style->name, "default")) break; - source_style = NULL; - } - break; - } - source_class = NULL; - } - } - - /* If failed get base/default style from template file, get first style in class*/ - if (!source_style) - { - if (!source_class) - source_class = EINA_INLIST_CONTAINER_GET(source_wdg->classes, - Class); - source_style = EINA_INLIST_CONTAINER_GET(source_class->styles, - Style); - if ((!source_style) || (source_style->isAlias)) - { - STRING_CLEAR; - eina_stringshare_del(full_name); - return; - } - } - - - /* Trying search class in widget from current loaded theme. If that class - * does'nt exist, will create new class with name, which user type. */ - EINA_INLIST_FOREACH_SAFE(widget->classes, l, dest_class) - { - if (!strcmp(dest_class->name, class_name)) break; - dest_class = NULL; - } - - /* Trying create new class*/ - if (!dest_class) - { - dest_style = EINA_INLIST_CONTAINER_GET( - EINA_INLIST_CONTAINER_GET(widget->classes, Class)->styles, - Style); - styles = eina_list_append(styles, full_name); - dest_class = wm_class_add(class_name, styles, dest_wdg); - dest_wdg->classes = eina_inlist_append(dest_wdg->classes, - EINA_INLIST_GET(dest_class)); - style = EINA_INLIST_CONTAINER_GET(dest_class->styles, Style); - } - else - { - style = wm_style_add(style_name, full_name, STYLE, dest_class); - dest_class->styles = eina_inlist_append(dest_class->styles, - EINA_INLIST_GET(style)); - } - - if (!dest_style) - dest_style = EINA_INLIST_CONTAINER_GET(dest_class->styles, Style); - - - if (dest_style->isAlias) dest_style = dest_style->main_group; - - /* call method, which copy all parts and their params into new style */ - if (wm_style_copy(dest_style->obj, source_style->full_group_name, full_name, - ap.project->dev, style)) - { - //pm_save_to_dev(ap.project, source_style, true); - wm_style_data_load(style, evas_object_evas_get(ap.win), - ap.project->mmap_file); - _reload_classes(dest_wdg->classes); - //pm_save_to_dev(ap.project, style, true); - - /* Selecting added style in genlist! */ -/* tabs = ui_block_widget_list_get(); */ -TODO("Remove this old function") -/* - current_tab_item = ewe_tabs_active_item_get(tabs); - nf = ewe_tabs_item_content_get(tabs, current_tab_item); -*/ - nf_item = elm_naviframe_top_item_get(nf); - widget_list = elm_object_item_part_content_get(nf_item, NULL); - - eoi = elm_genlist_first_item_get(widget_list); - - _style_find = elm_object_item_data_get(eoi); - while (strcmp(_style_find->full_group_name, full_name) != 0) - { - eoi = elm_genlist_item_next_get(eoi); - _style_find = elm_object_item_data_get(eoi); - } - - elm_genlist_item_selected_set(eoi, true); - } - - //project_changed(true); - - STRING_CLEAR; - eina_stringshare_del(full_name); - ecore_job_add(_job_popup_close, NULL); -#undef STRING_CLEAR -} - -static void -_on_entry_changed(void *data __UNUSED__, - Evas_Object *obj __UNUSED__, - void *event_info __UNUSED__) -{ - if ((elm_validator_regexp_status_get(class_validator) != ELM_REG_NOERROR) || - (elm_validator_regexp_status_get(style_validator) != ELM_REG_NOERROR)) - elm_object_disabled_set(btn_add, true); - else - elm_object_disabled_set(btn_add, false); -} - -/* FIXME: change name to class_dialog_add */ -Eina_Bool -style_dialog_add() -{ - Evas_Object *box, *item, *button; - Widget *widget = NULL; - Class *class_st = NULL; - Eina_Stringshare *title = NULL; - Eina_Stringshare *entry_text = NULL; - Elm_Object_Item *glit = NULL; - Style *_style = NULL; - Evas_Object *nf = NULL; - - assert(class_validator == NULL); - assert(style_validator == NULL); - - widget = ui_widget_from_ap_get(); - class_validator = elm_validator_regexp_new(NAME_REGEX, NULL); - style_validator = elm_validator_regexp_new(NAME_REGEX, NULL); - - assert(widget != NULL); - - /* Checking if the source style is an alias. - We can't clone aliases right now, it need lots of difficult code for that. - */ - nf = ui_block_widget_list_get(); - nf = evas_object_data_get(nf, "nf_widgets"); - nf = elm_object_item_part_content_get(elm_naviframe_top_item_get(nf), - "elm.swallow.content"); - glit = elm_genlist_selected_item_get(nf); - if (glit) - { - _style = elm_object_item_data_get(glit); - if (_style->isAlias) return false; - } - - title = eina_stringshare_printf(_("Add style/class for \"%s\" widget"), - widget->name); - ap.popup = elm_popup_add(ap.win_layout); - elm_object_part_text_set(ap.popup, "title,text", title); - elm_popup_orient_set(ap.popup, ELM_POPUP_ORIENT_CENTER); - - BOX_ADD(ap.popup, box, false, false); - - class_st = ui_class_from_ap_get(); - entry_text = eina_stringshare_add(class_st->name); - - LAYOUT_PROP_ADD(box, _("Class name:"), "property", "1swallow") - ENTRY_ADD(box, entry_class, true); - eo_do(entry_class, eo_event_callback_add(ELM_ENTRY_EVENT_VALIDATE, elm_validator_regexp_helper, class_validator)); - elm_entry_entry_set(entry_class, entry_text); - evas_object_smart_callback_add(entry_class, "changed", _on_entry_changed, NULL); - elm_object_part_text_set(entry_class, "guide", _("Type a new class name")); - elm_object_part_content_set(item, "elm.swallow.content", entry_class); - elm_box_pack_end(box, item); - - LAYOUT_PROP_ADD(box, _("Style name:"), "property", "1swallow") - ENTRY_ADD(item, entry_style, true); - eo_do(entry_style, eo_event_callback_add(ELM_ENTRY_EVENT_VALIDATE, elm_validator_regexp_helper, style_validator)); - evas_object_smart_callback_add(entry_style, "changed", _on_entry_changed, NULL); - elm_object_part_text_set(entry_style, "guide", _("Type a new style name")); - elm_object_part_content_set(item, "elm.swallow.content", entry_style); - elm_box_pack_end(box, item); - - assert(class_st != NULL); - - elm_object_content_set(ap.popup, box); - - BUTTON_ADD(ap.popup, btn_add, _("Add")); - evas_object_smart_callback_add(btn_add, "clicked", _on_popup_btn_yes, NULL); - elm_object_part_content_set(ap.popup, "button1", btn_add); - elm_object_disabled_set(btn_add, true); - - BUTTON_ADD(ap.popup, button, _("Cancel")); - evas_object_smart_callback_add(button, "clicked", _popup_close_cb, NULL); - elm_object_part_content_set(ap.popup, "button2", button); - - ui_menu_items_list_disable_set(ap.menu, MENU_ITEMS_LIST_MAIN, true); - - evas_object_show(ap.popup); - elm_object_focus_set(entry_style, true); - - eina_stringshare_del(title); - eina_stringshare_del(entry_text); - - return true; -} diff --git a/src/bin/ui/dialogs/style_dialog.h b/src/bin/ui/dialogs/style_dialog.h deleted file mode 100644 index 5431f55..0000000 --- a/src/bin/ui/dialogs/style_dialog.h +++ /dev/null @@ -1,46 +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. - */ - -#ifndef STYLE_DIALOG_H -#define STYLE_DIALOG_H - -/** - * @defgroup New_Style_Dialog New_Style_Dialog - * @ingroup Dialogs - * - * Show dialog window for create new style and/or class. - */ - -#include "eflete.h" -#include "widget_manager.h" -#include "widget_macro.h" -#include "notify.h" -#include "ui_widget_list.h" - -/** - * Add new dialog for input params style and/or class, like names of style and class. - * - * @return EINA_TRUE if a dialog was added, else EINA_FALSE. - * - * @ingroup New_Style_Dialog - */ -Eina_Bool -style_dialog_add(void); - -#endif /* STYLE_DIALOG_H */ diff --git a/src/bin/ui/main_window.h b/src/bin/ui/main_window.h index 49ce546..806fe16 100644 --- a/src/bin/ui/main_window.h +++ b/src/bin/ui/main_window.h @@ -39,9 +39,6 @@ #include "notify.h" #include "string_common.h" -#include "part_dialog.h" -#include "style_dialog.h" -#include "item_dialog.h" #include "colorsel.h" #include "colorclass_manager.h" --