diff options
author | Thomas White <taw@physics.org> | 2020-08-11 16:02:14 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-08-11 16:02:14 +0200 |
commit | e3ce7996792a406340384848994ea72b8b41a8b3 (patch) | |
tree | 0be7f532ceeb23ea3d3ce3818d03d0d33bb8c75d /src/crystfel_gui.c | |
parent | 965fcbce63090c620e5d7dbc56b7aae4f1d7f36d (diff) |
GUI: Add random image button
Diffstat (limited to 'src/crystfel_gui.c')
-rw-r--r-- | src/crystfel_gui.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index 7f593e6e..5e2eda26 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -573,6 +573,16 @@ static gint prev_frame_sig(GtkWidget *widget, } +static gint random_frame_sig(GtkWidget *widget, + struct crystfelproject *proj) +{ + proj->cur_frame = random()*proj->n_frames / RAND_MAX; + update_imageview(proj); + update_peaks(proj); + return FALSE; +} + + static gint next_frame_sig(GtkWidget *widget, struct crystfelproject *proj) { @@ -863,6 +873,13 @@ int main(int argc, char *argv[]) g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(prev_frame_sig), &proj); + /* Random */ + button = gtk_button_new_from_icon_name("media-playlist-shuffle", + GTK_ICON_SIZE_LARGE_TOOLBAR); + gtk_box_pack_start(GTK_BOX(toolbar), button, FALSE, FALSE, 0.0); + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(random_frame_sig), &proj); + /* Next */ button = gtk_button_new_from_icon_name("go-next", GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_box_pack_start(GTK_BOX(toolbar), button, FALSE, FALSE, 0.0); |