fixed plugin image size problem
[framework/uifw/elementary.git] / src / bin / test_photocam.c
index 8bac763..75431ee 100644 (file)
@@ -1,7 +1,7 @@
-#include <Elementary.h>
 #ifdef HAVE_CONFIG_H
 # include "elementary_config.h"
 #endif
+#include <Elementary.h>
 #ifndef ELM_LIB_QUICKLAUNCH
 
 static Evas_Object *rect;
@@ -100,7 +100,7 @@ static void
 my_ph_scroll(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
 {
    int x, y, w, h;
-   elm_photocam_region_get(obj, &x, &y, &w, &h);
+   elm_photocam_image_region_get(obj, &x, &y, &w, &h);
    printf("scroll %i %i %ix%i\n", x, y, w, h);
 }
 
@@ -174,6 +174,12 @@ my_bt_zoom_fill(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUS
 }
 
 static void
+my_bt_gesture(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+  elm_photocam_gesture_enabled_set(data, !elm_photocam_gesture_enabled_get(data));
+}
+
+static void
 _photocam_mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
 {
    Evas_Object *photocam = data;
@@ -193,7 +199,7 @@ _photocam_mouse_wheel_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
 
    val = 1;
    int _zoom = zoom;
-   while(_zoom>1)
+   while (_zoom>1)
      {
        _zoom /= 2;
        val++;
@@ -216,7 +222,7 @@ _photocam_move_resize_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUS
 void
 test_photocam(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *win, *bg, *ph, *tb2, *bt, *box;
+   Evas_Object *win, *ph, *tb2, *bt, *box;
    // these were just testing - use the "select photo" browser to select one
    const char *img[5] =
      {
@@ -227,15 +233,9 @@ test_photocam(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
         "/home/raster/t5.jpg"   // 466 mpixel
      };
 
-   win = elm_win_add(NULL, "photocam", ELM_WIN_BASIC);
-   elm_win_title_set(win, "Photocam");
+   win = elm_win_util_standard_add("photocam", "PhotoCam");
    elm_win_autodel_set(win, EINA_TRUE);
 
-   bg = elm_bg_add(win);
-   evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   elm_win_resize_object_add(win, bg);
-   evas_object_show(bg);
-
    ph = elm_photocam_add(win);
    evas_object_size_hint_weight_set(ph, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
    elm_win_resize_object_add(win, ph);
@@ -316,12 +316,25 @@ test_photocam(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_in
    elm_table_pack(tb2, bt, 2, 1, 1, 1);
    evas_object_show(bt);
 
+   box = elm_box_add(win);
+   elm_box_horizontal_set(box, EINA_TRUE);
+   evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_align_set(box, 0.0, 0.9);
+   elm_table_pack(tb2, box, 0, 2, 1, 1);
+   evas_object_show(box);
+
    bt = elm_button_add(win);
    elm_object_text_set(bt, "Pause On/Off");
    evas_object_smart_callback_add(bt, "clicked", my_bt_pause, ph);
    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-   evas_object_size_hint_align_set(bt, 0.1, 0.9);
-   elm_table_pack(tb2, bt, 0, 2, 1, 1);
+   elm_box_pack_end(box, bt);
+   evas_object_show(bt);
+
+   bt = elm_button_add(win);
+   elm_object_text_set(bt, "Gesture On/Off");
+   evas_object_smart_callback_add(bt, "clicked", my_bt_gesture, ph);
+   evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   elm_box_pack_end(box, bt);
    evas_object_show(bt);
 
    box = elm_box_add(win);