rimmed pushed a commit to branch master.

http://git.enlightenment.org/tools/eflete.git/commit/?id=286cfa608ae2b6d3b01904037e6454bea225ca10

commit 286cfa608ae2b6d3b01904037e6454bea225ca10
Author: Andrii Kroitor <an.kroi...@samsung.com>
Date:   Fri Mar 25 11:05:19 2016 +0200

    workspace: add shortcuts for modes
    
    normal - F1
    code - F2
    demo - F3
---
 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                | 30 ++++++++++++++++++++++++++++++
 src/bin/ui/workspace/workspace.c | 20 ++++++++++----------
 src/bin/ui/workspace/workspace.h | 12 ++++++++++++
 6 files changed, 68 insertions(+), 10 deletions(-)

diff --git a/src/bin/common/signals.h b/src/bin/common/signals.h
index fe9f0e4..debed69 100644
--- a/src/bin/common/signals.h
+++ b/src/bin/common/signals.h
@@ -464,6 +464,9 @@ typedef struct {
 #define SIGNAL_SHORTCUT_TAB_SOUND_MANAGER "SIGNAL_SHORTCUT_TAB_SOUND_MANAGER"
 #define SIGNAL_SHORTCUT_TAB_COLOR_CLASS_MANAGER 
"SIGNAL_SHORTCUT_TAB_COLOR_CLASS_MANAGER"
 #define SIGNAL_SHORTCUT_TAB_STYLE_MANAGER "SIGNAL_SHORTCUT_TAB_STYLE_MANAGER"
+#define SIGNAL_SHORTCUT_MODE_NORMAL "SIGNAL_SHORTCUT_MODE_NORMAL"
+#define SIGNAL_SHORTCUT_MODE_CODE "SIGNAL_SHORTCUT_MODE_CODE"
+#define SIGNAL_SHORTCUT_MODE_DEMO "SIGNAL_SHORTCUT_MODE_DEMO"
 /**
  * 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 3c1785b..6480c5a 100644
--- a/src/bin/ui/shortcuts/shortcuts.c
+++ b/src/bin/ui/shortcuts/shortcuts.c
@@ -162,6 +162,9 @@ _shortcut_handle(Shortcut_Type type)
         SHORTCUT(TAB_SOUND_MANAGER);
         SHORTCUT(TAB_COLOR_CLASS_MANAGER);
         SHORTCUT(TAB_STYLE_MANAGER);
+        SHORTCUT(MODE_NORMAL);
+        SHORTCUT(MODE_CODE);
+        SHORTCUT(MODE_DEMO);
 
       case SHORTCUT_TYPE_NONE:
          break;
@@ -397,6 +400,13 @@ _default_shortcuts_add()
    _add_shortcut(SHORTCUT_TYPE_TAB_CLOSE, SHORTCUT_TYPE_NONE,
                  MOD_CTRL, 25/*w*/);
 
