summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Juyung Seo <seojuyung2@gmail.com>2014-11-26 09:40:36 +0900
committerDaniel Juyung Seo <seojuyung2@gmail.com>2014-11-26 09:40:38 +0900
commit49ac2b812b3e284f27321b251bde8a5bd1927cdb (patch)
treea391ca5f8f8e73fa9ad59cf2fb86574863a8e612
parent1ad784f48f84a520dd9688072bd6d5b50a93310d (diff)
test_photocam: Enhance photocam test.
- Remove wrong global variable usage. This becomes problematic when you run multiple photocam test instances. - Fix formatting. - Add more comments.
-rw-r--r--src/bin/test_photocam.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/bin/test_photocam.c b/src/bin/test_photocam.c
index ea6e85f59..b85adc314 100644
--- a/src/bin/test_photocam.c
+++ b/src/bin/test_photocam.c
@@ -3,8 +3,6 @@
3#endif 3#endif
4#include <Elementary.h> 4#include <Elementary.h>
5 5
6static Evas_Object *rect;
7
8static void 6static void
9my_ph_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 7my_ph_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
10{ 8{
@@ -219,6 +217,7 @@ _photocam_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
219 Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info; 217 Evas_Event_Mouse_Wheel *ev = (Evas_Event_Mouse_Wheel*) event_info;
220 int zoom; 218 int zoom;
221 double val; 219 double val;
220
222 //unset the mouse wheel 221 //unset the mouse wheel
223 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD; 222 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
224 223
@@ -243,19 +242,20 @@ _photocam_mouse_wheel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
243} 242}
244 243
245static void 244static void
246_photocam_move_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 245_photocam_move_resize_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
247{ 246{
248 int x,y,w,h; 247 int x, y, w, h;
249 248
250 evas_object_geometry_get(data,&x,&y,&w,&h); 249 evas_object_geometry_get(obj, &x, &y, &w, &h);
251 evas_object_resize(rect,w,h); 250 evas_object_resize(data, w, h);
252 evas_object_move(rect,x,y); 251 evas_object_move(data, x, y);
253} 252}
254 253
255void 254void
256test_photocam(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 255test_photocam(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
257{ 256{
258 Evas_Object *win, *ph, *tb2, *bt, *box; 257 Evas_Object *win, *ph, *tb2, *bt, *box;
258 Evas_Object *rect = NULL;
259 259
260 win = elm_win_util_standard_add("photocam", "PhotoCam"); 260 win = elm_win_util_standard_add("photocam", "PhotoCam");
261 elm_win_autodel_set(win, EINA_TRUE); 261 elm_win_autodel_set(win, EINA_TRUE);
@@ -264,6 +264,7 @@ test_photocam(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
264 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 264 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
265 elm_win_resize_object_add(win, ph); 265 elm_win_resize_object_add(win, ph);
266 266
267 // this rectangle hooks the event prior to scroller
267 rect = evas_object_rectangle_add(evas_object_evas_get(win)); 268 rect = evas_object_rectangle_add(evas_object_evas_get(win));
268 evas_object_color_set(rect, 0, 0, 0, 0); 269 evas_object_color_set(rect, 0, 0, 0, 0);
269 evas_object_repeat_events_set(rect, EINA_TRUE); 270 evas_object_repeat_events_set(rect, EINA_TRUE);
@@ -271,8 +272,9 @@ test_photocam(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
271 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_WHEEL, _photocam_mouse_wheel_cb, ph); 272 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_WHEEL, _photocam_mouse_wheel_cb, ph);
272 evas_object_raise(rect); 273 evas_object_raise(rect);
273 274
274 evas_object_event_callback_add(ph, EVAS_CALLBACK_RESIZE, _photocam_move_resize_cb, ph); 275 // add move/resize callbacks to resize rect manually
275 evas_object_event_callback_add(ph, EVAS_CALLBACK_MOVE, _photocam_move_resize_cb, ph); 276 evas_object_event_callback_add(ph, EVAS_CALLBACK_RESIZE, _photocam_move_resize_cb, rect);
277 evas_object_event_callback_add(ph, EVAS_CALLBACK_MOVE, _photocam_move_resize_cb, rect);
276 278
277 evas_object_smart_callback_add(ph, "clicked", my_ph_clicked, win); 279 evas_object_smart_callback_add(ph, "clicked", my_ph_clicked, win);
278 evas_object_smart_callback_add(ph, "press", my_ph_press, win); 280 evas_object_smart_callback_add(ph, "press", my_ph_press, win);
@@ -396,6 +398,7 @@ void
396test_photocam_remote(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 398test_photocam_remote(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
397{ 399{
398 Evas_Object *win, *ph, *tb2, *bt, *box, *pb; 400 Evas_Object *win, *ph, *tb2, *bt, *box, *pb;
401 Evas_Object *rect = NULL;
399 // these were just testing - use the "select photo" browser to select one 402 // these were just testing - use the "select photo" browser to select one
400 static const char *url = "http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x10800.jpg"; 403 static const char *url = "http://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73751/world.topo.bathy.200407.3x21600x10800.jpg";
401 404
@@ -406,6 +409,7 @@ test_photocam_remote(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
406 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 409 evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
407 elm_win_resize_object_add(win, ph); 410 elm_win_resize_object_add(win, ph);
408 411
412 // this rectangle hooks the event prior to scroller
409 rect = evas_object_rectangle_add(evas_object_evas_get(win)); 413 rect = evas_object_rectangle_add(evas_object_evas_get(win));
410 evas_object_color_set(rect, 0, 0, 0, 0); 414 evas_object_color_set(rect, 0, 0, 0, 0);
411 evas_object_repeat_events_set(rect, EINA_TRUE); 415 evas_object_repeat_events_set(rect, EINA_TRUE);
@@ -413,8 +417,9 @@ test_photocam_remote(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
413 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_WHEEL, _photocam_mouse_wheel_cb, ph); 417 evas_object_event_callback_add(rect, EVAS_CALLBACK_MOUSE_WHEEL, _photocam_mouse_wheel_cb, ph);
414 evas_object_raise(rect); 418 evas_object_raise(rect);
415 419
416 evas_object_event_callback_add(ph, EVAS_CALLBACK_RESIZE, _photocam_move_resize_cb, ph); 420 // add move/resize callbacks to resize rect manually
417 evas_object_event_callback_add(ph, EVAS_CALLBACK_MOVE, _photocam_move_resize_cb, ph); 421 evas_object_event_callback_add(ph, EVAS_CALLBACK_RESIZE, _photocam_move_resize_cb, rect);
422 evas_object_event_callback_add(ph, EVAS_CALLBACK_MOVE, _photocam_move_resize_cb, rect);
418 423
419 evas_object_smart_callback_add(ph, "clicked", my_ph_clicked, win); 424 evas_object_smart_callback_add(ph, "clicked", my_ph_clicked, win);
420 evas_object_smart_callback_add(ph, "press", my_ph_press, win); 425 evas_object_smart_callback_add(ph, "press", my_ph_press, win);