[aravis] viewer: add auto gain and auto exposure button.



commit b1dbf425b8a77ed47bad95d09be206617abe9b50
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Fri Jan 28 15:32:21 2011 +0100

    viewer: add auto gain and auto exposure button.

 docs/reference/aravis/aravis-sections.txt |    7 ++
 src/arvcamera.c                           |   32 +++++++
 src/arvcamera.h                           |    4 +
 src/arvenums.c                            |   19 ++++
 src/arvenums.h                            |   22 ++++-
 viewer/arv-viewer.ui                      |  101 +++++++++++++++++----
 viewer/arvviewer.c                        |  138 ++++++++++++++++++++++++++++-
 7 files changed, 300 insertions(+), 23 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 19b0a12..ddb4272 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -1,6 +1,9 @@
 <SECTION>
 <FILE>arvcamera</FILE>
 <TITLE>ArvCamera</TITLE>
+ArvAuto
+arv_auto_from_string
+arv_auto_to_string
 ArvCamera
 arv_camera_new
 arv_camera_create_stream
@@ -25,9 +28,13 @@ arv_camera_set_trigger
 arv_camera_set_exposure_time
 arv_camera_get_exposure_time
 arv_camera_get_exposure_time_bounds
+arv_camera_set_exposure_time_auto
+arv_camera_get_exposure_time_auto
 arv_camera_set_gain
 arv_camera_get_gain
 arv_camera_get_gain_bounds
+arv_camera_set_gain_auto
+arv_camera_get_gain_auto
 arv_camera_get_payload
 ArvAcquisitionMode
 arv_acquisition_mode_to_string
diff --git a/src/arvcamera.c b/src/arvcamera.c
index 32705be..8b4a13e 100644
--- a/src/arvcamera.c
+++ b/src/arvcamera.c
@@ -523,6 +523,22 @@ arv_camera_get_exposure_time_bounds (ArvCamera *camera, double *min, double *max
 	}
 }
 
+void
+arv_camera_set_exposure_time_auto (ArvCamera *camera, ArvAuto auto_mode)
+{
+	g_return_if_fail (ARV_IS_CAMERA (camera));
+
+	arv_device_set_string_feature_value (camera->priv->device, "ExposureAuto", arv_auto_to_string (auto_mode));
+}
+
+ArvAuto
+arv_camera_get_exposure_time_auto (ArvCamera *camera)
+{
+	g_return_val_if_fail (ARV_IS_CAMERA (camera), ARV_AUTO_OFF);
+
+	return arv_auto_from_string (arv_device_get_string_feature_value (camera->priv->device, "ExposureAuto"));
+}
+
 /* Analog control */
 
 /**
@@ -566,6 +582,22 @@ arv_camera_get_gain_bounds (ArvCamera *camera, gint64 *min, gint64 *max)
 	arv_device_get_integer_feature_bounds (camera->priv->device, "GainRaw", min, max);
 }
 
+void
+arv_camera_set_gain_auto (ArvCamera *camera, ArvAuto auto_mode)
+{
+	g_return_if_fail (ARV_IS_CAMERA (camera));
+
+	arv_device_set_string_feature_value (camera->priv->device, "GainAuto", arv_auto_to_string (auto_mode));
+}
+
+ArvAuto
+arv_camera_get_gain_auto (ArvCamera *camera)
+{
+	g_return_val_if_fail (ARV_IS_CAMERA (camera), ARV_AUTO_OFF);
+
+	return arv_auto_from_string (arv_device_get_string_feature_value (camera->priv->device, "GainAuto"));
+}
+
 /* Transport layer control */
 
 /**
diff --git a/src/arvcamera.h b/src/arvcamera.h
index f0764a8..3471046 100644
--- a/src/arvcamera.h
+++ b/src/arvcamera.h
@@ -86,12 +86,16 @@ void		arv_camera_set_trigger			(ArvCamera *camera, const char *source);
 void 		arv_camera_set_exposure_time 		(ArvCamera *camera, double exposure_time_us);
 double 		arv_camera_get_exposure_time 		(ArvCamera *camera);
 void		arv_camera_get_exposure_time_bounds	(ArvCamera *camera, double *min, double *max);
+void		arv_camera_set_exposure_time_auto	(ArvCamera *camera, ArvAuto auto_mode);
+ArvAuto		arv_camera_get_exposure_time_auto	(ArvCamera *camera);
 
 /* Analog control */
 
 void 		arv_camera_set_gain	 	(ArvCamera *camera, gint64 gain);
 gint64 		arv_camera_get_gain 		(ArvCamera *camera);
 void		arv_camera_get_gain_bounds	(ArvCamera *camera, gint64 *min, gint64 *max);
