aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-02-18 09:36:13 +0100
committerThomas White <taw@physics.org>2021-02-18 09:36:13 +0100
commitf1f1d45b612a1b99acaea20a99ff2bcebee8df3f (patch)
treeccf6ddd7c972d2c175354161b37537c61bca3f86
parente0437375017e504124cab53e5d19f4da499e88e7 (diff)
GUI: Track separately whether ambiguity operation should be used
This allows values to be held for both, which is more helpful.
-rw-r--r--src/gui_ambi.c9
-rw-r--r--src/gui_project.c5
-rw-r--r--src/gui_project.h1
3 files changed, 11 insertions, 4 deletions
diff --git a/src/gui_ambi.c b/src/gui_ambi.c
index 8ab0acc3..8d315b00 100644
--- a/src/gui_ambi.c
+++ b/src/gui_ambi.c
@@ -134,6 +134,7 @@ static void ambi_response_sig(GtkWidget *dialog, gint resp,
win->proj->ambi_params.sym = get_sym(win->sym);
win->proj->ambi_params.source_sym = get_sym(win->source_sym);
win->proj->ambi_params.operator = get_str(win->operator);
+ win->proj->ambi_params.use_operator = get_bool(win->use_operator);
backend_idx = gtk_combo_box_get_active(GTK_COMBO_BOX(win->backend_combo));
if ( backend_idx < 0 ) return;
@@ -223,12 +224,12 @@ static GtkWidget *make_ambigator_options(struct ambi_window *win)
g_signal_connect(G_OBJECT(win->use_operator), "toggled",
G_CALLBACK(i_maybe_disable), win->operator);
- if ( proj->ambi_params.source_sym != NULL ) {
- gtk_widget_set_sensitive(win->operator, FALSE);
- set_active(win->use_source_sym, TRUE);
- } else {
+ if ( proj->ambi_params.use_operator ) {
gtk_widget_set_sensitive(win->source_sym, FALSE);
set_active(win->use_operator, TRUE);
+ } else {
+ gtk_widget_set_sensitive(win->operator, FALSE);
+ set_active(win->use_source_sym, TRUE);
}
hbox = gtk_hbox_new(FALSE, 0.0);
diff --git a/src/gui_project.c b/src/gui_project.c
index af50dec2..abc80276 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -339,6 +339,9 @@ static void parse_ambi_opt(const char *key, const char *val,
if ( strcmp(key, "ambi.source_sym") == 0 ) {
proj->ambi_params.source_sym = strdup(val);
}
+ if ( strcmp(key, "ambi.use_operator") == 0 ) {
+ proj->ambi_params.use_operator = parse_int(val);
+ }
if ( strcmp(key, "ambi.operator") == 0 ) {
proj->ambi_params.operator = strdup(val);
}
@@ -919,6 +922,7 @@ int save_project(struct crystfelproject *proj)
fprintf(fh, "ambi.niter %i\n", proj->ambi_params.niter);
fprintf(fh, "ambi.ncorr %i\n", proj->ambi_params.ncorr);
fprintf(fh, "ambi.use_ncorr %i\n", proj->ambi_params.use_ncorr);
+ fprintf(fh, "ambi.use_operator %i\n", proj->ambi_params.use_operator);
if ( proj->ambi_params.sym != NULL ) {
fprintf(fh, "ambi.sym %s\n", proj->ambi_params.sym);
}
@@ -1123,6 +1127,7 @@ void default_project(struct crystfelproject *proj)
proj->ambi_params.sym = NULL;
proj->ambi_params.source_sym = NULL;
proj->ambi_params.operator = NULL;
+ proj->ambi_params.use_operator = 1;
proj->merging_params.model = strdup("unity");
proj->merging_params.symmetry = strdup("1");
diff --git a/src/gui_project.h b/src/gui_project.h
index f62de101..7ab607d2 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -123,6 +123,7 @@ struct ambi_params {
int ncorr;
char *sym;
char *source_sym;
+ int use_operator;
char *operator;
};