aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-25 12:24:30 +0200
committerThomas White <taw@physics.org>2020-08-25 12:31:46 +0200
commitf2f35c529e31d42927ff9d0e6a1e55d4237ee8bb (patch)
treebb138cc1cc85750c6b96785d917f0447d573b261 /src
parent30a11737e799faa335d049cc9018ada08cf3442e (diff)
Read/write backend options
Diffstat (limited to 'src')
-rw-r--r--src/gui_index.c4
-rw-r--r--src/gui_project.c39
-rw-r--r--src/gui_project.h1
3 files changed, 43 insertions, 1 deletions
diff --git a/src/gui_index.c b/src/gui_index.c
index 45ae943b..278bbf9c 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -134,6 +134,7 @@ static void indexing_backend_changed_sig(GtkWidget *combo,
backend_idx = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
if ( backend_idx < 0 ) return;
+ proj->indexing_backend_selected = backend_idx;
be = &proj->backends[backend_idx];
@@ -187,7 +188,8 @@ static GtkWidget *make_backend_opts(struct crystfelproject *proj)
/* proj->indexing_backend_opts{_box} must exist before the following */
g_signal_connect(G_OBJECT(proj->indexing_backend_combo), "changed",
G_CALLBACK(indexing_backend_changed_sig), proj);
- gtk_combo_box_set_active(GTK_COMBO_BOX(proj->indexing_backend_combo), 0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(proj->indexing_backend_combo),
+ proj->indexing_backend_selected);
return box;
}
diff --git a/src/gui_project.c b/src/gui_project.c
index a38cc305..7d124a5c 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -135,6 +135,21 @@ static void parse_tols(const char *text, float *tols)
}
+static int find_backend(const char *name, struct crystfelproject *proj)
+{
+ int i;
+
+ for ( i=0; i<proj->n_backends; i++ ) {
+ if ( strcmp(proj->backends[i].name, name) == 0 ) {
+ return i;
+ }
+ }
+
+ ERROR("Couldn't find backend '%s'\n", name);
+ return 0;
+}
+
+
static void handle_var(const char *key, const char *val,
struct crystfelproject *proj)
{
@@ -242,6 +257,10 @@ static void handle_var(const char *key, const char *val,
proj->indexing_params.min_peaks = parse_int(val);
}
+ if ( strcmp(key, "indexing.backend") == 0 ) {
+ proj->indexing_backend_selected = find_backend(val, proj);
+ }
+
if ( strcmp(key, "integration.method") == 0 ) {
proj->indexing_params.integration_method = strdup(val);
}
@@ -277,6 +296,18 @@ static void handle_var(const char *key, const char *val,
if ( strcmp(key, "search_pattern") == 0 ) {
proj->data_search_pattern = decode_matchtype(val);
}
+
+ /* Backend indexing option? */
+ if ( strncmp(key, "indexing.", 9) == 0 ) {
+ int i;
+ for ( i=0; i<proj->n_backends; i++ ) {
+ struct crystfel_backend *be;
+ be = &proj->backends[i];
+ be->read_indexing_opt(be->indexing_opts_priv,
+ key, val);
+ }
+ }
+
}
@@ -463,6 +494,14 @@ int save_project(struct crystfelproject *proj)
fprintf(fh, "indexing.min_peaks %i\n",
proj->indexing_params.min_peaks);
+ fprintf(fh, "indexing.backend %s\n",
+ proj->backends[proj->indexing_backend_selected].name);
+ for ( i=0; i<proj->n_backends; i++ ) {
+ struct crystfel_backend *be;
+ be = &proj->backends[i];
+ be->write_indexing_opts(be->indexing_opts_priv, fh);
+ }
+
fprintf(fh, "integration.method %s\n",
proj->indexing_params.integration_method);
fprintf(fh, "integration.overpredict %i\n",
diff --git a/src/gui_project.h b/src/gui_project.h
index 42ab43f1..e3066b5f 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -153,6 +153,7 @@ struct crystfelproject {
int show_refls;
struct index_params indexing_params;
+ int indexing_backend_selected;
GtkWidget *indexing_opts;
GtkWidget *indexing_backend_combo;
GtkWidget *indexing_backend_opts_widget;