+void		arv_camera_set_gain_auto	(ArvCamera *camera, ArvAuto auto_mode);
+ArvAuto		arv_camera_get_gain_auto	(ArvCamera *camera);
 
 /* Transport layer control */
 
diff --git a/src/arvenums.c b/src/arvenums.c
index d607cc2..12b87f3 100644
--- a/src/arvenums.c
+++ b/src/arvenums.c
@@ -37,6 +37,25 @@ _from_string (const char *string, const char **strings, unsigned int n_strings)
 	return 0;
 }
 
+static const char *arv_auto_strings[] = {
+	"Off",
+	"Once",
+	"Continuous"
+};
+
+const char *
+arv_auto_to_string (ArvAuto value)
+{
+	return arv_auto_strings[CLAMP (value, 0, ARV_AUTO_CONTINUOUS)];
+}
+
+ArvAuto
+arv_auto_from_string (const char *string)
+{
+	return _from_string (string, arv_auto_strings,
+			     G_N_ELEMENTS (arv_auto_strings));
+}
+
 static const char *arv_acquisition_mode_strings[] = {
 	"Continuous",
 	"SingleFrame"
diff --git a/src/arvenums.h b/src/arvenums.h
index 2386b91..9488ea6 100644
--- a/src/arvenums.h
+++ b/src/arvenums.h
@@ -46,6 +46,22 @@ typedef enum {
 } ArvGcCachable;
 
 /**
+ * ArvAuto:
+ * @ARV_AUTO_OFF: manual setting
+ * @ARV_AUTO_ONCE: automatic setting done once, then returns to manual
+ * @ARV_AUTO_CONTINUOUS: setting is adjusted continuously
+ */
+
+typedef enum {
+	ARV_AUTO_OFF,
+	ARV_AUTO_ONCE,
+	ARV_AUTO_CONTINUOUS
+} ArvAuto;
+
+const char * 		arv_auto_to_string 		(ArvAuto value);
+ArvAuto 		arv_auto_from_string		(const char *string);
+
+/**
  * ArvAcquisitionMode:
  * @ARV_ACQUISITION_MODE_CONTINUOUS: continuous acquisition
  * @ARV_ACQUISITION_MODE_SINGLE_FRAME: only one frame will be acquired
@@ -56,6 +72,9 @@ typedef enum {
 	ARV_ACQUISITION_MODE_SINGLE_FRAME
 } ArvAcquisitionMode;
 
+const char * 		arv_acquisition_mode_to_string 		(ArvAcquisitionMode value);
+ArvAcquisitionMode 	arv_acquisition_mode_from_string	(const char *string);
+
 /**
  * ArvPixelFormat:
  */
@@ -100,9 +119,6 @@ typedef enum {
 	ARV_PIXEL_FORMAT_BAYER_BG_16		= 0x81100009
 } ArvPixelFormat;
 
-const char * 		arv_acquisition_mode_to_string 		(ArvAcquisitionMode value);
-ArvAcquisitionMode 	arv_acquisition_mode_from_string	(const char *string);
-
 G_END_DECLS
 
 #endif
diff --git a/viewer/arv-viewer.ui b/viewer/arv-viewer.ui
index 65941a6..a409be2 100644
--- a/viewer/arv-viewer.ui
+++ b/viewer/arv-viewer.ui
@@ -10,8 +10,35 @@
         <property name="border_width">12</property>
         <property name="spacing">6</property>
         <child>
-          <object class="GtkComboBox" id="camera_combobox">
+          <object class="GtkHBox" id="hbox1">
             <property name="visible">True</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkButton" id="play_button">
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <child>
+                  <object class="GtkImage" id="play_image">
+                    <property name="visible">True</property>
+                    <property name="stock">gtk-media-play</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBox" id="camera_combobox">
+                <property name="visible">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -37,7 +64,7 @@
               <object class="GtkTable" id="table1">
                 <property name="visible">True</property>
                 <property name="n_rows">3</property>
-                <property name="n_columns">4</property>
+                <property name="n_columns">5</property>
                 <property name="column_spacing">6</property>
                 <property name="row_spacing">6</property>
                 <child>
@@ -47,6 +74,8 @@
                     <property name="label" translatable="yes">Frame rate:</property>
                   </object>
                   <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
@@ -57,6 +86,8 @@
                     <property name="label" translatable="yes">Exposure:</property>
                   </object>
                   <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
@@ -69,6 +100,8 @@
                     <property name="label" translatable="yes">Gain:</property>
                   </object>
                   <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
@@ -82,8 +115,8 @@
                     <property name="width_chars">10</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
@@ -94,8 +127,8 @@
                     <property name="label" translatable="yes">Hz</property>
                   </object>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
+                    <property name="left_attach">3</property>
+                    <property name="right_attach">4</property>
                     <property name="x_options">GTK_FILL</property>
                   </packing>
                 </child>
@@ -106,8 +139,8 @@
                     <property name="label" translatable="yes">µs</property>
                   </object>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
+                    <property name="left_attach">3</property>
+                    <property name="right_attach">4</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
@@ -118,8 +151,8 @@
                     <property name="visible">True</property>
                   </object>
                   <packing>
-                    <property name="left_attach">2</property>
-                    <property name="right_attach">3</property>
+                    <property name="left_attach">3</property>
+                    <property name="right_attach">4</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
@@ -132,8 +165,8 @@
                     <property name="draw_value">False</property>
                   </object>
                   <packing>
-                    <property name="left_attach">3</property>
-                    <property name="right_attach">4</property>
+                    <property name="left_attach">4</property>
+                    <property name="right_attach">5</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
                   </packing>
@@ -145,8 +178,8 @@
                     <property name="draw_value">False</property>
                   </object>
                   <packing>
-                    <property name="left_attach">3</property>
-                    <property name="right_attach">4</property>
+                    <property name="left_attach">4</property>
+                    <property name="right_attach">5</property>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                   </packing>
@@ -158,8 +191,8 @@
                     <property name="invisible_char">â?¢</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
                     <property name="top_attach">1</property>
                     <property name="bottom_attach">2</property>
                     <property name="x_options">GTK_FILL</property>
@@ -172,8 +205,40 @@
                     <property name="invisible_char">â?¢</property>
                   </object>
                   <packing>
-                    <property name="left_attach">1</property>
-                    <property name="right_attach">2</property>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBox" id="trigger_combobox"/>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="auto_exposure_togglebutton">
+                    <property name="label" translatable="yes">Auto</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToggleButton" id="auto_gain_togglebutton">
+                    <property name="label" translatable="yes">Auto</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                  </object>
+                  <packing>
                     <property name="top_attach">2</property>
                     <property name="bottom_attach">3</property>
                     <property name="x_options">GTK_FILL</property>
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
index 64dfd3b..e2c6d6b 100644
--- a/viewer/arvviewer.c
+++ b/viewer/arvviewer.c
@@ -56,20 +56,29 @@ typedef struct {
 	guint64 last_timestamp;
 
 	GtkWidget *main_window;
+	GtkWidget *play_button;
 	GtkWidget *drawing_area;
 	GtkWidget *camera_combo_box;
+	GtkWidget *trigger_combo_box;
 	GtkWidget *frame_rate_entry;
 	GtkWidget *exposure_spin_button;
 	GtkWidget *gain_spin_button;
 	GtkWidget *exposure_hscale;
 	GtkWidget *gain_hscale;
+	GtkWidget *auto_exposure_toggle;
+	GtkWidget *auto_gain_toggle;
 
 	gulong exposure_spin_changed;
 	gulong gain_spin_changed;
 	gulong exposure_hscale_changed;
 	gulong gain_hscale_changed;
+	gulong auto_gain_clicked;
+	gulong auto_exposure_clicked;
 
 	double exposure_min, exposure_max;
+
+	guint gain_update_event;
+	guint exposure_update_event;
 } ArvViewer;
 
 double
@@ -167,7 +176,7 @@ arv_viewer_exposure_spin_cb (GtkSpinButton *spin_button, ArvViewer *viewer)
 	double exposure = gtk_spin_button_get_value (spin_button);
 	double log_exposure = arv_viewer_value_to_log (exposure, viewer->exposure_min, viewer->exposure_max);
 
-	arv_camera_set_exposure_time (viewer->camera, exposure); 
+	arv_camera_set_exposure_time (viewer->camera, exposure);
 
 	g_signal_handler_block (viewer->exposure_hscale, viewer->exposure_hscale_changed);
 	gtk_range_set_value (GTK_RANGE (viewer->exposure_hscale), log_exposure);
@@ -207,6 +216,101 @@ arv_viewer_gain_scale_cb (GtkRange *range, ArvViewer *viewer)
 	g_signal_handler_unblock (viewer->gain_spin_button, viewer->gain_spin_changed);
 }
 
