hotkeys - redesign ui

This commit is contained in:
ChunEon Park 2014-03-08 22:55:48 +09:00
parent edb20219b8
commit dc3ce7be3f
27 changed files with 147 additions and 207 deletions

27
README
View File

@ -36,27 +36,20 @@ Once you have met requirements, compiling and installing is simple:
[Short Cut Keys]
Esc = Open/Close Menu
F1 = Help
F1 = About
F2 = New
F3 = Save
F4 = Load
F5 = Show/Hide Line Number
F6 = Show/Hide Status
F12 = Setting
Ctrl+S = Quick Save + Compile EDC
Ctrl+A = Select Text All
Ctrl+Double Click = Select a word
Ctrl+C = Copy Selected Text
Ctrl+V = Paste Copied Text
Ctrl+X = Cut Selected Text
Ctrl+F = Find/Replace
Ctrl+I = On/Off Auto Indentation
Ctrl+Home = Go to the Top line
Ctrl+End = Go to the Bottom line
Ctrl+H = Part Highlighting
Ctrl+W = Show/Hide Dummy Swallow
Ctrl+H = On/Off Part Highlighting
Ctrl+, = Full Edit View / Split View
Ctrl+. = Full Edje View / Split View
Ctrl+W = Show/Hide Dummy Swallow Object
Ctrl++ = Font Size Up
Ctrl+- = Font Size Down
Ctrl+T = Insert Defaut Template Code
@ -68,7 +61,17 @@ Ctrl+Shift+R = Insert Part Template Code: Rectangle
Ctrl+Shift+T = Insert Part Template Code: Text
Ctrl+Shift+S = Insert Part Template Code: Spacer
Ctrl+Shift+W = Insert Part Template Code: Swallow
Ctrl+A = Select Text All
Ctrl+Double Click = Select a word
Ctrl+C = Copy Selected Text
Ctrl+V = Paste Copied Text
Ctrl+X = Cut Selected Text
Ctrl+F = Find/Replace
Ctrl+Home = Go to the Top line
Ctrl+End = Go to the Bottom line
[Command Line Usage]
enventor --help

View File

@ -1,6 +1,15 @@
MAINTAINERCLEANFILES = Makefile.in
filesdir = $(datadir)/$(PACKAGE)/images
files_DATA = logo.png
files_DATA = logo.png \
about.png \
new.png \
file.png \
highlight.png \
swallow.png \
status.png \
lines.png \
find.png \
setting.png
EXTRA_DIST = $(files_DATA)

View File

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 876 B

BIN
data/images/file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

BIN
data/images/find.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

BIN
data/images/highlight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

BIN
data/images/lines.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 569 B

BIN
data/images/new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

BIN
data/images/setting.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 772 B

BIN
data/images/status.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 B

BIN
data/images/swallow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

View File

