summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2013-03-12 12:06:03 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2013-03-12 12:06:47 +0100
commit0c2a3b8d2f35ccc4dc67616e430df7fb72cb5e62 (patch)
treec46a65e5e0ee737e1fba10de0e92306284ba1db2
parentb448763e0b4a0b7fec4861aaf1b3a709bcecad2b (diff)
downloaduca-0c2a3b8d2f35ccc4dc67616e430df7fb72cb5e62.tar.gz
uca-0c2a3b8d2f35ccc4dc67616e430df7fb72cb5e62.tar.bz2
uca-0c2a3b8d2f35ccc4dc67616e430df7fb72cb5e62.tar.xz
uca-0c2a3b8d2f35ccc4dc67616e430df7fb72cb5e62.zip
Update bitmap when ROI is changed
-rw-r--r--tools/gui/control.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/tools/gui/control.c b/tools/gui/control.c
index f74e0f1..c2ea59c 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);
@@ -415,13 +417,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;
@@ -455,6 +469,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"));