diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-12-13 10:12:03 +0100 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2013-12-13 10:12:03 +0100 |
commit | c937734ceab15c51c551274435f20128d1904485 (patch) | |
tree | a3212dab9bf449976cbcc5477735b171887a9727 /bin | |
parent | 044258b984409089e3e8d70f9145aa265a535881 (diff) | |
download | libuca-c937734ceab15c51c551274435f20128d1904485.tar.gz libuca-c937734ceab15c51c551274435f20128d1904485.tar.bz2 libuca-c937734ceab15c51c551274435f20128d1904485.tar.xz libuca-c937734ceab15c51c551274435f20128d1904485.zip |
Replace zoom combo box with toolbar buttons
Diffstat (limited to 'bin')
-rw-r--r-- | bin/gui/control.c | 61 | ||||
-rw-r--r-- | bin/gui/control.glade | 128 |
2 files changed, 110 insertions, 79 deletions
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 @@ <child> <object class="GtkButton" id="cancel-button"> <property name="label">gtk-quit</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> <signal name="clicked" handler="gtk_main_quit" swapped="no"/> </object> @@ -88,10 +88,10 @@ <child> <object class="GtkButton" id="proceed-button"> <property name="label">gtk-ok</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -152,10 +152,10 @@ <child> <object class="GtkButton" id="download-close-button"> <property name="label">gtk-close</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> + <property name="use_action_appearance">False</property> <property name="use_stock">True</property> </object> <packing> @@ -272,9 +272,9 @@ <property name="can_focus">False</property> <child> <object class="GtkMenuItem" id="menuitem1"> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">_File</property> <property name="use_underline">True</property> <child type="submenu"> @@ -284,9 +284,9 @@ <child> <object class="GtkImageMenuItem" id="imagemenuitem1"> <property name="label">gtk-new</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> </object> @@ -294,9 +294,9 @@ <child> <object class="GtkImageMenuItem" id="imagemenuitem2"> <property name="label">gtk-open</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> </object> @@ -304,9 +304,9 @@ <child> <object class="GtkImageMenuItem" id="save-item"> <property name="label">gtk-save-as</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> </object> @@ -320,9 +320,9 @@ <child> <object class="GtkImageMenuItem" id="imagemenuitem_quit"> <property name="label">gtk-quit</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> <signal name="activate" handler="gtk_main_quit" swapped="no"/> @@ -334,9 +334,9 @@ </child> <child> <object class="GtkMenuItem" id="menuitem4"> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">_Help</property> <property name="use_underline">True</property> <child type="submenu"> @@ -346,9 +346,9 @@ <child> <object class="GtkImageMenuItem" id="imagemenuitem_about"> <property name="label">gtk-about</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="use_underline">True</property> <property name="use_stock">True</property> </object> @@ -370,9 +370,9 @@ <property name="can_focus">False</property> <child> <object class="GtkToolButton" id="start-button"> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Run</property> <property name="use_underline">True</property> <property name="stock_id">gtk-media-play</property> @@ -384,9 +384,9 @@ </child> <child> <object class="GtkToolButton" id="record-button"> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Record</property> <property name="use_underline">True</property> <property name="stock_id">gtk-media-record</property> @@ -398,9 +398,9 @@ </child> <child> <object class="GtkToolButton" id="stop-button"> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Stop</property> <property name="use_underline">True</property> <property name="stock_id">gtk-media-stop</property> @@ -412,9 +412,9 @@ </child> <child> <object class="GtkToolButton" id="download-button"> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> <property name="label" translatable="yes">Download</property> <property name="use_underline">True</property> <property name="icon_name">network-receive</property> @@ -424,6 +424,59 @@ <property name="homogeneous">True</property> </packing> </child> + <child> + <object class="GtkSeparatorToolItem" id="toolbutton1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="zoom-in-button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="label" translatable="yes">Zoom in</property> + <property name="use_underline">True</property> + <property name="stock_id">gtk-zoom-in</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="zoom-out-button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="label" translatable="yes">Zoom out</property> + <property name="use_underline">True</property> + <property name="stock_id">gtk-zoom-out</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + <child> + <object class="GtkToolButton" id="zoom-normal-button"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="use_action_appearance">False</property> + <property name="label" translatable="yes">100 %</property> + <property name="use_underline">True</property> + <property name="stock_id">gtk-zoom-100</property> + </object> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> </object> <packing> <property name="expand">False</property> @@ -632,10 +685,10 @@ <child> <object class="GtkCheckButton" id="repeat-checkbutton"> <property name="label" translatable="yes">Repeat</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> @@ -872,11 +925,11 @@ <child> <object class="GtkCheckButton" id="histogram-checkbutton"> <property name="label" translatable="yes">Live Update</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="border_width">6</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -904,9 +957,6 @@ <property name="column_spacing">6</property> <property name="row_spacing">6</property> <child> - <placeholder/> - </child> - <child> <object class="GtkLabel" id="label21"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -1038,6 +1088,9 @@ <property name="y_options"></property> </packing> </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">True</property> @@ -1079,37 +1132,6 @@ <property name="border_width">12</property> <property name="spacing">6</property> <child> - <object class="GtkLabel" id="label23"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Zoom:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="zoom-box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="model">zoom-values</property> - <child> - <object class="GtkCellRendererText" id="cellrenderertext2"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - <child> <object class="GtkLabel" id="label24"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -1119,7 +1141,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">0</property> </packing> </child> <child> @@ -1137,7 +1159,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">3</property> + <property name="position">1</property> </packing> </child> </object> @@ -1240,11 +1262,11 @@ <child> <object class="GtkCheckButton" id="logarithm-checkbutton"> <property name="label" translatable="yes">Logarithm</property> - <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="border_width">10</property> + <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> </object> |