hermet pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=b653cf3b28374606a1bf6d997c6a3b36090ffa49

commit b653cf3b28374606a1bf6d997c6a3b36090ffa49
Author: ChunEon Park <[email protected]>
Date:   Mon May 12 23:44:49 2014 +0900

    main - Modified font size short cut key.
    
    Now you can change font size by using mouse wheel.
    
    If the cursor is on the edje view, the view scale will be changed,
    if the cursor on the editor, on the other hand, the font size will be 
changed.
---
 README         |  6 ++----
 src/bin/main.c | 65 ++++++++++++++++++++++++++++++++++++----------------------
 2 files changed, 43 insertions(+), 28 deletions(-)

diff --git a/README b/README
index eb5102b..92dc983 100644
--- a/README
+++ b/README
@@ -51,11 +51,9 @@ 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++ = Font Size Up
-Ctrl+- = Font Size Down
 Ctrl+T = Insert Defaut Template Code
-Ctrl+Mouse Wheel Up = View Scale Up
-Ctrl+Mouse Wheel Down = View Scale Down
+Ctrl+Mouse Wheel Up = View Scale Up / Font Size Up
+Ctrl+Mouse Wheel Down = View Scale Down / Font Size Down
 Ctrl+Shift+B = Insert Part Template Code: Textblock
 Ctrl+Shift+I = Insert Part Template Code: Image
 Ctrl+Shift+R = Insert Part Template Code: Rectangle
diff --git a/src/bin/main.c b/src/bin/main.c
index d3e6d45..4647cc3 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -179,20 +179,6 @@ ctrl_func(app_data *ad, const char *key)
         auto_indentation_toggle();
         return ECORE_CALLBACK_DONE;
      }
-   //Font Size Up
-   if (!strcmp(key, "equal"))
-     {
-        config_font_size_set(config_font_size_get() + 0.1f);
-        edit_font_size_update(ad->ed, EINA_TRUE);
-        return ECORE_CALLBACK_DONE;
-     }
-   //Font Size Down
-   if (!strcmp(key, "minus"))
-     {
-        config_font_size_set(config_font_size_get() - 0.1f);
-        edit_font_size_update(ad->ed, EINA_TRUE);
-        return ECORE_CALLBACK_DONE;
-     }
    return ECORE_CALLBACK_DONE;
 }
 
@@ -296,23 +282,54 @@ main_mouse_wheel_cb(void *data, int type EINA_UNUSED, 
void *ev)
 {
    Ecore_Event_Mouse_Wheel *event = ev;
    app_data *ad = data;
+   Evas_Coord x, y, w, h;
 
    if (!ad->ctrl_pressed) return ECORE_CALLBACK_PASS_ON;
 
-   //Scale up/down layout
+   //View Scale
    view_data *vd = edj_mgr_view_get(NULL);
-   double scale = config_view_scale_get();
+   Evas_Object *view = view_obj_get(vd);
+   evas_object_geometry_get(view, &x, &y, &w, &h);
 
-   if (event->z < 0) scale += 0.1;
-   else scale -= 0.1;
+   if ((event->x >= x) && (event->x <= (x + w)) &&
+       (event->y >= y) && (event->y <= (y + h)))
+     {
+        double scale = config_view_scale_get();
+
+        if (event->z < 0) scale += 0.1;
+        else scale -= 0.1;
+
+        config_view_scale_set(scale);
+        scale = config_view_scale_get();
+        view_scale_set(vd, scale);
 
-   config_view_scale_set(scale);
-   scale = config_view_scale_get();
-   view_scale_set(vd, scale);
+        char buf[256];
+        snprintf(buf, sizeof(buf), "View Scale: %2.2fx", scale);
+        stats_info_msg_update(buf);
 
-   char buf[256];
-   snprintf(buf, sizeof(buf), "View Scale: %2.2fx", scale);
-   stats_info_msg_update(buf);
+        return ECORE_CALLBACK_PASS_ON;
+     }
+
+   //Font Size
+   Evas_Object *editor = edit_obj_get(ad->ed);
+   evas_object_geometry_get(editor, &x, &y, &w, &h);
+
+   if ((event->x >= x) && (event->x <= (x + w)) &&
+       (event->y >= y) && (event->y <= (y + h)))
+     {
+        if (event->z < 0)
+          {
+             config_font_size_set(config_font_size_get() + 0.1f);
+             edit_font_size_update(ad->ed, EINA_TRUE);
+          }
+        else
+          {
+             config_font_size_set(config_font_size_get() - 0.1f);
+             edit_font_size_update(ad->ed, EINA_TRUE);
+          }
+
+        return ECORE_CALLBACK_PASS_ON;
+     }
 
    return ECORE_CALLBACK_PASS_ON;
 }

-- 


Reply via email to