rimmed pushed a commit to branch master. http://git.enlightenment.org/tools/eflete.git/commit/?id=70bcf12b3fb1a2cc06575b74f66a2c2ec4b23bff
commit 70bcf12b3fb1a2cc06575b74f66a2c2ec4b23bff Author: Andrii Kroitor <an.kroi...@samsung.com> Date: Mon Mar 28 14:05:32 2016 +0300 workspace: add zoom shortcuts zoom_in: KP_PLUS zoom_out: KP_MINUS zoom_reset: KP_DIVIDE --- src/bin/common/signals.h | 3 +++ src/bin/ui/shortcuts/shortcuts.c | 10 ++++++++++ src/bin/ui/shortcuts/shortcuts.h | 3 +++ src/bin/ui/tabs.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/bin/ui/workspace/workspace.c | 2 ++ 5 files changed, 58 insertions(+) diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h index d5b9870..320b58e 100644 --- a/src/bin/common/signals.h +++ b/src/bin/common/signals.h @@ -469,6 +469,9 @@ typedef struct { #define SIGNAL_SHORTCUT_MODE_DEMO "SIGNAL_SHORTCUT_MODE_DEMO" #define SIGNAL_SHORTCUT_STATE_NEXT "SIGNAL_SHORTCUT_STATE_NEXT" #define SIGNAL_SHORTCUT_PART_SHOWHIDE "SIGNAL_SHORTCUT_PART_SHOWHIDE" +#define SIGNAL_SHORTCUT_ZOOM_IN "SIGNAL_SHORTCUT_ZOOM_IN" +#define SIGNAL_SHORTCUT_ZOOM_OUT "SIGNAL_SHORTCUT_ZOOM_OUT" +#define SIGNAL_SHORTCUT_ZOOM_RESET "SIGNAL_SHORTCUT_ZOOM_RESET" /** * emited when shortcut is pressed. * eventinfo - tab number. diff --git a/src/bin/ui/shortcuts/shortcuts.c b/src/bin/ui/shortcuts/shortcuts.c index 7db14a7..33febf8 100644 --- a/src/bin/ui/shortcuts/shortcuts.c +++ b/src/bin/ui/shortcuts/shortcuts.c @@ -167,6 +167,9 @@ _shortcut_handle(Shortcut_Type type) SHORTCUT(MODE_NORMAL); SHORTCUT(MODE_CODE); SHORTCUT(MODE_DEMO); + SHORTCUT(ZOOM_IN); + SHORTCUT(ZOOM_OUT); + SHORTCUT(ZOOM_RESET); case SHORTCUT_TYPE_NONE: break; @@ -421,6 +424,13 @@ _default_shortcuts_add() MOD_NONE, 75/*F9*/); _add_shortcut(SHORTCUT_TYPE_TAB_COLOR_CLASS_MANAGER, SHORTCUT_TYPE_NONE, MOD_NONE, 76/*F10*/); + + _add_shortcut(SHORTCUT_TYPE_ZOOM_IN, SHORTCUT_TYPE_NONE, + MOD_NONE, 86/*KP_+*/); + _add_shortcut(SHORTCUT_TYPE_ZOOM_OUT, SHORTCUT_TYPE_NONE, + MOD_NONE, 82/*KP_-*/); + _add_shortcut(SHORTCUT_TYPE_ZOOM_RESET, SHORTCUT_TYPE_NONE, + MOD_NONE, 106/*KP_/ */); } /*=============================================*/ diff --git a/src/bin/ui/shortcuts/shortcuts.h b/src/bin/ui/shortcuts/shortcuts.h index 7c919ab..1629a4a 100644 --- a/src/bin/ui/shortcuts/shortcuts.h +++ b/src/bin/ui/shortcuts/shortcuts.h @@ -86,6 +86,9 @@ typedef enum { SHORTCUT_TYPE_MODE_DEMO, SHORTCUT_TYPE_STATE_NEXT, SHORTCUT_TYPE_PART_SHOWHIDE, + SHORTCUT_TYPE_ZOOM_IN, + SHORTCUT_TYPE_ZOOM_OUT, + SHORTCUT_TYPE_ZOOM_RESET, SHORTCUT_TYPE_LAST, } Shortcut_Type; diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c index 66450e8..6d15911 100644 --- a/src/bin/ui/tabs.c +++ b/src/bin/ui/tabs.c @@ -742,6 +742,43 @@ _shortcut_mode_demo_cb(void *data __UNUSED__, workspace_mode_set(tabs.current_workspace, MODE_DEMO); } +static void +_shortcut_zoom_in_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + double factor; + + if (tabs.current_workspace) + { + factor = workspace_zoom_factor_get(tabs.current_workspace); + workspace_zoom_factor_set(tabs.current_workspace, factor + 0.1); + } +} + +static void +_shortcut_zoom_out_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + double factor; + + if (tabs.current_workspace) + { + factor = workspace_zoom_factor_get(tabs.current_workspace); + workspace_zoom_factor_set(tabs.current_workspace, factor - 0.1); + } +} + +static void +_shortcut_zoom_reset_cb(void *data __UNUSED__, + Evas_Object *obj __UNUSED__, + void *event_info __UNUSED__) +{ + if (tabs.current_workspace) + workspace_zoom_factor_set(tabs.current_workspace, 1.0); +} + Evas_Object * tabs_add(void) { @@ -860,6 +897,9 @@ tabs_add(void) evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_MODE_NORMAL, _shortcut_mode_normal_cb, NULL); evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_MODE_CODE, _shortcut_mode_code_cb, NULL); evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_MODE_DEMO, _shortcut_mode_demo_cb, NULL); + evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_ZOOM_IN, _shortcut_zoom_in_cb, NULL); + evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_ZOOM_OUT, _shortcut_zoom_out_cb, NULL); + evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_ZOOM_RESET, _shortcut_zoom_reset_cb, NULL); return tabs.layout; } diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c index e7591b6..460cb57 100644 --- a/src/bin/ui/workspace/workspace.c +++ b/src/bin/ui/workspace/workspace.c @@ -1167,6 +1167,8 @@ workspace_zoom_factor_set(Evas_Object *obj, double factor) wd->zoom_factor = factor; elm_slider_value_set(wd->toolbar.zoom.slider, factor * 100); + TODO("Fix elementary callbacks on changing value from code"); + _slider_zoom_cb(wd, wd->toolbar.zoom.slider, NULL); } double --