+gboolean
+arv_viewer_update_exposure_cb (void *data)
+{
+	ArvViewer *viewer = data;
+	double exposure;
+	double log_exposure;
+
+	exposure = arv_camera_get_exposure_time (viewer->camera);
+	log_exposure = arv_viewer_value_to_log (exposure, viewer->exposure_min, viewer->exposure_max);
+
+	g_signal_handler_block (viewer->exposure_hscale, viewer->exposure_hscale_changed);
+	g_signal_handler_block (viewer->exposure_spin_button, viewer->exposure_spin_changed);
+	gtk_range_set_value (GTK_RANGE (viewer->exposure_hscale), log_exposure);
+	gtk_spin_button_set_value (GTK_SPIN_BUTTON (viewer->exposure_spin_button), exposure);
+	g_signal_handler_unblock (viewer->exposure_spin_button, viewer->exposure_spin_changed);
+	g_signal_handler_unblock (viewer->exposure_hscale, viewer->exposure_hscale_changed);
+
+	return TRUE;
+}
+
+void
+arv_viewer_update_exposure_ui (ArvViewer *viewer, gboolean is_auto)
+{
+	gtk_widget_set_sensitive (viewer->exposure_spin_button, !is_auto);
+	gtk_widget_set_sensitive (viewer->exposure_hscale, !is_auto);
+
+	arv_viewer_update_exposure_cb (viewer);
+
+	if (viewer->exposure_update_event > 0) {
+		g_source_remove (viewer->exposure_update_event);
+		viewer->exposure_update_event = 0;
+	}
+
+	if (is_auto)
+		viewer->exposure_update_event = g_timeout_add_seconds (1, arv_viewer_update_exposure_cb, viewer);
+}
+
+void
+arv_viewer_auto_exposure_cb (GtkToggleButton *toggle, ArvViewer *viewer)
+{
+	gboolean is_auto;
+
+	is_auto = gtk_toggle_button_get_active (toggle);
+
+	arv_camera_set_exposure_time_auto (viewer->camera, is_auto ? ARV_AUTO_CONTINUOUS : ARV_AUTO_OFF);
+	arv_viewer_update_exposure_ui (viewer, is_auto);
+}
+
+gboolean
+arv_viewer_update_gain_cb (void *data)
+{
+	ArvViewer *viewer = data;
+	gint64 gain;
+
+	gain = arv_camera_get_gain (viewer->camera);
+
+	g_signal_handler_block (viewer->gain_hscale, viewer->gain_hscale_changed);
+	g_signal_handler_block (viewer->gain_spin_button, viewer->gain_spin_changed);
+	gtk_range_set_value (GTK_RANGE (viewer->gain_hscale), gain);
+	gtk_spin_button_set_value (GTK_SPIN_BUTTON (viewer->gain_spin_button), gain);
+	g_signal_handler_unblock (viewer->gain_spin_button, viewer->gain_spin_changed);
+	g_signal_handler_unblock (viewer->gain_hscale, viewer->gain_hscale_changed);
+
+	return TRUE;
+}
+
+void
+arv_viewer_update_gain_ui (ArvViewer *viewer, gboolean is_auto)
+{
+	gtk_widget_set_sensitive (viewer->gain_spin_button, !is_auto);
+	gtk_widget_set_sensitive (viewer->gain_hscale, !is_auto);
+
+	arv_viewer_update_gain_cb (viewer);
+
+	if (viewer->gain_update_event > 0) {
+		g_source_remove (viewer->gain_update_event);
+		viewer->gain_update_event = 0;
+	}
+
+	if (is_auto)
+		viewer->gain_update_event = g_timeout_add_seconds (1, arv_viewer_update_gain_cb, viewer);
+
+}
+
+void
+arv_viewer_auto_gain_cb (GtkToggleButton *toggle, ArvViewer *viewer)
+{
+	gboolean is_auto;
+
+	is_auto = gtk_toggle_button_get_active (toggle);
+
+	arv_camera_set_gain_auto (viewer->camera, is_auto ? ARV_AUTO_CONTINUOUS : ARV_AUTO_OFF);
+	arv_viewer_update_gain_ui (viewer, is_auto);
+}
+
 void
 arv_viewer_release_camera (ArvViewer *viewer)
 {
@@ -257,6 +361,7 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	double log_exposure;
 	double frame_rate;
 	gint64 gain, gain_min, gain_max;
+	gboolean auto_gain, auto_exposure;
 
 	g_return_if_fail (viewer != NULL);
 
@@ -281,8 +386,11 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	arv_camera_get_exposure_time_bounds (viewer->camera, &viewer->exposure_min, &viewer->exposure_max);
 	arv_camera_get_gain_bounds (viewer->camera, &gain_min, &gain_max);
 	frame_rate = arv_camera_get_frame_rate (viewer->camera);
+	auto_gain = arv_camera_get_gain_auto (viewer->camera) != ARV_AUTO_OFF;
+	auto_exposure = arv_camera_get_gain_auto (viewer->camera) != ARV_AUTO_OFF;
 
-	gtk_spin_button_set_range (GTK_SPIN_BUTTON (viewer->exposure_spin_button), viewer->exposure_min, viewer->exposure_max);
+	gtk_spin_button_set_range (GTK_SPIN_BUTTON (viewer->exposure_spin_button),
+				   viewer->exposure_min, viewer->exposure_max);
 	gtk_spin_button_set_increments (GTK_SPIN_BUTTON (viewer->exposure_spin_button), 200.0, 1000.0); 
 	gtk_spin_button_set_value (GTK_SPIN_BUTTON (viewer->exposure_spin_button), exposure);
 	gtk_spin_button_set_range (GTK_SPIN_BUTTON (viewer->gain_spin_button), gain_min, gain_max);
@@ -300,6 +408,16 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	gtk_entry_set_text (GTK_ENTRY (viewer->frame_rate_entry), string);
 	g_free (string);
 
+	arv_viewer_update_gain_ui (viewer, auto_gain);
+	arv_viewer_update_exposure_ui (viewer, auto_exposure);
+
+	g_signal_handler_block (viewer->auto_gain_toggle, viewer->auto_gain_clicked);
+	g_signal_handler_block (viewer->auto_exposure_toggle, viewer->auto_exposure_clicked);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (viewer->auto_gain_toggle), auto_gain);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (viewer->auto_exposure_toggle), auto_exposure);
+	g_signal_handler_unblock (viewer->auto_gain_toggle, viewer->auto_gain_clicked);
+	g_signal_handler_unblock (viewer->auto_exposure_toggle, viewer->auto_exposure_clicked);
+
 	for (caps_infos_id = 0; caps_infos_id < G_N_ELEMENTS (arv_viewer_caps_infos); caps_infos_id++)
 		if (arv_viewer_caps_infos[caps_infos_id].pixel_format == pixel_format)
 			break;
