aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/elementary/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2009-09-25 09:26:04 +0000
committerCarsten Haitzler <raster@rasterman.com>2009-09-25 09:26:04 +0000
commitc880a4f5ba8cc4ddeb444ed2ac976c1766655103 (patch)
treee8cae5fb24e1571e1b70969eb159a076c28c4a2c /legacy/elementary/src/bin
parentDelete timer if it's there when slideshow dies (diff)
downloadefl-c880a4f5ba8cc4ddeb444ed2ac976c1766655103.tar.gz
and a lot more added to photocam + test code
SVN revision: 42693
Diffstat (limited to 'legacy/elementary/src/bin')
-rw-r--r--legacy/elementary/src/bin/test_photocam.c90
1 files changed, 81 insertions, 9 deletions
diff --git a/legacy/elementary/src/bin/test_photocam.c b/legacy/elementary/src/bin/test_photocam.c
index c54deaf528..190e8a106a 100644
--- a/legacy/elementary/src/bin/test_photocam.c
+++ b/legacy/elementary/src/bin/test_photocam.c
@@ -1,6 +1,6 @@
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
-void
+static void
my_bt_zoom_in(void *data, Evas_Object *obj, void *event_info)
{
int zoom;
@@ -11,7 +11,52 @@ my_bt_zoom_in(void *data, Evas_Object *obj, void *event_info)
if (zoom >= 1) elm_photocam_zoom_set(data, zoom);
}
-void
+static void
+sel_done(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *ph, *iw;
+
+ ph = data;
+ iw = evas_object_data_get(ph, "inwin");
+ elm_photocam_file_set(ph, elm_fileselector_selected_get(obj));
+ evas_object_del(iw);
+}
+
+static void
+my_bt_open(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object *ph, *win;
+ Evas_Object *iw, *fs;
+
+ ph = data;
+ win = evas_object_data_get(ph, "window");
+ iw = elm_win_inwin_add(win);
+
+ fs = elm_fileselector_add(win);
+ elm_fileselector_expandable_set(fs, EINA_TRUE);
+ elm_fileselector_path_set(fs, getenv("HOME"));
+ evas_object_smart_callback_add(fs, "done", sel_done, ph);
+
+ evas_object_data_set(ph, "inwin", iw);
+
+ elm_win_inwin_content_set(iw, fs);
+ evas_object_show(fs);
+ elm_win_inwin_activate(iw);
+}
+
+static void
+my_bt_show_reg(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_photocam_image_region_show(data, 30, 50, 500, 300);
+}
+
+static void
+my_bt_bring_reg(void *data, Evas_Object *obj, void *event_info)
+{
+ elm_photocam_image_region_bring_in(data, 800, 300, 500, 300);
+}
+
+static void
my_bt_zoom_out(void *data, Evas_Object *obj, void *event_info)
{
int zoom;
@@ -22,19 +67,19 @@ my_bt_zoom_out(void *data, Evas_Object *obj, void *event_info)
if (zoom <= 256) elm_photocam_zoom_set(data, zoom);
}
-void
+static void
my_bt_zoom_man(void *data, Evas_Object *obj, void *event_info)
{
elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_MANUAL);
}
-void
+static void
my_bt_zoom_fit(void *data, Evas_Object *obj, void *event_info)
{
elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FIT);
}
-void
+static void
my_bt_zoom_fill(void *data, Evas_Object *obj, void *event_info)
{
elm_photocam_zoom_mode_set(data, ELM_PHOTOCAM_ZOOM_MODE_AUTO_FILL);
@@ -45,7 +90,7 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
{
Evas_Object *win, *bg, *ph, *tb2, *bt;
char buf[PATH_MAX];
- // FIXME: add a file selector and a "select a file" button.
+ // these were just testing - use the "select photo" browser to select one
const char *img[5] =
{
"/home/raster/t1.jpg", // 5 mpixel
@@ -67,6 +112,7 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
ph = elm_photocam_add(win);
evas_object_size_hint_weight_set(ph, 1.0, 1.0);
elm_win_resize_object_add(win, ph);
+ evas_object_data_set(ph, "window", win);
elm_photocam_file_set(ph, img[1]);
@@ -85,19 +131,45 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
evas_object_show(bt);
bt = elm_button_add(win);
+ elm_button_label_set(bt, "Select Photo");
+ evas_object_smart_callback_add(bt, "clicked", my_bt_open, ph);
+ evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt, 0.5, 0.1);
+ elm_table_pack(tb2, bt, 1, 0, 1, 1);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
elm_button_label_set(bt, "Z +");
evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_in, ph);
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, 0.9, 0.1);
elm_table_pack(tb2, bt, 2, 0, 1, 1);
evas_object_show(bt);
+
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Show 30,50 500x300");
+ evas_object_smart_callback_add(bt, "clicked", my_bt_show_reg, ph);
+ evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt, 0.1, 0.5);
+ elm_table_pack(tb2, bt, 0, 1, 1, 1);
+ evas_object_show(bt);
+
+ bt = elm_button_add(win);
+ elm_button_label_set(bt, "Bring 800,300 500x300");
+ evas_object_smart_callback_add(bt, "clicked", my_bt_bring_reg, ph);
+ evas_object_size_hint_weight_set(bt, 1.0, 1.0);
+ evas_object_size_hint_align_set(bt, 0.9, 0.5);
+ elm_table_pack(tb2, bt, 2, 1, 1, 1);
+ evas_object_show(bt);
+
bt = elm_button_add(win);
elm_button_label_set(bt, "Manual");
evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_man, ph);
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, 0.1, 0.9);
- elm_table_pack(tb2, bt, 0, 1, 1, 1);
+ elm_table_pack(tb2, bt, 0, 2, 1, 1);
evas_object_show(bt);
bt = elm_button_add(win);
@@ -105,7 +177,7 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fit, ph);
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, 0.5, 0.9);
- elm_table_pack(tb2, bt, 1, 1, 1, 1);
+ elm_table_pack(tb2, bt, 1, 2, 1, 1);
evas_object_show(bt);
bt = elm_button_add(win);
@@ -113,7 +185,7 @@ test_photocam(void *data, Evas_Object *obj, void *event_info)
evas_object_smart_callback_add(bt, "clicked", my_bt_zoom_fill, ph);
evas_object_size_hint_weight_set(bt, 1.0, 1.0);
evas_object_size_hint_align_set(bt, 0.9, 0.9);
- elm_table_pack(tb2, bt, 2, 1, 1, 1);
+ elm_table_pack(tb2, bt, 2, 2, 1, 1);
evas_object_show(bt);
evas_object_show(tb2);