summaryrefslogtreecommitdiffstats
path: root/tools/gui
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gui')
-rw-r--r--tools/gui/control.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/tools/gui/control.c b/tools/gui/control.c
index f74e0f1..c177f07 100644
--- a/tools/gui/control.c
+++ b/tools/gui/control.c
@@ -135,6 +135,8 @@ update_pixbuf_dimensions (ThreadData *data)
if (data->pixbuf != NULL)
g_object_unref (data->pixbuf);
+ data->display_width = (gint) data->width * data->zoom_factor;
+ data->display_height = (gint) data->height * data->zoom_factor;
data->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, data->display_width, data->display_height);
data->pixels = gdk_pixbuf_get_pixels (data->pixbuf);
gtk_image_set_from_pixbuf (GTK_IMAGE (data->image), data->pixbuf);
@@ -159,7 +161,8 @@ preview_frames (void *args)
gpointer buffer;
buffer = ring_buffer_get_current_pointer (data->buffer);
- uca_camera_grab (data->camera, &buffer, &error);
+ uca_camera_trigger (data->camera, &error);
+ uca_camera_grab (data->camera, buffer, &error);
if (error == NULL) {
convert_grayscale_to_rgb (data, buffer);
@@ -189,7 +192,7 @@ record_frames (gpointer args)
while (data->state == RECORDING) {
buffer = ring_buffer_get_current_pointer (data->buffer);
- uca_camera_grab (data->camera, &buffer, NULL);
+ uca_camera_grab (data->camera, buffer, NULL);
if (error == NULL) {
ring_buffer_proceed (data->buffer);
@@ -343,7 +346,7 @@ download_frames (ThreadData *data)
while (error == NULL) {
buffer = ring_buffer_get_current_pointer (data->buffer);
- uca_camera_grab (data->camera, &buffer, &error);
+ uca_camera_grab (data->camera, buffer, &error);
ring_buffer_proceed (data->buffer);
gdk_threads_enter ();
gtk_adjustment_set_value (data->download_adjustment, current_frame++);
@@ -415,13 +418,25 @@ on_zoom_changed (GtkComboBox *widget, ThreadData *data)
gtk_combo_box_get_active_iter (widget, &iter);
gtk_tree_model_get (model, &iter, FACTOR_COLUMN, &factor, -1);
- data->display_width = (gint) data->width * factor;
- data->display_height = (gint) data->height * factor;
data->zoom_factor = factor;
update_pixbuf_dimensions (data);
}
static void
+on_roi_width_changed (GObject *object, GParamSpec *pspec, ThreadData *data)
+{
+ g_object_get (object, "roi-width", &data->width, NULL);
+ update_pixbuf_dimensions (data);
+}
+
+static void
+on_roi_height_changed (GObject *object, GParamSpec *pspec, ThreadData *data)
+{
+ g_object_get (object, "roi-height", &data->height, NULL);
+ update_pixbuf_dimensions (data);
+}
+
+static void
create_main_window (GtkBuilder *builder, const gchar* camera_name)
{
static ThreadData td;
@@ -442,7 +457,7 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name)
guint width, height;
GError *error = NULL;
- camera = uca_plugin_manager_get_camera (plugin_manager, camera_name, &error);
+ camera = uca_plugin_manager_get_camera (plugin_manager, camera_name, &error, NULL);
if ((camera == NULL) || (error != NULL)) {
g_error ("%s\n", error->message);
@@ -455,6 +470,9 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name)
"sensor-bitdepth", &bits_per_sample,
NULL);
+ g_signal_connect (camera, "notify::roi-width", (GCallback) on_roi_width_changed, &td);
+ g_signal_connect (camera, "notify::roi-height", (GCallback) on_roi_height_changed, &td);
+
histogram_view = egg_histogram_view_new ();
property_tree_view = egg_property_tree_view_new (G_OBJECT (camera));
property_window = GTK_CONTAINER (gtk_builder_get_object (builder, "property-window"));