diff options
author | Thomas White <taw@physics.org> | 2021-12-02 15:48:52 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-12-02 16:19:39 +0100 |
commit | 681fbbe63fc58fe0783310f840f7de390470b351 (patch) | |
tree | af47f01acf05dbf22078fc778c391445b5090308 /src | |
parent | 70bf4744ce51d52f439dcb6a652cad7c6daab466 (diff) |
GUI: Add a checkbox for automatically rescanning streams
Usually, one will want this option enabled. However, sometimes it
speeds things up a lot to disable it.
Fixes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/54
Diffstat (limited to 'src')
-rw-r--r-- | src/crystfel_gui.c | 12 | ||||
-rw-r--r-- | src/gui_project.c | 6 | ||||
-rw-r--r-- | src/gui_project.h | 1 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index 165ed666..177b6499 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -178,6 +178,8 @@ static int should_rescan_streams(struct crystfelproject *proj) { GSList *item = proj->tasks; + if ( !proj->rescan_on_change ) return 0; + if ( !proj->scanned_since_last_job_finished ) { proj->scanned_since_last_job_finished = 1; return 1; @@ -657,6 +659,13 @@ static gint results_combo_changed_sig(GtkComboBox *w, } +static gint rescan_on_change_sig(GtkWidget *w, struct crystfelproject *proj) +{ + proj->rescan_on_change = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)); + return FALSE; +} + + static gint show_centre_sig(GtkWidget *w, struct crystfelproject *proj) { proj->show_centre = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w)); @@ -711,6 +720,7 @@ static void add_menu_bar(struct crystfelproject *proj, GtkWidget *vbox) " <menuitem name=\"resetzoom\" action=\"ResetZoomAction\" />" "</menu>" "<menu name=\"tools\" action=\"ToolsAction\" >" + " <menuitem name=\"rescanonchange\" action=\"RescanOnChangeAction\" />" " <menuitem name=\"rescan\" action=\"RescanAction\" />" " <menuitem name=\"jumpframe\" action=\"JumpFrameAction\" />" "</menu>" @@ -752,6 +762,8 @@ static void add_menu_bar(struct crystfelproject *proj, GtkWidget *vbox) G_CALLBACK(label_refls_sig), FALSE }, { "CentreAction", NULL, "Beam centre", NULL, NULL, G_CALLBACK(show_centre_sig), FALSE }, + { "RescanOnChangeAction", NULL, "Rescan streams when changing frame", NULL, NULL, + G_CALLBACK(rescan_on_change_sig), FALSE }, }; proj->action_group = gtk_action_group_new("cellwindow"); diff --git a/src/gui_project.c b/src/gui_project.c index 42c28df4..16b8b8fc 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -534,6 +534,10 @@ static void handle_var(const char *key, const char *val, proj->show_centre = parse_int(val); } + if ( strcmp(key, "rescan_on_change") == 0 ) { + proj->rescan_on_change = parse_int(val); + } + if ( strcmp(key, "show_peaks") == 0 ) { proj->show_peaks = parse_int(val); } @@ -1140,6 +1144,7 @@ int save_project(struct crystfelproject *proj) fprintf(fh, "show_peaks %i\n", proj->show_peaks); fprintf(fh, "show_refls %i\n", proj->show_refls); fprintf(fh, "label_refls %i\n", proj->label_refls); + fprintf(fh, "rescan_on_change %i\n", proj->rescan_on_change); fprintf(fh, "-----\n"); for ( iresult=0; iresult<proj->n_results; iresult++ ) { @@ -1234,6 +1239,7 @@ int default_project(struct crystfelproject *proj) proj->show_peaks = 1; proj->show_refls = 1; proj->label_refls = 1; + proj->rescan_on_change = 1; proj->peak_search_params.method = PEAK_ZAEF; proj->peak_search_params.threshold = 800.0; diff --git a/src/gui_project.h b/src/gui_project.h index 84c7cd55..f034e125 100644 --- a/src/gui_project.h +++ b/src/gui_project.h @@ -301,6 +301,7 @@ struct crystfelproject { char **filenames; char **events; int show_centre; + int rescan_on_change; int show_peaks; struct peak_params peak_search_params; |