@@ -340,6 +458,11 @@ arv_viewer_free (ArvViewer *viewer)
 {
 	g_return_if_fail (viewer != NULL);
 
+	if (viewer->exposure_update_event > 0)
+		g_source_remove (viewer->exposure_update_event);
+	if (viewer->gain_update_event > 0)
+		g_source_remove (viewer->gain_update_event);
+
 	arv_viewer_release_camera (viewer);
 }
 
@@ -368,13 +491,17 @@ arv_viewer_new (void)
 	g_free (ui_filename);
 
 	viewer->camera_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "camera_combobox"));
+	viewer->play_button = GTK_WIDGET (gtk_builder_get_object (builder, "play_button"));
 	viewer->main_window = GTK_WIDGET (gtk_builder_get_object (builder, "main_window"));
 	viewer->drawing_area = GTK_WIDGET (gtk_builder_get_object (builder, "video_drawingarea"));
+	viewer->trigger_combo_box = GTK_WIDGET (gtk_builder_get_object (builder, "trigger_combobox"));
 	viewer->frame_rate_entry = GTK_WIDGET (gtk_builder_get_object (builder, "frame_rate_entry"));
 	viewer->exposure_spin_button = GTK_WIDGET (gtk_builder_get_object (builder, "exposure_spinbutton"));
 	viewer->gain_spin_button = GTK_WIDGET (gtk_builder_get_object (builder, "gain_spinbutton"));
 	viewer->exposure_hscale = GTK_WIDGET (gtk_builder_get_object (builder, "exposure_hscale"));
 	viewer->gain_hscale = GTK_WIDGET (gtk_builder_get_object (builder, "gain_hscale"));
