diff options
author | Thomas White <taw@physics.org> | 2021-01-21 15:26:49 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-01-21 15:26:49 +0100 |
commit | e29d82eb4da07cda77ba76817a2318a250de163c (patch) | |
tree | 52022b3139d5d8298540af5fddc5d1866b2a4932 /src | |
parent | b1ad534716b532a54103200fb0749aa82b929fde (diff) |
GUI: Implement choice of input for merging
Diffstat (limited to 'src')
-rw-r--r-- | src/gui_merge.c | 34 | ||||
-rw-r--r-- | src/gui_project.h | 2 |
2 files changed, 32 insertions, 4 deletions
diff --git a/src/gui_merge.c b/src/gui_merge.c index 64e5416d..4677ffc3 100644 --- a/src/gui_merge.c +++ b/src/gui_merge.c @@ -53,6 +53,7 @@ struct new_merging_job_params { GtkWidget *job_title_entry; GtkWidget *job_notes_text; GtkWidget *model_combo; + GtkWidget *input_combo; }; @@ -88,17 +89,16 @@ static void get_merging_opts(struct merging_params *opts, static int run_merging(struct crystfelproject *proj, + const char *results_name, int backend_idx, const char *job_title, const char *job_notes) { struct crystfel_backend *be; void *job_priv; - const gchar *results_name; struct gui_indexing_result *input; /* Which result to merge? */ - results_name = gtk_combo_box_get_active_id(GTK_COMBO_BOX(proj->results_combo)); input = find_indexing_result_by_name(proj, results_name); if ( input == NULL ) { ERROR("Please select a result first\n"); @@ -128,6 +128,7 @@ static void merging_response_sig(GtkWidget *dialog, gint resp, int backend_idx; const char *job_title; char *job_notes; + const char *results_name; get_merging_opts(&njp->proj->merging_params, CRYSTFEL_MERGE_OPTS(njp->proj->merging_opts)); @@ -146,8 +147,13 @@ static void merging_response_sig(GtkWidget *dialog, gint resp, free(njp->proj->merging_new_job_title); njp->proj->merging_new_job_title = strdup(job_title); - if ( run_merging(njp->proj, backend_idx, - job_title, job_notes) == 0 ) + results_name = gtk_combo_box_get_active_id(GTK_COMBO_BOX(njp->input_combo)); + if ( results_name == NULL ) { + ERROR("Please select the input\n"); + return; + } + if ( run_merging(njp->proj, results_name, + backend_idx, job_title, job_notes) == 0 ) { gtk_widget_destroy(dialog); njp->proj->merging_opts = NULL; @@ -313,10 +319,13 @@ static GtkWidget *make_merging_backend_opts(struct new_merging_job_params *njp) gint merge_sig(GtkWidget *widget, struct crystfelproject *proj) { GtkWidget *dialog; + GtkWidget *label; GtkWidget *content_area; GtkWidget *vbox; + GtkWidget *hbox; GtkWidget *backend_page; GtkWidget *job_page; + int i; struct new_merging_job_params *njp; njp = malloc(sizeof(struct new_merging_job_params)); @@ -340,6 +349,23 @@ gint merge_sig(GtkWidget *widget, struct crystfelproject *proj) gtk_container_add(GTK_CONTAINER(content_area), vbox); gtk_container_set_border_width(GTK_CONTAINER(content_area), 8); + hbox = gtk_hbox_new(FALSE, 0.0); + gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox), FALSE, FALSE, 4.0); + label = gtk_label_new("Input:"); + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), + FALSE, FALSE, 4.0); + njp->input_combo = gtk_combo_box_text_new(); + gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(njp->input_combo), + FALSE, FALSE, 4.0); + for ( i=0; i<proj->n_results; i++ ) { + gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(njp->input_combo), + proj->results[i].name, + proj->results[i].name); + } + gtk_combo_box_set_active_id(GTK_COMBO_BOX(njp->input_combo), + selected_result(proj)); + + proj->merging_opts = crystfel_merge_opts_new(); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(proj->merging_opts), FALSE, FALSE, 8.0); diff --git a/src/gui_project.h b/src/gui_project.h index 62503e6f..db1ad2ad 100644 --- a/src/gui_project.h +++ b/src/gui_project.h @@ -300,4 +300,6 @@ extern int add_merge_result(struct crystfelproject *proj, char *name, char *hkl); +extern const char *selected_result(struct crystfelproject *proj); + #endif |