aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-03-16 17:38:18 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:24 +0200
commit827f521b3f5661b38e615a1f77d77958a9c0663c (patch)
treeb61dcc279cefb9bdd03f78ce9e048715e13abfd7 /src
parent43a5b52f414eb6591ba8533435ae61c0a2fcd7e7 (diff)
Pass indexing algorithm to backend
Diffstat (limited to 'src')
-rw-r--r--src/crystfel_gui.h3
-rw-r--r--src/gui_backend_local.c5
-rw-r--r--src/gui_index.c39
3 files changed, 32 insertions, 15 deletions
diff --git a/src/crystfel_gui.h b/src/crystfel_gui.h
index 39d37de0..077f900b 100644
--- a/src/crystfel_gui.h
+++ b/src/crystfel_gui.h
@@ -56,7 +56,8 @@ struct peak_params {
struct crystfelproject;
struct crystfel_backend {
- int (*run_unitcell)(struct crystfelproject *proj);
+ int (*run_unitcell)(struct crystfelproject *proj,
+ const char *algo);
};
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c
index 4c81c35c..b3ba8657 100644
--- a/src/gui_backend_local.c
+++ b/src/gui_backend_local.c
@@ -29,9 +29,10 @@
#include "crystfel_gui.h"
-static int run_unitcell(struct crystfelproject *proj)
+static int run_unitcell(struct crystfelproject *proj,
+ const char *algo)
{
- STATUS("run unit cell!\n");
+ STATUS("run unit cell with '%s'!\n", algo);
return 0;
}
diff --git a/src/gui_index.c b/src/gui_index.c
index 629939b8..a09b4c27 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -48,10 +48,18 @@
static void unitcell_response_sig(GtkWidget *dialog, gint resp,
struct crystfelproject *proj)
{
+ const char *algo;
+
+ algo = gtk_combo_box_get_active_id(GTK_COMBO_BOX(proj->unitcell_combo));
+
gtk_widget_destroy(dialog);
- if ( resp != GTK_RESPONSE_OK ) return;
+ if ( resp != GTK_RESPONSE_OK ) {
+ proj->unitcell_combo = NULL;
+ return;
+ }
- proj->backend->run_unitcell(proj);
+ proj->backend->run_unitcell(proj, algo);
+ proj->unitcell_combo = NULL;
}
@@ -64,6 +72,8 @@ gint unitcell_sig(GtkWidget *widget, struct crystfelproject *proj)
GtkWidget *label;
GtkWidget *combo;
+ if ( proj->unitcell_combo != NULL ) return FALSE;
+
dialog = gtk_dialog_new_with_buttons("Determine unit cell",
GTK_WINDOW(proj->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -87,16 +97,21 @@ gint unitcell_sig(GtkWidget *widget, struct crystfelproject *proj)
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 2.0);
combo = gtk_combo_box_text_new();
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(combo), TRUE, TRUE, 2.0);
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "mosflm",
- "MOSFLM");
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "dirax",
- "DirAx");
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "asdf",
- "ASDF");
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "xds",
- "xds");
- gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo), "xgandalf",
- "XGANDALF");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
+ "mosflm-nocell-nolatt",
+ "MOSFLM");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
+ "dirax",
+ "DirAx");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
+ "asdf-nocell",
+ "ASDF");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
+ "xds-nocell-nolatt",
+ "xds");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(combo),
+ "xgandalf-nocell",
+ "XGANDALF");
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
proj->unitcell_combo = combo;