+	viewer->auto_exposure_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "auto_exposure_togglebutton"));
+	viewer->auto_gain_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "auto_gain_togglebutton"));
 
 	g_object_unref (builder);
 
@@ -382,6 +509,9 @@ arv_viewer_new (void)
 	gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (viewer->camera_combo_box), cell, TRUE);
 	gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (viewer->camera_combo_box), cell, "text", 0, NULL);
 
+	gtk_widget_set_no_show_all (viewer->play_button, TRUE);
+	gtk_widget_set_no_show_all (viewer->trigger_combo_box, TRUE);
+
 	gtk_widget_show_all (viewer->main_window);
 
 	g_signal_connect (viewer->main_window, "destroy", G_CALLBACK (arv_viewer_quit_cb), viewer);
@@ -397,6 +527,10 @@ arv_viewer_new (void)
 							    G_CALLBACK (arv_viewer_exposure_scale_cb), viewer);
 	viewer->gain_hscale_changed = g_signal_connect (viewer->gain_hscale, "value-changed",
 							G_CALLBACK (arv_viewer_gain_scale_cb), viewer);
+	viewer->auto_exposure_clicked = g_signal_connect (viewer->auto_exposure_toggle, "clicked",
+							  G_CALLBACK (arv_viewer_auto_exposure_cb), viewer);
+	viewer->auto_gain_clicked = g_signal_connect (viewer->auto_gain_toggle, "clicked",
+						      G_CALLBACK (arv_viewer_auto_gain_cb), viewer);
 
 	return viewer;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]