@ -6,92 +6,7 @@ images {
image: "panes_recover_arrow.png" COMP;
image: "hotkeys_open.png" COMP;
image: "hotkeys_close.png" COMP;
image: "logo_s.png" COMP;
image: "new.png" COMP;
image: "load.png" COMP;
image: "save.png" COMP;
image: "lines.png" COMP;
image: "setting.png" COMP;
image: "status.png" COMP;
}
group { name: "status";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "status.png";
}
}
}
}
group { name: "setting";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "setting.png";
}
}
}
}
group { name: "lines";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "lines.png";
}
}
}
}
group { name: "save";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "save.png";
}
}
}
}
group { name: "load";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "load.png";
}
}
}
}
group { name: "new";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "new.png";
}
}
}
}
group { name: "logo";
parts {
part { name: "img";
type: IMAGE;
description { state: "default" 0.0;
image.normal: "logo_s.png";
}
}
}
}
group { name: "hotkeys_open";
parts {
part { name: "img";

View File

@ -39,7 +39,6 @@ EXTRA_DIST = \
runner_vert.png \
sb_runnerh.png \
sb_runnerv.png \
setting_icon.png \
shadow_square_tiny.png \
shine.png \
sl_bt2_2.png \
@ -59,12 +58,4 @@ EXTRA_DIST = \
panes_recover_arrow.png \
hotkeys_close.png \
hotkeys_open.png \
pm_fill.png \
logo_s.png \
new.png \
load.png \
save.png \
lines.png \
setting.png \
status.png \
hotkey_inset_light.png
pm_fill.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 B

View File

@ -4,10 +4,6 @@ styles {
}
}
images {
image: "hotkey_inset_light.png" COMP;
}
group { name: "search";
parts {
part { name: "base";
@ -471,18 +467,6 @@ group { name: "main_layout";
align: 0.5 0;
}
}
part { name: "hotkey_overlay";
type: IMAGE;
scale: 1;
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "elm.swallow.hotkeys";
rel2.to: "elm.swallow.hotkeys";
image.normal: "hotkey_inset_light.png";
image.border: 0 0 0 1;
image.border_scale: 1;
}
}
part { name: "elm.swallow.panes";
type: SWALLOW;
scale: 1;

View File

@ -861,3 +861,18 @@ edit_font_size_update(edit_data *ed, Eina_Bool msg)
snprintf(buf, sizeof(buf), "Font Size: %1.1fx", config_font_size_get());
stats_info_msg_update(buf);
}
void
edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg)
{
Eina_Bool highlight = config_part_highlight_get();
if (highlight) edit_view_sync(ed);
else view_part_highlight_set(VIEW_DATA, NULL);
if (!msg) return;
if (highlight)
stats_info_msg_update("Part Highlighting Enabled.");
else
stats_info_msg_update("Part Highlighting Disabled.");
}

View File

@ -1,106 +1,129 @@
#include <Elementary.h>
#include "common.h"
#define TOOLBAR_ICON_SIZE 16
static void
f1_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
Eina_Bool
unselect_anim_cb(void *data)
{
menu_about();
Elm_Object_Item *it = data;
elm_toolbar_item_selected_set(it, EINA_FALSE);
return ECORE_CALLBACK_CANCEL;
}
static void
f2_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
item_unselect(Elm_Object_Item *it)
{
ecore_timer_add(0.1, unselect_anim_cb, it);
}
static void
f2_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
menu_edc_new();
item_unselect((Elm_Object_Item *)event_info);
}
static void
f3_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
f3_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
menu_edc_save();
item_unselect((Elm_Object_Item *)event_info);
}
static void
f4_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
f4_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
menu_edc_load();
item_unselect((Elm_Object_Item *)event_info);
}
static void
f5_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
f5_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
edit_data *ed = data;
config_part_highlight_set(!config_part_highlight_get());
edit_part_highlight_toggle(ed, EINA_TRUE);
item_unselect((Elm_Object_Item *)event_info);
}
static void
f6_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
config_dummy_swallow_set(!config_dummy_swallow_get());
view_dummy_toggle(VIEW_DATA, EINA_TRUE);
item_unselect((Elm_Object_Item *)event_info);
}
static void
f9_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
{
edit_data *ed = data;
config_linenumber_set(!config_linenumber_get());
edit_line_number_toggle(ed);
item_unselect((Elm_Object_Item *)event_info);
}
static void
f6_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
f10_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
config_stats_bar_set(!config_stats_bar_get());
base_statusbar_toggle();
item_unselect((Elm_Object_Item *)event_info);
}
static void
f12_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
f11_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
menu_setting();
if (search_is_opened()) search_close();
else search_open();
item_unselect((Elm_Object_Item *)event_info);
}
static Evas_Object *
btn_create(Evas_Object *parent, const char *text, Evas_Smart_Cb cb, void *data, const char *img_name)
static void
f12_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
{
Evas_Object *btn = elm_button_add(parent);
elm_object_style_set(btn, "anchor");
elm_object_text_set(btn, text);
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(btn, 0.5, 0);
elm_object_focus_allow_set(btn, EINA_FALSE);
evas_object_smart_callback_add(btn, "clicked", cb, data);
evas_object_show(btn);
Evas_Object *img = elm_image_add(btn);
elm_image_file_set(img, EDJE_PATH, img_name);
elm_object_content_set(btn, img);
return btn;
menu_setting();
item_unselect((Elm_Object_Item *)event_info);
}
Evas_Object *
hotkeys_create(Evas_Object *parent, edit_data *ed)
{
Evas_Object *box = elm_box_add(parent);
elm_box_horizontal_set(box, EINA_TRUE);
Evas_Object *toolbar = elm_toolbar_add(parent);
elm_object_style_set(toolbar, "item_horizontal");
elm_toolbar_icon_size_set(toolbar,
TOOLBAR_ICON_SIZE * elm_config_scale_get());
elm_toolbar_transverse_expanded_set(toolbar, EINA_TRUE);
elm_toolbar_homogeneous_set(toolbar, EINA_FALSE);
elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
evas_object_size_hint_weight_set(toolbar, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(toolbar, EVAS_HINT_FILL, EVAS_HINT_FILL);
elm_object_focus_allow_set(toolbar, EINA_FALSE);
Evas_Object *btn;
Elm_Object_Item *it;
Evas_Object *icon;
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%s/images/new.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "New", f2_cb, NULL);
snprintf(buf, sizeof(buf), "%s/images/file.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Save", f3_cb, NULL);
snprintf(buf, sizeof(buf), "%s/images/file.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Load", f4_cb, NULL);
snprintf(buf, sizeof(buf), "%s/images/highlight.png",
elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Highlight", f5_cb, ed);
snprintf(buf, sizeof(buf), "%s/images/swallow.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Swallow", f6_cb, NULL);
snprintf(buf, sizeof(buf), "%s/images/lines.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Lines", f9_cb, ed);
snprintf(buf, sizeof(buf), "%s/images/status.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Status", f10_cb, NULL);
snprintf(buf, sizeof(buf), "%s/images/find.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Find", f11_cb, NULL);
snprintf(buf, sizeof(buf), "%s/images/setting.png", elm_app_data_dir_get());
it = elm_toolbar_item_append(toolbar, buf, "Setting", f12_cb, NULL);
btn = btn_create(box, "About", f1_cb, NULL, "logo");
elm_box_pack_end(box, btn);
btn = btn_create(box, "New", f2_cb, NULL, "new");
elm_box_pack_end(box, btn);
btn = btn_create(box, "Save", f3_cb, NULL, "save");
elm_box_pack_end(box, btn);
btn = btn_create(box, "Load", f4_cb, NULL, "load");
elm_box_pack_end(box, btn);
btn = btn_create(box, "Lines", f5_cb, ed, "lines");
elm_box_pack_end(box, btn);
btn = btn_create(box, "Status", f6_cb, NULL, "status");
elm_box_pack_end(box, btn);
btn = btn_create(box, "Setting", f12_cb, NULL, "setting");
elm_box_pack_end(box, btn);
return box;
return toolbar;
}

View File

@ -77,21 +77,6 @@ main_key_up_cb(void *data, int type EINA_UNUSED, void *ev)
return ECORE_CALLBACK_PASS_ON;
}
static void
part_highlight_toggle(app_data *ad, Eina_Bool msg)
{
Eina_Bool highlight = config_part_highlight_get();
if (highlight) edit_view_sync(ad->ed);
else view_part_highlight_set(VIEW_DATA, NULL);
if (!msg) return;
if (highlight)
stats_info_msg_update("Part Highlighting Enabled.");
else
stats_info_msg_update("Part Highlighting Disabled.");
}
static void
auto_indentation_toggle()
{
@ -168,17 +153,11 @@ ctrl_func(app_data *ad, const char *key)
search_open();
return ECORE_CALLBACK_DONE;
}
//Template Code
if (!strcmp(key, "t") || !strcmp(key, "T"))
{
edit_template_insert(ad->ed);
return ECORE_CALLBACK_DONE;
}
//Part Highlight
if (!strcmp(key, "h") || !strcmp(key, "H"))
if (!strcmp(key, "h") || !strcmp(key, "h"))
{
config_part_highlight_set(!config_part_highlight_get());
part_highlight_toggle(ad, EINA_TRUE);
config_part_highlight_set(!config_part_highlight_get());
edit_part_highlight_toggle(ad->ed, EINA_TRUE);
return ECORE_CALLBACK_DONE;
}
//Swallow Dummy Object
@ -188,6 +167,12 @@ ctrl_func(app_data *ad, const char *key)
view_dummy_toggle(VIEW_DATA, EINA_TRUE);
return ECORE_CALLBACK_DONE;
}
//Template Code
if (!strcmp(key, "t") || !strcmp(key, "T"))
{
edit_template_insert(ad->ed);
return ECORE_CALLBACK_DONE;
}
//Full Edit View
if (!strcmp(key, "comma"))
{
@ -289,6 +274,20 @@ main_key_down_cb(void *data, int type EINA_UNUSED, void *ev)
menu_edc_load();
return ECORE_CALLBACK_DONE;
}
//Part Highlight
if (!strcmp(event->key, "F5"))
{
config_part_highlight_set(!config_part_highlight_get());
edit_part_highlight_toggle(ad->ed, EINA_TRUE);
return ECORE_CALLBACK_DONE;
}
//Swallow Dummy Object
if (!strcmp(event->key, "F6"))
{
config_dummy_swallow_set(!config_dummy_swallow_get());
view_dummy_toggle(VIEW_DATA, EINA_TRUE);
return ECORE_CALLBACK_DONE;
}
//Line Number
if (!strcmp(event->key, "F5"))
{
@ -388,7 +387,7 @@ config_update_cb(void *data)
edit_font_size_update(ad->ed, EINA_FALSE);
base_statusbar_toggle();
part_highlight_toggle(ad, EINA_FALSE);
edit_part_highlight_toggle(ad->ed, EINA_TRUE);
view_dummy_toggle(VIEW_DATA, EINA_FALSE);
//previous build was failed, Need to rebuild then reload the edj.

View File

@ -14,3 +14,4 @@ void edit_view_sync(edit_data *ed);
void edit_font_size_update(edit_data *ed, Eina_Bool msg);
void edit_template_insert(edit_data *ed);
void edit_template_part_insert(edit_data *ed, Edje_Part_Type type);
void edit_part_highlight_toggle(edit_data *ed, Eina_Bool msg);