bin/tools: add save button.

This commit is contained in:
ChunEon Park 2015-02-26 14:22:30 +09:00
parent e76fa5a666
commit 3a60e771a6
7 changed files with 88 additions and 63 deletions

View File

@ -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 { \

View File

@ -64,4 +64,5 @@ EXTRA_DIST = \
live_edit.png \
new.png \
slider_up.png \
slider_down.png
slider_down.png \
save.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -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)
{

View File

@ -571,31 +571,6 @@ enventor_setup(app_data *ad)
ad->enventor = enventor;
}
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)
{
@ -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

View File

@ -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,22 +143,49 @@ 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)",
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, "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, "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);
sp = elm_separator_add(box);
evas_object_show(sp);
elm_box_pack_end(box, sp);
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, "swallow_s", "Swallow",
"Dummy Swallow (Ctrl + W)", swallow_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, "live_edit", "LiveEdit",
"Live View Edit (Ctrl + E)", live_edit_cb, NULL);
evas_object_size_hint_weight_set(btn, 0, EVAS_HINT_EXPAND);
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);
@ -161,36 +194,13 @@ tools_create(Evas_Object *parent, Evas_Object *enventor)
evas_object_show(sp);
elm_box_pack_end(box, sp);
btn = tools_btn_create(box, "lines", "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);
btn = tools_btn_create(box, "find", "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, "line", "Goto", "Goto Lines (Ctrl + L)",
goto_cb, enventor);
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);
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);

View File

@ -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);