diff options
author | Takanori Nakane <nakane.t@gmail.com> | 2014-07-03 14:42:25 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-08-12 17:36:56 +0200 |
commit | a7e9dcfaa0d4f91842c832af5f5f02feea391ca8 (patch) | |
tree | d69f0e4caca4dbae276de6378dc1c44dcecc9aae | |
parent | 719aaa07e570c46054aec1bee4b4326f8805d8dd (diff) |
Added scrollbar in hdfsee
-rw-r--r-- | src/dw-hdfsee.c | 21 | ||||
-rw-r--r-- | src/dw-hdfsee.h | 2 |
2 files changed, 17 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; } diff --git a/src/dw-hdfsee.h b/src/dw-hdfsee.h index 22e44a34..7b84f256 100644 --- a/src/dw-hdfsee.h +++ b/src/dw-hdfsee.h @@ -11,6 +11,7 @@ * 2009-2012 Thomas White <taw@physics.org> * 2012 Richard Kirian * 2014 Valerio Mariani + * 2014 Takanori Nakane <nakane.t@gmail.com> * * This file is part of CrystFEL. * @@ -79,6 +80,7 @@ typedef struct { GtkWidget *window; GtkWidget *drawingarea; + GtkWidget *scrollarea; GtkUIManager *ui; GtkActionGroup *action_group; int n_pixbufs; |