hermet pushed a commit to branch master. http://git.enlightenment.org/tools/enventor.git/commit/?id=3a60e771a685a2587fdaf49e3825d841dd922b74
commit 3a60e771a685a2587fdaf49e3825d841dd922b74 Author: ChunEon Park <her...@hermet.pe.kr> Date: Thu Feb 26 14:22:30 2015 +0900 bin/tools: add save button. --- data/themes/default/images.edc | 12 ++++++++ data/themes/default/images/Makefile.am | 3 +- data/themes/default/images/save.png | Bin 0 -> 2978 bytes src/bin/file_mgr.c | 26 +++++++++++++++++ src/bin/main.c | 27 +---------------- src/bin/tools.c | 52 ++++++++++++++++++++------------- src/include/file_mgr.h | 1 + 7 files changed, 73 insertions(+), 48 deletions(-) diff --git a/data/themes/default/images.edc b/data/themes/default/images.edc index 1a1c4f1..a38f963 100644 --- a/data/themes/default/images.edc +++ b/data/themes/default/images.edc @@ -9,6 +9,7 @@ images { image: "status.png" COMP; image: "swallow_s.png" COMP; image: "goto.png" COMP; + image: "save.png" COMP; image: "live_image.png" COMP; image: "live_rectangle.png" COMP; image: "live_swallow.png" COMP; @@ -139,6 +140,17 @@ group { name: "live_edit"; } } +group { name: "save"; + parts { + part { name: "img"; + type: IMAGE; + description { state: "default" 0.0; + image.normal: "save.png"; + } + } + } +} + #define ADD_LIVE_EDIT_ICON_GROUP(_group_name, _image_path) \ group { name: _group_name; \ parts { \ diff --git a/data/themes/default/images/Makefile.am b/data/themes/default/images/Makefile.am index 4181434..e0307d2 100644 --- a/data/themes/default/images/Makefile.am +++ b/data/themes/default/images/Makefile.am @@ -64,4 +64,5 @@ EXTRA_DIST = \ live_edit.png \ new.png \ slider_up.png \ - slider_down.png + slider_down.png \ + save.png diff --git a/data/themes/default/images/save.png b/data/themes/default/images/save.png new file mode 100755 index 0000000..25ca6da Binary files /dev/null and b/data/themes/default/images/save.png differ diff --git a/src/bin/file_mgr.c b/src/bin/file_mgr.c index 3255f43..b6d2663 100644 --- a/src/bin/file_mgr.c +++ b/src/bin/file_mgr.c @@ -146,6 +146,32 @@ file_mgr_edc_modified_get(void) return ((fmd->edc_modified == 2) ? EINA_TRUE : EINA_FALSE); } +void +file_mgr_edc_save(void) +{ + char buf[PATH_MAX]; + file_mgr_data *fmd = g_fmd; + + if (enventor_object_save(fmd->enventor, config_edc_path_get())) + { + if (config_stats_bar_get()) + { + snprintf(buf, sizeof(buf), "File saved. \"%s\"", + config_edc_path_get()); + } + } + else + { + if (config_stats_bar_get()) + { + snprintf(buf, sizeof(buf), "Already saved. \"%s\"", + config_edc_path_get()); + } + + } + stats_info_msg_update(buf); +} + Eina_Bool file_mgr_warning_is_opened(void) { diff --git a/src/bin/main.c b/src/bin/main.c index 72bd64c..7d5ad00 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -572,31 +572,6 @@ enventor_setup(app_data *ad) } static void -edc_save(app_data *ad) -{ - char buf[PATH_MAX]; - - if (enventor_object_save(ad->enventor, config_edc_path_get())) - { - if (config_stats_bar_get()) - { - snprintf(buf, sizeof(buf), "File saved. \"%s\"", - config_edc_path_get()); - } - } - else - { - if (config_stats_bar_get()) - { - snprintf(buf, sizeof(buf), "Already saved. \"%s\"", - config_edc_path_get()); - } - - } - stats_info_msg_update(buf); -} - -static void part_highlight_toggle(app_data *ad) { config_part_highlight_set(!config_part_highlight_get()); @@ -651,7 +626,7 @@ ctrl_func(app_data *ad, const char *key) //Save if (!strcmp(key, "s") || !strcmp(key, "S")) { - edc_save(ad); + file_mgr_edc_save(); return ECORE_CALLBACK_DONE; } //Delete Line diff --git a/src/bin/tools.c b/src/bin/tools.c index 840e051..a93d077 100644 --- a/src/bin/tools.c +++ b/src/bin/tools.c @@ -93,8 +93,15 @@ live_edit_cb(void *data, Evas_Object *obj, void *event_info) live_edit_toggle(); } +static void +save_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, + void *event_info EINA_UNUSED) +{ + file_mgr_edc_save(); +} + static Evas_Object * -tools_btn_create(Evas_Object *parent, const char *icon, const char *label, +tools_btn_create(Evas_Object *parent, const char *icon, const char *tooltip_msg, Evas_Smart_Cb func, void *data) { Evas_Object *btn = elm_button_add(parent); @@ -107,7 +114,6 @@ tools_btn_create(Evas_Object *parent, const char *icon, const char *label, elm_image_file_set(img, EDJE_PATH, icon); elm_object_content_set(btn, img); - elm_object_text_set(btn, label); evas_object_smart_callback_add(btn, "clicked", func, data); evas_object_show(btn); @@ -125,7 +131,7 @@ tools_create(Evas_Object *parent, Evas_Object *enventor) evas_object_size_hint_align_set(box, EVAS_HINT_FILL, EVAS_HINT_FILL); Evas_Object *btn; - btn = tools_btn_create(box, "menu", "Menu", "Enventor Menu (Esc)", + btn = tools_btn_create(box, "menu", "Enventor Menu (Esc)", menu_cb, enventor); elm_object_tooltip_orient_set(btn, ELM_TOOLTIP_ORIENT_BOTTOM_RIGHT); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); @@ -137,60 +143,64 @@ tools_create(Evas_Object *parent, Evas_Object *enventor) evas_object_show(sp); elm_box_pack_end(box, sp); - btn = tools_btn_create(box, "highlight", "Highlight", - "Part Highlighting (Ctrl + H)", - highlight_cb, enventor); + btn = tools_btn_create(box, "save","Save File (Ctrl + S)", + save_cb, enventor); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); - btn = tools_btn_create(box, "swallow_s", "Swallow", - "Dummy Swallow (Ctrl + W)", swallow_cb, enventor); + btn = tools_btn_create(box, "find", "Find/Replace (Ctrl + F)", + find_cb, enventor); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); - btn = tools_btn_create(box, "live_edit", "LiveEdit", - "Live View Edit (Ctrl + E)", live_edit_cb, NULL); + btn = tools_btn_create(box, "line", "Goto Lines (Ctrl + L)", + goto_cb, enventor); + evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(box, btn); + + btn = tools_btn_create(box, "lines", "Line Numbers (F5)", + lines_cb, enventor); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); - evas_object_data_set(box, "live_edit", btn); sp = elm_separator_add(box); evas_object_show(sp); elm_box_pack_end(box, sp); - btn = tools_btn_create(box, "lines", "Lines", "Line Numbers (F5)", - lines_cb, enventor); + btn = tools_btn_create(box, "highlight", "Part Highlighting (Ctrl + H)", + highlight_cb, enventor); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); - btn = tools_btn_create(box, "find", "Find", "Find/Replace (Ctrl + F)", - find_cb, enventor); + btn = tools_btn_create(box, "swallow_s", "Dummy Swallow (Ctrl + W)", + swallow_cb, enventor); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); - btn = tools_btn_create(box, "line", "Goto", "Goto Lines (Ctrl + L)", - goto_cb, enventor); + btn = tools_btn_create(box, "live_edit", "Live View Edit (Ctrl + E)", + live_edit_cb, NULL); evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 0.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); + evas_object_data_set(box, "live_edit", btn); sp = elm_separator_add(box); evas_object_show(sp); elm_box_pack_end(box, sp); - btn = tools_btn_create(box, "console", "Console", - "Console Box (Ctrl + Down)", console_cb, NULL); + btn = tools_btn_create(box, "console", "Console Box (Ctrl + Down)", + console_cb, NULL); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 1.0, EVAS_HINT_FILL); elm_box_pack_end(box, btn); - btn = tools_btn_create(box, "status", "Status", "Status (F11)", status_cb, - NULL); + btn = tools_btn_create(box, "status", "Status (F11)", status_cb, NULL); elm_object_tooltip_orient_set(btn, ELM_TOOLTIP_ORIENT_BOTTOM_LEFT); evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(btn, 1.0, EVAS_HINT_FILL); diff --git a/src/include/file_mgr.h b/src/include/file_mgr.h index 72395c2..1ddc859 100644 --- a/src/include/file_mgr.h +++ b/src/include/file_mgr.h @@ -5,3 +5,4 @@ void file_mgr_init(Evas_Object *enventor); void file_mgr_term(void); int file_mgr_edc_modified_get(void); void file_mgr_reset(void); +void file_mgr_edc_save(void); --