aboutsummaryrefslogtreecommitdiff
path: root/src/crystfelindexingopts.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-08-20 11:17:49 +0200
committerThomas White <taw@physics.org>2020-08-20 11:17:49 +0200
commit2ffe338d663cfc1c2cdb42a63a1e50f769a508c0 (patch)
tree495d0fdc27511bd1bf0b3a4467801cc24c692a0e /src/crystfelindexingopts.c
parentd9e011c9e3f877ed95482fd54a549c065ff9b8be (diff)
GUI: Implement automatic indexing method selection
Diffstat (limited to 'src/crystfelindexingopts.c')
-rw-r--r--src/crystfelindexingopts.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/crystfelindexingopts.c b/src/crystfelindexingopts.c
index 23866786..5f29a97c 100644
--- a/src/crystfelindexingopts.c
+++ b/src/crystfelindexingopts.c
@@ -428,6 +428,8 @@ char *crystfel_indexing_opts_get_cell_file(CrystFELIndexingOpts *opts)
}
+/* NULL means "automatic".
+ * "none" means "no indexing" */
char *crystfel_indexing_opts_get_indexing_method_string(CrystFELIndexingOpts *opts)
{
GtkTreePath *path;
@@ -435,6 +437,10 @@ char *crystfel_indexing_opts_get_indexing_method_string(CrystFELIndexingOpts *op
char indm_str[1024];
int first = 1;
+ if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opts->auto_indm)) ) {
+ return NULL;
+ }
+
path = gtk_tree_path_new_from_string("0");
gtk_tree_model_get_iter(GTK_TREE_MODEL(opts->indm_store),
&iter, path);
@@ -470,6 +476,9 @@ char *crystfel_indexing_opts_get_indexing_method_string(CrystFELIndexingOpts *op
} while ( gtk_tree_model_iter_next(GTK_TREE_MODEL(opts->indm_store),
&iter) );
+ if ( indm_str[0] == '\0' ) {
+ strcpy(indm_str, "none");
+ }
return strdup(indm_str);
}
@@ -658,10 +667,7 @@ void crystfel_indexing_opts_set_indexing_method_string(CrystFELIndexingOpts *opt
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(opts->auto_indm),
(indm_str == NULL));
- if ( indm_str == NULL ) {
- unset_all_methods(opts);
- return;
- }
+ if ( indm_str == NULL ) return;
methods = parse_indexing_methods(indm_str, &n);
if ( methods == NULL ) {