aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-22 18:28:25 +0200
committerThomas White <taw@physics.org>2020-10-22 18:28:25 +0200
commit65f7ff44d6a5461f2392b644a0c4e03b550d4975 (patch)
tree5c9088a10d1cd04d6ac6ee83c60ed67e790a8656
parent5d09bcdda5ee7bcec251051eb24ec41e3f06b650 (diff)
Skeleton for merging via GUI
-rw-r--r--CMakeLists.txt4
-rw-r--r--meson.build2
-rw-r--r--src/crystfel_gui.c3
-rw-r--r--src/crystfelmergeopts.c164
-rw-r--r--src/crystfelmergeopts.h73
-rw-r--r--src/gui_backend_local.c57
-rw-r--r--src/gui_merge.c247
-rw-r--r--src/gui_merge.h39
-rw-r--r--src/gui_project.c2
-rw-r--r--src/gui_project.h15
10 files changed, 603 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c5ac445..8ea46558 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -392,8 +392,8 @@ list(APPEND CRYSTFEL_EXECUTABLES cell_tool)
if (GTK_FOUND)
set(CRYSTFEL_GUI_SOURCES src/crystfel_gui.c src/crystfelimageview.c
- src/gui_peaksearch.c src/gui_index.c src/gui_backend_local.c
- src/gui_project.c src/crystfelindexingopts.c)
+ src/gui_peaksearch.c src/gui_index.c src/gui_merge.c src/gui_backend_local.c
+ src/gui_project.c src/crystfelindexingopts.c src/crystfelmergeopts.c)
if (HAVE_SLURM)
set(CRYSTFEL_GUI_SOURCES ${CRYSTFEL_GUI_SOURCES} src/gui_backend_slurm.c)
diff --git a/meson.build b/meson.build
index 24f29f44..ce0a5325 100644
--- a/meson.build
+++ b/meson.build
@@ -209,8 +209,10 @@ if gtkdep.found()
gui_sources = ['src/crystfel_gui.c',
'src/crystfelimageview.c',
'src/crystfelindexingopts.c',
+ 'src/crystfelmergeopts.c',
'src/gui_peaksearch.c',
'src/gui_index.c',
+ 'src/gui_merge.c',
'src/gui_backend_local.c',
'src/gui_project.c',
versionc]
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 02196fa5..e7baacdc 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -47,6 +47,7 @@
#include "crystfelimageview.h"
#include "gui_peaksearch.h"
#include "gui_index.h"
+#include "gui_merge.h"
#include "gui_project.h"
#include "version.h"
@@ -827,7 +828,7 @@ static void add_task_buttons(GtkWidget *vbox, struct crystfelproject *proj)
add_button(vbox, "Indexing ambiguity", "face-worried",
G_CALLBACK(NULL), proj);
add_button(vbox, "Merge", "applications-science",
- G_CALLBACK(NULL), proj);
+ G_CALLBACK(merge_sig), proj);
add_button(vbox, "Figures of merit", "trophy-gold",
G_CALLBACK(NULL), proj);
add_button(vbox, "Export data", "document-send",
diff --git a/src/crystfelmergeopts.c b/src/crystfelmergeopts.c
new file mode 100644
index 00000000..87b14c85
--- /dev/null
+++ b/src/crystfelmergeopts.c
@@ -0,0 +1,164 @@
+/*
+ * crystfelmergeopts.h
+ *
+ * A GTK widget to set merge options
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <gtk/gtk.h>
+#include <glib-object.h>
+#include <errno.h>
+#include <math.h>
+
+#include <integration.h>
+#include <index.h>
+
+#include "crystfelmergeopts.h"
+
+
+G_DEFINE_TYPE(CrystFELMergeOpts,
+ crystfel_merge_opts,
+ GTK_TYPE_NOTEBOOK)
+
+
+static void crystfel_merge_opts_class_init(CrystFELMergeOptsClass *klass)
+{
+}
+
+
+static void crystfel_merge_opts_init(CrystFELMergeOpts *mo)
+{
+}
+
+
+static GtkWidget *merge_parameters(CrystFELMergeOpts *mo)
+{
+ GtkWidget *box;
+ GtkWidget *hbox;
+ GtkWidget *label;
+
+ box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
+ gtk_container_set_border_width(GTK_CONTAINER(box), 8);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(hbox),
+ FALSE, FALSE, 0);
+ label = gtk_label_new("Model:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ mo->model_combo = gtk_combo_box_text_new();
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(mo->model_combo),
+ FALSE, FALSE, 0);
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(mo->model_combo),
+ "process_hkl",
+ "Simple merging (process_hkl)");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(mo->model_combo),
+ "unity",
+ "No partialities (unity)");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(mo->model_combo),
+ "xsphere",
+ "Bandwidth integral (xsphere)");
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(mo->model_combo),
+ "offset",
+ "Monochromatic Ewald sphere offset (offset)");
+
+ /* Symmetry */
+ /* Scale on/off */
+ /* B-factor scaling */
+ /* Post-refinement on/off */
+ /* Polarisation horiz/vert/unpolarized beam/no correction */
+ /* Number of iterations */
+ /* deltaCChalf */
+ /* Detector saturation value */
+ /* Minimum pattern resolution */
+ /* push-res */
+ /* Minimum measurements */
+ /* Custom split file */
+ /* Detwin */
+
+ return box;
+}
+
+
+GtkWidget *crystfel_merge_opts_new()
+{
+ CrystFELMergeOpts *mo;
+
+ mo = g_object_new(CRYSTFEL_TYPE_MERGE_OPTS, NULL);
+
+ gtk_notebook_append_page(GTK_NOTEBOOK(mo),
+ merge_parameters(mo),
+ gtk_label_new("Merging"));
+
+ gtk_widget_show_all(GTK_WIDGET(mo));
+ return GTK_WIDGET(mo);
+}
+
+
+//int crystfel_merge_opts_get_multi_lattice(CrystFELMergeOpts *opts)
+//{
+// return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opts->multi));
+//}
+
+
+float crystfel_merge_opts_get_push_res(CrystFELMergeOpts *opts)
+{
+ if ( !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(opts->limit_res)) ) {
+ return INFINITY;
+ } else {
+ const gchar *text;
+ float push_res;
+ char *rval;
+ text = gtk_entry_get_text(GTK_ENTRY(opts->push_res));
+ errno = 0;
+ push_res = strtof(text, &rval);
+ if ( *rval != '\0' ) {
+ printf("Invalid value for push-res (%s)\n",
+ rval);
+ return INFINITY;
+ }
+ return push_res;
+ }
+}
+
+
+void crystfel_merge_opts_set_push_res(CrystFELMergeOpts *mo,
+ float push_res)
+{
+ char tmp[64];
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(mo->limit_res),
+ !isinf(push_res));
+
+ snprintf(tmp, 63, "%f", push_res);
+ gtk_entry_set_text(GTK_ENTRY(mo->push_res), tmp);
+}
diff --git a/src/crystfelmergeopts.h b/src/crystfelmergeopts.h
new file mode 100644
index 00000000..dc4333fc
--- /dev/null
+++ b/src/crystfelmergeopts.h
@@ -0,0 +1,73 @@
+/*
+ * crystfelmergeopts.h
+ *
+ * A GTK widget to set merge options
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CRYSTFELMERGEOPTS_H
+#define CRYSTFELMERGEOPTS_H
+
+#include <gtk/gtk.h>
+#include <glib-object.h>
+
+#define CRYSTFEL_TYPE_MERGE_OPTS (crystfel_merge_opts_get_type())
+
+#define CRYSTFEL_MERGE_OPTS(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
+ CRYSTFEL_TYPE_MERGE_OPTS, CrystFELMergeOpts))
+
+#define CRYSTFEL_IS_MERGE_OPTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), \
+ CRYSTFEL_TYPE_MERGE_OPTS))
+
+#define CRYSTFEL_MERGE_OPTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((obj), \
+ CRYSTFEL_TYPE_MERGE_OPTS, CrystFELMergeOpts))
+
+#define CRYSTFEL_IS_MERGE_OPTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((obj), \
+ CRYSTFEL_TYPE_MERGE_OPTS))
+
+#define CRYSTFEL_MERGE_OPTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), \
+ CRYSTFEL_TYPE_MERGE_OPTS, CrystFELMergeOpts))
+
+struct _crystfelmergeopts
+{
+ GtkNotebook parent_instance;
+
+ /*< private >*/
+ GtkWidget *model_combo;
+ GtkWidget *limit_res;
+ GtkWidget *push_res;
+};
+
+struct _crystfelmergeoptsclass
+{
+ GtkNotebookClass parent_class;
+};
+
+typedef struct _crystfelmergeopts CrystFELMergeOpts;
+typedef struct _crystfelmergeoptsclass CrystFELMergeOptsClass;
+
+extern GType crystfel_merge_opts_get_type(void);
+extern GtkWidget *crystfel_merge_opts_new(void);
+
+#endif /* CRYSTFELMERGEOPTS_H */
diff --git a/src/gui_backend_local.c b/src/gui_backend_local.c
index 7a5f440e..28b6e0ec 100644
--- a/src/gui_backend_local.c
+++ b/src/gui_backend_local.c
@@ -45,6 +45,12 @@ struct local_indexing_opts
};
+struct local_merge_opts
+{
+ int n_threads;
+};
+
+
struct local_job
{
double frac_complete;
@@ -368,6 +374,55 @@ static void read_indexing_opt(void *opts_priv,
}
+static void n_threads_activate_sig(GtkEntry *entry, gpointer data)
+{
+ struct local_merge_opts *opts = data;
+ convert_int(gtk_entry_get_text(entry), &opts->n_threads);
+}
+
+
+static gboolean n_threads_focus_sig(GtkEntry *entry, GdkEvent *event,
+ gpointer data)
+{
+ n_threads_activate_sig(entry, data);
+ return FALSE;
+}
+
+
+static GtkWidget *make_merge_parameters_widget(void *opts_priv)
+{
+ struct local_merge_opts *opts = opts_priv;
+ GtkWidget *vbox;
+ GtkWidget *hbox;
+ GtkWidget *entry;
+ GtkWidget *label;
+ char tmp[64];
+
+ vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(hbox),
+ FALSE, FALSE, 0);
+ label = gtk_label_new("Number of threads:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ entry = gtk_entry_new();
+ snprintf(tmp, 63, "%i", opts->n_threads);
+ gtk_entry_set_text(GTK_ENTRY(entry), tmp);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 5);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry),
+ FALSE, FALSE, 0);
+
+ g_signal_connect(G_OBJECT(entry), "activate",
+ G_CALLBACK(n_threads_activate_sig),
+ opts);
+ g_signal_connect(G_OBJECT(entry), "focus-out-event",
+ G_CALLBACK(n_threads_focus_sig),
+ opts);
+ return vbox;
+}
+
+
int make_local_backend(struct crystfel_backend *be)
{
be->name = "local";
@@ -382,5 +437,7 @@ int make_local_backend(struct crystfel_backend *be)
be->write_indexing_opts = write_indexing_opts;
be->read_indexing_opt = read_indexing_opt;
+ be->make_merge_parameters_widget = make_merge_parameters_widget;
+
return 0;
};
diff --git a/src/gui_merge.c b/src/gui_merge.c
new file mode 100644
index 00000000..ad108933
--- /dev/null
+++ b/src/gui_merge.c
@@ -0,0 +1,247 @@
+/*
+ * gui_merge.c
+ *
+ * Peak search parts of GUI
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <gtk/gtk.h>
+#include <assert.h>
+
+#include "gui_project.h"
+#include "crystfel_gui.h"
+#include "crystfelmergeopts.h"
+
+
+struct new_merge_job_params {
+ struct crystfelproject *proj;
+ GtkWidget *backend_combo;
+ GtkWidget *backend_opts_widget;
+ GtkWidget *backend_opts_box;
+ GtkWidget *job_title_entry;
+ GtkWidget *job_notes_text;
+ GtkWidget *model_combo;
+};
+
+
+static void free_new_merge_job_params(gpointer njp, GClosure *closure)
+{
+ free(njp);
+}
+
+
+static void merge_response_sig(GtkWidget *dialog, gint resp,
+ struct new_merge_job_params *njp)
+{
+ if ( resp == GTK_RESPONSE_OK ) {
+ STATUS("Doing it!\n");
+ }
+}
+
+
+static GtkWidget *make_merge_job_opts(struct crystfelproject *proj,
+ struct new_merge_job_params *njp)
+{
+ GtkWidget *box;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ GtkWidget *scroll;
+
+ box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
+ gtk_container_set_border_width(GTK_CONTAINER(box), 8);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(hbox),
+ FALSE, FALSE, 0);
+ label = gtk_label_new("Job name:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ njp->job_title_entry = gtk_entry_new();
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(njp->job_title_entry),
+ TRUE, TRUE, 2.0);
+ if ( proj->merge_new_job_title != NULL ) {
+ gtk_entry_set_text(GTK_ENTRY(njp->job_title_entry),
+ proj->merge_new_job_title);
+ }
+
+ label = gtk_label_new("This name will be used for a working subfolder");
+ gtk_label_set_markup(GTK_LABEL(label),
+ "<i>This name will be used for a working subfolder</i>");
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ gtk_entry_set_placeholder_text(GTK_ENTRY(njp->job_title_entry),
+ "merge-trial-1");
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(hbox),
+ TRUE, TRUE, 0);
+ label = gtk_label_new("Notes:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+ njp->job_notes_text = gtk_text_view_new();
+ scroll = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(scroll), njp->job_notes_text);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll),
+ GTK_SHADOW_ETCHED_IN);
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(scroll),
+ TRUE, TRUE, 2.0);
+
+ label = gtk_label_new("The notes above will be placed in the job's folder as 'notes.txt'");
+ gtk_label_set_markup(GTK_LABEL(label),
+ "<i>The notes above will be placed in the job's folder as 'notes.txt'</i>");
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+
+ return box;
+}
+
+
+static void merge_backend_changed_sig(GtkWidget *combo,
+ struct new_merge_job_params *njp)
+{
+ int backend_idx;
+ struct crystfel_backend *be;
+
+ backend_idx = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
+ if ( backend_idx < 0 ) return;
+ njp->proj->merge_backend_selected = backend_idx;
+
+ be = &njp->proj->backends[backend_idx];
+
+ if ( njp->backend_opts_widget != NULL ) {
+ gtk_widget_destroy(njp->backend_opts_widget);
+ }
+
+ njp->backend_opts_widget = be->make_merge_parameters_widget(be->merge_opts_priv);
+
+ gtk_box_pack_start(GTK_BOX(njp->backend_opts_box),
+ GTK_WIDGET(njp->backend_opts_widget),
+ FALSE, FALSE, 0);
+ gtk_widget_show_all(njp->backend_opts_widget);
+}
+
+
+static GtkWidget *make_merge_backend_opts(struct new_merge_job_params *njp)
+{
+ GtkWidget *box;
+ GtkWidget *hbox;
+ GtkWidget *label;
+ int i;
+
+ box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 8);
+ gtk_container_set_border_width(GTK_CONTAINER(box), 8);
+
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
+ gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(hbox),
+ FALSE, FALSE, 0);
+ label = gtk_label_new("Batch system:");
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label),
+ FALSE, FALSE, 0);
+
+ njp->backend_combo = gtk_combo_box_text_new();
+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(njp->backend_combo),
+ FALSE, FALSE, 0);
+
+ for ( i=0; i<njp->proj->n_backends; i++ ) {
+ gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(njp->backend_combo),
+ njp->proj->backends[i].name,
+ njp->proj->backends[i].friendly_name);
+ }
+
+ njp->backend_opts_box = gtk_box_new(GTK_ORIENTATION_VERTICAL,
+ 0);
+ gtk_box_pack_start(GTK_BOX(box),
+ GTK_WIDGET(njp->backend_opts_box),
+ FALSE, FALSE, 0);
+ njp->backend_opts_widget = NULL;
+
+ /* njp->backend_opts{_box} must exist before the following */
+ g_signal_connect(G_OBJECT(njp->backend_combo), "changed",
+ G_CALLBACK(merge_backend_changed_sig), njp);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(njp->backend_combo),
+ njp->proj->merge_backend_selected);
+
+ return box;
+}
+
+
+gint merge_sig(GtkWidget *widget, struct crystfelproject *proj)
+{
+ GtkWidget *dialog;
+ GtkWidget *content_area;
+ GtkWidget *vbox;
+ GtkWidget *backend_page;
+ GtkWidget *job_page;
+ GtkWidget *notebook;
+ struct new_merge_job_params *njp;
+
+ njp = malloc(sizeof(struct new_merge_job_params));
+ if ( njp == NULL ) return FALSE;
+
+ njp->proj = proj;
+
+ dialog = gtk_dialog_new_with_buttons("Merge",
+ GTK_WINDOW(proj->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ "Cancel", GTK_RESPONSE_CANCEL,
+ "Run", GTK_RESPONSE_OK,
+ NULL);
+
+ g_signal_connect_data(G_OBJECT(dialog), "response",
+ G_CALLBACK(merge_response_sig),
+ njp, free_new_merge_job_params, 0);
+
+ vbox = gtk_vbox_new(FALSE, 0.0);
+ content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ gtk_container_add(GTK_CONTAINER(content_area), vbox);
+ gtk_container_set_border_width(GTK_CONTAINER(content_area), 8);
+
+ notebook = crystfel_merge_opts_new();
+ gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(notebook),
+ FALSE, FALSE, 8.0);
+
+ job_page = make_merge_job_opts(proj, njp);
+ gtk_notebook_prepend_page(GTK_NOTEBOOK(notebook),
+ job_page,
+ gtk_label_new("Job name/notes"));
+
+ backend_page = make_merge_backend_opts(njp);
+ gtk_notebook_append_page(GTK_NOTEBOOK(notebook),
+ backend_page,
+ gtk_label_new("Cluster/batch system"));
+
+ gtk_dialog_set_default_response(GTK_DIALOG(dialog),
+ GTK_RESPONSE_OK);
+ gtk_widget_show_all(dialog);
+
+ return FALSE;
+}
diff --git a/src/gui_merge.h b/src/gui_merge.h
new file mode 100644
index 00000000..6d8b6a50
--- /dev/null
+++ b/src/gui_merge.h
@@ -0,0 +1,39 @@
+/*
+ * gui_merge.h
+ *
+ * Merging parts of GUI
+ *
+ * Copyright © 2020 Deutsches Elektronen-Synchrotron DESY,
+ * a research centre of the Helmholtz Association.
+ *
+ * Authors:
+ * 2020 Thomas White <taw@physics.org>
+ *
+ * This file is part of CrystFEL.
+ *
+ * CrystFEL is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * CrystFEL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with CrystFEL. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef GUI_MERGE_H
+#define GUI_MERGE_H
+
+#include <gtk/gtk.h>
+
+#include "gui_project.h"
+
+extern gint merge_sig(GtkWidget *widget,
+ struct crystfelproject *proj);
+
+#endif
diff --git a/src/gui_project.c b/src/gui_project.c
index fe2f72c0..83d9f083 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -680,8 +680,10 @@ void default_project(struct crystfelproject *proj)
proj->indexing_opts = NULL;
proj->n_running_tasks = 0;
proj->indexing_new_job_title = NULL;
+ proj->merge_new_job_title = NULL;
proj->indexing_backend_selected = 0;
+ proj->merge_backend_selected = 0;
proj->n_backends = 0;
proj->backends = malloc(2*sizeof(struct crystfel_backend));
/* FIXME: Crappy error handling */
diff --git a/src/gui_project.h b/src/gui_project.h
index 8a3af512..af4b1037 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -89,6 +89,10 @@ struct index_params {
float ir_out;
};
+struct merge_params {
+ int nothing;
+};
+
struct crystfelproject;
struct crystfel_backend {
@@ -125,6 +129,12 @@ struct crystfel_backend {
/* Backend should store options for indexing here */
void *indexing_opts_priv;
+ /* Backend should provide a GTK widget to set options */
+ GtkWidget *(*make_merge_parameters_widget)(void *opts_priv);
+
+ /* Backend should store options for merging here */
+ void *merge_opts_priv;
+
};
struct gui_task
@@ -189,6 +199,11 @@ struct crystfelproject {
GtkWidget *indexing_opts;
char *indexing_new_job_title;
+ struct merge_params merge_params;
+ int merge_backend_selected;
+ GtkWidget *merge_opts;
+ char *merge_new_job_title;
+
GtkWidget *type_combo;
GtkWidget *peak_vbox; /* Box for peak search parameter widgets */
GtkWidget *peak_params; /* Peak search parameter widgets */