From da302649298f40a3b586e468bb44a24b4bed2735 Mon Sep 17 00:00:00 2001 From: Al Poole Date: Tue, 22 Aug 2017 12:41:05 +0100 Subject: [PATCH] popups: improve visual display/style of the main popup widgets. Reviewers: ajwillia.ms Differential Revision: https://phab.enlightenment.org/D5117 --- src/bin/editor/edi_editor.c | 2 +- src/bin/mainview/edi_mainview.c | 34 +++++++++-- src/bin/screens/edi_file_screens.c | 96 ++++++++++++++++++++++++++---- src/bin/screens/edi_screens.c | 15 ++++- 4 files changed, 127 insertions(+), 20 deletions(-) diff --git a/src/bin/editor/edi_editor.c b/src/bin/editor/edi_editor.c index 853a590..27e581b 100644 --- a/src/bin/editor/edi_editor.c +++ b/src/bin/editor/edi_editor.c @@ -76,7 +76,7 @@ _edi_editor_file_change_popup(Evas_Object *parent, Edi_Editor *editor) table = elm_table_add(editor->popup); icon = elm_icon_add(table); elm_icon_standard_set(icon, "dialog-warning"); - evas_object_size_hint_min_set(icon, 47 * elm_config_scale_get(), 48 * elm_config_scale_get()); + evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get()); evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(icon); diff --git a/src/bin/mainview/edi_mainview.c b/src/bin/mainview/edi_mainview.c index 91fe347..7035bcb 100644 --- a/src/bin/mainview/edi_mainview.c +++ b/src/bin/mainview/edi_mainview.c @@ -509,25 +509,49 @@ _edi_mainview_project_search_popup_key_up_cb(void *data EINA_UNUSED, Evas *e EIN void edi_mainview_project_search_popup_show(void) { - Evas_Object *popup, *box, *input, *button; + Evas_Object *table, *popup, *box, *input, *button, *sep, *label, *icon; popup = elm_popup_add(_main_win); _edi_mainview_search_project_popup = popup; elm_object_part_text_set(popup, "title,text", - "Search for"); + "Search for (whole project)"); + + table = elm_table_add(popup); + icon = elm_icon_add(table); + elm_icon_standard_set(icon, "system-search"); + evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get()); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(icon); + elm_table_pack(table, icon, 0, 0, 1, 1); box = elm_box_add(popup); - elm_box_horizontal_set(box, EINA_FALSE); - elm_object_content_set(popup, box); + label = elm_label_add(popup); + elm_object_text_set(label, "Please enter a term to search for within
the whole prject."); + evas_object_show(label); + + elm_box_pack_end(box, label); input = elm_entry_add(box); elm_entry_single_line_set(input, EINA_TRUE); + elm_entry_editable_set(input, EINA_TRUE); elm_entry_scrollable_set(input, EINA_TRUE); - evas_object_event_callback_add(input, EVAS_CALLBACK_KEY_UP, _edi_mainview_project_search_popup_key_up_cb, NULL); evas_object_size_hint_weight_set(input, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_event_callback_add(input, EVAS_CALLBACK_KEY_UP, _edi_mainview_project_search_popup_key_up_cb, NULL); evas_object_show(input); elm_box_pack_end(box, input); + evas_object_show(box); + + sep = elm_separator_add(box); + elm_separator_horizontal_set(sep, EINA_TRUE); + evas_object_show(sep); + + elm_box_pack_end(box, sep); + elm_table_pack(table, box, 1, 0, 1, 1); + evas_object_show(table); + + elm_object_content_set(popup, table); button = elm_button_add(popup); elm_object_text_set(button, "cancel"); diff --git a/src/bin/screens/edi_file_screens.c b/src/bin/screens/edi_file_screens.c index 110b20a..7ab64e2 100644 --- a/src/bin/screens/edi_file_screens.c +++ b/src/bin/screens/edi_file_screens.c @@ -165,7 +165,7 @@ _edi_file_screens_rename_cb(void *data, void edi_file_screens_rename(Evas_Object *parent, const char *path) { - Evas_Object *popup, *box, *input, *button; + Evas_Object *table, *popup, *box, *input, *button, *sep, *label, *icon; const char *leaf; _parent_obj = parent; @@ -180,9 +180,25 @@ edi_file_screens_rename(Evas_Object *parent, const char *path) leaf = ecore_file_file_get(path); _directory_path = eina_stringshare_add(ecore_file_dir_get(path)); + + table = elm_table_add(popup); + icon = elm_icon_add(table); + elm_icon_standard_set(icon, "dialog-information"); + evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get()); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(icon); + elm_table_pack(table, icon, 0, 0, 1, 1); + box = elm_box_add(popup); - elm_box_horizontal_set(box, EINA_FALSE); - elm_object_content_set(popup, box); + label = elm_label_add(popup); + if (ecore_file_is_dir(path)) + elm_object_text_set(label, "Please enter a new name for this directory."); + else + elm_object_text_set(label, "Please enter a new name for this file."); + evas_object_show(label); + + elm_box_pack_end(box, label); input = elm_entry_add(box); elm_entry_single_line_set(input, EINA_TRUE); @@ -193,6 +209,16 @@ edi_file_screens_rename(Evas_Object *parent, const char *path) evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(input); elm_box_pack_end(box, input); + evas_object_show(box); + + sep = elm_separator_add(box); + elm_separator_horizontal_set(sep, EINA_TRUE); + evas_object_show(sep); + elm_box_pack_end(box, sep); + elm_table_pack(table, box, 1, 0, 1, 1); + evas_object_show(table); + + elm_object_content_set(popup, table); button = elm_button_add(popup); elm_object_text_set(button, "cancel"); @@ -214,7 +240,7 @@ edi_file_screens_rename(Evas_Object *parent, const char *path) void edi_file_screens_create_file(Evas_Object *parent, const char *directory) { - Evas_Object *popup, *box, *input, *button; + Evas_Object *table, *popup, *box, *input, *button, *sep, *label, *icon; _parent_obj = parent; _popup = popup = elm_popup_add(parent); @@ -222,17 +248,41 @@ edi_file_screens_create_file(Evas_Object *parent, const char *directory) "Enter new file name"); _directory_path = eina_stringshare_add(directory); + table = elm_table_add(popup); + icon = elm_icon_add(table); + elm_icon_standard_set(icon, "document-new"); + evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get()); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(icon); + elm_table_pack(table, icon, 0, 0, 1, 1); + box = elm_box_add(popup); - elm_box_horizontal_set(box, EINA_FALSE); - elm_object_content_set(popup, box); + label = elm_label_add(popup); + elm_object_text_set(label, "Please enter a name for this new file."); + evas_object_show(label); + + elm_box_pack_end(box, label); input = elm_entry_add(box); elm_entry_single_line_set(input, EINA_TRUE); + elm_entry_editable_set(input, EINA_TRUE); elm_entry_scrollable_set(input, EINA_TRUE); - evas_object_size_hint_weight_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(input, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(input); elm_box_pack_end(box, input); + evas_object_show(box); + + sep = elm_separator_add(box); + elm_separator_horizontal_set(sep, EINA_TRUE); + evas_object_show(sep); + + elm_box_pack_end(box, sep); + elm_table_pack(table, box, 1, 0, 1, 1); + evas_object_show(table); + + elm_object_content_set(popup, table); button = elm_button_add(popup); elm_object_text_set(button, "cancel"); @@ -253,7 +303,7 @@ edi_file_screens_create_file(Evas_Object *parent, const char *directory) void edi_file_screens_create_dir(Evas_Object *parent, const char *directory) { - Evas_Object *popup, *box, *input, *button; + Evas_Object *table, *popup, *box, *input, *button, *sep, *label, *icon; _parent_obj = parent; _directory_path = eina_stringshare_add(directory); @@ -262,17 +312,41 @@ edi_file_screens_create_dir(Evas_Object *parent, const char *directory) elm_object_part_text_set(popup, "title,text", "Enter new directory name"); + table = elm_table_add(popup); + icon = elm_icon_add(table); + elm_icon_standard_set(icon, "folder-new"); + evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get()); + evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(icon); + elm_table_pack(table, icon, 0, 0, 1, 1); + box = elm_box_add(popup); - elm_box_horizontal_set(box, EINA_FALSE); - elm_object_content_set(popup, box); + label = elm_label_add(popup); + elm_object_text_set(label, "Please enter a name for this new directory."); + evas_object_show(label); + + elm_box_pack_end(box, label); input = elm_entry_add(box); elm_entry_single_line_set(input, EINA_TRUE); + elm_entry_editable_set(input, EINA_TRUE); elm_entry_scrollable_set(input, EINA_TRUE); - evas_object_size_hint_weight_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(input, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(input, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(input); elm_box_pack_end(box, input); + evas_object_show(box); + + sep = elm_separator_add(box); + elm_separator_horizontal_set(sep, EINA_TRUE); + evas_object_show(sep); + + elm_box_pack_end(box, sep); + elm_table_pack(table, box, 1, 0, 1, 1); + evas_object_show(table); + + elm_object_content_set(popup, table); button = elm_button_add(popup); elm_object_text_set(button, "cancel"); diff --git a/src/bin/screens/edi_screens.c b/src/bin/screens/edi_screens.c index 4df3a1d..1a5eab9 100644 --- a/src/bin/screens/edi_screens.c +++ b/src/bin/screens/edi_screens.c @@ -34,7 +34,7 @@ _edi_screens_message_confirm_cb(void *data, Evas_Object *obj, void edi_screens_message_confirm(Evas_Object *parent, const char *message, void ((*confirm_cb)(void *)), void *data) { - Evas_Object *popup, *table, *label, *button, *icon; + Evas_Object *popup, *table, *label, *button, *icon, *box, *sep; _edi_screens_popup = popup = elm_popup_add(parent); elm_object_part_text_set(popup, "title,text", "Confirmation required"); @@ -42,17 +42,26 @@ void edi_screens_message_confirm(Evas_Object *parent, const char *message, void table = elm_table_add(popup); icon = elm_icon_add(table); - elm_icon_standard_set(icon, "dialog-warning"); + elm_icon_standard_set(icon, "dialog-question"); evas_object_size_hint_min_set(icon, 48 * elm_config_scale_get(), 48 * elm_config_scale_get()); evas_object_size_hint_weight_set(icon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(icon, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_show(icon); elm_table_pack(table, icon, 0, 0, 1, 1); + box = elm_box_add(popup); label = elm_label_add(table); elm_object_text_set(label, message); evas_object_show(label); - elm_table_pack(table, label, 1, 0, 1, 1); + elm_box_pack_end(box, label); + + sep = elm_separator_add(box); + elm_separator_horizontal_set(sep, EINA_TRUE); + evas_object_show(sep); + elm_box_pack_end(box, sep); + evas_object_show(box); + + elm_table_pack(table, box, 1, 0, 1, 1); elm_object_content_set(popup, table); evas_object_show(table);