forked from enlightenment/enventor
hotkeys - add a trigger button for hotkey gui enable/disable
This commit is contained in:
parent
0f8a545b48
commit
3aefa8ff8a
|
@ -4,6 +4,18 @@ images {
|
|||
image: "panes_left_arrow.png" COMP;
|
||||
image: "panes_right_arrow.png" COMP;
|
||||
image: "panes_recover_arrow.png" COMP;
|
||||
image: "hotkeys.png" COMP;
|
||||
}
|
||||
|
||||
group { name: "hotkeys";
|
||||
parts {
|
||||
part { name: "img";
|
||||
type: IMAGE;
|
||||
description { state: "default" 0.0;
|
||||
image.normal: "hotkeys.png";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group { name: "plus_img";
|
||||
|
|
|
@ -58,4 +58,5 @@ EXTRA_DIST = \
|
|||
white_bar_vert_glow.png \
|
||||
panes_left_arrow.png \
|
||||
panes_right_arrow.png \
|
||||
panes_recover_arrow.png
|
||||
panes_recover_arrow.png \
|
||||
hotkeys.png
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 486 B |
|
@ -271,6 +271,10 @@ group { name: "main_layout";
|
|||
fixed: 0 1;
|
||||
align: 0.5 0;
|
||||
}
|
||||
description { state: "hide" 0.0;
|
||||
inherit: "default";
|
||||
align: 0.5 1;
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.panes";
|
||||
type: SWALLOW;
|
||||
|
@ -320,6 +324,19 @@ group { name: "main_layout";
|
|||
target: "statusbar_clip";
|
||||
transition: DECELERATE 0.35;
|
||||
}
|
||||
program { name: "hotkeys_show";
|
||||
signal: "elm,state,hotkeys,show";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.swallow.hotkeys";
|
||||
transition: DECELERATE 0.35;
|
||||
}
|
||||
program { name: "hotkeys_hide";
|
||||
signal: "elm,state,hotkeys,hide";
|
||||
action: STATE_SET "hide" 0.0;
|
||||
target: "elm.swallow.hotkeys";
|
||||
transition: DECELERATE 0.35;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2142,6 +2142,18 @@ group { name: "elm/panes/vertical/enventor";
|
|||
rel2.to: "bar";
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.hotkeys";
|
||||
type: SWALLOW;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
min: 20 20;
|
||||
fixed: 1 1;
|
||||
align: 0.5 0;
|
||||
rel1.to: "bar";
|
||||
rel2.to: "bar";
|
||||
rel2.relative: 1 0;
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.left_arrow";
|
||||
type: SWALLOW;
|
||||
scale: 1;
|
||||
|
|
|
@ -27,6 +27,7 @@ struct config_s
|
|||
Eina_Bool part_highlight : 1;
|
||||
Eina_Bool dummy_swallow : 1;
|
||||
Eina_Bool auto_indent : 1;
|
||||
Eina_Bool hotkeys : 1;
|
||||
};
|
||||
|
||||
static config_data *g_cd = NULL;
|
||||
|
@ -78,6 +79,7 @@ config_init(const char *edc_path, const char *edc_img_path,
|
|||
cd->part_highlight = EINA_TRUE;
|
||||
cd->dummy_swallow = EINA_TRUE;
|
||||
cd->auto_indent = EINA_TRUE;
|
||||
cd->hotkeys = EINA_TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -514,3 +516,17 @@ config_view_size_get(Evas_Coord *w, Evas_Coord *h)
|
|||
if (w) *w = cd->view_size.w;
|
||||
if (h) *h = cd->view_size.h;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
config_hotkeys_get()
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
return cd->hotkeys;
|
||||
}
|
||||
|
||||
void
|
||||
config_hotkeys_set(Eina_Bool enabled)
|
||||
{
|
||||
config_data *cd = g_cd;
|
||||
cd->hotkeys = enabled;
|
||||
}
|
||||
|
|
|
@ -99,23 +99,18 @@ hotkeys_create(Evas_Object *parent, app_data *ad, edit_data *ed)
|
|||
elm_box_pack_end(box, btn);
|
||||
|
||||
btn = btn_create(box, "F7: ---", NULL, NULL);
|
||||
elm_object_disabled_set(btn, EINA_TRUE);
|
||||
elm_box_pack_end(box, btn);
|
||||
|
||||
btn = btn_create(box, "F8: ---", NULL, NULL);
|
||||
elm_object_disabled_set(btn, EINA_TRUE);
|
||||
elm_box_pack_end(box, btn);
|
||||
|
||||
btn = btn_create(box, "F9: ---", NULL, NULL);
|
||||
elm_object_disabled_set(btn, EINA_TRUE);
|
||||
elm_box_pack_end(box, btn);
|
||||
|
||||
btn = btn_create(box, "F10: ---", NULL, NULL);
|
||||
elm_object_disabled_set(btn, EINA_TRUE);
|
||||
elm_box_pack_end(box, btn);
|
||||
|
||||
btn = btn_create(box, "F11: ---", NULL, NULL);
|
||||
elm_object_disabled_set(btn, EINA_TRUE);
|
||||
elm_box_pack_end(box, btn);
|
||||
|
||||
btn = btn_create(box, "F12: Setting", f12_cb, NULL);
|
||||
|
|
|
@ -74,7 +74,7 @@ base_gui_construct(app_data *ad)
|
|||
evas_object_show(layout);
|
||||
|
||||
//Panes
|
||||
Evas_Object *panes = panes_create(layout);
|
||||
Evas_Object *panes = panes_create(layout, ad);
|
||||
elm_object_part_content_set(layout, "elm.swallow.panes", panes);
|
||||
|
||||
ad->win = win;
|
||||
|
@ -626,6 +626,18 @@ statusbar_toggle(app_data *ad)
|
|||
elm_object_signal_emit(ad->layout, "elm,state,statusbar,hide", "");
|
||||
}
|
||||
|
||||
//This function is used in panes. Maybe layout should be separated from main.
|
||||
void
|
||||
hotkey_toggle(app_data *ad)
|
||||
{
|
||||
config_hotkeys_set(!config_hotkeys_get());
|
||||
|
||||
if (config_hotkeys_get())
|
||||
elm_object_signal_emit(ad->layout, "elm,state,hotkeys,show", "");
|
||||
else
|
||||
elm_object_signal_emit(ad->layout, "elm,state,hotkeys,hide", "");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
|
|
|
@ -65,6 +65,13 @@ panes_full_view_cancel(panes_data *pd)
|
|||
pd->state = PANES_SPLIT_VIEW;
|
||||
}
|
||||
|
||||
static void
|
||||
hotkeys_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
app_data *ad = data;
|
||||
hotkey_toggle(ad);
|
||||
}
|
||||
|
||||
static void
|
||||
left_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
||||
{
|
||||
|
@ -160,7 +167,7 @@ panes_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
Evas_Object *
|
||||
panes_create(Evas_Object *parent)
|
||||
panes_create(Evas_Object *parent, app_data *ad)
|
||||
{
|
||||
Evas_Object *img;
|
||||
char buf[PATH_MAX];
|
||||
|
@ -176,9 +183,24 @@ panes_create(Evas_Object *parent)
|
|||
evas_object_smart_callback_add(panes, "unpress",
|
||||
unpress_cb, NULL);
|
||||
evas_object_event_callback_add(panes, EVAS_CALLBACK_DEL, panes_del_cb, pd);
|
||||
|
||||
evas_object_show(panes);
|
||||
|
||||
//Hotkey Button
|
||||
Evas_Object *hotkeys_btn = elm_button_add(panes);
|
||||
elm_object_focus_allow_set(hotkeys_btn, EINA_FALSE);
|
||||
evas_object_smart_callback_add(hotkeys_btn, "clicked", hotkeys_clicked_cb,
|
||||
ad);
|
||||
evas_object_show(hotkeys_btn);
|
||||
|
||||
//Hotkey Image
|
||||
img = elm_image_add(hotkeys_btn);
|
||||
elm_image_file_set(img, EDJE_PATH, "hotkeys");
|
||||
evas_object_show(img);
|
||||
|
||||
elm_object_content_set(hotkeys_btn, img);
|
||||
|
||||
elm_object_part_content_set(panes, "elm.swallow.hotkeys", hotkeys_btn);
|
||||
|
||||
//Left Button
|
||||
Evas_Object *left_arrow = elm_button_add(panes);
|
||||
elm_object_focus_allow_set(left_arrow, EINA_FALSE);
|
||||
|
|
|
@ -38,4 +38,6 @@ void config_font_size_set(float font_size);
|
|||
float config_font_size_get();
|
||||
void config_view_scale_set(double view_scale);
|
||||
double config_view_scale_get();
|
||||
Eina_Bool config_hotkeys_get();
|
||||
void config_hotkeys_set(Eina_Bool enabled);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Evas_Object *panes_create(Evas_Object *parent);
|
||||
Evas_Object *panes_create(Evas_Object *parent, app_data *ad);
|
||||
void panes_full_view_right(Evas_Object *panes);
|
||||
void panes_full_view_left(Evas_Object *panes);
|
||||
|
||||
|
|
Loading…
Reference in New Issue