summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2014-08-22 12:52:59 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-08-22 12:52:59 -0400
commitca5a6f3857f041cc8ebfbc03a8aed72e4feb85b7 (patch)
tree4316f1fb772d3624a95ce37045e47f9e7f468ea8
parent70719368af677947b1dd10c0a92c8d1fdcec3370 (diff)
add pip zooming with ctrl+wheel
-rw-r--r--src/pip.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/pip.c b/src/pip.c
index 97e7feb..ec30a26 100644
--- a/src/pip.c
+++ b/src/pip.c
@@ -16,6 +16,7 @@ typedef struct Pip
16 Evas_Point down; 16 Evas_Point down;
17 unsigned char opacity; 17 unsigned char opacity;
18 E_Pointer_Mode resize_mode; 18 E_Pointer_Mode resize_mode;
19 double zoom;
19 Eina_Bool move : 1; 20 Eina_Bool move : 1;
20 Eina_Bool resize : 1; 21 Eina_Bool resize : 1;
21 Eina_Bool crop : 1; 22 Eina_Bool crop : 1;
@@ -156,14 +157,25 @@ _pip_mouse_move(Pip *pip, int t EINA_UNUSED, Ecore_Event_Mouse_Move *ev)
156static void 157static void
157_pip_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 158_pip_mouse_wheel(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
158{ 159{
159 Ecore_Event_Mouse_Wheel *ev = event_info; 160 Evas_Event_Mouse_Wheel *ev = event_info;
160 Pip *pip = data; 161 Pip *pip = data;
161 162
162 if (ev->z < 0) 163 if (ev->direction % 2) return;
163 pip->opacity = E_CLAMP(pip->opacity + 15, 0, 255); 164 if (evas_key_modifier_is_set(ev->modifiers, "Control"))
164 else if (ev->z > 0) 165 {
165 pip->opacity = E_CLAMP(pip->opacity - 15, 0, 255); 166 if (ev->z < 0)
166 efx_fade(pip->pip, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(pip->opacity, pip->opacity, pip->opacity), pip->opacity, 0.2, NULL, NULL); 167 efx_zoom(pip->pip, EFX_EFFECT_SPEED_LINEAR, 0, pip->zoom -= 0.05, EFX_POINT(ev->output.x, ev->output.y), 0.2, NULL, NULL);
168 else if (ev->z > 0)
169 efx_zoom(pip->pip, EFX_EFFECT_SPEED_LINEAR, 0, pip->zoom += 0.05, EFX_POINT(ev->output.x, ev->output.y), 0.2, NULL, NULL);
170 }
171 else
172 {
173 if (ev->z < 0)
174 pip->opacity = E_CLAMP(pip->opacity + 15, 0, 255);
175 else if (ev->z > 0)
176 pip->opacity = E_CLAMP(pip->opacity - 15, 0, 255);
177 efx_fade(pip->pip, EFX_EFFECT_SPEED_LINEAR, EFX_COLOR(pip->opacity, pip->opacity, pip->opacity), pip->opacity, 0.2, NULL, NULL);
178 }
167} 179}
168 180
169static void 181static void
@@ -309,6 +321,7 @@ _pip_create(void *data, E_Menu *m EINA_UNUSED, E_Menu_Item *mi EINA_UNUSED)
309 pip->pip = o; 321 pip->pip = o;
310 pip->resize_mode = E_POINTER_RESIZE_NONE; 322 pip->resize_mode = E_POINTER_RESIZE_NONE;
311 pip->opacity = 255; 323 pip->opacity = 255;
324 pip->zoom = 1.0;
312 325
313 evas_object_geometry_set(o, ec->zone->x + 1, ec->zone->y + 1, (ec->w * (ec->zone->h / 4)) / ec->h, ec->zone->h / 4); 326 evas_object_geometry_set(o, ec->zone->x + 1, ec->zone->y + 1, (ec->w * (ec->zone->h / 4)) / ec->h, ec->zone->h / 4);
314 e_comp_object_util_center(o); 327 e_comp_object_util_center(o);