Control: tags -1 + patch Attached is a patch which makes the main (study) windows resizable at the expense of losing automatic expanding and shrinking. Currently, if you switch off two of the Transverse/Coronal/Sagittal views the window will shrink automatically. Likewise, if you enable 2-way/3-way views it will expand to the necessary height and by disabling them it will shrink. This is a nice feature and judging by the comment in ui_study.c, it is the sole reason why upstream decided to make the window non-resizable.
However, the OP's complaint is perfectly legitimate, it is very difficult and unpleasant to work with a window that large.
Description: Make the main (study) window resizable. Toolbar menu items "Thickness", "Field of view" and "Zoom" do nothing but they are necessary -- if the window is resized so that the right border is at one of these widgets, no drop-down arrow will be shown so the user will not have access to the Gate/Time buttons. Other items from "Threshold" leftwards are proper GtkToolItems (rather than widgets packed in a GtkToolItem) so their menus are fully functional and will appear as normal/toggle/radio menu items. Bug-Debian: https://bugs.debian.org/901677 Bug: https://github.com/ferdymercury/amide/issues/26 Author: Yavor Doganov <[email protected]> Forwarded: no Last-Update: 2024-02-24 --- --- amide.orig/amide-current/src/ui_study.c +++ amide/amide-current/src/ui_study.c @@ -540,7 +540,7 @@ toolbar = gtk_toolbar_new(); gtk_box_pack_start (GTK_BOX (ui_study->window_vbox), toolbar, FALSE, FALSE, 0); gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); - gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), FALSE); + gtk_widget_set_hexpand(toolbar, FALSE); tool_item = gtk_radio_tool_button_new(NULL); gtk_tool_button_set_label(GTK_TOOL_BUTTON(tool_item), _("Near.")); @@ -568,9 +568,8 @@ for (i_rendering = 0; i_rendering < AMITK_RENDERING_NUM; i_rendering++) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(ui_study->rendering_menu), amitk_rendering_get_name(i_rendering)); g_signal_connect(G_OBJECT(ui_study->rendering_menu), "changed", G_CALLBACK(ui_study_cb_rendering), ui_study); - ui_common_toolbar_insert_widget(toolbar, ui_study->rendering_menu, - _(amitk_rendering_explanation), - gtk_toolbar_get_n_items(GTK_TOOLBAR(toolbar))); + ui_common_toolbar_append_widget(toolbar, ui_study->rendering_menu, + _(amitk_rendering_explanation)); ui_common_toolbar_append_separator(toolbar); @@ -672,7 +671,7 @@ icon = gtk_image_new_from_icon_name("amide_icon_thresholding", GTK_ICON_SIZE_LARGE_TOOLBAR); - tool_item = gtk_tool_button_new(icon, _("_Threshold")); + tool_item = gtk_tool_button_new(icon, _("Threshold")); gtk_tool_item_set_tooltip_text(tool_item, _("Set the thresholds and colormaps for the active data set")); gtk_actionable_set_action_name(GTK_ACTIONABLE(tool_item), "win.thresholding"); @@ -697,7 +696,10 @@ g_signal_connect(G_OBJECT(ui_study->zoom_spin), "output", G_CALLBACK(amitk_spin_button_scientific_output), NULL); g_signal_connect(G_OBJECT(ui_study->zoom_spin), "button_press_event", G_CALLBACK(amitk_spin_button_discard_double_or_triple_click), NULL); - ui_common_toolbar_append_widget(toolbar,ui_study->zoom_spin,_("specify how much to magnify the images")); + ui_common_toolbar_append_widget_full(toolbar, ui_study->zoom_spin, + _("Zoom"), + _("specify how much to magnify the images"), + NULL, NULL); /* a separator for clarity */ ui_common_toolbar_append_separator(toolbar); @@ -716,7 +718,10 @@ g_signal_connect(G_OBJECT(ui_study->fov_spin), "value_changed", G_CALLBACK(ui_study_cb_fov), ui_study); g_signal_connect(G_OBJECT(ui_study->fov_spin), "button_press_event", G_CALLBACK(amitk_spin_button_discard_double_or_triple_click), NULL); - ui_common_toolbar_append_widget(toolbar,ui_study->fov_spin,_("specify how much of the image field of view to display")); + ui_common_toolbar_append_widget_full(toolbar, ui_study->fov_spin, + _("Field of view"), + _("specify how much of the image field of view to display"), + NULL, NULL); /* a separator for clarity */ ui_common_toolbar_append_separator(toolbar); @@ -736,7 +741,10 @@ g_signal_connect(G_OBJECT(ui_study->thickness_spin), "output", G_CALLBACK(amitk_spin_button_scientific_output), NULL); g_signal_connect(G_OBJECT(ui_study->thickness_spin), "button_press_event", G_CALLBACK(amitk_spin_button_discard_double_or_triple_click), NULL); - ui_common_toolbar_append_widget(toolbar,ui_study->thickness_spin,_("specify how thick to make the slices (mm)")); + ui_common_toolbar_append_widget_full(toolbar, ui_study->thickness_spin, + _("Thickness"), + _("specify how thick to make the slices (mm)"), + NULL, NULL); /* a separator for clarity */ ui_common_toolbar_append_separator(toolbar); @@ -749,9 +757,10 @@ ui_study->gate_button = gtk_button_new_with_label("?"); g_signal_connect(G_OBJECT(ui_study->gate_button), "clicked", G_CALLBACK(ui_study_cb_gate), ui_study); - ui_common_toolbar_append_widget(toolbar, ui_study->gate_button, - _("the gate range over which to view the data")); - + ui_common_toolbar_append_widget_full(toolbar, ui_study->gate_button, + _("Gate"), + _("the gate range over which to view the data"), + G_CALLBACK(ui_study_cb_gate), ui_study); /* a separator for clarity */ ui_common_toolbar_append_separator(toolbar); @@ -762,8 +771,10 @@ ui_study->time_button = gtk_button_new_with_label("?"); g_signal_connect(G_OBJECT(ui_study->time_button), "clicked", G_CALLBACK(ui_study_cb_time), ui_study); - ui_common_toolbar_append_widget(toolbar, ui_study->time_button, - _("the time range over which to view the data (s)")); + ui_common_toolbar_append_widget_full(toolbar, ui_study->time_button, + _("Time"), + _("the time range over which to view the data (s)"), + G_CALLBACK(ui_study_cb_time), ui_study); return; } @@ -1540,13 +1551,22 @@ void ui_study_setup_widgets(ui_study_t * ui_study) { GtkWidget * scrolled; + GtkWidget * scrld; GtkWidget * left_vbox; GtkWidget * hbox; /* the hbox that'll contain everything in the ui besides the menu and toolbar */ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); - gtk_box_pack_start (GTK_BOX (ui_study->window_vbox), hbox, TRUE, TRUE, 0); + scrld = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrld), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_propagate_natural_width(GTK_SCROLLED_WINDOW(scrld), + TRUE); + gtk_scrolled_window_set_propagate_natural_height(GTK_SCROLLED_WINDOW(scrld), + TRUE); + gtk_container_add(GTK_CONTAINER(scrld), hbox); + gtk_box_pack_start (GTK_BOX (ui_study->window_vbox), scrld, TRUE, TRUE, 0); /* make and add the left packing table */ left_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); @@ -1638,9 +1658,6 @@ gtk_window_set_default_icon(pixbuf); /* sets it as the default for all additional windows */ g_object_unref(pixbuf); - /* disable user resizability, allows the window to autoshrink */ - gtk_window_set_resizable(ui_study->window, FALSE); - /* setup the callbacks for the window */ g_signal_connect(G_OBJECT(ui_study->window), "delete_event", G_CALLBACK(ui_study_cb_delete_event), ui_study); --- amide.orig/amide-current/src/ui_common.c +++ amide/amide-current/src/ui_common.c @@ -821,6 +821,25 @@ return; } +void ui_common_toolbar_append_widget_full(GtkWidget * toolbar, GtkWidget * widget, const gchar * label, const gchar * tooltip, GCallback cb, gpointer data) { + + GtkToolItem * toolbar_item; + GtkWidget * menu_item; + + toolbar_item = gtk_tool_item_new(); + gtk_container_add(GTK_CONTAINER(toolbar_item), widget); + if (tooltip != NULL) + gtk_widget_set_tooltip_text(widget, tooltip); + if (label != NULL) { + menu_item = gtk_menu_item_new_with_label(label); + gtk_tool_item_set_proxy_menu_item(toolbar_item, label, menu_item); + if (cb != NULL) + g_signal_connect(menu_item, "activate", cb, data); + } + gtk_tool_item_set_homogeneous(toolbar_item, FALSE); + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolbar_item, -1); +} + void ui_common_toolbar_append_separator(GtkWidget * toolbar) { GtkToolItem * toolbar_item; toolbar_item = gtk_separator_tool_item_new(); --- amide.orig/amide-current/src/ui_common.h +++ amide/amide-current/src/ui_common.h @@ -86,6 +86,7 @@ GList * ui_common_init_dialog_selected_objects(GtkWidget * dialog); void ui_common_toolbar_insert_widget(GtkWidget * toolbar, GtkWidget * widget, const gchar * tooltip, gint position); void ui_common_toolbar_append_widget(GtkWidget * toolbar, GtkWidget * widget, const gchar * tooltip); +void ui_common_toolbar_append_widget_full(GtkWidget * toolbar, GtkWidget * widget, const gchar * label, const gchar * tooltip, GCallback cb, gpointer data); void ui_common_toolbar_append_separator(GtkWidget * toolbar); void amide_call_help(const gchar * link_id); --- amide.orig/amide-current/configure.ac +++ amide/amide-current/configure.ac @@ -369,7 +369,7 @@ glib-2.0 >= 2.68.0 gio-2.0 >= 2.68.0 gobject-2.0 >= 2.68.0 - gtk+-3.0 >= 3.21.5 + gtk+-3.0 >= 3.21.6 libxml-2.0 >= 2.4.12 goocanvas-2.0 >= 2.0.2 ])

