diff options
author | Thomas White <taw@physics.org> | 2020-12-07 14:48:07 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-12-07 14:48:07 +0100 |
commit | 72f857fbd0c29ba4954f5602ecc43574e581776a (patch) | |
tree | 6e6f194506e34de3079a39fa559a5be05f2f2658 /src/gui_project.c | |
parent | 79b8daba1e34e0c16104966314213ce1d0ad7b56 (diff) |
GUI: Save and restore the selected result
Diffstat (limited to 'src/gui_project.c')
-rw-r--r-- | src/gui_project.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui_project.c b/src/gui_project.c index 638ee065..53874121 100644 --- a/src/gui_project.c +++ b/src/gui_project.c @@ -37,6 +37,7 @@ #include <assert.h> #include "gui_project.h" +#include "crystfel_gui.h" #include "gui_backend_local.h" #include "gui_backend_slurm.h" @@ -565,6 +566,7 @@ static void read_results(FILE *fh, struct crystfelproject *proj) char **streams = NULL; int n_streams = 0; char *results_name = NULL; + int selected = 0; do { @@ -576,17 +578,27 @@ static void read_results(FILE *fh, struct crystfelproject *proj) if ( strncmp(line, "Result ", 7) == 0 ) { if ( n_streams > 0 ) { + /* Add the previously-read result */ add_result(proj, results_name, streams, n_streams); + + if ( selected ) { + select_result(proj, results_name); + } } n_streams = 0; + selected = 0; streams = NULL; results_name = strdup(line+7); } + if ( strncmp(line, " Selected", 11) == 0 ) { + selected = 1; + } + if ( strncmp(line, " Stream ", 10) == 0 ) { streams = add_stream(strdup(line+10), streams, @@ -600,6 +612,10 @@ static void read_results(FILE *fh, struct crystfelproject *proj) results_name, streams, n_streams); + + if ( selected ) { + select_result(proj, results_name); + } } break; @@ -836,6 +852,11 @@ int save_project(struct crystfelproject *proj) fprintf(fh, " Stream %s\n", proj->results[i].streams[j]); } + if ( strcmp(selected_result(proj), + proj->results[i].name) == 0 ) + { + fprintf(fh, " Selected\n"); + } } fprintf(fh, "-----\n"); |