aboutsummaryrefslogtreecommitdiff
path: root/src/dw-hdfsee.c
diff options
context:
space:
mode:
authorTakanori Nakane <nakane.t@gmail.com>2014-07-03 14:42:25 +0100
committerThomas White <taw@physics.org>2014-08-12 17:36:56 +0200
commita7e9dcfaa0d4f91842c832af5f5f02feea391ca8 (patch)
treed69f0e4caca4dbae276de6378dc1c44dcecc9aae /src/dw-hdfsee.c
parent719aaa07e570c46054aec1bee4b4326f8805d8dd (diff)
Added scrollbar in hdfsee
Diffstat (limited to 'src/dw-hdfsee.c')
-rw-r--r--src/dw-hdfsee.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index da40fe58..28367ffa 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -552,12 +552,12 @@ static void set_window_size(DisplayWindow *dw)
gtk_widget_set_size_request(GTK_WIDGET(dw->drawingarea), width,
dw->height);
- geom.min_width = -1;
- geom.min_height = -1;
- geom.max_width = -1;
- geom.max_height = -1;
+ geom.min_width = 0;
+ geom.min_height = 0;
+ geom.max_width = dw->width + 10; // allow for scroll bar
+ geom.max_height = dw->height + 30;
gtk_window_set_geometry_hints(GTK_WINDOW(dw->window),
- GTK_WIDGET(dw->drawingarea), &geom,
+ GTK_WIDGET(dw->scrollarea), &geom,
GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
}
@@ -2536,7 +2536,11 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
displaywindow_addmenubar(dw, vbox, colscale);
dw->drawingarea = gtk_drawing_area_new();
- gtk_box_pack_start(GTK_BOX(vbox), dw->drawingarea, TRUE, TRUE, 0);
+ dw->scrollarea = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(dw->scrollarea),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(dw->scrollarea), dw->drawingarea);
+ gtk_box_pack_start(GTK_BOX(vbox), dw->scrollarea, TRUE, TRUE, 0);
g_signal_connect(GTK_OBJECT(dw->drawingarea), "expose-event",
G_CALLBACK(displaywindow_expose), dw);
@@ -2581,5 +2585,10 @@ DisplayWindow *displaywindow_open(const char *filename, const char *peaks,
displaywindow_update_menus(dw, element);
dw->not_ready_yet = 0;
+ // Keep the behaviour similar when loading an image from command line
+ // for compatibility with check_*** scripts
+ gtk_window_resize(GTK_WINDOW(dw->window), dw->width + 10,
+ dw->height + 30);
+
return dw;
}