From c937734ceab15c51c551274435f20128d1904485 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Fri, 13 Dec 2013 10:12:03 +0100 Subject: Replace zoom combo box with toolbar buttons --- bin/gui/control.c | 61 ++++++++++++++---------- bin/gui/control.glade | 128 +++++++++++++++++++++++++++++--------------------- 2 files changed, 110 insertions(+), 79 deletions(-) (limited to 'bin') diff --git a/bin/gui/control.c b/bin/gui/control.c index 97ec4d4..c4248f0 100644 --- a/bin/gui/control.c +++ b/bin/gui/control.c @@ -44,9 +44,11 @@ typedef struct { GtkWidget *stop_button; GtkWidget *record_button; GtkWidget *download_button; + GtkWidget *zoom_in_button; + GtkWidget *zoom_out_button; + GtkWidget *zoom_normal_button; GtkWidget *acquisition_expander; GtkWidget *properties_expander; - GtkWidget *zoom_box; GtkWidget *colormap_box; GtkWidget *event_box; GtkLabel *mean_label; @@ -624,8 +626,6 @@ set_tool_button_state (ThreadData *data) data->state == IDLE); gtk_widget_set_sensitive (data->properties_expander, data->state == IDLE); - gtk_widget_set_sensitive (data->zoom_box, - data->state == IDLE); gtk_widget_set_sensitive (data->colormap_box, data->state == IDLE); } @@ -958,33 +958,39 @@ on_download_button_clicked (GtkWidget *widget, ThreadData *data) } static void -on_histogram_changed (EggHistogramView *view, ThreadData *data) +update_zoomed_pixbuf (ThreadData *data) { - if (data->state == IDLE) - update_current_frame (data); + update_pixbuf_dimensions (data); + up_and_down_scale (data, uca_ring_buffer_get_current_pointer (data->buffer)); + update_pixbuf (data); } static void -on_zoom_changed (GtkComboBox *widget, ThreadData *data) +on_zoom_in_button_clicked (GtkWidget *widget, ThreadData *data) { - GtkTreeModel *model; - GtkTreeIter iter; - gdouble factor; - - enum { - DISPLAY_COLUMN, - FACTOR_COLUMN - }; + data->zoom_factor *= 2; + update_zoomed_pixbuf (data); +} - model = gtk_combo_box_get_model (widget); - gtk_combo_box_get_active_iter (widget, &iter); - gtk_tree_model_get (model, &iter, FACTOR_COLUMN, &factor, -1); +static void +on_zoom_out_button_clicked (GtkWidget *widget, ThreadData *data) +{ + data->zoom_factor /= 2; + update_zoomed_pixbuf (data); +} - data->zoom_factor = factor; - update_pixbuf_dimensions (data); +static void +on_zoom_normal_button_clicked (GtkWidget *widget, ThreadData *data) +{ + data->zoom_factor = 1.0; + update_zoomed_pixbuf (data); +} - up_and_down_scale (data, uca_ring_buffer_get_current_pointer (data->buffer)); - update_pixbuf (data); +static void +on_histogram_changed (EggHistogramView *view, ThreadData *data) +{ + if (data->state == IDLE) + update_current_frame (data); } static void @@ -1070,12 +1076,15 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name) td.acquisition_expander = GTK_WIDGET (gtk_builder_get_object (builder, "acquisition-expander")); td.properties_expander = GTK_WIDGET (gtk_builder_get_object (builder, "properties-expander")); - td.zoom_box = GTK_WIDGET (gtk_builder_get_object (builder, "zoom-box")); td.colormap_box = GTK_WIDGET (gtk_builder_get_object (builder, "colormap-box")); td.start_button = GTK_WIDGET (gtk_builder_get_object (builder, "start-button")); td.stop_button = GTK_WIDGET (gtk_builder_get_object (builder, "stop-button")); td.record_button = GTK_WIDGET (gtk_builder_get_object (builder, "record-button")); td.download_button = GTK_WIDGET (gtk_builder_get_object (builder, "download-button")); + td.zoom_in_button = GTK_WIDGET (gtk_builder_get_object (builder, "zoom-in-button")); + td.zoom_out_button = GTK_WIDGET (gtk_builder_get_object (builder, "zoom-out-button")); + td.zoom_normal_button = GTK_WIDGET (gtk_builder_get_object (builder, "zoom-normal-button")); + td.download_button = GTK_WIDGET (gtk_builder_get_object (builder, "download-button")); td.histogram_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "histogram-checkbutton")); td.log_button = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, "logarithm-checkbutton")); td.frame_slider = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "frames-adjustment")); @@ -1160,9 +1169,6 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name) g_signal_connect (gtk_builder_get_object (builder, "save-item"), "activate", G_CALLBACK (on_save), &td); - g_signal_connect (gtk_builder_get_object (builder, "zoom-box"), - "changed", G_CALLBACK (on_zoom_changed), &td); - g_signal_connect (gtk_builder_get_object (builder, "colormap-box"), "changed", G_CALLBACK (on_colormap_changed), &td); @@ -1174,6 +1180,9 @@ create_main_window (GtkBuilder *builder, const gchar* camera_name) g_signal_connect (td.stop_button, "clicked", G_CALLBACK (on_stop_button_clicked), &td); g_signal_connect (td.record_button, "clicked", G_CALLBACK (on_record_button_clicked), &td); g_signal_connect (td.download_button, "clicked", G_CALLBACK (on_download_button_clicked), &td); + g_signal_connect (td.zoom_in_button, "clicked", G_CALLBACK (on_zoom_in_button_clicked), &td); + g_signal_connect (td.zoom_out_button, "clicked", G_CALLBACK (on_zoom_out_button_clicked), &td); + g_signal_connect (td.zoom_normal_button, "clicked", G_CALLBACK (on_zoom_normal_button_clicked), &td); g_signal_connect (histogram_view, "changed", G_CALLBACK (on_histogram_changed), &td); g_signal_connect (window, "destroy", G_CALLBACK (on_destroy), &td); diff --git a/bin/gui/control.glade b/bin/gui/control.glade index 5bd55ff..95184ed 100644 --- a/bin/gui/control.glade +++ b/bin/gui/control.glade @@ -72,10 +72,10 @@ gtk-quit - False True True True + False True @@ -88,10 +88,10 @@ gtk-ok - False True True True + False True @@ -152,10 +152,10 @@ gtk-close - False True True True + False True @@ -272,9 +272,9 @@ False - False True False + False _File True @@ -284,9 +284,9 @@ gtk-new - False True False + False True True @@ -294,9 +294,9 @@ gtk-open - False True False + False True True @@ -304,9 +304,9 @@ gtk-save-as - False True False + False True True @@ -320,9 +320,9 @@ gtk-quit - False True False + False True True @@ -334,9 +334,9 @@ - False True False + False _Help True @@ -346,9 +346,9 @@ gtk-about - False True False + False True True @@ -370,9 +370,9 @@ False - False True False + False Run True gtk-media-play @@ -384,9 +384,9 @@ - False True False + False Record True gtk-media-record @@ -398,9 +398,9 @@ - False True False + False Stop True gtk-media-stop @@ -412,9 +412,9 @@ - False True False + False Download True network-receive @@ -424,6 +424,59 @@ True + + + True + False + False + + + False + True + + + + + True + False + False + Zoom in + True + gtk-zoom-in + + + False + True + + + + + True + False + False + Zoom out + True + gtk-zoom-out + + + False + True + + + + + True + False + False + 100 % + True + gtk-zoom-100 + + + False + True + + False @@ -632,10 +685,10 @@ Repeat - False True True False + False 0 True @@ -872,11 +925,11 @@ Live Update - False True True False 6 + False 0 True True @@ -903,9 +956,6 @@ 2 6 6 - - - True @@ -1038,6 +1088,9 @@ + + + True @@ -1078,37 +1131,6 @@ False 12 6 - - - True - False - 0 - Zoom: - - - False - False - 0 - - - - - True - False - zoom-values - - - - 0 - - - - - False - False - 1 - - True @@ -1119,7 +1141,7 @@ False False - 2 + 0 @@ -1137,7 +1159,7 @@ False False - 3 + 1 @@ -1240,11 +1262,11 @@ Logarithm - False True True False 10 + False 0 True -- cgit v1.2.3