aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crystfelindexingopts.c37
-rw-r--r--src/crystfelmergeopts.c24
2 files changed, 45 insertions, 16 deletions
diff --git a/src/crystfelindexingopts.c b/src/crystfelindexingopts.c
index d5ed7717..b7b0e9ba 100644
--- a/src/crystfelindexingopts.c
+++ b/src/crystfelindexingopts.c
@@ -60,6 +60,24 @@ static void crystfel_indexing_opts_init(CrystFELIndexingOpts *io)
}
+static int i_maybe_disable(GtkWidget *toggle, GtkWidget *widget)
+{
+ gtk_widget_set_sensitive(GTK_WIDGET(widget),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)));
+ return FALSE;
+}
+
+
+static void i_disable_if_not(GtkWidget *toggle, GtkWidget *widget)
+{
+ i_maybe_disable(toggle, widget);
+ g_signal_connect(G_OBJECT(toggle),
+ "toggled",
+ G_CALLBACK(i_maybe_disable),
+ widget);
+}
+
+
static GtkWidget *add_tol(GtkGrid *grid, const char *spec_t,
const char *unit_t, gint left, gint top)
{
@@ -240,20 +258,6 @@ static void auto_indm_toggle_sig(GtkToggleButton *togglebutton,
gtk_widget_set_sensitive(GTK_WIDGET(io->indm_chooser),
!gtk_toggle_button_get_active(togglebutton));
}
-
-
-static void check_cell_toggle_sig(GtkToggleButton *togglebutton,
- CrystFELIndexingOpts *io)
-{
- int i;
- int active = gtk_toggle_button_get_active(togglebutton);
- for ( i=0; i<6; i++ ) {
- gtk_widget_set_sensitive(GTK_WIDGET(io->tols[i]),
- active);
- }
-}
-
-
static void cell_file_set_sig(GtkFileChooserButton *widget,
CrystFELIndexingOpts *io)
{
@@ -345,8 +349,7 @@ static GtkWidget *indexing_parameters(CrystFELIndexingOpts *io)
FALSE, FALSE, 0);
tolerances = make_tolerances(io);
gtk_container_add(GTK_CONTAINER(expander), tolerances);
- g_signal_connect(G_OBJECT(io->check_cell), "toggled",
- G_CALLBACK(check_cell_toggle_sig), io);
+ i_disable_if_not(io->check_cell, tolerances);
/* --min-peaks (NB add one) */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -362,6 +365,7 @@ static GtkWidget *indexing_parameters(CrystFELIndexingOpts *io)
label = gtk_label_new("peaks");
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
FALSE, FALSE, 0);
+ i_disable_if_not(io->enable_hitfind, io->ignore_fewer_peaks);
return box;
}
@@ -419,6 +423,7 @@ static GtkWidget *integration_parameters(CrystFELIndexingOpts *io)
"nm<sup>-1</sup> above apparent resolution limit");
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
FALSE, FALSE, 0);
+ i_disable_if_not(io->limit_res, io->push_res);
/* --int-radii */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
diff --git a/src/crystfelmergeopts.c b/src/crystfelmergeopts.c
index 0162ed21..98f2d85c 100644
--- a/src/crystfelmergeopts.c
+++ b/src/crystfelmergeopts.c
@@ -61,6 +61,24 @@ static void crystfel_merge_opts_init(CrystFELMergeOpts *mo)
}
+static int maybe_disable(GtkWidget *toggle, GtkWidget *widget)
+{
+ gtk_widget_set_sensitive(GTK_WIDGET(widget),
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle)));
+ return FALSE;
+}
+
+
+static void disable_if_not(GtkWidget *toggle, GtkWidget *widget)
+{
+ maybe_disable(toggle, widget);
+ g_signal_connect(G_OBJECT(toggle),
+ "toggled",
+ G_CALLBACK(maybe_disable),
+ widget);
+}
+
+
static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
{
GtkWidget *box;
@@ -116,6 +134,7 @@ static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
mo->postref = gtk_check_button_new_with_label("Post-refinement");
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(mo->postref),
FALSE, FALSE, 0);
+ disable_if_not(mo->scale, mo->bscale);
/* Number of iterations */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -164,6 +183,7 @@ static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
gtk_entry_set_width_chars(GTK_ENTRY(mo->max_adu), 4);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(mo->max_adu),
FALSE, FALSE, 0);
+ disable_if_not(mo->use_max_adu, mo->max_adu);
/* Minimum measurements */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -188,6 +208,7 @@ static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(mo->custom_split_file),
FALSE, FALSE, 0);
+ disable_if_not(mo->custom_split, mo->custom_split_file);
/* Minimum pattern resolution */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -203,6 +224,7 @@ static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
label = gtk_label_new("Å");
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
FALSE, FALSE, 0);
+ disable_if_not(mo->min_res, mo->min_res_val);
/* push-res */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -219,6 +241,7 @@ static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
gtk_label_set_markup(GTK_LABEL(label), "nm<sup>-1</sup> above resolution limit");
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
FALSE, FALSE, 0);
+ disable_if_not(mo->limit_res, mo->push_res);
/* Detwin */
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
@@ -230,6 +253,7 @@ static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
mo->detwin_sym = crystfel_symmetry_selector_new();
gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(mo->detwin_sym),
FALSE, FALSE, 0);
+ disable_if_not(mo->detwin, mo->detwin_sym);
return box;
}