+   _add_shortcut(SHORTCUT_TYPE_MODE_NORMAL, SHORTCUT_TYPE_NONE,
+                 MOD_NONE, 67/*F1*/);
+   _add_shortcut(SHORTCUT_TYPE_MODE_CODE, SHORTCUT_TYPE_NONE,
+                 MOD_NONE, 68/*F2*/);
+   _add_shortcut(SHORTCUT_TYPE_MODE_DEMO, SHORTCUT_TYPE_NONE,
+                 MOD_NONE, 69/*F3*/);
+
    _add_shortcut(SHORTCUT_TYPE_TAB_IMAGE_MANAGER, SHORTCUT_TYPE_NONE,
                  MOD_NONE, 73/*F7*/);
    _add_shortcut(SHORTCUT_TYPE_TAB_SOUND_MANAGER, SHORTCUT_TYPE_NONE,
diff --git a/src/bin/ui/shortcuts/shortcuts.h b/src/bin/ui/shortcuts/shortcuts.h
index c6144bb..2aa5ce2 100644
--- a/src/bin/ui/shortcuts/shortcuts.h
+++ b/src/bin/ui/shortcuts/shortcuts.h
@@ -81,6 +81,9 @@ typedef enum {
    SHORTCUT_TYPE_TAB_COLOR_CLASS_MANAGER,
    SHORTCUT_TYPE_TAB_STYLE_MANAGER,
    SHORTCUT_TYPE_QUIT,
+   SHORTCUT_TYPE_MODE_NORMAL,
+   SHORTCUT_TYPE_MODE_CODE,
+   SHORTCUT_TYPE_MODE_DEMO,
 
    SHORTCUT_TYPE_LAST,
 } Shortcut_Type;
diff --git a/src/bin/ui/tabs.c b/src/bin/ui/tabs.c
index bb08b9e..d1ddb44 100644
--- a/src/bin/ui/tabs.c
+++ b/src/bin/ui/tabs.c
@@ -697,6 +697,33 @@ _shortcut_tab_style_manager_cb(void *data __UNUSED__,
      elm_toolbar_item_selected_set(tabs.menu.item_text, true);
 }
 
+static void
+_shortcut_mode_normal_cb(void *data __UNUSED__,
+                         Evas_Object *obj __UNUSED__,
+                         void *event_info __UNUSED__)
+{
+   if (tabs.current_workspace)
+     workspace_mode_set(tabs.current_workspace, MODE_NORMAL);
+}
+
+static void
+_shortcut_mode_code_cb(void *data __UNUSED__,
+                       Evas_Object *obj __UNUSED__,
+                       void *event_info __UNUSED__)
+{
+   if (tabs.current_workspace)
+     workspace_mode_set(tabs.current_workspace, MODE_CODE);
+}
+
+static void
+_shortcut_mode_demo_cb(void *data __UNUSED__,
+                       Evas_Object *obj __UNUSED__,
+                       void *event_info __UNUSED__)
+{
+   if (tabs.current_workspace)
+     workspace_mode_set(tabs.current_workspace, MODE_DEMO);
+}
+
 Evas_Object *
 tabs_add(void)
 {
@@ -810,6 +837,9 @@ tabs_add(void)
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_TAB_SOUND_MANAGER, 
_shortcut_tab_sound_manager_cb, NULL);
    evas_object_smart_callback_add(ap.win, 
SIGNAL_SHORTCUT_TAB_COLOR_CLASS_MANAGER, _shortcut_tab_color_class_manager_cb, 
NULL);
    evas_object_smart_callback_add(ap.win, SIGNAL_SHORTCUT_TAB_STYLE_MANAGER, 
_shortcut_tab_style_manager_cb, NULL);
+   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);
    return tabs.layout;
 }
 
diff --git a/src/bin/ui/workspace/workspace.c b/src/bin/ui/workspace/workspace.c
index 0aa4f74..f3e0d01 100644
--- a/src/bin/ui/workspace/workspace.c
+++ b/src/bin/ui/workspace/workspace.c
@@ -44,15 +44,6 @@
 static Change *change;
 static Evas_Coord part_w, part_h;
 
-typedef enum
-{
-   MODE_NORMAL = 1,
-   MODE_CODE,
-   /* MODE_SEPARATE, */
-   /* MODE_ANIMATOR, */
-   MODE_DEMO
-} Workspace_Mode;
-
 struct _Ruler {
    Evas_Object *obj;
    Ewe_Ruler_Marker *pointer;
@@ -560,7 +551,7 @@ _mode_cb(void *data,
    Scroll_Area *area = NULL;
    int w = 0, h = 0;
 
-   mode = elm_radio_state_value_get(obj);
+   mode = elm_radio_value_get(obj);
    if (mode == wd->mode) return;
 
    wd->mode = mode;
@@ -885,6 +876,15 @@ workspace_add(Evas_Object *parent, Group *group)
 }
 
 void
+workspace_mode_set(Evas_Object *obj, Workspace_Mode mode)
+{
+   WS_DATA_GET(obj);
+
+   elm_radio_value_set(wd->toolbar.mode_switcher.normal, mode);
+   _mode_cb(wd, wd->toolbar.mode_switcher.normal, NULL);
+}
+
+void
 workspace_group_navigator_update_part(Evas_Object *obj, Part *part)
 {
    WS_DATA_GET(obj);
diff --git a/src/bin/ui/workspace/workspace.h b/src/bin/ui/workspace/workspace.h
index 30eaf1e..8e8550f 100644
--- a/src/bin/ui/workspace/workspace.h
+++ b/src/bin/ui/workspace/workspace.h
@@ -34,6 +34,16 @@
 
 #include "eflete.h"
 
+typedef enum
+{
+   MODE_NORMAL = 1,
+   MODE_CODE,
+   /* MODE_SEPARATE, */
+   /* MODE_ANIMATOR, */
+   MODE_DEMO
+} Workspace_Mode;
+
+
 /**
  * Create a new Workspace object to the parent.
  *
@@ -336,4 +346,6 @@ workspace_add_program_request(Evas_Object *obj);
 void
 workspace_delete_request(Evas_Object *obj);
 
+void
+workspace_mode_set(Evas_Object *obj, Workspace_Mode mode);
 #endif /* WORKSPACE_H */

-- 


Reply via email to