From 0c2a3b8d2f35ccc4dc67616e430df7fb72cb5e62 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 12 Mar 2013 12:06:03 +0100 Subject: Update bitmap when ROI is changed --- tools/gui/control.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'tools/gui/control.c') 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,12 +417,24 @@ 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) { @@ -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")); -- cgit v1.2.3