File: resizable-window.patch

package info (click to toggle)
amide 1.0.6-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,904 kB
  • sloc: ansic: 51,916; cpp: 2,332; xml: 1,995; makefile: 674; sh: 129
file content (193 lines) | stat: -rw-r--r-- 9,513 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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 <yavor@gnu.org>
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
 ])