set up the treeview reflections
[hkl.git] / gui / hkl-gui.c
blob72144899c98dcc12b62cdb1f8b20a782d53622b5
1 /* This file is part of the hkl library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2003-2010 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
23 #include "hkl-gui.h"
24 #include <glib.h>
25 #include <glib-object.h>
26 #include <gtk/gtk.h>
27 #include "hkl.h"
28 #include "hkl-gui-pseudoaxes.h"
29 #include <gdk/gdk.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <float.h>
33 #include <math.h>
34 #include <stdio.h>
36 #define HKL_GUI_TYPE_WINDOW (hkl_gui_window_get_type ())
37 #define HKL_GUI_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), HKL_GUI_TYPE_WINDOW, HklGuiWindow))
38 #define HKL_GUI_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), HKL_GUI_TYPE_WINDOW, HklGuiWindowClass))
39 #define HKL_GUI_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HKL_GUI_TYPE_WINDOW))
40 #define HKL_GUI_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HKL_GUI_TYPE_WINDOW))
41 #define HKL_GUI_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), HKL_GUI_TYPE_WINDOW, HklGuiWindowClass))
43 G_DEFINE_TYPE (HklGuiWindow, hkl_gui_window, G_TYPE_OBJECT);
45 typedef enum {
46 REFLECTION_COL_INDEX = 0,
47 REFLECTION_COL_H,
48 REFLECTION_COL_K,
49 REFLECTION_COL_L,
50 REFLECTION_COL_FLAG,
51 REFLECTION_COL_REFLECTION,
52 REFLECTION_COL_N_COLUMNS
53 } ReflectionCol;
55 typedef enum {
56 AXIS_COL_AXIS = 0,
57 AXIS_COL_NAME,
58 AXIS_COL_READ,
59 AXIS_COL_WRITE,
60 AXIS_COL_MIN,
61 AXIS_COL_MAX,
62 AXIS_COL_N_COLUMNS
63 } AxisCol;
65 typedef enum {
66 PSEUDO_AXIS_COL_PARAMETER = 0,
67 PSEUDO_AXIS_COL_ENGINE,
68 PSEUDO_AXIS_COL_NAME,
69 PSEUDO_AXIS_COL_READ,
70 PSEUDO_AXIS_COL_WRITE,
71 PSEUDO_AXIS_COL_N_COLUMNS
72 } PseudoAxisCol;
74 typedef enum {
75 PARAMETER_COL_PARAMETER = 0,
76 PARAMETER_COL_NAME,
77 PARAMETER_COL_VALUE,
78 PARAMETER_COL_N_COLUMNS
79 } ParameterCol;
81 typedef enum {
82 SAMPLE_COL_SAMPLE = 0,
83 SAMPLE_COL_REFLECTIONS,
84 SAMPLE_COL_NAME,
85 SAMPLE_COL_A,
86 SAMPLE_COL_B,
87 SAMPLE_COL_C,
88 SAMPLE_COL_ALPHA,
89 SAMPLE_COL_BETA,
90 SAMPLE_COL_GAMMA,
91 SAMPLE_COL_N_COLUMNS
92 } SampleCol;
94 typedef enum {
95 SOLUTION_COL_INDEX = 0,
96 SOLUTION_COL_N_COLUMNS
97 } SolutionCol;
99 typedef enum {
100 DIFFRACTOMETER_COL_NAME = 0,
101 DIFFRACTOMETER_COL_FACTORY,
102 DIFFRACTOMETER_COL_DIFFRACTOMETER,
103 DIFFRACTOMETER_COL_N_COLUMNS
104 } DiffractometerCol;
106 /******************/
107 /* Diffractometer */
108 /******************/
110 struct diffractometer_t {
111 HklGeometry *geometry;
112 HklDetector *detector;
113 HklEngineList *engines;
117 static struct diffractometer_t *
118 create_diffractometer(HklFactory *factory)
120 struct diffractometer_t *self;
122 self = malloc(sizeof(*self));
124 self->geometry = hkl_factory_create_new_geometry (factory);
125 self->engines = hkl_factory_create_new_engine_list (factory);
126 self->detector = hkl_detector_factory_new (HKL_DETECTOR_TYPE_0D);
127 hkl_detector_idx_set (self->detector, 1);
129 return self;
132 static void
133 delete_diffractometer(struct diffractometer_t *self)
135 hkl_geometry_free(self->geometry);
136 hkl_engine_list_free(self->engines);
137 hkl_detector_free(self->detector);
141 static void
142 dump_diffractometer(struct diffractometer_t *self)
144 /* hkl_geometry_fprintf(stderr, self->geometry); */
145 /* hkl_engine_list_fprintf(stderr, self->engines); */
146 /* hkl_detector_fprintf(stderr, self->detector); */
149 /****************/
150 /* HklGuiWindow */
151 /****************/
153 struct _HklGuiWindowPrivate {
154 GtkBuilder* builder;
155 GtkLabel* _label_UB11;
156 GtkLabel* _label_UB12;
157 GtkLabel* _label_UB13;
158 GtkLabel* _label_UB21;
159 GtkLabel* _label_UB22;
160 GtkLabel* _label_UB23;
161 GtkLabel* _label_UB31;
162 GtkLabel* _label_UB32;
163 GtkLabel* _label_UB33;
164 GtkButton* _button2;
165 GtkSpinButton* _spinbutton_a;
166 GtkSpinButton* _spinbutton_b;
167 GtkSpinButton* _spinbutton_c;
168 GtkSpinButton* _spinbutton_alpha;
169 GtkSpinButton* _spinbutton_beta;
170 GtkSpinButton* _spinbutton_gamma;
171 GtkSpinButton* _spinbutton_a_min;
172 GtkSpinButton* _spinbutton_b_min;
173 GtkSpinButton* _spinbutton_c_min;
174 GtkSpinButton* _spinbutton_alpha_min;
175 GtkSpinButton* _spinbutton_beta_min;
176 GtkSpinButton* _spinbutton_gamma_min;
177 GtkSpinButton* _spinbutton_a_max;
178 GtkSpinButton* _spinbutton_b_max;
179 GtkSpinButton* _spinbutton_c_max;
180 GtkSpinButton* _spinbutton_alpha_max;
181 GtkSpinButton* _spinbutton_beta_max;
182 GtkSpinButton* _spinbutton_gamma_max;
183 GtkSpinButton* _spinbutton_lambda;
184 GtkSpinButton* _spinbutton_a_star;
185 GtkSpinButton* _spinbutton_b_star;
186 GtkSpinButton* _spinbutton_c_star;
187 GtkSpinButton* _spinbutton_alpha_star;
188 GtkSpinButton* _spinbutton_beta_star;
189 GtkSpinButton* _spinbutton_gamma_star;
190 GtkSpinButton* _spinbutton_ux;
191 GtkSpinButton* _spinbutton_uy;
192 GtkSpinButton* _spinbutton_uz;
193 GtkSpinButton* _spinbutton_U11;
194 GtkSpinButton* _spinbutton_U12;
195 GtkSpinButton* _spinbutton_U13;
196 GtkSpinButton* _spinbutton_U21;
197 GtkSpinButton* _spinbutton_U22;
198 GtkSpinButton* _spinbutton_U23;
199 GtkSpinButton* _spinbutton_U31;
200 GtkSpinButton* _spinbutton_U32;
201 GtkSpinButton* _spinbutton_U33;
202 GtkCheckButton* _checkbutton_a;
203 GtkCheckButton* _checkbutton_b;
204 GtkCheckButton* _checkbutton_c;
205 GtkCheckButton* _checkbutton_alpha;
206 GtkCheckButton* _checkbutton_beta;
207 GtkCheckButton* _checkbutton_gamma;
208 GtkCheckButton* _checkbutton_Ux;
209 GtkCheckButton* _checkbutton_Uy;
210 GtkCheckButton* _checkbutton_Uz;
211 GtkTreeView* _treeview_reflections;
212 GtkTreeView* _treeview_crystals;
213 GtkTreeView* _treeview_axes;
214 GtkTreeView* _treeview_pseudo_axes;
215 GtkTreeView* _treeview_pseudo_axes_parameters;
216 GtkTreeView* _treeview_solutions;
217 GtkToolButton* _toolbutton_add_reflection;
218 GtkToolButton* _toolbutton_goto_reflection;
219 GtkToolButton* _toolbutton_del_reflection;
220 GtkToolButton* _toolbutton_setUB;
221 GtkToolButton* _toolbutton_computeUB;
222 GtkToolButton* _toolbutton_add_crystal;
223 GtkToolButton* _toolbutton_copy_crystal;
224 GtkToolButton* _toolbutton_del_crystal;
225 GtkToolButton* _toolbutton_affiner;
226 GtkStatusbar* _statusbar;
227 GtkImageMenuItem* _menuitem5;
228 GtkVBox* _box_info_bar; /* fake for the infor bar */
229 GtkVBox* _vbox7;
230 GtkVBox* _vbox2;
231 GtkDialog* _dialog1;
232 GtkButton* _button1;
233 GtkComboBox* _combobox1;
234 GtkListStore* _liststore_diffractometer;
235 GtkListStore* _liststore_axis;
236 GtkListStore* _liststore_pseudo_axes;
237 GtkListStore* _liststore_solutions;
238 GtkListStore* _liststore_reflections;
240 GtkListStore* store_samples;
241 GtkInfoBar *info_bar;
242 GtkLabel *info_message;
244 darray(HklGuiEngine *) pseudo_frames;
246 struct diffractometer_t *diffractometer; /* unowned */
247 HklSample *sample; /* unowned */
248 HklLattice *reciprocal;
251 #define HKL_GUI_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), HKL_GUI_TYPE_WINDOW, HklGuiWindowPrivate))
253 static gboolean
254 finalize_liststore_diffractometer(GtkTreeModel *model,
255 GtkTreePath *path,
256 GtkTreeIter *iter,
257 gpointer data)
259 struct diffractometer_t *diffractometer;
261 gtk_tree_model_get(model, iter,
262 DIFFRACTOMETER_COL_DIFFRACTOMETER, &diffractometer,
263 -1);
264 delete_diffractometer(diffractometer);
266 return FALSE;
269 static void
270 finalize (GObject* object)
272 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(object);
274 g_object_unref(priv->builder);
276 darray_free(priv->pseudo_frames);
278 gtk_tree_model_foreach(GTK_TREE_MODEL(priv->_liststore_diffractometer),
279 finalize_liststore_diffractometer,
280 NULL);
282 G_OBJECT_CLASS (hkl_gui_window_parent_class)->finalize (object);
285 HklGuiWindow* hkl_gui_window_new (void)
287 return g_object_new (HKL_GUI_TYPE_WINDOW, NULL);
291 #define get_object(builder, type, priv, name) priv->_ ## name = type(gtk_builder_get_object(builder, #name))
293 static void
294 hkl_gui_window_get_widgets_and_objects_from_ui (HklGuiWindow* self)
296 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
297 GtkBuilder* builder;
299 g_return_if_fail (self != NULL);
301 priv->builder = builder = gtk_builder_new ();
302 gtk_builder_add_from_file (builder, "ghkl.ui", NULL);
304 get_object(builder, GTK_LIST_STORE, priv, liststore_diffractometer);
305 get_object(builder, GTK_LIST_STORE, priv, liststore_axis);
306 get_object(builder, GTK_LIST_STORE, priv, liststore_pseudo_axes);
307 get_object(builder, GTK_LIST_STORE, priv, liststore_reflections);
309 get_object(builder, GTK_LABEL, priv, label_UB11);
310 get_object(builder, GTK_LABEL, priv, label_UB12);
311 get_object(builder, GTK_LABEL, priv, label_UB13);
312 get_object(builder, GTK_LABEL, priv, label_UB21);
313 get_object(builder, GTK_LABEL, priv, label_UB22);
314 get_object(builder, GTK_LABEL, priv, label_UB23);
315 get_object(builder, GTK_LABEL, priv, label_UB31);
316 get_object(builder, GTK_LABEL, priv, label_UB32);
317 get_object(builder, GTK_LABEL, priv, label_UB33);
319 get_object(builder, GTK_BUTTON, priv, button2);
321 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_a);
322 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_a_min);
323 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_a_max);
324 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_a_star);
326 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_b);
327 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_b_min);
328 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_b_max);
329 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_b_star);
331 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_c);
332 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_c_min);
333 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_c_max);
334 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_c_star);
336 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_alpha);
337 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_alpha_min);
338 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_alpha_max);
339 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_alpha_star);
341 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_beta);
342 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_beta_min);
343 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_beta_max);
344 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_beta_star);
346 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_gamma);
347 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_gamma_min);
348 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_gamma_max);
349 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_gamma_star);
351 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_lambda);
353 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_ux);
354 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_uy);
355 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_uz);
357 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U11);
358 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U12);
359 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U13);
360 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U21);
361 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U22);
362 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U23);
363 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U31);
364 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U32);
365 get_object(builder, GTK_SPIN_BUTTON, priv, spinbutton_U33);
368 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_a);
369 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_b);
370 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_c);
371 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_alpha);
372 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_beta);
373 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_gamma);
374 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_Ux);
375 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_Uy);
376 get_object(builder, GTK_CHECK_BUTTON, priv, checkbutton_Uz);
379 get_object(builder, GTK_TREE_VIEW, priv, treeview_reflections);
380 get_object(builder, GTK_TREE_VIEW, priv, treeview_crystals);
381 get_object(builder, GTK_TREE_VIEW, priv, treeview_axes);
382 get_object(builder, GTK_TREE_VIEW, priv, treeview_pseudo_axes);
383 get_object(builder, GTK_TREE_VIEW, priv, treeview_solutions);
384 priv->_treeview_pseudo_axes_parameters = GTK_TREE_VIEW(gtk_builder_get_object (builder, "treeview_pseudoAxes_parameters"));
387 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_add_reflection);
388 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_goto_reflection);
389 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_del_reflection);
390 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_setUB);
391 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_computeUB);
392 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_add_crystal);
393 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_copy_crystal);
394 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_del_crystal);
395 get_object(builder, GTK_TOOL_BUTTON, priv, toolbutton_affiner);
397 get_object(builder, GTK_STATUSBAR, priv, statusbar);
399 get_object(builder, GTK_IMAGE_MENU_ITEM, priv, menuitem5);
401 get_object(builder, GTK_VBOX, priv, vbox7);
402 get_object(builder, GTK_VBOX, priv, vbox2);
403 get_object(builder, GTK_VBOX, priv, box_info_bar);
405 get_object(builder, GTK_DIALOG, priv, dialog1);
407 get_object(builder, GTK_COMBO_BOX, priv, combobox1);
409 gtk_builder_connect_signals (builder, self);
412 static void
413 update_pseudo_axes_frames (HklGuiWindow* self)
415 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
416 HklGuiEngine **engine;
418 g_return_if_fail (self != NULL);
420 darray_foreach(engine, priv->pseudo_frames){
421 hkl_gui_engine_update(*engine);
425 static void
426 raise_error(HklGuiWindow *self, HklError **error)
428 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
430 g_return_if_fail (self != NULL);
431 g_return_if_fail (error != NULL);
433 /* show an error message */
434 gtk_label_set_text (GTK_LABEL (priv->info_message),
435 hkl_error_message_get(*error));
436 gtk_info_bar_set_message_type (priv->info_bar,
437 GTK_MESSAGE_ERROR);
438 gtk_widget_show (GTK_WIDGET(priv->info_bar));
440 hkl_error_clear(error);
443 static void
444 clear_error(HklGuiWindow *self, HklError **error)
446 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
448 g_return_if_fail (self != NULL);
450 gtk_widget_hide(GTK_WIDGET(priv->info_bar));
453 static gboolean
454 _update_axis (GtkTreeModel *model, GtkTreePath *path,
455 GtkTreeIter *iter, gpointer data)
457 HklParameter *parameter;
458 gdouble value, min, max;
460 gtk_tree_model_get (model, iter,
461 AXIS_COL_AXIS, &parameter,
462 -1);
464 hkl_parameter_min_max_unit_get(parameter, &min, &max);
465 value = hkl_parameter_value_unit_get(parameter);
467 gtk_list_store_set(GTK_LIST_STORE(model), iter,
468 AXIS_COL_READ, value,
469 AXIS_COL_WRITE, value,
470 AXIS_COL_MIN, min,
471 AXIS_COL_MAX, max,
472 -1);
473 return FALSE;
476 static void
477 update_axes (HklGuiWindow* self)
479 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
481 g_return_if_fail (self != NULL);
483 gtk_tree_model_foreach(GTK_TREE_MODEL(priv->_liststore_axis),
484 _update_axis,
485 self);
488 static gboolean
489 _update_pseudo_axes (GtkTreeModel *model, GtkTreePath *path,
490 GtkTreeIter *iter, gpointer data)
492 HklParameter *parameter;
493 gdouble value, min, max;
495 gtk_tree_model_get (model, iter,
496 PSEUDO_AXIS_COL_PARAMETER, &parameter,
497 -1);
499 hkl_parameter_min_max_unit_get(parameter, &min, &max);
500 value = hkl_parameter_value_unit_get(parameter);
502 gtk_list_store_set(GTK_LIST_STORE(model), iter,
503 PSEUDO_AXIS_COL_READ, value,
504 PSEUDO_AXIS_COL_WRITE, value,
505 -1);
506 return FALSE;
509 static void
510 update_pseudo_axes (HklGuiWindow* self)
512 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
514 g_return_if_fail (self != NULL);
516 gtk_tree_model_foreach(GTK_TREE_MODEL(priv->_liststore_pseudo_axes),
517 _update_pseudo_axes,
518 self);
521 static void
522 update_solutions (HklGuiWindow* self)
524 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
525 const HklGeometryList *geometries;
526 const darray_item *items;
527 GtkTreeIter iter = {0};
529 g_return_if_fail (self != NULL);
531 geometries = hkl_engine_list_geometries(priv->diffractometer->engines);
533 gtk_list_store_clear(priv->_liststore_solutions);
534 items = hkl_geometry_list_items_get(geometries);
535 if (darray_size(*items)){
536 gint n_values = gtk_tree_model_get_n_columns (GTK_TREE_MODEL(priv->_liststore_solutions));
537 GValue *values = g_new0(GValue, n_values);
538 gint *columns = g_new0(gint, n_values);
539 gint i;
541 /* prepare the GValue before using them */
542 g_value_init(&values[0], G_TYPE_INT);
543 for(i=1; i<n_values; ++i)
544 g_value_init(&values[i], G_TYPE_DOUBLE);
546 for(i=0; i<darray_size(*items);++i){
547 gint column = 0;
548 const HklGeometry *geometry;
549 HklParameter **parameter;
550 const darray_parameter *parameters;
552 geometry = hkl_geometry_list_item_geometry_get(darray_item(*items, i));
553 parameters = hkl_geometry_axes_get(geometry);
555 g_value_set_int(&values[column], i);
556 columns[0] = column;
558 darray_foreach(parameter, *parameters){
559 double value = hkl_parameter_value_unit_get(*parameter);
561 column = column + 1;
562 g_value_set_double(&values[column], value);
563 columns[column] = column;
565 gtk_list_store_insert_with_valuesv(priv->_liststore_solutions,
566 &iter, i,
567 columns, values, n_values);
569 g_free(columns);
570 g_free(values);
574 static gboolean
575 hkl_engine_to_axes(HklGuiWindow *self, HklEngine *engine)
577 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
578 HklError *error = NULL;
579 gboolean res = TRUE;
581 g_return_val_if_fail (self != NULL, FALSE);
582 g_return_val_if_fail (engine != NULL, FALSE);
584 if(hkl_engine_set(engine, &error)){
585 clear_error(self, &error);
586 hkl_engine_list_select_solution(priv->diffractometer->engines, 0);
587 hkl_engine_list_get(priv->diffractometer->engines);
589 update_axes (self);
590 update_pseudo_axes (self);
591 update_pseudo_axes_frames (self);
592 }else{
593 raise_error(self, &error);
594 dump_diffractometer(priv->diffractometer);
595 res = FALSE;
597 update_solutions (self);
598 return res;
601 static void
602 pseudo_axes_frame_changed_cb (HklGuiEngine *gui_engine, HklGuiWindow *self)
604 HklEngine *engine;
606 g_return_if_fail (self != NULL);
608 g_object_get(G_OBJECT(gui_engine),
609 "engine", &engine,
610 NULL);
612 hkl_engine_to_axes(self, engine);
615 static void
616 set_up_pseudo_axes_frames (HklGuiWindow* self)
618 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
619 HklGuiEngine **pseudo;
620 GtkVBox* vbox2;
621 HklEngine **engine;
622 darray_engine *engines;
624 g_return_if_fail (self != NULL);
626 darray_foreach (pseudo, priv->pseudo_frames){
627 gtk_container_remove(GTK_CONTAINER(priv->_vbox2),
628 GTK_WIDGET (hkl_gui_engine_get_frame (*pseudo)));
629 g_object_unref(*pseudo);
631 darray_size (priv->pseudo_frames) = 0;
633 engines = hkl_engine_list_engines (priv->diffractometer->engines);
634 darray_foreach (engine, *engines){
635 HklGuiEngine *pseudo;
637 pseudo = hkl_gui_engine_new (*engine);
638 darray_append(priv->pseudo_frames, pseudo);
639 gtk_container_add (GTK_CONTAINER (priv->_vbox2),
640 GTK_WIDGET (hkl_gui_engine_get_frame(pseudo)));
642 g_signal_connect_object (pseudo,
643 "changed",
644 G_CALLBACK(pseudo_axes_frame_changed_cb),
645 self, 0);
648 gtk_widget_show_all (GTK_WIDGET (priv->_vbox2));
652 static void
653 set_up_diffractometer_model (HklGuiWindow* self)
655 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
656 unsigned int i, n;
657 HklFactory **factories;
659 g_return_if_fail (self != NULL);
661 factories = hkl_factory_get_all(&n);
662 for(i=0; i<n; ++i){
663 GtkTreeIter iter = {0};
665 gtk_list_store_append (priv->_liststore_diffractometer, &iter);
666 gtk_list_store_set (priv->_liststore_diffractometer,
667 &iter,
668 DIFFRACTOMETER_COL_NAME, hkl_factory_name(factories[i]),
669 DIFFRACTOMETER_COL_FACTORY, factories[i],
670 DIFFRACTOMETER_COL_DIFFRACTOMETER, NULL,
671 -1);
675 static void
676 set_up_tree_view_axes (HklGuiWindow* self)
678 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
679 HklParameter **parameter;
680 const darray_parameter *parameters;
681 GtkCellRenderer* renderer = NULL;
682 GtkTreeViewColumn* column = NULL;
683 GList* columns;
685 g_return_if_fail (self != NULL);
687 gtk_list_store_clear (priv->_liststore_axis);
689 parameters = hkl_geometry_axes_get(priv->diffractometer->geometry);
690 darray_foreach (parameter, *parameters){
691 GtkTreeIter iter = {0};
693 gtk_list_store_append (priv->_liststore_axis, &iter);
694 gtk_list_store_set (priv->_liststore_axis, &iter,
695 AXIS_COL_AXIS, *parameter,
696 AXIS_COL_NAME, hkl_parameter_name_get(*parameter),
697 -1);
700 update_axes (self);
703 static void
704 set_up_tree_view_pseudo_axes (HklGuiWindow* self)
706 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
707 HklParameter **parameter;
708 const darray_parameter *parameters;
709 HklEngine **engine;
710 const darray_engine *engines;
712 GtkCellRendererText* renderer = NULL;
713 GtkTreeViewColumn* column = NULL;
714 GList* columns;
716 g_return_if_fail (self != NULL);
718 gtk_list_store_clear(priv->_liststore_pseudo_axes);
720 engines = hkl_engine_list_engines(priv->diffractometer->engines);
721 darray_foreach(engine, *engines){
722 parameters = hkl_engine_pseudo_axes(*engine);
723 darray_foreach(parameter, *parameters){
724 GtkTreeIter iter = {0};
726 gtk_list_store_append (priv->_liststore_pseudo_axes, &iter);
727 gtk_list_store_set (priv->_liststore_pseudo_axes, &iter,
728 PSEUDO_AXIS_COL_PARAMETER, *parameter,
729 PSEUDO_AXIS_COL_ENGINE, *engine,
730 PSEUDO_AXIS_COL_NAME, hkl_parameter_name_get(*parameter),
731 -1);
735 update_pseudo_axes (self);
738 static void
739 _delete_column(gpointer data,
740 gpointer user_data)
742 gtk_tree_view_remove_column (GTK_TREE_VIEW(user_data),
743 GTK_TREE_VIEW_COLUMN(data));
746 static void
747 set_up_tree_view_solutions (HklGuiWindow* self)
749 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
750 const darray_parameter *parameters;
751 int i;
752 GtkCellRenderer* renderer = NULL;
753 GtkTreeViewColumn* column = NULL;
754 GList* columns;
755 GType* types;
756 gint n_columns;
758 g_return_if_fail (self != NULL);
760 parameters = hkl_geometry_axes_get(priv->diffractometer->geometry);
762 n_columns = SOLUTION_COL_N_COLUMNS + darray_size(*parameters);
764 /* prepare types for the liststore */
765 types = g_new0 (GType, n_columns);
767 /* first remove all the columns */
768 columns = gtk_tree_view_get_columns (priv->_treeview_solutions);
769 g_list_foreach(columns, _delete_column, priv->_treeview_solutions);
770 g_list_free(columns);
772 /* now add the index column */
773 renderer = gtk_cell_renderer_text_new ();
774 column = gtk_tree_view_column_new_with_attributes ("index",
775 renderer, "text",
776 SOLUTION_COL_INDEX, NULL);
778 gtk_tree_view_append_column (priv->_treeview_solutions, column);
779 types[0] = G_TYPE_INT;
781 /* add the axes column */
782 for(i=1; i<n_columns; ++i){
783 HklParameter *parameter;
785 parameter = darray_item(*parameters, i - SOLUTION_COL_N_COLUMNS);
786 renderer = gtk_cell_renderer_text_new ();
787 column = gtk_tree_view_column_new_with_attributes (hkl_parameter_name_get(parameter),
788 renderer, "text",
789 i, NULL);
791 gtk_tree_view_append_column (priv->_treeview_solutions, column);
792 types[i] = G_TYPE_DOUBLE;
795 if (priv->_liststore_solutions)
796 g_object_unref(priv->_liststore_solutions);
797 priv->_liststore_solutions = gtk_list_store_newv (n_columns, types);
798 g_free (types);
800 gtk_tree_view_set_model (priv->_treeview_solutions,
801 GTK_TREE_MODEL(priv->_liststore_solutions));
803 update_solutions (self);
806 void
807 set_up_info_bar(HklGuiWindow *self)
809 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
810 GtkWidget *content_area;
812 g_return_if_fail (self != NULL);
814 /* set up info bar until we can use glade for this purpose or
815 * switch to gtk3 */
816 if (priv->info_bar)
817 return;
819 priv->info_bar = GTK_INFO_BAR(gtk_info_bar_new ());
820 gtk_widget_set_no_show_all (GTK_WIDGET(priv->info_bar), TRUE);
822 priv->info_message = GTK_LABEL(gtk_label_new (""));
823 gtk_widget_show (GTK_WIDGET(priv->info_message));
825 content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (priv->info_bar));
826 gtk_container_add (GTK_CONTAINER (content_area),
827 GTK_WIDGET(priv->info_message));
828 gtk_info_bar_add_button (priv->info_bar,
829 GTK_STOCK_OK, GTK_RESPONSE_OK);
830 g_signal_connect (priv->info_bar, "response",
831 G_CALLBACK (gtk_widget_hide), NULL);
833 gtk_box_pack_start(GTK_BOX(priv->_box_info_bar),
834 GTK_WIDGET(priv->info_bar),
835 TRUE, TRUE, 0);
838 void
839 hkl_gui_window_combobox1_changed_cb(GtkComboBox *combobox, gpointer *user_data)
841 HklGuiWindow *self = HKL_GUI_WINDOW(user_data);
842 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data);
843 HklFactory *factory;
844 struct diffractometer_t *dif = NULL;
846 GtkTreeIter iter = {0};
848 if(gtk_combo_box_get_active_iter (combobox, &iter)){
849 gtk_tree_model_get(GTK_TREE_MODEL(priv->_liststore_diffractometer),
850 &iter,
851 DIFFRACTOMETER_COL_FACTORY, &factory,
852 DIFFRACTOMETER_COL_DIFFRACTOMETER, &dif,
853 -1);
855 if (!dif){
856 dif = create_diffractometer(factory);
857 gtk_list_store_set(priv->_liststore_diffractometer,
858 &iter,
859 DIFFRACTOMETER_COL_DIFFRACTOMETER, dif,
860 -1);
862 printf("toto\n");
864 priv->diffractometer = dif;
865 /* TODO check if this is the right place for this */
866 hkl_engine_list_init(dif->engines, dif->geometry, dif->detector, priv->sample);
868 set_up_pseudo_axes_frames(self);
869 set_up_tree_view_axes(self);
870 //hkl_gui_window_set_up_tree_view_pseudo_axes_parameters(self);
871 set_up_tree_view_pseudo_axes(self);
873 /* FIXME create the right solution Model Column */
874 /* this._solutionModelColumns = 0; */
875 set_up_tree_view_solutions(self);
876 set_up_info_bar(self);
877 #if HKL3D
878 set_up_3D(self);
879 #endif
883 /* axis read cb */
884 void
885 hkl_gui_window_cellrendererspin1_edited_cb(GtkCellRendererText *renderer,
886 gchar *path,
887 gchar *new_text,
888 gpointer user_data)
890 HklGuiWindow *self = HKL_GUI_WINDOW(user_data);
891 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data);
892 GtkTreeIter iter = {0};
893 gdouble value = 0.0;
894 HklParameter* parameter = NULL;
896 g_return_if_fail (renderer != NULL);
897 g_return_if_fail (path != NULL);
898 g_return_if_fail (new_text != NULL);
899 g_return_if_fail (user_data != NULL);
901 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_axis),
902 &iter,
903 path);
904 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_axis), &iter,
905 AXIS_COL_AXIS, &parameter,
906 -1);
908 value = atof(new_text); /* TODO need to check for the right conversion */
909 hkl_parameter_value_unit_set (parameter, value, NULL);
910 hkl_geometry_axis_set(priv->diffractometer->geometry,
911 parameter);
913 hkl_engine_list_get(priv->diffractometer->engines);
915 /* ok so set the model with the new value */
916 gtk_list_store_set (priv->_liststore_axis, &iter,
917 AXIS_COL_READ, value,
918 AXIS_COL_WRITE, value,
919 -1);
921 update_pseudo_axes (self);
922 update_pseudo_axes_frames (self);
926 /* axis min cb */
927 void
928 hkl_gui_window_cellrendererspin3_edited_cb(GtkCellRendererText *renderer,
929 gchar *path,
930 gchar *new_text,
931 gpointer user_data)
933 HklGuiWindow *self = HKL_GUI_WINDOW(user_data);
934 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data);
935 GtkTreeIter iter = {0};
936 gdouble value = 0.0;
937 HklParameter* parameter = NULL;
938 gdouble shit, max;
940 g_return_if_fail (renderer != NULL);
941 g_return_if_fail (path != NULL);
942 g_return_if_fail (new_text != NULL);
943 g_return_if_fail (user_data != NULL);
945 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_axis),
946 &iter,
947 path);
948 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_axis), &iter,
949 AXIS_COL_AXIS, &parameter,
950 -1);
952 value = atof(new_text); /* TODO need to check for the right conversion */
953 hkl_parameter_min_max_unit_get (parameter, &shit, &max);
954 hkl_parameter_min_max_unit_set (parameter, value, max);
956 gtk_list_store_set (priv->_liststore_axis, &iter,
957 AXIS_COL_MIN, value,
958 -1);
960 update_pseudo_axes (self);
964 /* axis max cb */
965 void
966 hkl_gui_window_cellrendererspin4_edited_cb(GtkCellRendererText *renderer,
967 gchar *path,
968 gchar *new_text,
969 gpointer user_data)
971 HklGuiWindow *self = HKL_GUI_WINDOW(user_data);
972 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data);
973 GtkTreeIter iter = {0};
974 gdouble value = 0.0;
975 HklParameter* parameter = NULL;
976 gdouble shit, min;
978 g_return_if_fail (renderer != NULL);
979 g_return_if_fail (path != NULL);
980 g_return_if_fail (new_text != NULL);
981 g_return_if_fail (user_data != NULL);
983 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_axis),
984 &iter,
985 path);
986 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_axis), &iter,
987 AXIS_COL_AXIS, &parameter,
988 -1);
990 value = atof(new_text); /* TODO need to check for the right conversion */
991 hkl_parameter_min_max_unit_get (parameter, &min, &shit);
992 hkl_parameter_min_max_unit_set (parameter, min, value);
994 gtk_list_store_set (priv->_liststore_axis, &iter,
995 AXIS_COL_MAX, value,
996 -1);
998 update_pseudo_axes (self);
1002 /* pseudo axis write */
1003 void
1004 hkl_gui_window_cellrenderertext5_edited_cb(GtkCellRendererText *renderer,
1005 gchar *path,
1006 gchar *new_text,
1007 gpointer user_data)
1009 HklGuiWindow *self = HKL_GUI_WINDOW(user_data);
1010 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data);
1011 GtkTreeIter iter = {0};
1012 gdouble value = 0.0;
1013 gdouble old_value;
1014 HklParameter* parameter = NULL;
1015 HklEngine *engine = NULL;
1016 HklError *error = NULL;
1018 g_return_if_fail (renderer != NULL);
1019 g_return_if_fail (path != NULL);
1020 g_return_if_fail (new_text != NULL);
1021 g_return_if_fail (user_data != NULL);
1023 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_pseudo_axes),
1024 &iter,
1025 path);
1026 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_pseudo_axes), &iter,
1027 PSEUDO_AXIS_COL_PARAMETER, &parameter,
1028 PSEUDO_AXIS_COL_ENGINE, &engine,
1029 -1);
1031 value = atof(new_text); /* TODO need to check for the right conversion */
1032 old_value = hkl_parameter_value_unit_get(parameter);
1034 g_assert(error != NULL || error == NULL);
1035 hkl_parameter_value_unit_set (parameter, value, &error);
1036 if(error != NULL){
1037 raise_error(self, &error);
1040 if (hkl_engine_to_axes(self, engine)){
1041 gtk_list_store_set (priv->_liststore_pseudo_axes,
1042 &iter,
1043 PSEUDO_AXIS_COL_WRITE, value,
1044 -1);
1045 }else{
1046 hkl_parameter_value_unit_set(parameter, old_value, NULL);
1051 void
1052 hkl_gui_window_treeview_solutions_cursor_changed_cb (GtkTreeView *tree_view,
1053 gpointer user_data)
1055 HklGuiWindow* self = HKL_GUI_WINDOW(user_data);
1056 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(user_data);
1058 GtkTreePath* path = NULL;
1059 GtkTreeViewColumn* focus_column = NULL;
1060 GtkTreeIter iter = {0};
1061 gsize index = 0UL;
1063 g_return_if_fail (tree_view != NULL);
1064 g_return_if_fail (user_data != NULL);
1066 gtk_tree_view_get_cursor (tree_view, &path, &focus_column);
1067 gtk_tree_model_get_iter (GTK_TREE_MODEL(priv->_liststore_solutions), &iter, path);
1068 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_solutions), &iter,
1069 SOLUTION_COL_INDEX, &index,
1070 -1);
1072 hkl_engine_list_select_solution (priv->diffractometer->engines, index);
1073 hkl_engine_list_get (priv->diffractometer->engines);
1075 update_axes (self);
1076 update_pseudo_axes (self);
1077 update_pseudo_axes_frames (self);
1079 gtk_tree_path_free (path);
1082 /* reflection h */
1083 void
1084 hkl_gui_window_cellrenderertext7_edited_cb(GtkCellRendererText* _sender, const gchar* path,
1085 const gchar* new_text, gpointer self)
1087 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
1089 g_return_if_fail (self != NULL);
1090 g_return_if_fail (path != NULL);
1091 g_return_if_fail (new_text != NULL);
1093 if (priv->sample){
1094 gdouble h = 0.0;
1095 gdouble k = 0.0;
1096 gdouble l = 0.0;
1097 HklSampleReflection* reflection = NULL;
1098 GtkTreeIter iter = {0};
1100 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_reflections),
1101 &iter, path);
1102 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_reflections),
1103 &iter,
1104 REFLECTION_COL_REFLECTION, &reflection,
1105 -1);
1107 hkl_sample_reflection_hkl_get (reflection, &h, &k, &l);
1108 h = atof(new_text);
1109 hkl_sample_reflection_hkl_set (reflection, h, k, l);
1110 gtk_list_store_set (priv->_liststore_reflections,
1111 &iter,
1112 REFLECTION_COL_H, h,
1113 -1);
1117 /* reflection k */
1118 void
1119 hkl_gui_window_cellrenderertext8_edited_cb (GtkCellRendererText* _sender, const gchar* path,
1120 const gchar* new_text, gpointer self)
1122 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
1124 g_return_if_fail (self != NULL);
1125 g_return_if_fail (path != NULL);
1126 g_return_if_fail (new_text != NULL);
1128 if (priv->sample){
1129 gdouble h = 0.0;
1130 gdouble k = 0.0;
1131 gdouble l = 0.0;
1132 HklSampleReflection* reflection = NULL;
1133 GtkTreeIter iter = {0};
1135 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_reflections),
1136 &iter, path);
1137 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_reflections),
1138 &iter,
1139 REFLECTION_COL_REFLECTION, &reflection,
1140 -1);
1142 hkl_sample_reflection_hkl_get (reflection, &h, &k, &l);
1143 k = atof(new_text);
1144 hkl_sample_reflection_hkl_set (reflection, h, k, l);
1145 gtk_list_store_set (priv->_liststore_reflections,
1146 &iter,
1147 REFLECTION_COL_K, k,
1148 -1);
1152 /* reflection l */
1153 void
1154 hkl_gui_window_cellrenderertext9_edited_cb (GtkCellRendererText* _sender, const gchar* path,
1155 const gchar* new_text, gpointer self)
1157 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
1159 g_return_if_fail (self != NULL);
1160 g_return_if_fail (path != NULL);
1161 g_return_if_fail (new_text != NULL);
1163 if (priv->sample){
1164 gdouble h = 0.0;
1165 gdouble k = 0.0;
1166 gdouble l = 0.0;
1167 HklSampleReflection* reflection = NULL;
1168 GtkTreeIter iter = {0};
1170 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_reflections),
1171 &iter, path);
1172 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_reflections),
1173 &iter,
1174 REFLECTION_COL_REFLECTION, &reflection,
1175 -1);
1177 hkl_sample_reflection_hkl_get (reflection, &h, &k, &l);
1178 l = atof(new_text);
1179 hkl_sample_reflection_hkl_set (reflection, h, k, l);
1180 gtk_list_store_set (priv->_liststore_reflections,
1181 &iter,
1182 REFLECTION_COL_L, l,
1183 -1);
1187 /* reflection flag */
1188 void
1189 hkl_gui_window_cellrenderertoggle1_toggled_cb (GtkCellRendererToggle* renderer, const gchar* path,
1190 gpointer self)
1192 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
1194 g_return_if_fail (self != NULL);
1195 g_return_if_fail (path != NULL);
1197 if (priv->sample){
1198 gboolean flag;
1199 HklSampleReflection* reflection = NULL;
1200 GtkTreeIter iter = {0};
1202 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv->_liststore_reflections),
1203 &iter, path);
1204 gtk_tree_model_get (GTK_TREE_MODEL(priv->_liststore_reflections),
1205 &iter,
1206 REFLECTION_COL_REFLECTION, &reflection,
1207 -1);
1209 flag = gtk_cell_renderer_toggle_get_active(renderer);
1210 hkl_sample_reflection_flag_set (reflection, flag);
1211 gtk_list_store_set (priv->_liststore_reflections,
1212 &iter,
1213 REFLECTION_COL_FLAG, flag,
1214 -1);
1220 static void _hkl_gui_window_on_spinbutton_lambda_value_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
1222 hkl_gui_window_on_spinbutton_lambda_value_changed (self);
1227 static void _hkl_gui_window_on_spinbutton_uxuyuz_value_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
1229 hkl_gui_window_on_spinbutton_uxuyuz_value_changed (self);
1234 static void _hkl_gui_window_on_button2_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self) {
1236 hkl_gui_window_on_button2_clicked (self);
1241 static void _hkl_gui_window_on_checkbutton_a_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1243 hkl_gui_window_on_checkbutton_a_toggled (self);
1248 static void _hkl_gui_window_on_checkbutton_b_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1250 hkl_gui_window_on_checkbutton_b_toggled (self);
1255 static void _hkl_gui_window_on_checkbutton_c_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1257 hkl_gui_window_on_checkbutton_c_toggled (self);
1262 static void _hkl_gui_window_on_checkbutton_alpha_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1264 hkl_gui_window_on_checkbutton_alpha_toggled (self);
1269 static void _hkl_gui_window_on_checkbutton_beta_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1271 hkl_gui_window_on_checkbutton_beta_toggled (self);
1276 static void _hkl_gui_window_on_checkbutton_gamma_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1278 hkl_gui_window_on_checkbutton_gamma_toggled (self);
1283 static void _hkl_gui_window_on_checkbutton_Ux_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1285 hkl_gui_window_on_checkbutton_Ux_toggled (self);
1290 static void _hkl_gui_window_on_checkbutton_Uy_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1292 hkl_gui_window_on_checkbutton_Uy_toggled (self);
1297 static void _hkl_gui_window_on_checkbutton_Uz_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1299 hkl_gui_window_on_checkbutton_Uz_toggled (self);
1304 static gboolean _hkl_gui_window_on_tree_view_reflections_key_press_event_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
1305 gboolean result;
1306 result = hkl_gui_window_on_tree_view_reflections_key_press_event (event, self);
1308 return result;
1313 static void _hkl_gui_window_on_tree_view_pseudo_axes_cursor_changed_gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self) {
1315 hkl_gui_window_on_tree_view_pseudo_axes_cursor_changed (self);
1320 static void _hkl_gui_window_on_tree_view_crystals_cursor_changed_gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self) {
1322 hkl_gui_window_on_tree_view_crystals_cursor_changed (self);
1327 static gboolean _hkl_gui_window_on_tree_view_crystals_key_press_event_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
1328 gboolean result;
1329 result = hkl_gui_window_on_tree_view_crystals_key_press_event (event, self);
1331 return result;
1336 static void _hkl_gui_window_on_toolbutton_add_reflection_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1338 hkl_gui_window_on_toolbutton_add_reflection_clicked (self);
1343 static void _hkl_gui_window_on_toolbutton_goto_reflection_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1345 hkl_gui_window_on_toolbutton_goto_reflection_clicked (self);
1350 static void _hkl_gui_window_on_toolbutton_del_reflection_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1352 hkl_gui_window_on_toolbutton_del_reflection_clicked (self);
1357 static void _hkl_gui_window_on_toolbutton_setUB_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1359 hkl_gui_window_on_toolbutton_setUB_clicked (self);
1364 static void _hkl_gui_window_on_toolbutton_computeUB_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1366 hkl_gui_window_on_toolbutton_computeUB_clicked (self);
1371 static void _hkl_gui_window_on_toolbutton_add_crystal_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1373 hkl_gui_window_on_toolbutton_add_crystal_clicked (self);
1378 static void _hkl_gui_window_on_toolbutton_copy_crystal_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1380 hkl_gui_window_on_toolbutton_copy_crystal_clicked (self);
1385 static void _hkl_gui_window_on_toolbutton_del_crystal_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1387 hkl_gui_window_on_toolbutton_del_crystal_clicked (self);
1392 static void _hkl_gui_window_on_toolbutton_affiner_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
1394 hkl_gui_window_on_toolbutton_affiner_clicked (self);
1399 static void _hkl_gui_window_on_menuitem5_activate_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
1401 hkl_gui_window_on_menuitem5_activate (self);
1406 static void _hkl_gui_window_on_button1_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self) {
1408 hkl_gui_window_on_button1_clicked (self);
1413 static void _hkl_gui_window_on_combobox1_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
1415 hkl_gui_window_on_combobox1_changed (self);
1418 #define CONNECT_SPINBUTTON(name) \
1419 g_signal_connect_object (priv->_ ## name, \
1420 "value-changed", \
1421 (GCallback) SPINBUTTON_VALUE_CHANGED_CB(name), \
1422 self, 0);
1424 #define CONNECT_UX_UY_UZ(name) \
1425 g_signal_connect_object (priv->_ ## name, \
1426 "value-changed", \
1427 (GCallback) _hkl_gui_window_on_spinbutton_uxuyuz_value_changed_gtk_spin_button_value_changed, \
1428 self, 0);
1430 #define CONNECT_CHECKBUTTON(name) \
1431 g_signal_connect_object (priv->_ ## name, \
1432 "toggled", \
1433 (GCallback) CHECKBUTTON_TOGGLED_CB(name), \
1434 self, 0);
1435 static void
1436 hkl_gui_window_connect_all_signals (HklGuiWindow* self)
1438 HklGuiWindowPrivate *priv = self->priv;
1440 g_return_if_fail (self != NULL);
1442 CONNECT_SPINBUTTON(spinbutton_a);
1443 CONNECT_SPINBUTTON(spinbutton_a_min);
1444 CONNECT_SPINBUTTON(spinbutton_a_max);
1445 CONNECT_SPINBUTTON(spinbutton_a_star);
1447 CONNECT_SPINBUTTON(spinbutton_b);
1448 CONNECT_SPINBUTTON(spinbutton_b_min);
1449 CONNECT_SPINBUTTON(spinbutton_b_max);
1450 CONNECT_SPINBUTTON(spinbutton_b_star);
1452 CONNECT_SPINBUTTON(spinbutton_c);
1453 CONNECT_SPINBUTTON(spinbutton_c_min);
1454 CONNECT_SPINBUTTON(spinbutton_c_max);
1455 CONNECT_SPINBUTTON(spinbutton_c_star);
1457 CONNECT_SPINBUTTON(spinbutton_alpha);
1458 CONNECT_SPINBUTTON(spinbutton_alpha_min);
1459 CONNECT_SPINBUTTON(spinbutton_alpha_max);
1460 CONNECT_SPINBUTTON(spinbutton_alpha_star);
1462 CONNECT_SPINBUTTON(spinbutton_beta);
1463 CONNECT_SPINBUTTON(spinbutton_beta_min);
1464 CONNECT_SPINBUTTON(spinbutton_beta_max);
1465 CONNECT_SPINBUTTON(spinbutton_beta_star);
1467 CONNECT_SPINBUTTON(spinbutton_alpha);
1468 CONNECT_SPINBUTTON(spinbutton_alpha_min);
1469 CONNECT_SPINBUTTON(spinbutton_alpha_max);
1470 CONNECT_SPINBUTTON(spinbutton_alpha_star);
1472 g_signal_connect_object (priv->_spinbutton_lambda,
1473 "value-changed",
1474 (GCallback) _hkl_gui_window_on_spinbutton_lambda_value_changed_gtk_spin_button_value_changed,
1475 self, 0);
1477 CONNECT_UX_UY_UZ(spinbutton_ux);
1478 CONNECT_UX_UY_UZ(spinbutton_uy);
1479 CONNECT_UX_UY_UZ(spinbutton_uz);
1481 g_signal_connect_object (priv->_button2,
1482 "clicked",
1483 (GCallback) _hkl_gui_window_on_button2_clicked_gtk_button_clicked,
1484 self, 0);
1486 CONNECT_CHECKBUTTON(checkbutton_a);
1487 CONNECT_CHECKBUTTON(checkbutton_b);
1488 CONNECT_CHECKBUTTON(checkbutton_c);
1489 CONNECT_CHECKBUTTON(checkbutton_alpha);
1490 CONNECT_CHECKBUTTON(checkbutton_beta);
1491 CONNECT_CHECKBUTTON(checkbutton_gamma);
1492 CONNECT_CHECKBUTTON(checkbutton_Ux);
1493 CONNECT_CHECKBUTTON(checkbutton_Uy);
1494 CONNECT_CHECKBUTTON(checkbutton_Uz);
1496 g_signal_connect_object (GTK_WIDGET(priv->_treeview_reflections),
1497 "key-press-event",
1498 (GCallback) _hkl_gui_window_on_tree_view_reflections_key_press_event_gtk_widget_key_press_event,
1499 self, 0);
1501 g_signal_connect_object (priv->_treeview_pseudo_axes,
1502 "cursor-changed",
1503 (GCallback) _hkl_gui_window_on_tree_view_pseudo_axes_cursor_changed_gtk_tree_view_cursor_changed,
1504 self, 0);
1506 g_signal_connect_object (priv->_treeview_crystals,
1507 "cursor-changed",
1508 (GCallback) _hkl_gui_window_on_tree_view_crystals_cursor_changed_gtk_tree_view_cursor_changed, self, 0);
1510 g_signal_connect_object (GTK_WIDGET(priv->_treeview_crystals),
1511 "key-press-event",
1512 (GCallback) _hkl_gui_window_on_tree_view_crystals_key_press_event_gtk_widget_key_press_event,
1513 self, 0);
1515 g_signal_connect_object (priv->_toolbutton_add_reflection,
1516 "clicked",
1517 (GCallback) _hkl_gui_window_on_toolbutton_add_reflection_clicked_gtk_tool_button_clicked,
1518 self, 0);
1520 g_signal_connect_object (priv->_toolbutton_goto_reflection,
1521 "clicked",
1522 (GCallback) _hkl_gui_window_on_toolbutton_goto_reflection_clicked_gtk_tool_button_clicked,
1523 self, 0);
1525 g_signal_connect_object (priv->_toolbutton_del_reflection,
1526 "clicked",
1527 (GCallback) _hkl_gui_window_on_toolbutton_del_reflection_clicked_gtk_tool_button_clicked,
1528 self, 0);
1530 g_signal_connect_object (priv->_toolbutton_setUB,
1531 "clicked",
1532 (GCallback) _hkl_gui_window_on_toolbutton_setUB_clicked_gtk_tool_button_clicked,
1533 self, 0);
1535 g_signal_connect_object (priv->_toolbutton_computeUB,
1536 "clicked",
1537 (GCallback) _hkl_gui_window_on_toolbutton_computeUB_clicked_gtk_tool_button_clicked,
1538 self, 0);
1540 g_signal_connect_object (priv->_toolbutton_add_crystal,
1541 "clicked",
1542 (GCallback) _hkl_gui_window_on_toolbutton_add_crystal_clicked_gtk_tool_button_clicked,
1543 self, 0);
1545 g_signal_connect_object (priv->_toolbutton_copy_crystal,
1546 "clicked",
1547 (GCallback) _hkl_gui_window_on_toolbutton_copy_crystal_clicked_gtk_tool_button_clicked,
1548 self, 0);
1550 g_signal_connect_object (priv->_toolbutton_del_crystal,
1551 "clicked",
1552 (GCallback) _hkl_gui_window_on_toolbutton_del_crystal_clicked_gtk_tool_button_clicked,
1553 self, 0);
1555 g_signal_connect_object (priv->_toolbutton_affiner,
1556 "clicked",
1557 (GCallback) _hkl_gui_window_on_toolbutton_affiner_clicked_gtk_tool_button_clicked,
1558 self, 0);
1560 g_signal_connect_object (GTK_MENU_ITEM(priv->_menuitem5),
1561 "activate",
1562 (GCallback) _hkl_gui_window_on_menuitem5_activate_gtk_menu_item_activate,
1563 self, 0);
1565 g_signal_connect_object (priv->_button1,
1566 "clicked",
1567 (GCallback) _hkl_gui_window_on_button1_clicked_gtk_button_clicked,
1568 self, 0);
1570 g_signal_connect_object (priv->_combobox1,
1571 "changed",
1572 (GCallback) _hkl_gui_window_on_combobox1_changed_gtk_combo_box_changed,
1573 self, 0);
1580 static void _hkl_gui_window_on_cell_tree_view_axes_read_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1582 hkl_gui_window_on_cell_tree_view_axes_read_edited (path, new_text, self);
1587 static void _hkl_gui_window_on_cell_tree_view_axes_write_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1589 hkl_gui_window_on_cell_tree_view_axes_write_edited (path, new_text, self);
1594 static void _hkl_gui_window_on_cell_tree_view_axes_min_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1596 hkl_gui_window_on_cell_tree_view_axes_min_edited (path, new_text, self);
1601 static void _hkl_gui_window_on_cell_tree_view_axes_max_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1603 hkl_gui_window_on_cell_tree_view_axes_max_edited (path, new_text, self);
1609 static void _hkl_gui_window_on_cell_tree_view_pseudo_axes_write_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1611 hkl_gui_window_on_cell_tree_view_pseudo_axes_write_edited (path, new_text, self);
1616 static void _hkl_gui_window_on_cell_tree_view_pseudo_axes_is_initialized_toggled_gtk_cell_renderer_toggle_toggled (GtkCellRendererToggle* _sender, const gchar* path, gpointer self) {
1618 hkl_gui_window_on_cell_tree_view_pseudo_axes_is_initialized_toggled (path, self);
1623 static void _hkl_gui_window_on_cell_tree_view_pseudo_axes_parameters_value_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1625 hkl_gui_window_on_cell_tree_view_pseudo_axes_parameters_value_edited (path, new_text, self);
1630 static void hkl_gui_window_set_up_tree_view_pseudo_axes_parameters (HklGuiWindow* self) {
1631 GtkCellRendererText* renderer = NULL;
1632 GtkTreeViewColumn* column = NULL;
1633 GtkTreeView* _tmp0_;
1634 GList* _tmp1_ = NULL;
1635 GList* columns;
1636 GList* _tmp2_;
1637 GtkCellRendererText* _tmp5_;
1638 GtkCellRendererText* _tmp6_;
1639 GtkTreeViewColumn* _tmp7_;
1640 GtkTreeView* _tmp8_;
1641 GtkTreeViewColumn* _tmp9_;
1642 GtkCellRendererText* _tmp10_;
1643 GtkCellRendererText* _tmp11_;
1644 GtkCellRendererText* _tmp12_;
1645 GtkCellRendererText* _tmp13_;
1646 GtkTreeViewColumn* _tmp14_;
1647 GtkTreeView* _tmp15_;
1648 GtkTreeViewColumn* _tmp16_;
1650 g_return_if_fail (self != NULL);
1652 _tmp0_ = priv->_treeview_pseudo_axes_parameters;
1654 _tmp1_ = gtk_tree_view_get_columns (_tmp0_);
1656 columns = _tmp1_;
1658 _tmp2_ = columns;
1661 GList* col_collection = NULL;
1662 GList* col_it = NULL;
1664 col_collection = _tmp2_;
1666 for (col_it = col_collection; col_it != NULL; col_it = col_it->next) {
1668 GtkTreeViewColumn* col = NULL;
1670 col = (GtkTreeViewColumn*) col_it->data;
1673 GtkTreeView* _tmp3_;
1674 GtkTreeViewColumn* _tmp4_;
1676 _tmp3_ = priv->_treeview_pseudo_axes_parameters;
1678 _tmp4_ = col;
1680 gtk_tree_view_remove_column (_tmp3_, _tmp4_);
1686 _tmp5_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1688 g_object_ref_sink (_tmp5_);
1690 _g_object_unref0 (renderer);
1692 renderer = _tmp5_;
1694 _tmp6_ = renderer;
1696 _tmp7_ = gtk_tree_view_column_new_with_attributes ("name", (GtkCellRenderer*) _tmp6_, "text", PARAMETER_COL_NAME, NULL);
1698 g_object_ref_sink (_tmp7_);
1700 _g_object_unref0 (column);
1702 column = _tmp7_;
1704 _tmp8_ = priv->_treeview_pseudo_axes_parameters;
1706 _tmp9_ = column;
1708 gtk_tree_view_append_column (_tmp8_, _tmp9_);
1710 _tmp10_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1712 g_object_ref_sink (_tmp10_);
1714 _g_object_unref0 (renderer);
1716 renderer = _tmp10_;
1718 _tmp11_ = renderer;
1720 g_signal_connect_object (_tmp11_, "edited", (GCallback) _hkl_gui_window_on_cell_tree_view_pseudo_axes_parameters_value_edited_gtk_cell_renderer_text_edited, self, 0);
1722 _tmp12_ = renderer;
1724 g_object_set (_tmp12_, "editable", TRUE, NULL);
1726 _tmp13_ = renderer;
1728 _tmp14_ = gtk_tree_view_column_new_with_attributes ("read", (GtkCellRenderer*) _tmp13_, "text", PARAMETER_COL_VALUE, NULL);
1730 g_object_ref_sink (_tmp14_);
1732 _g_object_unref0 (column);
1734 column = _tmp14_;
1736 _tmp15_ = priv->_treeview_pseudo_axes_parameters;
1738 _tmp16_ = column;
1740 gtk_tree_view_append_column (_tmp15_, _tmp16_);
1742 _g_list_free0 (columns);
1744 _g_object_unref0 (column);
1746 _g_object_unref0 (renderer);
1751 static void _hkl_gui_window_on_tree_view1_cursor_changed_gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self) {
1753 hkl_gui_window_on_tree_view1_cursor_changed (self);
1762 static void _hkl_gui_window_on_cell_tree_view_crystals_name_edited_gtk_cell_renderer_text_edited (GtkCellRendererText* _sender, const gchar* path, const gchar* new_text, gpointer self) {
1764 hkl_gui_window_on_cell_tree_view_crystals_name_edited (path, new_text, self);
1769 static void hkl_gui_window_set_up_tree_view_crystals (HklGuiWindow* self) {
1770 GtkTreeViewColumn* column = NULL;
1771 GtkCellRendererText* renderer = NULL;
1772 GtkTreeView* _tmp0_;
1773 GList* _tmp1_ = NULL;
1774 GList* columns;
1775 GList* _tmp2_;
1776 GtkCellRendererText* _tmp5_;
1777 GtkCellRendererText* _tmp6_;
1778 GtkCellRendererText* _tmp7_;
1779 GtkCellRendererText* _tmp8_;
1780 GtkTreeViewColumn* _tmp9_;
1781 GtkTreeView* _tmp10_;
1782 GtkTreeViewColumn* _tmp11_;
1783 GtkCellRendererText* _tmp12_;
1784 GtkCellRendererText* _tmp13_;
1785 GtkTreeViewColumn* _tmp14_;
1786 GtkTreeView* _tmp15_;
1787 GtkTreeViewColumn* _tmp16_;
1788 GtkCellRendererText* _tmp17_;
1789 GtkCellRendererText* _tmp18_;
1790 GtkTreeViewColumn* _tmp19_;
1791 GtkTreeView* _tmp20_;
1792 GtkTreeViewColumn* _tmp21_;
1793 GtkCellRendererText* _tmp22_;
1794 GtkCellRendererText* _tmp23_;
1795 GtkTreeViewColumn* _tmp24_;
1796 GtkTreeView* _tmp25_;
1797 GtkTreeViewColumn* _tmp26_;
1798 GtkCellRendererText* _tmp27_;
1799 GtkCellRendererText* _tmp28_;
1800 GtkTreeViewColumn* _tmp29_;
1801 GtkTreeView* _tmp30_;
1802 GtkTreeViewColumn* _tmp31_;
1803 GtkCellRendererText* _tmp32_;
1804 GtkCellRendererText* _tmp33_;
1805 GtkTreeViewColumn* _tmp34_;
1806 GtkTreeView* _tmp35_;
1807 GtkTreeViewColumn* _tmp36_;
1808 GtkCellRendererText* _tmp37_;
1809 GtkCellRendererText* _tmp38_;
1810 GtkTreeViewColumn* _tmp39_;
1811 GtkTreeView* _tmp40_;
1812 GtkTreeViewColumn* _tmp41_;
1813 GtkTreeView* _tmp42_;
1814 GtkTreeSelection* _tmp43_ = NULL;
1816 g_return_if_fail (self != NULL);
1818 _tmp0_ = priv->_treeview_crystals;
1820 _tmp1_ = gtk_tree_view_get_columns (_tmp0_);
1822 columns = _tmp1_;
1824 _tmp2_ = columns;
1827 GList* col_collection = NULL;
1828 GList* col_it = NULL;
1830 col_collection = _tmp2_;
1832 for (col_it = col_collection; col_it != NULL; col_it = col_it->next) {
1834 GtkTreeViewColumn* col = NULL;
1836 col = (GtkTreeViewColumn*) col_it->data;
1839 GtkTreeView* _tmp3_;
1840 GtkTreeViewColumn* _tmp4_;
1842 _tmp3_ = priv->_treeview_crystals;
1844 _tmp4_ = col;
1846 gtk_tree_view_remove_column (_tmp3_, _tmp4_);
1852 _tmp5_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1854 g_object_ref_sink (_tmp5_);
1856 _g_object_unref0 (renderer);
1858 renderer = _tmp5_;
1860 _tmp6_ = renderer;
1862 g_signal_connect_object (_tmp6_, "edited", (GCallback) _hkl_gui_window_on_cell_tree_view_crystals_name_edited_gtk_cell_renderer_text_edited, self, 0);
1864 _tmp7_ = renderer;
1866 g_object_set (_tmp7_, "editable", TRUE, NULL);
1868 _tmp8_ = renderer;
1870 _tmp9_ = gtk_tree_view_column_new_with_attributes ("name", (GtkCellRenderer*) _tmp8_, "text", SAMPLE_COL_NAME, NULL);
1872 g_object_ref_sink (_tmp9_);
1874 _g_object_unref0 (column);
1876 column = _tmp9_;
1878 _tmp10_ = priv->_treeview_crystals;
1880 _tmp11_ = column;
1882 gtk_tree_view_append_column (_tmp10_, _tmp11_);
1884 _tmp12_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1886 g_object_ref_sink (_tmp12_);
1888 _g_object_unref0 (renderer);
1890 renderer = _tmp12_;
1892 _tmp13_ = renderer;
1894 _tmp14_ = gtk_tree_view_column_new_with_attributes ("a", (GtkCellRenderer*) _tmp13_, "text", SAMPLE_COL_A, NULL);
1896 g_object_ref_sink (_tmp14_);
1898 _g_object_unref0 (column);
1900 column = _tmp14_;
1902 _tmp15_ = priv->_treeview_crystals;
1904 _tmp16_ = column;
1906 gtk_tree_view_append_column (_tmp15_, _tmp16_);
1908 _tmp17_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1910 g_object_ref_sink (_tmp17_);
1912 _g_object_unref0 (renderer);
1914 renderer = _tmp17_;
1916 _tmp18_ = renderer;
1918 _tmp19_ = gtk_tree_view_column_new_with_attributes ("b", (GtkCellRenderer*) _tmp18_, "text", SAMPLE_COL_B, NULL);
1920 g_object_ref_sink (_tmp19_);
1922 _g_object_unref0 (column);
1924 column = _tmp19_;
1926 _tmp20_ = priv->_treeview_crystals;
1928 _tmp21_ = column;
1930 gtk_tree_view_append_column (_tmp20_, _tmp21_);
1932 _tmp22_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1934 g_object_ref_sink (_tmp22_);
1936 _g_object_unref0 (renderer);
1938 renderer = _tmp22_;
1940 _tmp23_ = renderer;
1942 _tmp24_ = gtk_tree_view_column_new_with_attributes ("c", (GtkCellRenderer*) _tmp23_, "text", SAMPLE_COL_C, NULL);
1944 g_object_ref_sink (_tmp24_);
1946 _g_object_unref0 (column);
1948 column = _tmp24_;
1950 _tmp25_ = priv->_treeview_crystals;
1952 _tmp26_ = column;
1954 gtk_tree_view_append_column (_tmp25_, _tmp26_);
1956 _tmp27_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1958 g_object_ref_sink (_tmp27_);
1960 _g_object_unref0 (renderer);
1962 renderer = _tmp27_;
1964 _tmp28_ = renderer;
1966 _tmp29_ = gtk_tree_view_column_new_with_attributes ("alpha", (GtkCellRenderer*) _tmp28_, "text", SAMPLE_COL_ALPHA, NULL);
1968 g_object_ref_sink (_tmp29_);
1970 _g_object_unref0 (column);
1972 column = _tmp29_;
1974 _tmp30_ = priv->_treeview_crystals;
1976 _tmp31_ = column;
1978 gtk_tree_view_append_column (_tmp30_, _tmp31_);
1980 _tmp32_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
1982 g_object_ref_sink (_tmp32_);
1984 _g_object_unref0 (renderer);
1986 renderer = _tmp32_;
1988 _tmp33_ = renderer;
1990 _tmp34_ = gtk_tree_view_column_new_with_attributes ("beta", (GtkCellRenderer*) _tmp33_, "text", SAMPLE_COL_BETA, NULL);
1992 g_object_ref_sink (_tmp34_);
1994 _g_object_unref0 (column);
1996 column = _tmp34_;
1998 _tmp35_ = priv->_treeview_crystals;
2000 _tmp36_ = column;
2002 gtk_tree_view_append_column (_tmp35_, _tmp36_);
2004 _tmp37_ = (GtkCellRendererText*) gtk_cell_renderer_text_new ();
2006 g_object_ref_sink (_tmp37_);
2008 _g_object_unref0 (renderer);
2010 renderer = _tmp37_;
2012 _tmp38_ = renderer;
2014 _tmp39_ = gtk_tree_view_column_new_with_attributes ("gamma", (GtkCellRenderer*) _tmp38_, "text", SAMPLE_COL_GAMMA, NULL);
2016 g_object_ref_sink (_tmp39_);
2018 _g_object_unref0 (column);
2020 column = _tmp39_;
2022 _tmp40_ = priv->_treeview_crystals;
2024 _tmp41_ = column;
2026 gtk_tree_view_append_column (_tmp40_, _tmp41_);
2028 _tmp42_ = priv->_treeview_crystals;
2030 _tmp43_ = gtk_tree_view_get_selection (_tmp42_);
2032 gtk_tree_selection_set_mode (_tmp43_, GTK_SELECTION_MULTIPLE);
2034 _g_list_free0 (columns);
2036 _g_object_unref0 (renderer);
2038 _g_object_unref0 (column);
2043 static void hkl_gui_window_set_up_3D (HklGuiWindow* self) {
2044 HklGeometry* _tmp0_;
2045 HklGeometryConfig* _tmp1_;
2046 HklGeometryType _tmp2_;
2047 GtkVBox* _tmp7_;
2048 HklGui3DFrame* _tmp8_;
2049 GtkFrame* _tmp9_ = NULL;
2050 GtkFrame* _tmp10_;
2051 GtkVBox* _tmp11_;
2053 g_return_if_fail (self != NULL);
2055 _tmp0_ = priv->geometry;
2057 _tmp1_ = _tmp0_->config;
2059 _tmp2_ = (*_tmp1_).type;
2061 switch (_tmp2_) {
2063 case HKL_GEOMETRY_TYPE_KAPPA6C:
2066 HklGeometry* _tmp3_;
2067 HklGui3DFrame* _tmp4_;
2069 _tmp3_ = priv->geometry;
2071 _tmp4_ = hkl_gui_3d_frame_new ("../data/diffabs.yaml", _tmp3_);
2073 _g_object_unref0 (priv->Frame3D);
2075 priv->Frame3D = _tmp4_;
2077 break;
2081 case HKL_GEOMETRY_TYPE_KAPPA4C_VERTICAL:
2084 HklGeometry* _tmp5_;
2085 HklGui3DFrame* _tmp6_;
2087 _tmp5_ = priv->geometry;
2089 _tmp6_ = hkl_gui_3d_frame_new ("../data/cristal4C.yaml", _tmp5_);
2091 _g_object_unref0 (priv->Frame3D);
2093 priv->Frame3D = _tmp6_;
2095 break;
2098 default:
2100 break;
2104 _tmp7_ = priv->_vbox7;
2106 _tmp8_ = priv->Frame3D;
2108 _tmp9_ = hkl_gui_3d_frame_frame (_tmp8_);
2110 _tmp10_ = _tmp9_;
2112 gtk_box_pack_start ((GtkBox*) _tmp7_, (GtkWidget*) _tmp10_, TRUE, TRUE, (guint) 0);
2114 _g_object_unref0 (_tmp10_);
2116 _tmp11_ = priv->_vbox7;
2118 gtk_widget_show_all ((GtkWidget*) _tmp11_);
2123 static void hkl_gui_window_update_source (HklGuiWindow* self) {
2124 HklGeometry* _tmp0_;
2126 g_return_if_fail (self != NULL);
2128 _tmp0_ = priv->geometry;
2130 if (_tmp0_ != NULL) {
2132 HklGeometry* _tmp1_;
2133 gdouble _tmp2_ = 0.0;
2134 gdouble lambda;
2135 GtkSpinButton* _tmp3_;
2136 gdouble _tmp4_;
2138 _tmp1_ = priv->geometry;
2140 _tmp2_ = hkl_source_get_wavelength (&_tmp1_->source);
2142 lambda = _tmp2_;
2144 _tmp3_ = priv->_spinbutton_lambda;
2146 _tmp4_ = lambda;
2148 gtk_spin_button_set_value (_tmp3_, _tmp4_);
2154 static void hkl_gui_window_update_pseudo_axes_parameters (HklGuiWindow* self) {
2155 GeeHashMap* _tmp0_;
2156 GeeMapIterator* _tmp1_ = NULL;
2157 GeeMapIterator* iter;
2159 g_return_if_fail (self != NULL);
2161 _tmp0_ = priv->hash_store_pseudo_axis_parameter;
2163 _tmp1_ = gee_abstract_map_map_iterator ((GeeAbstractMap*) _tmp0_);
2165 iter = _tmp1_;
2167 while (TRUE) {
2169 GeeMapIterator* _tmp2_;
2170 gboolean _tmp3_ = FALSE;
2171 GtkListStore* model = NULL;
2172 GtkTreeIter iter2 = {0};
2173 gboolean valid = FALSE;
2174 GeeMapIterator* _tmp4_;
2175 gpointer _tmp5_ = NULL;
2176 GtkListStore* _tmp6_;
2177 GtkTreeIter _tmp7_ = {0};
2178 gboolean _tmp8_ = FALSE;
2180 _tmp2_ = iter;
2182 _tmp3_ = gee_map_iterator_next (_tmp2_);
2184 if (!_tmp3_) {
2186 break;
2190 _tmp4_ = iter;
2192 _tmp5_ = gee_map_iterator_get_value (_tmp4_);
2194 _g_object_unref0 (model);
2196 model = (GtkListStore*) _tmp5_;
2198 _tmp6_ = model;
2200 _tmp8_ = gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp6_, &_tmp7_);
2202 iter2 = _tmp7_;
2204 valid = _tmp8_;
2206 while (TRUE) {
2208 gboolean _tmp9_;
2209 HklParameter* parameter = NULL;
2210 GtkListStore* _tmp10_;
2211 GtkTreeIter _tmp11_;
2212 GtkListStore* _tmp12_;
2213 GtkTreeIter _tmp13_;
2214 HklParameter* _tmp14_;
2215 const gchar* _tmp15_;
2216 HklParameter* _tmp16_;
2217 HklParameter _tmp17_;
2218 gdouble _tmp18_ = 0.0;
2219 GtkListStore* _tmp19_;
2220 gboolean _tmp20_ = FALSE;
2222 _tmp9_ = valid;
2224 if (!_tmp9_) {
2226 break;
2230 _tmp10_ = model;
2232 _tmp11_ = iter2;
2234 gtk_tree_model_get ((GtkTreeModel*) _tmp10_, &_tmp11_, PARAMETER_COL_PARAMETER, &parameter, -1);
2236 _tmp12_ = model;
2238 _tmp13_ = iter2;
2240 _tmp14_ = parameter;
2242 _tmp15_ = (*_tmp14_).name;
2244 _tmp16_ = parameter;
2246 _tmp17_ = *_tmp16_;
2248 _tmp18_ = hkl_parameter_get_value_unit (&_tmp17_);
2250 gtk_list_store_set (_tmp12_, &_tmp13_, PARAMETER_COL_NAME, _tmp15_, PARAMETER_COL_VALUE, _tmp18_, -1);
2252 _tmp19_ = model;
2254 _tmp20_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp19_, &iter2);
2256 valid = _tmp20_;
2260 _g_object_unref0 (model);
2264 _g_object_unref0 (iter);
2269 static void hkl_gui_window_update_lattice (HklGuiWindow* self) {
2270 HklSampleList* _tmp0_;
2271 HklSample* _tmp1_;
2272 HklSample* sample;
2273 HklSample* _tmp2_;
2275 g_return_if_fail (self != NULL);
2277 _tmp0_ = priv->samples;
2279 _tmp1_ = _tmp0_->current;
2281 sample = _tmp1_;
2283 _tmp2_ = sample;
2285 if (_tmp2_ != NULL) {
2287 GtkSpinButton* _tmp3_;
2288 HklSample* _tmp4_;
2289 HklLattice* _tmp5_;
2290 HklParameter* _tmp6_;
2291 HklParameter _tmp7_;
2292 gdouble _tmp8_ = 0.0;
2293 GtkSpinButton* _tmp9_;
2294 HklSample* _tmp10_;
2295 HklLattice* _tmp11_;
2296 HklParameter* _tmp12_;
2297 HklParameter _tmp13_;
2298 gdouble _tmp14_ = 0.0;
2299 GtkSpinButton* _tmp15_;
2300 HklSample* _tmp16_;
2301 HklLattice* _tmp17_;
2302 HklParameter* _tmp18_;
2303 HklParameter _tmp19_;
2304 gdouble _tmp20_ = 0.0;
2305 GtkSpinButton* _tmp21_;
2306 HklSample* _tmp22_;
2307 HklLattice* _tmp23_;
2308 HklParameter* _tmp24_;
2309 HklParameter _tmp25_;
2310 gdouble _tmp26_ = 0.0;
2311 GtkSpinButton* _tmp27_;
2312 HklSample* _tmp28_;
2313 HklLattice* _tmp29_;
2314 HklParameter* _tmp30_;
2315 HklParameter _tmp31_;
2316 gdouble _tmp32_ = 0.0;
2317 GtkSpinButton* _tmp33_;
2318 HklSample* _tmp34_;
2319 HklLattice* _tmp35_;
2320 HklParameter* _tmp36_;
2321 HklParameter _tmp37_;
2322 gdouble _tmp38_ = 0.0;
2324 _tmp3_ = priv->_spinbutton_a;
2326 _tmp4_ = sample;
2328 _tmp5_ = _tmp4_->lattice;
2330 _tmp6_ = _tmp5_->a;
2332 _tmp7_ = *_tmp6_;
2334 _tmp8_ = hkl_parameter_get_value_unit (&_tmp7_);
2336 gtk_spin_button_set_value (_tmp3_, _tmp8_);
2338 _tmp9_ = priv->_spinbutton_b;
2340 _tmp10_ = sample;
2342 _tmp11_ = _tmp10_->lattice;
2344 _tmp12_ = _tmp11_->b;
2346 _tmp13_ = *_tmp12_;
2348 _tmp14_ = hkl_parameter_get_value_unit (&_tmp13_);
2350 gtk_spin_button_set_value (_tmp9_, _tmp14_);
2352 _tmp15_ = priv->_spinbutton_c;
2354 _tmp16_ = sample;
2356 _tmp17_ = _tmp16_->lattice;
2358 _tmp18_ = _tmp17_->c;
2360 _tmp19_ = *_tmp18_;
2362 _tmp20_ = hkl_parameter_get_value_unit (&_tmp19_);
2364 gtk_spin_button_set_value (_tmp15_, _tmp20_);
2366 _tmp21_ = priv->_spinbutton_alpha;
2368 _tmp22_ = sample;
2370 _tmp23_ = _tmp22_->lattice;
2372 _tmp24_ = _tmp23_->alpha;
2374 _tmp25_ = *_tmp24_;
2376 _tmp26_ = hkl_parameter_get_value_unit (&_tmp25_);
2378 gtk_spin_button_set_value (_tmp21_, _tmp26_);
2380 _tmp27_ = priv->_spinbutton_beta;
2382 _tmp28_ = sample;
2384 _tmp29_ = _tmp28_->lattice;
2386 _tmp30_ = _tmp29_->beta;
2388 _tmp31_ = *_tmp30_;
2390 _tmp32_ = hkl_parameter_get_value_unit (&_tmp31_);
2392 gtk_spin_button_set_value (_tmp27_, _tmp32_);
2394 _tmp33_ = priv->_spinbutton_gamma;
2396 _tmp34_ = sample;
2398 _tmp35_ = _tmp34_->lattice;
2400 _tmp36_ = _tmp35_->gamma;
2402 _tmp37_ = *_tmp36_;
2404 _tmp38_ = hkl_parameter_get_value_unit (&_tmp37_);
2406 gtk_spin_button_set_value (_tmp33_, _tmp38_);
2412 static void hkl_gui_window_update_lattice_parameters (HklGuiWindow* self) {
2413 HklSampleList* _tmp0_;
2414 HklSample* _tmp1_;
2415 HklSample* sample;
2416 HklSample* _tmp2_;
2418 g_return_if_fail (self != NULL);
2420 _tmp0_ = priv->samples;
2422 _tmp1_ = _tmp0_->current;
2424 sample = _tmp1_;
2426 _tmp2_ = sample;
2428 if (_tmp2_ != NULL) {
2430 gdouble min = 0.0;
2431 gdouble max = 0.0;
2432 HklParameter* parameter = NULL;
2433 HklSample* _tmp3_;
2434 HklLattice* _tmp4_;
2435 HklParameter* _tmp5_;
2436 HklParameter* _tmp6_;
2437 HklParameter _tmp7_;
2438 gdouble _tmp8_ = 0.0;
2439 gdouble _tmp9_ = 0.0;
2440 GtkSpinButton* _tmp10_;
2441 gdouble _tmp11_;
2442 GtkSpinButton* _tmp12_;
2443 gdouble _tmp13_;
2444 GtkCheckButton* _tmp14_;
2445 HklParameter* _tmp15_;
2446 gboolean _tmp16_;
2447 HklSample* _tmp17_;
2448 HklLattice* _tmp18_;
2449 HklParameter* _tmp19_;
2450 HklParameter* _tmp20_;
2451 HklParameter _tmp21_;
2452 gdouble _tmp22_ = 0.0;
2453 gdouble _tmp23_ = 0.0;
2454 GtkSpinButton* _tmp24_;
2455 gdouble _tmp25_;
2456 GtkSpinButton* _tmp26_;
2457 gdouble _tmp27_;
2458 GtkCheckButton* _tmp28_;
2459 HklParameter* _tmp29_;
2460 gboolean _tmp30_;
2461 HklSample* _tmp31_;
2462 HklLattice* _tmp32_;
2463 HklParameter* _tmp33_;
2464 HklParameter* _tmp34_;
2465 HklParameter _tmp35_;
2466 gdouble _tmp36_ = 0.0;
2467 gdouble _tmp37_ = 0.0;
2468 GtkSpinButton* _tmp38_;
2469 gdouble _tmp39_;
2470 GtkSpinButton* _tmp40_;
2471 gdouble _tmp41_;
2472 GtkCheckButton* _tmp42_;
2473 HklParameter* _tmp43_;
2474 gboolean _tmp44_;
2475 HklSample* _tmp45_;
2476 HklLattice* _tmp46_;
2477 HklParameter* _tmp47_;
2478 HklParameter* _tmp48_;
2479 HklParameter _tmp49_;
2480 gdouble _tmp50_ = 0.0;
2481 gdouble _tmp51_ = 0.0;
2482 GtkSpinButton* _tmp52_;
2483 gdouble _tmp53_;
2484 GtkSpinButton* _tmp54_;
2485 gdouble _tmp55_;
2486 GtkCheckButton* _tmp56_;
2487 HklParameter* _tmp57_;
2488 gboolean _tmp58_;
2489 HklSample* _tmp59_;
2490 HklLattice* _tmp60_;
2491 HklParameter* _tmp61_;
2492 HklParameter* _tmp62_;
2493 HklParameter _tmp63_;
2494 gdouble _tmp64_ = 0.0;
2495 gdouble _tmp65_ = 0.0;
2496 GtkSpinButton* _tmp66_;
2497 gdouble _tmp67_;
2498 GtkSpinButton* _tmp68_;
2499 gdouble _tmp69_;
2500 GtkCheckButton* _tmp70_;
2501 HklParameter* _tmp71_;
2502 gboolean _tmp72_;
2503 HklSample* _tmp73_;
2504 HklLattice* _tmp74_;
2505 HklParameter* _tmp75_;
2506 HklParameter* _tmp76_;
2507 HklParameter _tmp77_;
2508 gdouble _tmp78_ = 0.0;
2509 gdouble _tmp79_ = 0.0;
2510 GtkSpinButton* _tmp80_;
2511 gdouble _tmp81_;
2512 GtkSpinButton* _tmp82_;
2513 gdouble _tmp83_;
2514 GtkCheckButton* _tmp84_;
2515 HklParameter* _tmp85_;
2516 gboolean _tmp86_;
2518 _tmp3_ = sample;
2520 _tmp4_ = _tmp3_->lattice;
2522 _tmp5_ = _tmp4_->a;
2524 parameter = _tmp5_;
2526 _tmp6_ = parameter;
2528 _tmp7_ = *_tmp6_;
2530 hkl_parameter_get_range_unit (&_tmp7_, &_tmp8_, &_tmp9_);
2532 min = _tmp8_;
2534 max = _tmp9_;
2536 _tmp10_ = priv->_spinbutton_a_min;
2538 _tmp11_ = min;
2540 gtk_spin_button_set_value (_tmp10_, _tmp11_);
2542 _tmp12_ = priv->_spinbutton_a_max;
2544 _tmp13_ = max;
2546 gtk_spin_button_set_value (_tmp12_, _tmp13_);
2548 _tmp14_ = priv->_checkbutton_a;
2550 _tmp15_ = parameter;
2552 _tmp16_ = (*_tmp15_).fit;
2554 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp14_, _tmp16_);
2556 _tmp17_ = sample;
2558 _tmp18_ = _tmp17_->lattice;
2560 _tmp19_ = _tmp18_->b;
2562 parameter = _tmp19_;
2564 _tmp20_ = parameter;
2566 _tmp21_ = *_tmp20_;
2568 hkl_parameter_get_range_unit (&_tmp21_, &_tmp22_, &_tmp23_);
2570 min = _tmp22_;
2572 max = _tmp23_;
2574 _tmp24_ = priv->_spinbutton_b_min;
2576 _tmp25_ = min;
2578 gtk_spin_button_set_value (_tmp24_, _tmp25_);
2580 _tmp26_ = priv->_spinbutton_b_max;
2582 _tmp27_ = max;
2584 gtk_spin_button_set_value (_tmp26_, _tmp27_);
2586 _tmp28_ = priv->_checkbutton_b;
2588 _tmp29_ = parameter;
2590 _tmp30_ = (*_tmp29_).fit;
2592 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp28_, _tmp30_);
2594 _tmp31_ = sample;
2596 _tmp32_ = _tmp31_->lattice;
2598 _tmp33_ = _tmp32_->c;
2600 parameter = _tmp33_;
2602 _tmp34_ = parameter;
2604 _tmp35_ = *_tmp34_;
2606 hkl_parameter_get_range_unit (&_tmp35_, &_tmp36_, &_tmp37_);
2608 min = _tmp36_;
2610 max = _tmp37_;
2612 _tmp38_ = priv->_spinbutton_c_min;
2614 _tmp39_ = min;
2616 gtk_spin_button_set_value (_tmp38_, _tmp39_);
2618 _tmp40_ = priv->_spinbutton_c_max;
2620 _tmp41_ = max;
2622 gtk_spin_button_set_value (_tmp40_, _tmp41_);
2624 _tmp42_ = priv->_checkbutton_c;
2626 _tmp43_ = parameter;
2628 _tmp44_ = (*_tmp43_).fit;
2630 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp42_, _tmp44_);
2632 _tmp45_ = sample;
2634 _tmp46_ = _tmp45_->lattice;
2636 _tmp47_ = _tmp46_->alpha;
2638 parameter = _tmp47_;
2640 _tmp48_ = parameter;
2642 _tmp49_ = *_tmp48_;
2644 hkl_parameter_get_range_unit (&_tmp49_, &_tmp50_, &_tmp51_);
2646 min = _tmp50_;
2648 max = _tmp51_;
2650 _tmp52_ = priv->_spinbutton_alpha_min;
2652 _tmp53_ = min;
2654 gtk_spin_button_set_value (_tmp52_, _tmp53_);
2656 _tmp54_ = priv->_spinbutton_alpha_max;
2658 _tmp55_ = max;
2660 gtk_spin_button_set_value (_tmp54_, _tmp55_);
2662 _tmp56_ = priv->_checkbutton_alpha;
2664 _tmp57_ = parameter;
2666 _tmp58_ = (*_tmp57_).fit;
2668 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp56_, _tmp58_);
2670 _tmp59_ = sample;
2672 _tmp60_ = _tmp59_->lattice;
2674 _tmp61_ = _tmp60_->beta;
2676 parameter = _tmp61_;
2678 _tmp62_ = parameter;
2680 _tmp63_ = *_tmp62_;
2682 hkl_parameter_get_range_unit (&_tmp63_, &_tmp64_, &_tmp65_);
2684 min = _tmp64_;
2686 max = _tmp65_;
2688 _tmp66_ = priv->_spinbutton_beta_min;
2690 _tmp67_ = min;
2692 gtk_spin_button_set_value (_tmp66_, _tmp67_);
2694 _tmp68_ = priv->_spinbutton_beta_max;
2696 _tmp69_ = max;
2698 gtk_spin_button_set_value (_tmp68_, _tmp69_);
2700 _tmp70_ = priv->_checkbutton_beta;
2702 _tmp71_ = parameter;
2704 _tmp72_ = (*_tmp71_).fit;
2706 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp70_, _tmp72_);
2708 _tmp73_ = sample;
2710 _tmp74_ = _tmp73_->lattice;
2712 _tmp75_ = _tmp74_->gamma;
2714 parameter = _tmp75_;
2716 _tmp76_ = parameter;
2718 _tmp77_ = *_tmp76_;
2720 hkl_parameter_get_range_unit (&_tmp77_, &_tmp78_, &_tmp79_);
2722 min = _tmp78_;
2724 max = _tmp79_;
2726 _tmp80_ = priv->_spinbutton_gamma_min;
2728 _tmp81_ = min;
2730 gtk_spin_button_set_value (_tmp80_, _tmp81_);
2732 _tmp82_ = priv->_spinbutton_gamma_max;
2734 _tmp83_ = max;
2736 gtk_spin_button_set_value (_tmp82_, _tmp83_);
2738 _tmp84_ = priv->_checkbutton_gamma;
2740 _tmp85_ = parameter;
2742 _tmp86_ = (*_tmp85_).fit;
2744 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp84_, _tmp86_);
2750 static void hkl_gui_window_update_reciprocal_lattice (HklGuiWindow* self) {
2751 HklSampleList* _tmp0_;
2752 HklSample* _tmp1_;
2753 HklSample* sample;
2754 HklSample* _tmp2_;
2756 g_return_if_fail (self != NULL);
2758 _tmp0_ = priv->samples;
2760 _tmp1_ = _tmp0_->current;
2762 sample = _tmp1_;
2764 _tmp2_ = sample;
2766 if (_tmp2_ != NULL) {
2768 HklSample* _tmp3_;
2769 HklLattice* _tmp4_;
2770 HklLattice* _tmp5_;
2771 GtkSpinButton* _tmp6_;
2772 HklLattice* _tmp7_;
2773 HklParameter* _tmp8_;
2774 HklParameter _tmp9_;
2775 gdouble _tmp10_ = 0.0;
2776 GtkSpinButton* _tmp11_;
2777 HklLattice* _tmp12_;
2778 HklParameter* _tmp13_;
2779 HklParameter _tmp14_;
2780 gdouble _tmp15_ = 0.0;
2781 GtkSpinButton* _tmp16_;
2782 HklLattice* _tmp17_;
2783 HklParameter* _tmp18_;
2784 HklParameter _tmp19_;
2785 gdouble _tmp20_ = 0.0;
2786 GtkSpinButton* _tmp21_;
2787 HklLattice* _tmp22_;
2788 HklParameter* _tmp23_;
2789 HklParameter _tmp24_;
2790 gdouble _tmp25_ = 0.0;
2791 GtkSpinButton* _tmp26_;
2792 HklLattice* _tmp27_;
2793 HklParameter* _tmp28_;
2794 HklParameter _tmp29_;
2795 gdouble _tmp30_ = 0.0;
2796 GtkSpinButton* _tmp31_;
2797 HklLattice* _tmp32_;
2798 HklParameter* _tmp33_;
2799 HklParameter _tmp34_;
2800 gdouble _tmp35_ = 0.0;
2802 _tmp3_ = sample;
2804 _tmp4_ = _tmp3_->lattice;
2806 _tmp5_ = priv->reciprocal;
2808 hkl_lattice_reciprocal (_tmp4_, _tmp5_);
2810 _tmp6_ = priv->_spinbutton_a_star;
2812 _tmp7_ = priv->reciprocal;
2814 _tmp8_ = _tmp7_->a;
2816 _tmp9_ = *_tmp8_;
2818 _tmp10_ = hkl_parameter_get_value_unit (&_tmp9_);
2820 gtk_spin_button_set_value (_tmp6_, _tmp10_);
2822 _tmp11_ = priv->_spinbutton_b_star;
2824 _tmp12_ = priv->reciprocal;
2826 _tmp13_ = _tmp12_->b;
2828 _tmp14_ = *_tmp13_;
2830 _tmp15_ = hkl_parameter_get_value_unit (&_tmp14_);
2832 gtk_spin_button_set_value (_tmp11_, _tmp15_);
2834 _tmp16_ = priv->_spinbutton_c_star;
2836 _tmp17_ = priv->reciprocal;
2838 _tmp18_ = _tmp17_->c;
2840 _tmp19_ = *_tmp18_;
2842 _tmp20_ = hkl_parameter_get_value_unit (&_tmp19_);
2844 gtk_spin_button_set_value (_tmp16_, _tmp20_);
2846 _tmp21_ = priv->_spinbutton_alpha_star;
2848 _tmp22_ = priv->reciprocal;
2850 _tmp23_ = _tmp22_->alpha;
2852 _tmp24_ = *_tmp23_;
2854 _tmp25_ = hkl_parameter_get_value_unit (&_tmp24_);
2856 gtk_spin_button_set_value (_tmp21_, _tmp25_);
2858 _tmp26_ = priv->_spinbutton_beta_star;
2860 _tmp27_ = priv->reciprocal;
2862 _tmp28_ = _tmp27_->beta;
2864 _tmp29_ = *_tmp28_;
2866 _tmp30_ = hkl_parameter_get_value_unit (&_tmp29_);
2868 gtk_spin_button_set_value (_tmp26_, _tmp30_);
2870 _tmp31_ = priv->_spinbutton_gamma_star;
2872 _tmp32_ = priv->reciprocal;
2874 _tmp33_ = _tmp32_->gamma;
2876 _tmp34_ = *_tmp33_;
2878 _tmp35_ = hkl_parameter_get_value_unit (&_tmp34_);
2880 gtk_spin_button_set_value (_tmp31_, _tmp35_);
2886 static gchar* double_to_string (gdouble self) {
2887 gchar* result = NULL;
2888 gchar* _tmp0_ = NULL;
2889 gchar* _tmp1_;
2890 gint _tmp1__length1;
2891 const gchar* _tmp2_ = NULL;
2892 gchar* _tmp3_;
2893 gchar* _tmp4_;
2895 _tmp0_ = g_new0 (gchar, G_ASCII_DTOSTR_BUF_SIZE);
2897 _tmp1_ = _tmp0_;
2899 _tmp1__length1 = G_ASCII_DTOSTR_BUF_SIZE;
2901 _tmp2_ = g_ascii_dtostr (_tmp1_, G_ASCII_DTOSTR_BUF_SIZE, self);
2903 _tmp3_ = g_strdup (_tmp2_);
2905 _tmp4_ = _tmp3_;
2907 _tmp1_ = (g_free (_tmp1_), NULL);
2909 result = _tmp4_;
2911 return result;
2916 static void hkl_gui_window_update_UB (HklGuiWindow* self) {
2917 HklSampleList* _tmp0_;
2918 HklSample* _tmp1_;
2919 HklSample* sample;
2920 HklSample* _tmp2_;
2922 g_return_if_fail (self != NULL);
2924 _tmp0_ = priv->samples;
2926 _tmp1_ = _tmp0_->current;
2928 sample = _tmp1_;
2930 _tmp2_ = sample;
2932 if (_tmp2_ != NULL) {
2934 HklMatrix UB = {0};
2935 HklSample* _tmp3_;
2936 HklMatrix _tmp4_ = {0};
2937 GtkLabel* _tmp5_;
2938 HklMatrix _tmp6_;
2939 gdouble** _tmp7_;
2940 gint _tmp7__length1;
2941 gdouble* _tmp8_;
2942 gint _tmp8__length1;
2943 gdouble _tmp9_;
2944 gchar* _tmp10_ = NULL;
2945 gchar* _tmp11_;
2946 GtkLabel* _tmp12_;
2947 HklMatrix _tmp13_;
2948 gdouble** _tmp14_;
2949 gint _tmp14__length1;
2950 gdouble* _tmp15_;
2951 gint _tmp15__length1;
2952 gdouble _tmp16_;
2953 gchar* _tmp17_ = NULL;
2954 gchar* _tmp18_;
2955 GtkLabel* _tmp19_;
2956 HklMatrix _tmp20_;
2957 gdouble** _tmp21_;
2958 gint _tmp21__length1;
2959 gdouble* _tmp22_;
2960 gint _tmp22__length1;
2961 gdouble _tmp23_;
2962 gchar* _tmp24_ = NULL;
2963 gchar* _tmp25_;
2964 GtkLabel* _tmp26_;
2965 HklMatrix _tmp27_;
2966 gdouble** _tmp28_;
2967 gint _tmp28__length1;
2968 gdouble* _tmp29_;
2969 gint _tmp29__length1;
2970 gdouble _tmp30_;
2971 gchar* _tmp31_ = NULL;
2972 gchar* _tmp32_;
2973 GtkLabel* _tmp33_;
2974 HklMatrix _tmp34_;
2975 gdouble** _tmp35_;
2976 gint _tmp35__length1;
2977 gdouble* _tmp36_;
2978 gint _tmp36__length1;
2979 gdouble _tmp37_;
2980 gchar* _tmp38_ = NULL;
2981 gchar* _tmp39_;
2982 GtkLabel* _tmp40_;
2983 HklMatrix _tmp41_;
2984 gdouble** _tmp42_;
2985 gint _tmp42__length1;
2986 gdouble* _tmp43_;
2987 gint _tmp43__length1;
2988 gdouble _tmp44_;
2989 gchar* _tmp45_ = NULL;
2990 gchar* _tmp46_;
2991 GtkLabel* _tmp47_;
2992 HklMatrix _tmp48_;
2993 gdouble** _tmp49_;
2994 gint _tmp49__length1;
2995 gdouble* _tmp50_;
2996 gint _tmp50__length1;
2997 gdouble _tmp51_;
2998 gchar* _tmp52_ = NULL;
2999 gchar* _tmp53_;
3000 GtkLabel* _tmp54_;
3001 HklMatrix _tmp55_;
3002 gdouble** _tmp56_;
3003 gint _tmp56__length1;
3004 gdouble* _tmp57_;
3005 gint _tmp57__length1;
3006 gdouble _tmp58_;
3007 gchar* _tmp59_ = NULL;
3008 gchar* _tmp60_;
3009 GtkLabel* _tmp61_;
3010 HklMatrix _tmp62_;
3011 gdouble** _tmp63_;
3012 gint _tmp63__length1;
3013 gdouble* _tmp64_;
3014 gint _tmp64__length1;
3015 gdouble _tmp65_;
3016 gchar* _tmp66_ = NULL;
3017 gchar* _tmp67_;
3019 _tmp3_ = sample;
3021 hkl_sample_get_UB (_tmp3_, &_tmp4_);
3023 (&UB);
3025 UB = _tmp4_;
3027 _tmp5_ = priv->_label_UB11;
3029 _tmp6_ = UB;
3031 _tmp7_ = _tmp6_.data;
3033 _tmp7__length1 = -1;
3035 _tmp8_ = _tmp7_[0];
3037 _tmp8__length1 = -1;
3039 _tmp9_ = _tmp8_[0];
3041 _tmp10_ = double_to_string (_tmp9_);
3043 _tmp11_ = _tmp10_;
3045 gtk_label_set_text (_tmp5_, _tmp11_);
3047 _g_free0 (_tmp11_);
3049 _tmp12_ = priv->_label_UB12;
3051 _tmp13_ = UB;
3053 _tmp14_ = _tmp13_.data;
3055 _tmp14__length1 = -1;
3057 _tmp15_ = _tmp14_[0];
3059 _tmp15__length1 = -1;
3061 _tmp16_ = _tmp15_[1];
3063 _tmp17_ = double_to_string (_tmp16_);
3065 _tmp18_ = _tmp17_;
3067 gtk_label_set_text (_tmp12_, _tmp18_);
3069 _g_free0 (_tmp18_);
3071 _tmp19_ = priv->_label_UB13;
3073 _tmp20_ = UB;
3075 _tmp21_ = _tmp20_.data;
3077 _tmp21__length1 = -1;
3079 _tmp22_ = _tmp21_[0];
3081 _tmp22__length1 = -1;
3083 _tmp23_ = _tmp22_[2];
3085 _tmp24_ = double_to_string (_tmp23_);
3087 _tmp25_ = _tmp24_;
3089 gtk_label_set_text (_tmp19_, _tmp25_);
3091 _g_free0 (_tmp25_);
3093 _tmp26_ = priv->_label_UB21;
3095 _tmp27_ = UB;
3097 _tmp28_ = _tmp27_.data;
3099 _tmp28__length1 = -1;
3101 _tmp29_ = _tmp28_[1];
3103 _tmp29__length1 = -1;
3105 _tmp30_ = _tmp29_[0];
3107 _tmp31_ = double_to_string (_tmp30_);
3109 _tmp32_ = _tmp31_;
3111 gtk_label_set_text (_tmp26_, _tmp32_);
3113 _g_free0 (_tmp32_);
3115 _tmp33_ = priv->_label_UB22;
3117 _tmp34_ = UB;
3119 _tmp35_ = _tmp34_.data;
3121 _tmp35__length1 = -1;
3123 _tmp36_ = _tmp35_[1];
3125 _tmp36__length1 = -1;
3127 _tmp37_ = _tmp36_[1];
3129 _tmp38_ = double_to_string (_tmp37_);
3131 _tmp39_ = _tmp38_;
3133 gtk_label_set_text (_tmp33_, _tmp39_);
3135 _g_free0 (_tmp39_);
3137 _tmp40_ = priv->_label_UB23;
3139 _tmp41_ = UB;
3141 _tmp42_ = _tmp41_.data;
3143 _tmp42__length1 = -1;
3145 _tmp43_ = _tmp42_[1];
3147 _tmp43__length1 = -1;
3149 _tmp44_ = _tmp43_[2];
3151 _tmp45_ = double_to_string (_tmp44_);
3153 _tmp46_ = _tmp45_;
3155 gtk_label_set_text (_tmp40_, _tmp46_);
3157 _g_free0 (_tmp46_);
3159 _tmp47_ = priv->_label_UB31;
3161 _tmp48_ = UB;
3163 _tmp49_ = _tmp48_.data;
3165 _tmp49__length1 = -1;
3167 _tmp50_ = _tmp49_[2];
3169 _tmp50__length1 = -1;
3171 _tmp51_ = _tmp50_[0];
3173 _tmp52_ = double_to_string (_tmp51_);
3175 _tmp53_ = _tmp52_;
3177 gtk_label_set_text (_tmp47_, _tmp53_);
3179 _g_free0 (_tmp53_);
3181 _tmp54_ = priv->_label_UB32;
3183 _tmp55_ = UB;
3185 _tmp56_ = _tmp55_.data;
3187 _tmp56__length1 = -1;
3189 _tmp57_ = _tmp56_[2];
3191 _tmp57__length1 = -1;
3193 _tmp58_ = _tmp57_[1];
3195 _tmp59_ = double_to_string (_tmp58_);
3197 _tmp60_ = _tmp59_;
3199 gtk_label_set_text (_tmp54_, _tmp60_);
3201 _g_free0 (_tmp60_);
3203 _tmp61_ = priv->_label_UB33;
3205 _tmp62_ = UB;
3207 _tmp63_ = _tmp62_.data;
3209 _tmp63__length1 = -1;
3211 _tmp64_ = _tmp63_[2];
3213 _tmp64__length1 = -1;
3215 _tmp65_ = _tmp64_[2];
3217 _tmp66_ = double_to_string (_tmp65_);
3219 _tmp67_ = _tmp66_;
3221 gtk_label_set_text (_tmp61_, _tmp67_);
3223 _g_free0 (_tmp67_);
3225 (&UB);
3231 static void hkl_gui_window_update_UxUyUz (HklGuiWindow* self) {
3232 HklSampleList* _tmp0_;
3233 HklSample* _tmp1_;
3234 HklSample* sample;
3235 HklSample* _tmp2_;
3237 g_return_if_fail (self != NULL);
3239 _tmp0_ = priv->samples;
3241 _tmp1_ = _tmp0_->current;
3243 sample = _tmp1_;
3245 _tmp2_ = sample;
3247 if (_tmp2_ != NULL) {
3249 GtkSpinButton* _tmp3_;
3250 HklSample* _tmp4_;
3251 HklParameter* _tmp5_;
3252 gdouble _tmp6_ = 0.0;
3253 GtkSpinButton* _tmp7_;
3254 HklSample* _tmp8_;
3255 HklParameter* _tmp9_;
3256 gdouble _tmp10_ = 0.0;
3257 GtkSpinButton* _tmp11_;
3258 HklSample* _tmp12_;
3259 HklParameter* _tmp13_;
3260 gdouble _tmp14_ = 0.0;
3261 GtkCheckButton* _tmp15_;
3262 HklSample* _tmp16_;
3263 HklParameter* _tmp17_;
3264 gboolean _tmp18_;
3265 GtkCheckButton* _tmp19_;
3266 HklSample* _tmp20_;
3267 HklParameter* _tmp21_;
3268 gboolean _tmp22_;
3269 GtkCheckButton* _tmp23_;
3270 HklSample* _tmp24_;
3271 HklParameter* _tmp25_;
3272 gboolean _tmp26_;
3274 _tmp3_ = priv->_spinbutton_ux;
3276 _tmp4_ = sample;
3278 _tmp5_ = _tmp4_->ux;
3280 _tmp6_ = hkl_parameter_get_value_unit (_tmp5_);
3282 gtk_spin_button_set_value (_tmp3_, _tmp6_);
3284 _tmp7_ = priv->_spinbutton_uy;
3286 _tmp8_ = sample;
3288 _tmp9_ = _tmp8_->uy;
3290 _tmp10_ = hkl_parameter_get_value_unit (_tmp9_);
3292 gtk_spin_button_set_value (_tmp7_, _tmp10_);
3294 _tmp11_ = priv->_spinbutton_uz;
3296 _tmp12_ = sample;
3298 _tmp13_ = _tmp12_->uz;
3300 _tmp14_ = hkl_parameter_get_value_unit (_tmp13_);
3302 gtk_spin_button_set_value (_tmp11_, _tmp14_);
3304 _tmp15_ = priv->_checkbutton_Ux;
3306 _tmp16_ = sample;
3308 _tmp17_ = _tmp16_->ux;
3310 _tmp18_ = (*_tmp17_).fit;
3312 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp15_, _tmp18_);
3314 _tmp19_ = priv->_checkbutton_Uy;
3316 _tmp20_ = sample;
3318 _tmp21_ = _tmp20_->uy;
3320 _tmp22_ = (*_tmp21_).fit;
3322 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp19_, _tmp22_);
3324 _tmp23_ = priv->_checkbutton_Uz;
3326 _tmp24_ = sample;
3328 _tmp25_ = _tmp24_->uz;
3330 _tmp26_ = (*_tmp25_).fit;
3332 gtk_toggle_button_set_active ((GtkToggleButton*) _tmp23_, _tmp26_);
3338 static void _hkl_gui_window_update_reflections (HklSample* sample, GtkListStore* model) {
3339 gsize i = 0UL;
3340 GtkListStore* _tmp0_;
3341 HklSample* _tmp1_;
3342 HklSampleReflection** _tmp2_;
3343 gint _tmp2__length1;
3345 g_return_if_fail (sample != NULL);
3347 g_return_if_fail (model != NULL);
3349 _tmp0_ = model;
3351 gtk_list_store_clear (_tmp0_);
3353 i = (gsize) 0;
3355 _tmp1_ = sample;
3357 _tmp2_ = _tmp1_->reflections;
3359 _tmp2__length1 = _tmp1_->reflections_len;
3362 HklSampleReflection** reflection_collection = NULL;
3363 gint reflection_collection_length1 = 0;
3364 gint _reflection_collection_size_ = 0;
3365 gint reflection_it = 0;
3367 reflection_collection = _tmp2_;
3369 reflection_collection_length1 = _tmp2__length1;
3371 for (reflection_it = 0; reflection_it < _tmp2__length1; reflection_it = reflection_it + 1) {
3373 HklSampleReflection* reflection = NULL;
3375 reflection = reflection_collection[reflection_it];
3378 GtkTreeIter iter = {0};
3379 GtkListStore* _tmp3_;
3380 GtkTreeIter _tmp4_ = {0};
3381 GtkListStore* _tmp5_;
3382 GtkTreeIter _tmp6_;
3383 gsize _tmp7_;
3384 HklSampleReflection* _tmp8_;
3385 HklVector _tmp9_;
3386 gdouble* _tmp10_;
3387 gint _tmp10__length1;
3388 gdouble _tmp11_;
3389 HklSampleReflection* _tmp12_;
3390 HklVector _tmp13_;
3391 gdouble* _tmp14_;
3392 gint _tmp14__length1;
3393 gdouble _tmp15_;
3394 HklSampleReflection* _tmp16_;
3395 HklVector _tmp17_;
3396 gdouble* _tmp18_;
3397 gint _tmp18__length1;
3398 gdouble _tmp19_;
3399 HklSampleReflection* _tmp20_;
3400 gint _tmp21_;
3402 _tmp3_ = model;
3404 gtk_list_store_append (_tmp3_, &_tmp4_);
3406 iter = _tmp4_;
3408 _tmp5_ = model;
3410 _tmp6_ = iter;
3412 _tmp7_ = i;
3414 i = _tmp7_ + 1;
3416 _tmp8_ = reflection;
3418 _tmp9_ = _tmp8_->hkl;
3420 _tmp10_ = _tmp9_.data;
3422 _tmp10__length1 = _tmp9_.data_length1;
3424 _tmp11_ = _tmp10_[0];
3426 _tmp12_ = reflection;
3428 _tmp13_ = _tmp12_->hkl;
3430 _tmp14_ = _tmp13_.data;
3432 _tmp14__length1 = _tmp13_.data_length1;
3434 _tmp15_ = _tmp14_[1];
3436 _tmp16_ = reflection;
3438 _tmp17_ = _tmp16_->hkl;
3440 _tmp18_ = _tmp17_.data;
3442 _tmp18__length1 = _tmp17_.data_length1;
3444 _tmp19_ = _tmp18_[2];
3446 _tmp20_ = reflection;
3448 _tmp21_ = _tmp20_->flag;
3450 gtk_list_store_set (_tmp5_, &_tmp6_, REFLECTION_COL_INDEX, _tmp7_, REFLECTION_COL_H, _tmp11_, REFLECTION_COL_K, _tmp15_, REFLECTION_COL_L, _tmp19_, REFLECTION_COL_FLAG, _tmp21_, -1);
3458 static void hkl_gui_window_update_tree_view_crystals (HklGuiWindow* self) {
3459 GtkListStore* reflections = NULL;
3460 GtkTreeIter iter = {0};
3461 GtkListStore* _tmp0_;
3462 GtkTreeView* _tmp1_;
3463 GtkListStore* _tmp2_;
3464 HklSampleList* _tmp3_;
3465 HklSample** _tmp4_;
3466 gint _tmp4__length1;
3468 g_return_if_fail (self != NULL);
3470 _tmp0_ = gtk_list_store_new ((gint) SAMPLE_COL_N_COLUMNS, G_TYPE_POINTER, GTK_TYPE_LIST_STORE, G_TYPE_STRING, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE);
3472 _g_object_unref0 (priv->store_samples);
3474 priv->store_samples = _tmp0_;
3476 _tmp1_ = priv->_treeview_crystals;
3478 _tmp2_ = priv->store_samples;
3480 gtk_tree_view_set_model (_tmp1_, (GtkTreeModel*) _tmp2_);
3482 _tmp3_ = priv->samples;
3484 _tmp4_ = _tmp3_->samples;
3486 _tmp4__length1 = _tmp3_->len;
3489 HklSample** sample_collection = NULL;
3490 gint sample_collection_length1 = 0;
3491 gint _sample_collection_size_ = 0;
3492 gint sample_it = 0;
3494 sample_collection = _tmp4_;
3496 sample_collection_length1 = _tmp4__length1;
3498 for (sample_it = 0; sample_it < _tmp4__length1; sample_it = sample_it + 1) {
3500 HklSample* sample = NULL;
3502 sample = sample_collection[sample_it];
3505 HklSample* _tmp5_;
3506 HklLattice* _tmp6_;
3507 HklLattice* lattice;
3508 GtkListStore* _tmp7_;
3509 HklSample* _tmp8_;
3510 GtkListStore* _tmp9_;
3511 GtkListStore* _tmp10_;
3512 GtkTreeIter _tmp11_ = {0};
3513 GtkListStore* _tmp12_;
3514 GtkTreeIter _tmp13_;
3515 HklSample* _tmp14_;
3516 GtkListStore* _tmp15_;
3517 HklSample* _tmp16_;
3518 const gchar* _tmp17_;
3519 HklLattice* _tmp18_;
3520 HklParameter* _tmp19_;
3521 HklParameter _tmp20_;
3522 gdouble _tmp21_ = 0.0;
3523 HklLattice* _tmp22_;
3524 HklParameter* _tmp23_;
3525 HklParameter _tmp24_;
3526 gdouble _tmp25_ = 0.0;
3527 HklLattice* _tmp26_;
3528 HklParameter* _tmp27_;
3529 HklParameter _tmp28_;
3530 gdouble _tmp29_ = 0.0;
3531 HklLattice* _tmp30_;
3532 HklParameter* _tmp31_;
3533 HklParameter _tmp32_;
3534 gdouble _tmp33_ = 0.0;
3535 HklLattice* _tmp34_;
3536 HklParameter* _tmp35_;
3537 HklParameter _tmp36_;
3538 gdouble _tmp37_ = 0.0;
3539 HklLattice* _tmp38_;
3540 HklParameter* _tmp39_;
3541 HklParameter _tmp40_;
3542 gdouble _tmp41_ = 0.0;
3543 gboolean _tmp42_ = FALSE;
3544 HklSampleList* _tmp43_;
3545 HklSample* _tmp44_;
3546 gboolean _tmp50_;
3548 _tmp5_ = sample;
3550 _tmp6_ = _tmp5_->lattice;
3552 lattice = _tmp6_;
3554 _tmp7_ = gtk_list_store_new ((gint) REFLECTION_COL_N_COLUMNS, G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
3556 _g_object_unref0 (reflections);
3558 reflections = _tmp7_;
3560 _tmp8_ = sample;
3562 _tmp9_ = reflections;
3564 _hkl_gui_window_update_reflections (_tmp8_, _tmp9_);
3566 _tmp10_ = priv->store_samples;
3568 gtk_list_store_append (_tmp10_, &_tmp11_);
3570 iter = _tmp11_;
3572 _tmp12_ = priv->store_samples;
3574 _tmp13_ = iter;
3576 _tmp14_ = sample;
3578 _tmp15_ = reflections;
3580 _tmp16_ = sample;
3582 _tmp17_ = _tmp16_->name;
3584 _tmp18_ = lattice;
3586 _tmp19_ = _tmp18_->a;
3588 _tmp20_ = *_tmp19_;
3590 _tmp21_ = hkl_parameter_get_value_unit (&_tmp20_);
3592 _tmp22_ = lattice;
3594 _tmp23_ = _tmp22_->b;
3596 _tmp24_ = *_tmp23_;
3598 _tmp25_ = hkl_parameter_get_value_unit (&_tmp24_);
3600 _tmp26_ = lattice;
3602 _tmp27_ = _tmp26_->c;
3604 _tmp28_ = *_tmp27_;
3606 _tmp29_ = hkl_parameter_get_value_unit (&_tmp28_);
3608 _tmp30_ = lattice;
3610 _tmp31_ = _tmp30_->alpha;
3612 _tmp32_ = *_tmp31_;
3614 _tmp33_ = hkl_parameter_get_value_unit (&_tmp32_);
3616 _tmp34_ = lattice;
3618 _tmp35_ = _tmp34_->beta;
3620 _tmp36_ = *_tmp35_;
3622 _tmp37_ = hkl_parameter_get_value_unit (&_tmp36_);
3624 _tmp38_ = lattice;
3626 _tmp39_ = _tmp38_->gamma;
3628 _tmp40_ = *_tmp39_;
3630 _tmp41_ = hkl_parameter_get_value_unit (&_tmp40_);
3632 gtk_list_store_set (_tmp12_, &_tmp13_, SAMPLE_COL_SAMPLE, _tmp14_, SAMPLE_COL_REFLECTIONS, _tmp15_, SAMPLE_COL_NAME, _tmp17_, SAMPLE_COL_A, _tmp21_, SAMPLE_COL_B, _tmp25_, SAMPLE_COL_C, _tmp29_, SAMPLE_COL_ALPHA, _tmp33_, SAMPLE_COL_BETA, _tmp37_, SAMPLE_COL_GAMMA, _tmp41_, -1);
3634 _tmp43_ = priv->samples;
3636 _tmp44_ = _tmp43_->current;
3638 if (_tmp44_ != NULL) {
3640 HklSampleList* _tmp45_;
3641 HklSample* _tmp46_;
3642 const gchar* _tmp47_;
3643 HklSample* _tmp48_;
3644 const gchar* _tmp49_;
3646 _tmp45_ = priv->samples;
3648 _tmp46_ = _tmp45_->current;
3650 _tmp47_ = _tmp46_->name;
3652 _tmp48_ = sample;
3654 _tmp49_ = _tmp48_->name;
3656 _tmp42_ = g_strcmp0 (_tmp47_, _tmp49_) == 0;
3658 } else {
3660 _tmp42_ = FALSE;
3664 _tmp50_ = _tmp42_;
3666 if (_tmp50_) {
3668 GtkTreePath* path = NULL;
3669 GtkListStore* _tmp51_;
3670 GtkTreeIter _tmp52_;
3671 GtkTreePath* _tmp53_ = NULL;
3672 GtkTreeView* _tmp54_;
3673 GtkTreePath* _tmp55_;
3674 GtkTreeView* _tmp56_;
3675 GtkListStore* _tmp57_;
3677 _tmp51_ = priv->store_samples;
3679 _tmp52_ = iter;
3681 _tmp53_ = gtk_tree_model_get_path ((GtkTreeModel*) _tmp51_, &_tmp52_);
3683 _gtk_tree_path_free0 (path);
3685 path = _tmp53_;
3687 _tmp54_ = priv->_treeview_crystals;
3689 _tmp55_ = path;
3691 gtk_tree_view_set_cursor (_tmp54_, _tmp55_, NULL, FALSE);
3693 _tmp56_ = priv->_treeview_reflections;
3695 _tmp57_ = reflections;
3697 gtk_tree_view_set_model (_tmp56_, (GtkTreeModel*) _tmp57_);
3699 _gtk_tree_path_free0 (path);
3706 _g_object_unref0 (reflections);
3711 static void hkl_gui_window_update_reflections (HklGuiWindow* self, HklSample* sample) {
3712 gboolean valid = FALSE;
3713 GtkTreeIter iter = {0};
3714 GtkListStore* _tmp0_;
3715 GtkTreeIter _tmp1_ = {0};
3716 gboolean _tmp2_ = FALSE;
3718 g_return_if_fail (self != NULL);
3720 g_return_if_fail (sample != NULL);
3722 _tmp0_ = priv->store_samples;
3724 _tmp2_ = gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp0_, &_tmp1_);
3726 iter = _tmp1_;
3728 valid = _tmp2_;
3730 while (TRUE) {
3732 gboolean _tmp3_;
3733 HklSample* sample_iter = NULL;
3734 GtkListStore* model = NULL;
3735 GtkListStore* _tmp4_;
3736 GtkTreeIter _tmp5_;
3737 HklSample* _tmp6_;
3738 HklSample* _tmp7_;
3739 GtkListStore* _tmp10_;
3740 gboolean _tmp11_ = FALSE;
3742 _tmp3_ = valid;
3744 if (!_tmp3_) {
3746 break;
3750 _tmp4_ = priv->store_samples;
3752 _tmp5_ = iter;
3754 gtk_tree_model_get ((GtkTreeModel*) _tmp4_, &_tmp5_, SAMPLE_COL_SAMPLE, &sample_iter, SAMPLE_COL_REFLECTIONS, &model, -1);
3756 _tmp6_ = sample;
3758 _tmp7_ = sample_iter;
3760 if (_tmp6_ == _tmp7_) {
3762 HklSample* _tmp8_;
3763 GtkListStore* _tmp9_;
3765 _tmp8_ = sample;
3767 _tmp9_ = model;
3769 _hkl_gui_window_update_reflections (_tmp8_, _tmp9_);
3771 _g_object_unref0 (model);
3773 break;
3777 _tmp10_ = priv->store_samples;
3779 _tmp11_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp10_, &iter);
3781 valid = _tmp11_;
3783 _g_object_unref0 (model);
3789 static void hkl_gui_window_update_crystal_model (HklGuiWindow* self, HklSample* sample) {
3790 GtkTreeIter iter = {0};
3791 gboolean valid = FALSE;
3792 GtkListStore* _tmp0_;
3793 GtkTreeIter _tmp1_ = {0};
3794 gboolean _tmp2_ = FALSE;
3796 g_return_if_fail (self != NULL);
3798 g_return_if_fail (sample != NULL);
3800 _tmp0_ = priv->store_samples;
3802 _tmp2_ = gtk_tree_model_get_iter_first ((GtkTreeModel*) _tmp0_, &_tmp1_);
3804 iter = _tmp1_;
3806 valid = _tmp2_;
3808 while (TRUE) {
3810 gboolean _tmp3_;
3811 gchar* name = NULL;
3812 GtkListStore* _tmp4_;
3813 GtkTreeIter _tmp5_;
3814 const gchar* _tmp6_;
3815 HklSample* _tmp7_;
3816 const gchar* _tmp8_;
3817 GtkListStore* _tmp37_;
3818 gboolean _tmp38_ = FALSE;
3820 _tmp3_ = valid;
3822 if (!_tmp3_) {
3824 break;
3828 _tmp4_ = priv->store_samples;
3830 _tmp5_ = iter;
3832 gtk_tree_model_get ((GtkTreeModel*) _tmp4_, &_tmp5_, SAMPLE_COL_NAME, &name, -1);
3834 _tmp6_ = name;
3836 _tmp7_ = sample;
3838 _tmp8_ = _tmp7_->name;
3840 if (g_strcmp0 (_tmp6_, _tmp8_) == 0) {
3842 HklSample* _tmp9_;
3843 HklLattice* _tmp10_;
3844 HklLattice* lattice;
3845 GtkListStore* _tmp11_;
3846 GtkTreeIter _tmp12_;
3847 HklLattice* _tmp13_;
3848 HklParameter* _tmp14_;
3849 HklParameter _tmp15_;
3850 gdouble _tmp16_ = 0.0;
3851 HklLattice* _tmp17_;
3852 HklParameter* _tmp18_;
3853 HklParameter _tmp19_;
3854 gdouble _tmp20_ = 0.0;
3855 HklLattice* _tmp21_;
3856 HklParameter* _tmp22_;
3857 HklParameter _tmp23_;
3858 gdouble _tmp24_ = 0.0;
3859 HklLattice* _tmp25_;
3860 HklParameter* _tmp26_;
3861 HklParameter _tmp27_;
3862 gdouble _tmp28_ = 0.0;
3863 HklLattice* _tmp29_;
3864 HklParameter* _tmp30_;
3865 HklParameter _tmp31_;
3866 gdouble _tmp32_ = 0.0;
3867 HklLattice* _tmp33_;
3868 HklParameter* _tmp34_;
3869 HklParameter _tmp35_;
3870 gdouble _tmp36_ = 0.0;
3872 _tmp9_ = sample;
3874 _tmp10_ = _tmp9_->lattice;
3876 lattice = _tmp10_;
3878 _tmp11_ = priv->store_samples;
3880 _tmp12_ = iter;
3882 _tmp13_ = lattice;
3884 _tmp14_ = _tmp13_->a;
3886 _tmp15_ = *_tmp14_;
3888 _tmp16_ = hkl_parameter_get_value_unit (&_tmp15_);
3890 _tmp17_ = lattice;
3892 _tmp18_ = _tmp17_->b;
3894 _tmp19_ = *_tmp18_;
3896 _tmp20_ = hkl_parameter_get_value_unit (&_tmp19_);
3898 _tmp21_ = lattice;
3900 _tmp22_ = _tmp21_->c;
3902 _tmp23_ = *_tmp22_;
3904 _tmp24_ = hkl_parameter_get_value_unit (&_tmp23_);
3906 _tmp25_ = lattice;
3908 _tmp26_ = _tmp25_->alpha;
3910 _tmp27_ = *_tmp26_;
3912 _tmp28_ = hkl_parameter_get_value_unit (&_tmp27_);
3914 _tmp29_ = lattice;
3916 _tmp30_ = _tmp29_->beta;
3918 _tmp31_ = *_tmp30_;
3920 _tmp32_ = hkl_parameter_get_value_unit (&_tmp31_);
3922 _tmp33_ = lattice;
3924 _tmp34_ = _tmp33_->gamma;
3926 _tmp35_ = *_tmp34_;
3928 _tmp36_ = hkl_parameter_get_value_unit (&_tmp35_);
3930 gtk_list_store_set (_tmp11_, &_tmp12_, SAMPLE_COL_A, _tmp16_, SAMPLE_COL_B, _tmp20_, SAMPLE_COL_C, _tmp24_, SAMPLE_COL_ALPHA, _tmp28_, SAMPLE_COL_BETA, _tmp32_, SAMPLE_COL_GAMMA, _tmp36_, -1);
3932 _g_free0 (name);
3934 break;
3938 _tmp37_ = priv->store_samples;
3940 _tmp38_ = gtk_tree_model_iter_next ((GtkTreeModel*) _tmp37_, &iter);
3942 valid = _tmp38_;
3944 _g_free0 (name);
3954 static void hkl_gui_window_on_tree_view_pseudo_axes_cursor_changed (HklGuiWindow* self) {
3955 GtkTreePath* path = NULL;
3956 GtkTreeViewColumn* focus_column = NULL;
3957 GtkListStore* model = NULL;
3958 GtkTreeIter iter = {0};
3959 HklPseudoAxis* pseudoAxis = NULL;
3960 GtkTreeView* _tmp0_;
3961 GtkTreePath* _tmp1_ = NULL;
3962 GtkTreeViewColumn* _tmp2_ = NULL;
3963 GtkTreeViewColumn* _tmp3_;
3964 GtkListStore* _tmp4_;
3965 GtkTreeIter _tmp5_ = {0};
3966 GtkListStore* _tmp6_;
3967 GtkTreeIter _tmp7_;
3968 GeeHashMap* _tmp8_;
3969 gpointer _tmp9_ = NULL;
3970 GtkTreeView* _tmp10_;
3972 g_return_if_fail (self != NULL);
3974 _tmp0_ = priv->_treeview_pseudo_axes;
3976 gtk_tree_view_get_cursor (_tmp0_, &_tmp1_, &_tmp2_);
3978 _gtk_tree_path_free0 (path);
3980 path = _tmp1_;
3982 _g_object_unref0 (focus_column);
3984 _tmp3_ = _g_object_ref0 (_tmp2_);
3986 focus_column = _tmp3_;
3988 _tmp4_ = priv->store_pseudo_axis;
3990 gtk_tree_model_get_iter ((GtkTreeModel*) _tmp4_, &_tmp5_, path);
3992 iter = _tmp5_;
3994 _tmp6_ = priv->store_pseudo_axis;
3996 _tmp7_ = iter;
3998 gtk_tree_model_get ((GtkTreeModel*) _tmp6_, &_tmp7_, PSEUDO_AXIS_COL_PSEUDOAXIS, &pseudoAxis, -1);
4000 _tmp8_ = priv->hash_store_pseudo_axis_parameter;
4002 _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp8_, pseudoAxis);
4004 _g_object_unref0 (model);
4006 model = (GtkListStore*) _tmp9_;
4008 _tmp10_ = priv->_treeview_pseudo_axes_parameters;
4010 gtk_tree_view_set_model (_tmp10_, (GtkTreeModel*) model);
4012 _g_object_unref0 (model);
4014 _g_object_unref0 (focus_column);
4016 _gtk_tree_path_free0 (path);
4021 static void hkl_gui_window_on_tree_view_crystals_cursor_changed (HklGuiWindow* self) {
4022 GtkTreePath* path = NULL;
4023 GtkTreeViewColumn* focus_column = NULL;
4024 GtkTreeModel* model = NULL;
4025 GtkListStore* reflections = NULL;
4026 GtkTreeIter iter = {0};
4027 gchar* name = NULL;
4028 GtkTreeView* _tmp0_;
4029 GtkTreePath* _tmp1_ = NULL;
4030 GtkTreeViewColumn* _tmp2_ = NULL;
4031 GtkTreeViewColumn* _tmp3_;
4032 GtkTreeView* _tmp4_;
4033 GtkTreeModel* _tmp5_ = NULL;
4034 GtkTreeModel* _tmp6_;
4035 GtkTreeIter _tmp7_ = {0};
4036 GtkTreeIter _tmp8_;
4037 HklSampleList* _tmp9_;
4038 HklPseudoAxisEngineList* _tmp10_;
4039 HklGeometry* _tmp11_;
4040 HklDetector* _tmp12_;
4041 HklSampleList* _tmp13_;
4042 HklSample* _tmp14_;
4043 GtkTreeView* _tmp15_;
4045 g_return_if_fail (self != NULL);
4047 _tmp0_ = priv->_treeview_crystals;
4049 gtk_tree_view_get_cursor (_tmp0_, &_tmp1_, &_tmp2_);
4051 _gtk_tree_path_free0 (path);
4053 path = _tmp1_;
4055 _g_object_unref0 (focus_column);
4057 _tmp3_ = _g_object_ref0 (_tmp2_);
4059 focus_column = _tmp3_;
4061 _tmp4_ = priv->_treeview_crystals;
4063 _tmp5_ = gtk_tree_view_get_model (_tmp4_);
4065 _tmp6_ = _g_object_ref0 (_tmp5_);
4067 _g_object_unref0 (model);
4069 model = _tmp6_;
4071 gtk_tree_model_get_iter (model, &_tmp7_, path);
4073 iter = _tmp7_;
4075 _tmp8_ = iter;
4077 gtk_tree_model_get (model, &_tmp8_, SAMPLE_COL_NAME, &name, SAMPLE_COL_REFLECTIONS, &reflections, -1);
4079 _tmp9_ = priv->samples;
4081 hkl_sample_list_select_current (_tmp9_, name);
4083 _tmp10_ = priv->engines;
4085 _tmp11_ = priv->geometry;
4087 _tmp12_ = priv->detector;
4089 _tmp13_ = priv->samples;
4091 _tmp14_ = _tmp13_->current;
4093 hkl_pseudo_axis_engine_list_init (_tmp10_, _tmp11_, _tmp12_, _tmp14_);
4095 _tmp15_ = priv->_treeview_reflections;
4097 gtk_tree_view_set_model (_tmp15_, (GtkTreeModel*) reflections);
4099 hkl_gui_window_update_lattice (self);
4101 hkl_gui_window_update_lattice_parameters (self);
4103 hkl_gui_window_update_reciprocal_lattice (self);
4105 hkl_gui_window_update_UxUyUz (self);
4107 hkl_gui_window_update_UB (self);
4109 hkl_gui_window_update_pseudo_axes (self);
4111 hkl_gui_window_update_pseudo_axes_frames (self);
4113 _g_free0 (name);
4115 _g_object_unref0 (reflections);
4117 _g_object_unref0 (model);
4119 _g_object_unref0 (focus_column);
4121 _gtk_tree_path_free0 (path);
4125 static void hkl_gui_window_on_spinbutton_lambda_value_changed (HklGuiWindow* self) {
4126 HklGeometry* _tmp0_;
4127 GtkSpinButton* _tmp1_;
4128 gdouble _tmp2_ = 0.0;
4130 g_return_if_fail (self != NULL);
4132 _tmp0_ = priv->geometry;
4134 _tmp1_ = priv->_spinbutton_lambda;
4136 _tmp2_ = gtk_spin_button_get_value (_tmp1_);
4138 _tmp0_->source.wave_length = _tmp2_;
4140 hkl_gui_window_update_pseudo_axes (self);
4142 hkl_gui_window_update_pseudo_axes_frames (self);
4147 static void hkl_gui_window_on_spinbutton_uxuyuz_value_changed (HklGuiWindow* self) {
4149 g_return_if_fail (self != NULL);
4154 static void hkl_gui_window_on_button2_clicked (HklGuiWindow* self) {
4155 HklSampleList* _tmp0_;
4156 HklSample* _tmp1_;
4157 HklSample* sample;
4158 HklSample* _tmp2_;
4160 g_return_if_fail (self != NULL);
4162 _tmp0_ = priv->samples;
4164 _tmp1_ = _tmp0_->current;
4166 sample = _tmp1_;
4168 _tmp2_ = sample;
4170 if (_tmp2_ != NULL) {
4172 HklSample* _tmp3_;
4173 GtkSpinButton* _tmp4_;
4174 gdouble _tmp5_ = 0.0;
4175 GtkSpinButton* _tmp6_;
4176 gdouble _tmp7_ = 0.0;
4177 GtkSpinButton* _tmp8_;
4178 gdouble _tmp9_ = 0.0;
4179 GtkSpinButton* _tmp10_;
4180 gdouble _tmp11_ = 0.0;
4181 GtkSpinButton* _tmp12_;
4182 gdouble _tmp13_ = 0.0;
4183 GtkSpinButton* _tmp14_;
4184 gdouble _tmp15_ = 0.0;
4185 HklSample* _tmp16_;
4186 GtkSpinButton* _tmp17_;
4187 gdouble _tmp18_ = 0.0;
4188 GtkSpinButton* _tmp19_;
4189 gdouble _tmp20_ = 0.0;
4190 GtkSpinButton* _tmp21_;
4191 gdouble _tmp22_ = 0.0;
4192 HklSample* _tmp23_;
4193 HklLattice* _tmp24_;
4194 HklParameter* _tmp25_;
4195 GtkSpinButton* _tmp26_;
4196 gdouble _tmp27_ = 0.0;
4197 GtkSpinButton* _tmp28_;
4198 gdouble _tmp29_ = 0.0;
4199 HklParameter _tmp30_;
4200 HklSample* _tmp31_;
4201 HklLattice* _tmp32_;
4202 HklParameter* _tmp33_;
4203 GtkSpinButton* _tmp34_;
4204 gdouble _tmp35_ = 0.0;
4205 GtkSpinButton* _tmp36_;
4206 gdouble _tmp37_ = 0.0;
4207 HklParameter _tmp38_;
4208 HklSample* _tmp39_;
4209 HklLattice* _tmp40_;
4210 HklParameter* _tmp41_;
4211 GtkSpinButton* _tmp42_;
4212 gdouble _tmp43_ = 0.0;
4213 GtkSpinButton* _tmp44_;
4214 gdouble _tmp45_ = 0.0;
4215 HklParameter _tmp46_;
4216 HklSample* _tmp47_;
4217 HklLattice* _tmp48_;
4218 HklParameter* _tmp49_;
4219 GtkSpinButton* _tmp50_;
4220 gdouble _tmp51_ = 0.0;
4221 GtkSpinButton* _tmp52_;
4222 gdouble _tmp53_ = 0.0;
4223 HklParameter _tmp54_;
4224 HklSample* _tmp55_;
4225 HklLattice* _tmp56_;
4226 HklParameter* _tmp57_;
4227 GtkSpinButton* _tmp58_;
4228 gdouble _tmp59_ = 0.0;
4229 GtkSpinButton* _tmp60_;
4230 gdouble _tmp61_ = 0.0;
4231 HklParameter _tmp62_;
4232 HklSample* _tmp63_;
4233 HklLattice* _tmp64_;
4234 HklParameter* _tmp65_;
4235 GtkSpinButton* _tmp66_;
4236 gdouble _tmp67_ = 0.0;
4237 GtkSpinButton* _tmp68_;
4238 gdouble _tmp69_ = 0.0;
4239 HklParameter _tmp70_;
4240 HklSample* _tmp71_;
4242 _tmp3_ = sample;
4244 _tmp4_ = priv->_spinbutton_a;
4246 _tmp5_ = gtk_spin_button_get_value (_tmp4_);
4248 _tmp6_ = priv->_spinbutton_b;
4250 _tmp7_ = gtk_spin_button_get_value (_tmp6_);
4252 _tmp8_ = priv->_spinbutton_c;
4254 _tmp9_ = gtk_spin_button_get_value (_tmp8_);
4256 _tmp10_ = priv->_spinbutton_alpha;
4258 _tmp11_ = gtk_spin_button_get_value (_tmp10_);
4260 _tmp12_ = priv->_spinbutton_beta;
4262 _tmp13_ = gtk_spin_button_get_value (_tmp12_);
4264 _tmp14_ = priv->_spinbutton_gamma;
4266 _tmp15_ = gtk_spin_button_get_value (_tmp14_);
4268 hkl_sample_set_lattice (_tmp3_, _tmp5_, _tmp7_, _tmp9_, _tmp11_ * HKL_DEGTORAD, _tmp13_ * HKL_DEGTORAD, _tmp15_ * HKL_DEGTORAD);
4270 _tmp16_ = sample;
4272 _tmp17_ = priv->_spinbutton_ux;
4274 _tmp18_ = gtk_spin_button_get_value (_tmp17_);
4276 _tmp19_ = priv->_spinbutton_uy;
4278 _tmp20_ = gtk_spin_button_get_value (_tmp19_);
4280 _tmp21_ = priv->_spinbutton_uz;
4282 _tmp22_ = gtk_spin_button_get_value (_tmp21_);
4284 hkl_sample_set_U_from_euler (_tmp16_, _tmp18_ * HKL_DEGTORAD, _tmp20_ * HKL_DEGTORAD, _tmp22_ * HKL_DEGTORAD);
4286 _tmp23_ = sample;
4288 _tmp24_ = _tmp23_->lattice;
4290 _tmp25_ = _tmp24_->a;
4292 _tmp26_ = priv->_spinbutton_a_min;
4294 _tmp27_ = gtk_spin_button_get_value (_tmp26_);
4296 _tmp28_ = priv->_spinbutton_a_max;
4298 _tmp29_ = gtk_spin_button_get_value (_tmp28_);
4300 _tmp30_ = *_tmp25_;
4302 hkl_parameter_set_range_unit (&_tmp30_, _tmp27_, _tmp29_);
4304 _tmp31_ = sample;
4306 _tmp32_ = _tmp31_->lattice;
4308 _tmp33_ = _tmp32_->b;
4310 _tmp34_ = priv->_spinbutton_b_min;
4312 _tmp35_ = gtk_spin_button_get_value (_tmp34_);
4314 _tmp36_ = priv->_spinbutton_b_max;
4316 _tmp37_ = gtk_spin_button_get_value (_tmp36_);
4318 _tmp38_ = *_tmp33_;
4320 hkl_parameter_set_range_unit (&_tmp38_, _tmp35_, _tmp37_);
4322 _tmp39_ = sample;
4324 _tmp40_ = _tmp39_->lattice;
4326 _tmp41_ = _tmp40_->c;
4328 _tmp42_ = priv->_spinbutton_c_min;
4330 _tmp43_ = gtk_spin_button_get_value (_tmp42_);
4332 _tmp44_ = priv->_spinbutton_c_max;
4334 _tmp45_ = gtk_spin_button_get_value (_tmp44_);
4336 _tmp46_ = *_tmp41_;
4338 hkl_parameter_set_range_unit (&_tmp46_, _tmp43_, _tmp45_);
4340 _tmp47_ = sample;
4342 _tmp48_ = _tmp47_->lattice;
4344 _tmp49_ = _tmp48_->alpha;
4346 _tmp50_ = priv->_spinbutton_alpha_min;
4348 _tmp51_ = gtk_spin_button_get_value (_tmp50_);
4350 _tmp52_ = priv->_spinbutton_alpha_max;
4352 _tmp53_ = gtk_spin_button_get_value (_tmp52_);
4354 _tmp54_ = *_tmp49_;
4356 hkl_parameter_set_range_unit (&_tmp54_, _tmp51_, _tmp53_);
4358 _tmp55_ = sample;
4360 _tmp56_ = _tmp55_->lattice;
4362 _tmp57_ = _tmp56_->beta;
4364 _tmp58_ = priv->_spinbutton_beta_min;
4366 _tmp59_ = gtk_spin_button_get_value (_tmp58_);
4368 _tmp60_ = priv->_spinbutton_beta_max;
4370 _tmp61_ = gtk_spin_button_get_value (_tmp60_);
4372 _tmp62_ = *_tmp57_;
4374 hkl_parameter_set_range_unit (&_tmp62_, _tmp59_, _tmp61_);
4376 _tmp63_ = sample;
4378 _tmp64_ = _tmp63_->lattice;
4380 _tmp65_ = _tmp64_->gamma;
4382 _tmp66_ = priv->_spinbutton_gamma_min;
4384 _tmp67_ = gtk_spin_button_get_value (_tmp66_);
4386 _tmp68_ = priv->_spinbutton_gamma_max;
4388 _tmp69_ = gtk_spin_button_get_value (_tmp68_);
4390 _tmp70_ = *_tmp65_;
4392 hkl_parameter_set_range_unit (&_tmp70_, _tmp67_, _tmp69_);
4394 _tmp71_ = sample;
4396 hkl_gui_window_update_crystal_model (self, _tmp71_);
4398 hkl_gui_window_update_reciprocal_lattice (self);
4400 hkl_gui_window_update_UB (self);
4402 hkl_gui_window_update_pseudo_axes (self);
4404 hkl_gui_window_update_pseudo_axes_frames (self);
4410 static void hkl_gui_window_on_checkbutton_a_toggled (HklGuiWindow* self) {
4411 HklSampleList* _tmp0_;
4412 HklSample* _tmp1_;
4413 HklSample* sample;
4414 HklSample* _tmp2_;
4416 g_return_if_fail (self != NULL);
4418 _tmp0_ = priv->samples;
4420 _tmp1_ = _tmp0_->current;
4422 sample = _tmp1_;
4424 _tmp2_ = sample;
4426 if (_tmp2_ != NULL) {
4428 HklSample* _tmp3_;
4429 HklLattice* _tmp4_;
4430 HklParameter* _tmp5_;
4431 GtkCheckButton* _tmp6_;
4432 gboolean _tmp7_ = FALSE;
4434 _tmp3_ = sample;
4436 _tmp4_ = _tmp3_->lattice;
4438 _tmp5_ = _tmp4_->a;
4440 _tmp6_ = priv->_checkbutton_a;
4442 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
4444 (*_tmp5_).fit = _tmp7_;
4450 static void hkl_gui_window_on_checkbutton_b_toggled (HklGuiWindow* self) {
4451 HklSampleList* _tmp0_;
4452 HklSample* _tmp1_;
4453 HklSample* sample;
4454 HklSample* _tmp2_;
4456 g_return_if_fail (self != NULL);
4458 _tmp0_ = priv->samples;
4460 _tmp1_ = _tmp0_->current;
4462 sample = _tmp1_;
4464 _tmp2_ = sample;
4466 if (_tmp2_ != NULL) {
4468 HklSample* _tmp3_;
4469 HklLattice* _tmp4_;
4470 HklParameter* _tmp5_;
4471 GtkCheckButton* _tmp6_;
4472 gboolean _tmp7_ = FALSE;
4474 _tmp3_ = sample;
4476 _tmp4_ = _tmp3_->lattice;
4478 _tmp5_ = _tmp4_->b;
4480 _tmp6_ = priv->_checkbutton_b;
4482 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
4484 (*_tmp5_).fit = _tmp7_;
4490 static void hkl_gui_window_on_checkbutton_c_toggled (HklGuiWindow* self) {
4491 HklSampleList* _tmp0_;
4492 HklSample* _tmp1_;
4493 HklSample* sample;
4494 HklSample* _tmp2_;
4496 g_return_if_fail (self != NULL);
4498 _tmp0_ = priv->samples;
4500 _tmp1_ = _tmp0_->current;
4502 sample = _tmp1_;
4504 _tmp2_ = sample;
4506 if (_tmp2_ != NULL) {
4508 HklSample* _tmp3_;
4509 HklLattice* _tmp4_;
4510 HklParameter* _tmp5_;
4511 GtkCheckButton* _tmp6_;
4512 gboolean _tmp7_ = FALSE;
4514 _tmp3_ = sample;
4516 _tmp4_ = _tmp3_->lattice;
4518 _tmp5_ = _tmp4_->c;
4520 _tmp6_ = priv->_checkbutton_c;
4522 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
4524 (*_tmp5_).fit = _tmp7_;
4530 static void hkl_gui_window_on_checkbutton_alpha_toggled (HklGuiWindow* self) {
4531 HklSampleList* _tmp0_;
4532 HklSample* _tmp1_;
4533 HklSample* sample;
4534 HklSample* _tmp2_;
4536 g_return_if_fail (self != NULL);
4538 _tmp0_ = priv->samples;
4540 _tmp1_ = _tmp0_->current;
4542 sample = _tmp1_;
4544 _tmp2_ = sample;
4546 if (_tmp2_ != NULL) {
4548 HklSample* _tmp3_;
4549 HklLattice* _tmp4_;
4550 HklParameter* _tmp5_;
4551 GtkCheckButton* _tmp6_;
4552 gboolean _tmp7_ = FALSE;
4554 _tmp3_ = sample;
4556 _tmp4_ = _tmp3_->lattice;
4558 _tmp5_ = _tmp4_->alpha;
4560 _tmp6_ = priv->_checkbutton_alpha;
4562 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
4564 (*_tmp5_).fit = _tmp7_;
4570 static void hkl_gui_window_on_checkbutton_beta_toggled (HklGuiWindow* self) {
4571 HklSampleList* _tmp0_;
4572 HklSample* _tmp1_;
4573 HklSample* sample;
4574 HklSample* _tmp2_;
4576 g_return_if_fail (self != NULL);
4578 _tmp0_ = priv->samples;
4580 _tmp1_ = _tmp0_->current;
4582 sample = _tmp1_;
4584 _tmp2_ = sample;
4586 if (_tmp2_ != NULL) {
4588 HklSample* _tmp3_;
4589 HklLattice* _tmp4_;
4590 HklParameter* _tmp5_;
4591 GtkCheckButton* _tmp6_;
4592 gboolean _tmp7_ = FALSE;
4594 _tmp3_ = sample;
4596 _tmp4_ = _tmp3_->lattice;
4598 _tmp5_ = _tmp4_->beta;
4600 _tmp6_ = priv->_checkbutton_beta;
4602 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
4604 (*_tmp5_).fit = _tmp7_;
4610 static void hkl_gui_window_on_checkbutton_gamma_toggled (HklGuiWindow* self) {
4611 HklSampleList* _tmp0_;
4612 HklSample* _tmp1_;
4613 HklSample* sample;
4614 HklSample* _tmp2_;
4616 g_return_if_fail (self != NULL);
4618 _tmp0_ = priv->samples;
4620 _tmp1_ = _tmp0_->current;
4622 sample = _tmp1_;
4624 _tmp2_ = sample;
4626 if (_tmp2_ != NULL) {
4628 HklSample* _tmp3_;
4629 HklLattice* _tmp4_;
4630 HklParameter* _tmp5_;
4631 GtkCheckButton* _tmp6_;
4632 gboolean _tmp7_ = FALSE;
4634 _tmp3_ = sample;
4636 _tmp4_ = _tmp3_->lattice;
4638 _tmp5_ = _tmp4_->gamma;
4640 _tmp6_ = priv->_checkbutton_gamma;
4642 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
4644 (*_tmp5_).fit = _tmp7_;
4650 static void hkl_gui_window_on_checkbutton_Ux_toggled (HklGuiWindow* self) {
4651 HklSampleList* _tmp0_;
4652 HklSample* _tmp1_;
4653 HklSample* sample;
4654 HklSample* _tmp2_;
4656 g_return_if_fail (self != NULL);
4658 _tmp0_ = priv->samples;
4660 _tmp1_ = _tmp0_->current;
4662 sample = _tmp1_;
4664 _tmp2_ = sample;
4666 if (_tmp2_ != NULL) {
4668 HklSample* _tmp3_;
4669 HklParameter* _tmp4_;
4670 GtkCheckButton* _tmp5_;
4671 gboolean _tmp6_ = FALSE;
4673 _tmp3_ = sample;
4675 _tmp4_ = _tmp3_->ux;
4677 _tmp5_ = priv->_checkbutton_Ux;
4679 _tmp6_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp5_);
4681 (*_tmp4_).fit = _tmp6_;
4687 static void hkl_gui_window_on_checkbutton_Uy_toggled (HklGuiWindow* self) {
4688 HklSampleList* _tmp0_;
4689 HklSample* _tmp1_;
4690 HklSample* sample;
4691 HklSample* _tmp2_;
4693 g_return_if_fail (self != NULL);
4695 _tmp0_ = priv->samples;
4697 _tmp1_ = _tmp0_->current;
4699 sample = _tmp1_;
4701 _tmp2_ = sample;
4703 if (_tmp2_ != NULL) {
4705 HklSample* _tmp3_;
4706 HklParameter* _tmp4_;
4707 GtkCheckButton* _tmp5_;
4708 gboolean _tmp6_ = FALSE;
4710 _tmp3_ = sample;
4712 _tmp4_ = _tmp3_->uy;
4714 _tmp5_ = priv->_checkbutton_Uy;
4716 _tmp6_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp5_);
4718 (*_tmp4_).fit = _tmp6_;
4724 static void hkl_gui_window_on_checkbutton_Uz_toggled (HklGuiWindow* self) {
4725 HklSampleList* _tmp0_;
4726 HklSample* _tmp1_;
4727 HklSample* sample;
4728 HklSample* _tmp2_;
4730 g_return_if_fail (self != NULL);
4732 _tmp0_ = priv->samples;
4734 _tmp1_ = _tmp0_->current;
4736 sample = _tmp1_;
4738 _tmp2_ = sample;
4740 if (_tmp2_ != NULL) {
4742 HklSample* _tmp3_;
4743 HklParameter* _tmp4_;
4744 GtkCheckButton* _tmp5_;
4745 gboolean _tmp6_ = FALSE;
4747 _tmp3_ = sample;
4749 _tmp4_ = _tmp3_->uz;
4751 _tmp5_ = priv->_checkbutton_Uz;
4753 _tmp6_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp5_);
4755 (*_tmp4_).fit = _tmp6_;
4761 static gdouble double_parse (const gchar* str) {
4762 gdouble result = 0.0;
4763 const gchar* _tmp0_;
4764 gdouble _tmp1_ = 0.0;
4766 g_return_val_if_fail (str != NULL, 0.0);
4768 _tmp0_ = str;
4770 _tmp1_ = g_ascii_strtod (_tmp0_, NULL);
4772 result = _tmp1_;
4774 return result;
4781 static void hkl_gui_window_on_cell_tree_view_axes_write_edited (const gchar* path, const gchar* new_text, HklGuiWindow* self) {
4782 GtkTreeIter iter = {0};
4783 gdouble value = 0.0;
4784 HklAxis* axis = NULL;
4785 GtkListStore* _tmp0_;
4786 const gchar* _tmp1_;
4787 GtkTreeIter _tmp2_ = {0};
4788 GtkListStore* _tmp3_;
4789 GtkTreeIter _tmp4_;
4790 const gchar* _tmp5_;
4791 gdouble _tmp6_ = 0.0;
4792 HklAxis _tmp7_;
4793 HklGeometry* _tmp8_;
4794 GtkListStore* _tmp9_;
4795 GtkTreeIter _tmp10_;
4797 g_return_if_fail (self != NULL);
4799 g_return_if_fail (path != NULL);
4801 g_return_if_fail (new_text != NULL);
4803 _tmp0_ = priv->store_axis;
4805 _tmp1_ = path;
4807 gtk_tree_model_get_iter_from_string ((GtkTreeModel*) _tmp0_, &_tmp2_, _tmp1_);
4809 iter = _tmp2_;
4811 _tmp3_ = priv->store_axis;
4813 _tmp4_ = iter;
4815 gtk_tree_model_get ((GtkTreeModel*) _tmp3_, &_tmp4_, AXIS_COL_AXIS, &axis, -1);
4817 _tmp5_ = new_text;
4819 _tmp6_ = double_parse (_tmp5_);
4821 value = _tmp6_;
4823 _tmp7_ = *axis;
4825 hkl_axis_set_value_unit (&_tmp7_, value);
4827 _tmp8_ = priv->geometry;
4828 hkl_geometry_update (_tmp8_);
4830 _tmp9_ = priv->store_axis;
4832 _tmp10_ = iter;
4834 gtk_list_store_set (_tmp9_, &_tmp10_, AXIS_COL_WRITE, value, -1);
4836 hkl_gui_window_update_pseudo_axes (self);
4838 hkl_gui_window_update_pseudo_axes_frames (self);
4845 static void hkl_gui_window_on_cell_tree_view_pseudo_axes_is_initialized_toggled (const gchar* path, HklGuiWindow* self) {
4846 GtkTreeModel* model = NULL;
4847 GtkTreeIter iter = {0};
4848 HklPseudoAxis* pseudoAxis = NULL;
4849 gboolean old_flag = FALSE;
4850 GtkTreeView* _tmp0_;
4851 GtkTreeModel* _tmp1_ = NULL;
4852 GtkTreeModel* _tmp2_;
4853 GtkTreeModel* _tmp3_;
4854 const gchar* _tmp4_;
4855 GtkTreeIter _tmp5_ = {0};
4856 GtkTreeModel* _tmp6_;
4857 GtkTreeIter _tmp7_;
4858 gboolean _tmp8_;
4860 g_return_if_fail (self != NULL);
4862 g_return_if_fail (path != NULL);
4864 _tmp0_ = priv->_treeview_pseudo_axes;
4866 _tmp1_ = gtk_tree_view_get_model (_tmp0_);
4868 _tmp2_ = _g_object_ref0 (_tmp1_);
4870 _g_object_unref0 (model);
4872 model = _tmp2_;
4874 _tmp3_ = model;
4876 _tmp4_ = path;
4878 gtk_tree_model_get_iter_from_string (_tmp3_, &_tmp5_, _tmp4_);
4880 iter = _tmp5_;
4882 _tmp6_ = model;
4884 _tmp7_ = iter;
4886 gtk_tree_model_get (_tmp6_, &_tmp7_, PSEUDO_AXIS_COL_PSEUDOAXIS, &pseudoAxis, PSEUDO_AXIS_COL_INITIALIZED, &old_flag, -1);
4888 _tmp8_ = old_flag;
4890 if (!_tmp8_) {
4892 HklPseudoAxis* _tmp9_;
4893 HklPseudoAxisEngine* _tmp10_;
4894 gboolean _tmp11_ = FALSE;
4896 _tmp9_ = pseudoAxis;
4898 _tmp10_ = _tmp9_->engine;
4900 _tmp11_ = hkl_pseudo_axis_engine_initialize (_tmp10_, NULL);
4902 if (_tmp11_) {
4904 hkl_gui_window_update_pseudo_axes (self);
4909 _g_object_unref0 (model);
4914 static void hkl_gui_window_on_cell_tree_view_pseudo_axes_parameters_value_edited (const gchar* path, const gchar* new_text, HklGuiWindow* self) {
4915 GtkListStore* model = NULL;
4916 GtkTreeIter iter = {0};
4917 gdouble value = 0.0;
4918 HklParameter* parameter;
4919 GtkTreeView* _tmp0_;
4920 GtkTreeModel* _tmp1_ = NULL;
4921 GtkListStore* _tmp2_;
4922 const gchar* _tmp3_;
4923 GtkTreeIter _tmp4_ = {0};
4924 GtkTreeIter _tmp5_;
4925 const gchar* _tmp6_;
4926 gdouble _tmp7_ = 0.0;
4927 HklParameter _tmp8_;
4928 GtkTreeIter _tmp9_;
4930 g_return_if_fail (self != NULL);
4932 g_return_if_fail (path != NULL);
4934 g_return_if_fail (new_text != NULL);
4936 parameter = NULL;
4938 _tmp0_ = priv->_treeview_pseudo_axes_parameters;
4940 _tmp1_ = gtk_tree_view_get_model (_tmp0_);
4942 _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, GTK_TYPE_LIST_STORE) ? ((GtkListStore*) _tmp1_) : NULL);
4944 _g_object_unref0 (model);
4946 model = _tmp2_;
4948 _tmp3_ = path;
4950 gtk_tree_model_get_iter_from_string ((GtkTreeModel*) model, &_tmp4_, _tmp3_);
4952 iter = _tmp4_;
4954 _tmp5_ = iter;
4956 gtk_tree_model_get ((GtkTreeModel*) model, &_tmp5_, PARAMETER_COL_PARAMETER, parameter, -1);
4958 _tmp6_ = new_text;
4960 _tmp7_ = double_parse (_tmp6_);
4962 value = _tmp7_;
4964 _tmp8_ = *parameter;
4966 hkl_parameter_set_value_unit (&_tmp8_, value);
4968 _tmp9_ = iter;
4970 gtk_list_store_set (model, &_tmp9_, PARAMETER_COL_VALUE, value, -1);
4972 hkl_gui_window_update_pseudo_axes (self);
4974 hkl_gui_window_update_pseudo_axes_parameters (self);
4976 _g_object_unref0 (model);
4981 static void hkl_gui_window_on_cell_tree_view_crystals_name_edited (const gchar* path, const gchar* new_text, HklGuiWindow* self) {
4982 GtkTreeModel* model = NULL;
4983 GtkTreeIter iter = {0};
4984 HklSample* sample = NULL;
4985 gchar* name = NULL;
4986 GtkTreeView* _tmp0_;
4987 GtkTreeModel* _tmp1_ = NULL;
4988 GtkTreeModel* _tmp2_;
4989 GtkTreeModel* _tmp3_;
4990 const gchar* _tmp4_;
4991 GtkTreeIter _tmp5_ = {0};
4992 GtkTreeModel* _tmp6_;
4993 GtkTreeIter _tmp7_;
4994 HklSampleList* _tmp8_;
4995 const gchar* _tmp9_;
4996 HklSample* _tmp10_ = NULL;
4997 HklSample* _tmp11_;
4999 g_return_if_fail (self != NULL);
5001 g_return_if_fail (path != NULL);
5003 g_return_if_fail (new_text != NULL);
5005 _tmp0_ = priv->_treeview_crystals;
5007 _tmp1_ = gtk_tree_view_get_model (_tmp0_);
5009 _tmp2_ = _g_object_ref0 (_tmp1_);
5011 _g_object_unref0 (model);
5013 model = _tmp2_;
5015 _tmp3_ = model;
5017 _tmp4_ = path;
5019 gtk_tree_model_get_iter_from_string (_tmp3_, &_tmp5_, _tmp4_);
5021 iter = _tmp5_;
5023 _tmp6_ = model;
5025 _tmp7_ = iter;
5027 gtk_tree_model_get (_tmp6_, &_tmp7_, SAMPLE_COL_NAME, &name, -1);
5029 _tmp8_ = priv->samples;
5031 _tmp9_ = name;
5033 _tmp10_ = hkl_sample_list_get_by_name (_tmp8_, _tmp9_);
5035 sample = _tmp10_;
5037 _tmp11_ = sample;
5039 if (_tmp11_ != NULL) {
5041 HklSample* _tmp12_;
5042 const gchar* _tmp13_;
5044 _tmp12_ = sample;
5046 _tmp13_ = new_text;
5048 hkl_sample_set_name (_tmp12_, _tmp13_);
5050 hkl_gui_window_update_tree_view_crystals (self);
5054 _g_free0 (name);
5056 _g_object_unref0 (model);
5063 static void hkl_gui_window_on_toolbutton_add_reflection_clicked (HklGuiWindow* self) {
5064 HklSampleList* _tmp0_;
5065 HklSample* _tmp1_;
5066 HklSample* sample;
5067 HklSample* _tmp2_;
5069 g_return_if_fail (self != NULL);
5071 _tmp0_ = priv->samples;
5073 _tmp1_ = _tmp0_->current;
5075 sample = _tmp1_;
5077 _tmp2_ = sample;
5079 if (_tmp2_ != NULL) {
5081 gdouble h;
5082 gdouble k;
5083 gdouble l;
5084 HklSample* _tmp3_;
5085 HklGeometry* _tmp4_;
5086 HklDetector* _tmp5_;
5087 gdouble _tmp6_;
5088 gdouble _tmp7_;
5089 gdouble _tmp8_;
5090 HklSampleReflection* _tmp9_ = NULL;
5091 HklSample* _tmp10_;
5093 h = (gdouble) 0;
5095 k = (gdouble) 0;
5097 l = (gdouble) 0;
5099 _tmp3_ = sample;
5101 _tmp4_ = priv->geometry;
5103 _tmp5_ = priv->detector;
5105 _tmp6_ = h;
5107 _tmp7_ = k;
5109 _tmp8_ = l;
5111 _tmp9_ = hkl_sample_add_reflection (_tmp3_, _tmp4_, _tmp5_, _tmp6_, _tmp7_, _tmp8_);
5113 _tmp10_ = sample;
5115 hkl_gui_window_update_reflections (self, _tmp10_);
5121 static void _gtk_tree_path_free0_ (gpointer var) {
5123 (var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL));
5128 static void _g_list_free__gtk_tree_path_free0_ (GList* self) {
5130 g_list_foreach (self, (GFunc) _gtk_tree_path_free0_, NULL);
5132 g_list_free (self);
5137 static void hkl_gui_window_on_toolbutton_goto_reflection_clicked (HklGuiWindow* self) {
5138 HklSampleList* _tmp0_;
5139 HklSample* _tmp1_;
5140 HklSample* sample;
5141 HklSample* _tmp2_;
5143 g_return_if_fail (self != NULL);
5145 _tmp0_ = priv->samples;
5147 _tmp1_ = _tmp0_->current;
5149 sample = _tmp1_;
5151 _tmp2_ = sample;
5153 if (_tmp2_ != NULL) {
5155 GtkTreeSelection* selection = NULL;
5156 guint nb_rows = 0U;
5157 GtkTreeView* _tmp3_;
5158 GtkTreeSelection* _tmp4_ = NULL;
5159 GtkTreeSelection* _tmp5_;
5160 GtkTreeSelection* _tmp6_;
5161 gint _tmp7_ = 0;
5162 guint _tmp8_;
5164 _tmp3_ = priv->_treeview_reflections;
5166 _tmp4_ = gtk_tree_view_get_selection (_tmp3_);
5168 _tmp5_ = _g_object_ref0 (_tmp4_);
5170 _g_object_unref0 (selection);
5172 selection = _tmp5_;
5174 _tmp6_ = selection;
5176 _tmp7_ = gtk_tree_selection_count_selected_rows (_tmp6_);
5178 nb_rows = (guint) _tmp7_;
5180 _tmp8_ = nb_rows;
5182 if (_tmp8_ == ((guint) 1)) {
5184 guint index = 0U;
5185 GtkTreeIter iter = {0};
5186 GtkTreeModel* model = NULL;
5187 GtkTreeSelection* _tmp9_;
5188 GtkTreeModel* _tmp10_ = NULL;
5189 GList* _tmp11_ = NULL;
5190 GtkTreeModel* _tmp12_;
5191 GList* list;
5192 GtkTreeModel* _tmp13_;
5193 GList* _tmp14_;
5194 gconstpointer _tmp15_;
5195 GtkTreeIter _tmp16_ = {0};
5196 GtkTreeModel* _tmp17_;
5197 GtkTreeIter _tmp18_;
5198 HklGeometry* _tmp19_;
5199 HklSample* _tmp20_;
5200 HklSampleReflection** _tmp21_;
5201 gint _tmp21__length1;
5202 guint _tmp22_;
5203 HklSampleReflection* _tmp23_;
5204 HklGeometry* _tmp24_;
5206 _tmp9_ = selection;
5208 _tmp11_ = gtk_tree_selection_get_selected_rows (_tmp9_, &_tmp10_);
5210 _g_object_unref0 (model);
5212 _tmp12_ = _g_object_ref0 (_tmp10_);
5214 model = _tmp12_;
5216 list = _tmp11_;
5218 _tmp13_ = model;
5220 _tmp14_ = list;
5222 _tmp15_ = _tmp14_->data;
5224 gtk_tree_model_get_iter (_tmp13_, &_tmp16_, (GtkTreePath*) _tmp15_);
5226 iter = _tmp16_;
5228 _tmp17_ = model;
5230 _tmp18_ = iter;
5232 gtk_tree_model_get (_tmp17_, &_tmp18_, REFLECTION_COL_INDEX, &index, -1);
5234 _tmp19_ = priv->geometry;
5236 _tmp20_ = sample;
5238 _tmp21_ = _tmp20_->reflections;
5240 _tmp21__length1 = _tmp20_->reflections_len;
5242 _tmp22_ = index;
5244 _tmp23_ = _tmp21_[_tmp22_];
5246 _tmp24_ = _tmp23_->geometry;
5248 hkl_geometry_init_geometry (_tmp19_, _tmp24_);
5250 hkl_gui_window_update_source (self);
5252 hkl_gui_window_update_axes (self);
5254 hkl_gui_window_update_pseudo_axes (self);
5256 __g_list_free__gtk_tree_path_free0_0 (list);
5258 _g_object_unref0 (model);
5260 } else {
5261 guint _tmp25_;
5263 _tmp25_ = nb_rows;
5265 if (_tmp25_ > ((guint) 0)) {
5267 GtkStatusbar* _tmp26_;
5269 _tmp26_ = priv->_statusBar;
5271 gtk_statusbar_push (_tmp26_, (guint) 0, "Please select only one reflection.");
5273 } else {
5274 GtkStatusbar* _tmp27_;
5276 _tmp27_ = priv->_statusBar;
5278 gtk_statusbar_push (_tmp27_, (guint) 0, "Please select at least one reflection.");
5283 _g_object_unref0 (selection);
5289 static gpointer _gtk_tree_path_copy0 (gpointer self) {
5291 return self ? gtk_tree_path_copy (self) : NULL;
5296 static void hkl_gui_window_on_toolbutton_del_reflection_clicked (HklGuiWindow* self) {
5297 HklSample* sample = NULL;
5298 HklSampleList* _tmp0_;
5299 HklSample* _tmp1_;
5300 HklSample* _tmp2_;
5302 g_return_if_fail (self != NULL);
5304 _tmp0_ = priv->samples;
5306 _tmp1_ = _tmp0_->current;
5308 sample = _tmp1_;
5310 _tmp2_ = sample;
5312 if (_tmp2_ != NULL) {
5314 GtkTreeSelection* selection = NULL;
5315 guint nb_rows = 0U;
5316 GtkTreeView* _tmp3_;
5317 GtkTreeSelection* _tmp4_ = NULL;
5318 GtkTreeSelection* _tmp5_;
5319 GtkTreeSelection* _tmp6_;
5320 gint _tmp7_ = 0;
5321 guint _tmp8_;
5323 _tmp3_ = priv->_treeview_reflections;
5325 _tmp4_ = gtk_tree_view_get_selection (_tmp3_);
5327 _tmp5_ = _g_object_ref0 (_tmp4_);
5329 _g_object_unref0 (selection);
5331 selection = _tmp5_;
5333 _tmp6_ = selection;
5335 _tmp7_ = gtk_tree_selection_count_selected_rows (_tmp6_);
5337 nb_rows = (guint) _tmp7_;
5339 _tmp8_ = nb_rows;
5341 if (_tmp8_ > ((guint) 0)) {
5343 GtkTreeModel* model = NULL;
5344 GtkTreeIter iter = {0};
5345 GtkTreeSelection* _tmp9_;
5346 GtkTreeModel* _tmp10_ = NULL;
5347 GList* _tmp11_ = NULL;
5348 GtkTreeModel* _tmp12_;
5349 GList* list;
5350 guint _tmp13_;
5351 guint* _tmp14_ = NULL;
5352 guint* indexes;
5353 gint indexes_length1;
5354 gint _indexes_size_;
5355 gint i;
5356 GList* _tmp15_;
5357 GtkMessageDialog* _tmp24_;
5358 GtkMessageDialog* dialog;
5359 GtkMessageDialog* _tmp25_;
5360 gint _tmp26_ = 0;
5361 gint respons;
5362 gint _tmp27_;
5364 _tmp9_ = selection;
5366 _tmp11_ = gtk_tree_selection_get_selected_rows (_tmp9_, &_tmp10_);
5368 _g_object_unref0 (model);
5370 _tmp12_ = _g_object_ref0 (_tmp10_);
5372 model = _tmp12_;
5374 list = _tmp11_;
5376 _tmp13_ = nb_rows;
5378 _tmp14_ = g_new0 (guint, _tmp13_);
5380 indexes = _tmp14_;
5382 indexes_length1 = _tmp13_;
5384 _indexes_size_ = indexes_length1;
5386 i = 0;
5388 _tmp15_ = list;
5391 GList* path_collection = NULL;
5392 GList* path_it = NULL;
5394 path_collection = _tmp15_;
5396 for (path_it = path_collection; path_it != NULL; path_it = path_it->next) {
5398 GtkTreePath* _tmp16_;
5399 GtkTreePath* path = NULL;
5401 _tmp16_ = _gtk_tree_path_copy0 ((GtkTreePath*) path_it->data);
5403 path = _tmp16_;
5406 GtkTreeModel* _tmp17_;
5407 GtkTreePath* _tmp18_;
5408 GtkTreeIter _tmp19_ = {0};
5409 GtkTreeModel* _tmp20_;
5410 GtkTreeIter _tmp21_;
5411 guint* _tmp22_;
5412 gint _tmp22__length1;
5413 gint _tmp23_;
5415 _tmp17_ = model;
5417 _tmp18_ = path;
5419 gtk_tree_model_get_iter (_tmp17_, &_tmp19_, _tmp18_);
5421 iter = _tmp19_;
5423 _tmp20_ = model;
5425 _tmp21_ = iter;
5427 _tmp22_ = indexes;
5429 _tmp22__length1 = indexes_length1;
5431 _tmp23_ = i;
5433 i = _tmp23_ + 1;
5435 gtk_tree_model_get (_tmp20_, &_tmp21_, REFLECTION_COL_INDEX, &_tmp22_[_tmp23_], -1);
5437 _gtk_tree_path_free0 (path);
5443 _tmp24_ = (GtkMessageDialog*) gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, "Are you sure that you want to delete reflections");
5445 g_object_ref_sink (_tmp24_);
5447 dialog = _tmp24_;
5449 _tmp25_ = dialog;
5451 _tmp26_ = gtk_dialog_run ((GtkDialog*) _tmp25_);
5453 respons = _tmp26_;
5455 _tmp27_ = respons;
5457 switch (_tmp27_) {
5459 case GTK_RESPONSE_YES:
5462 HklSample* _tmp39_;
5464 gboolean _tmp28_;
5466 i = 0;
5468 _tmp28_ = TRUE;
5470 while (TRUE) {
5472 gboolean _tmp29_;
5473 gint _tmp31_;
5474 guint _tmp32_;
5475 guint* _tmp33_;
5476 gint _tmp33__length1;
5477 gint _tmp34_;
5478 guint _tmp35_;
5479 gint _tmp36_;
5480 guint index;
5481 HklSample* _tmp37_;
5482 guint _tmp38_;
5484 _tmp29_ = _tmp28_;
5486 if (!_tmp29_) {
5488 gint _tmp30_;
5490 _tmp30_ = i;
5492 i = _tmp30_ + 1;
5496 _tmp28_ = FALSE;
5498 _tmp31_ = i;
5500 _tmp32_ = nb_rows;
5502 if (!(((guint) _tmp31_) < _tmp32_)) {
5504 break;
5508 _tmp33_ = indexes;
5510 _tmp33__length1 = indexes_length1;
5512 _tmp34_ = i;
5514 _tmp35_ = _tmp33_[_tmp34_];
5516 _tmp36_ = i;
5518 index = _tmp35_ - _tmp36_;
5520 _tmp37_ = sample;
5522 _tmp38_ = index;
5524 hkl_sample_del_reflection (_tmp37_, (gsize) _tmp38_);
5529 _tmp39_ = sample;
5531 hkl_gui_window_update_reflections (self, _tmp39_);
5533 break;
5536 default:
5538 break;
5542 _g_object_unref0 (dialog);
5544 indexes = (g_free (indexes), NULL);
5546 __g_list_free__gtk_tree_path_free0_0 (list);
5548 _g_object_unref0 (model);
5550 } else {
5551 GtkStatusbar* _tmp40_;
5553 _tmp40_ = priv->_statusBar;
5555 gtk_statusbar_push (_tmp40_, (guint) 0, "Please select at least one reflection.");
5559 _g_object_unref0 (selection);
5565 static void hkl_gui_window_on_toolbutton_setUB_clicked (HklGuiWindow* self) {
5566 HklSampleList* _tmp0_;
5567 HklSample* _tmp1_;
5569 g_return_if_fail (self != NULL);
5571 _tmp0_ = priv->samples;
5573 _tmp1_ = _tmp0_->current;
5575 if (_tmp1_ != NULL) {
5577 HklMatrix UB = {0};
5578 HklSampleList* _tmp2_;
5579 HklSample* _tmp3_;
5580 HklMatrix _tmp4_ = {0};
5581 HklMatrix _tmp5_;
5582 gdouble** _tmp6_;
5583 gint _tmp6__length1;
5584 gdouble* _tmp7_;
5585 gint _tmp7__length1;
5586 GtkSpinButton* _tmp8_;
5587 gdouble _tmp9_ = 0.0;
5588 gdouble _tmp10_;
5589 HklMatrix _tmp11_;
5590 gdouble** _tmp12_;
5591 gint _tmp12__length1;
5592 gdouble* _tmp13_;
5593 gint _tmp13__length1;
5594 GtkSpinButton* _tmp14_;
5595 gdouble _tmp15_ = 0.0;
5596 gdouble _tmp16_;
5597 HklMatrix _tmp17_;
5598 gdouble** _tmp18_;
5599 gint _tmp18__length1;
5600 gdouble* _tmp19_;
5601 gint _tmp19__length1;
5602 GtkSpinButton* _tmp20_;
5603 gdouble _tmp21_ = 0.0;
5604 gdouble _tmp22_;
5605 HklMatrix _tmp23_;
5606 gdouble** _tmp24_;
5607 gint _tmp24__length1;
5608 gdouble* _tmp25_;
5609 gint _tmp25__length1;
5610 GtkSpinButton* _tmp26_;
5611 gdouble _tmp27_ = 0.0;
5612 gdouble _tmp28_;
5613 HklMatrix _tmp29_;
5614 gdouble** _tmp30_;
5615 gint _tmp30__length1;
5616 gdouble* _tmp31_;
5617 gint _tmp31__length1;
5618 GtkSpinButton* _tmp32_;
5619 gdouble _tmp33_ = 0.0;
5620 gdouble _tmp34_;
5621 HklMatrix _tmp35_;
5622 gdouble** _tmp36_;
5623 gint _tmp36__length1;
5624 gdouble* _tmp37_;
5625 gint _tmp37__length1;
5626 GtkSpinButton* _tmp38_;
5627 gdouble _tmp39_ = 0.0;
5628 gdouble _tmp40_;
5629 HklMatrix _tmp41_;
5630 gdouble** _tmp42_;
5631 gint _tmp42__length1;
5632 gdouble* _tmp43_;
5633 gint _tmp43__length1;
5634 GtkSpinButton* _tmp44_;
5635 gdouble _tmp45_ = 0.0;
5636 gdouble _tmp46_;
5637 HklMatrix _tmp47_;
5638 gdouble** _tmp48_;
5639 gint _tmp48__length1;
5640 gdouble* _tmp49_;
5641 gint _tmp49__length1;
5642 GtkSpinButton* _tmp50_;
5643 gdouble _tmp51_ = 0.0;
5644 gdouble _tmp52_;
5645 HklMatrix _tmp53_;
5646 gdouble** _tmp54_;
5647 gint _tmp54__length1;
5648 gdouble* _tmp55_;
5649 gint _tmp55__length1;
5650 GtkSpinButton* _tmp56_;
5651 gdouble _tmp57_ = 0.0;
5652 gdouble _tmp58_;
5653 HklSampleList* _tmp59_;
5654 HklSample* _tmp60_;
5655 HklSampleList* _tmp61_;
5656 HklSample* _tmp62_;
5657 FILE* _tmp63_;
5658 HklSampleList* _tmp64_;
5659 HklSample* _tmp65_;
5661 _tmp2_ = priv->samples;
5663 _tmp3_ = _tmp2_->current;
5665 hkl_sample_get_UB (_tmp3_, &_tmp4_);
5667 (&UB);
5669 UB = _tmp4_;
5671 _tmp5_ = UB;
5673 _tmp6_ = _tmp5_.data;
5675 _tmp6__length1 = -1;
5677 _tmp7_ = _tmp6_[0];
5679 _tmp7__length1 = -1;
5681 _tmp8_ = priv->_spinbutton_U11;
5683 _tmp9_ = gtk_spin_button_get_value (_tmp8_);
5685 _tmp7_[0] = _tmp9_;
5687 _tmp10_ = _tmp7_[0];
5689 _tmp11_ = UB;
5691 _tmp12_ = _tmp11_.data;
5693 _tmp12__length1 = -1;
5695 _tmp13_ = _tmp12_[0];
5697 _tmp13__length1 = -1;
5699 _tmp14_ = priv->_spinbutton_U12;
5701 _tmp15_ = gtk_spin_button_get_value (_tmp14_);
5703 _tmp13_[1] = _tmp15_;
5705 _tmp16_ = _tmp13_[1];
5707 _tmp17_ = UB;
5709 _tmp18_ = _tmp17_.data;
5711 _tmp18__length1 = -1;
5713 _tmp19_ = _tmp18_[0];
5715 _tmp19__length1 = -1;
5717 _tmp20_ = priv->_spinbutton_U13;
5719 _tmp21_ = gtk_spin_button_get_value (_tmp20_);
5721 _tmp19_[2] = _tmp21_;
5723 _tmp22_ = _tmp19_[2];
5725 _tmp23_ = UB;
5727 _tmp24_ = _tmp23_.data;
5729 _tmp24__length1 = -1;
5731 _tmp25_ = _tmp24_[1];
5733 _tmp25__length1 = -1;
5735 _tmp26_ = priv->_spinbutton_U21;
5737 _tmp27_ = gtk_spin_button_get_value (_tmp26_);
5739 _tmp25_[0] = _tmp27_;
5741 _tmp28_ = _tmp25_[0];
5743 _tmp29_ = UB;
5745 _tmp30_ = _tmp29_.data;
5747 _tmp30__length1 = -1;
5749 _tmp31_ = _tmp30_[1];
5751 _tmp31__length1 = -1;
5753 _tmp32_ = priv->_spinbutton_U22;
5755 _tmp33_ = gtk_spin_button_get_value (_tmp32_);
5757 _tmp31_[1] = _tmp33_;
5759 _tmp34_ = _tmp31_[1];
5761 _tmp35_ = UB;
5763 _tmp36_ = _tmp35_.data;
5765 _tmp36__length1 = -1;
5767 _tmp37_ = _tmp36_[1];
5769 _tmp37__length1 = -1;
5771 _tmp38_ = priv->_spinbutton_U23;
5773 _tmp39_ = gtk_spin_button_get_value (_tmp38_);
5775 _tmp37_[2] = _tmp39_;
5777 _tmp40_ = _tmp37_[2];
5779 _tmp41_ = UB;
5781 _tmp42_ = _tmp41_.data;
5783 _tmp42__length1 = -1;
5785 _tmp43_ = _tmp42_[2];
5787 _tmp43__length1 = -1;
5789 _tmp44_ = priv->_spinbutton_U31;
5791 _tmp45_ = gtk_spin_button_get_value (_tmp44_);
5793 _tmp43_[0] = _tmp45_;
5795 _tmp46_ = _tmp43_[0];
5797 _tmp47_ = UB;
5799 _tmp48_ = _tmp47_.data;
5801 _tmp48__length1 = -1;
5803 _tmp49_ = _tmp48_[2];
5805 _tmp49__length1 = -1;
5807 _tmp50_ = priv->_spinbutton_U32;
5809 _tmp51_ = gtk_spin_button_get_value (_tmp50_);
5811 _tmp49_[1] = _tmp51_;
5813 _tmp52_ = _tmp49_[1];
5815 _tmp53_ = UB;
5817 _tmp54_ = _tmp53_.data;
5819 _tmp54__length1 = -1;
5821 _tmp55_ = _tmp54_[2];
5823 _tmp55__length1 = -1;
5825 _tmp56_ = priv->_spinbutton_U33;
5827 _tmp57_ = gtk_spin_button_get_value (_tmp56_);
5829 _tmp55_[2] = _tmp57_;
5831 _tmp58_ = _tmp55_[2];
5833 _tmp59_ = priv->samples;
5835 _tmp60_ = _tmp59_->current;
5837 hkl_sample_set_UB (_tmp60_, &UB);
5839 _tmp61_ = priv->samples;
5841 _tmp62_ = _tmp61_->current;
5843 _tmp63_ = stdout;
5845 hkl_sample_fprintf (_tmp63_, _tmp62_);
5847 hkl_gui_window_update_lattice (self);
5849 hkl_gui_window_update_lattice_parameters (self);
5851 hkl_gui_window_update_reciprocal_lattice (self);
5853 _tmp64_ = priv->samples;
5855 _tmp65_ = _tmp64_->current;
5857 hkl_gui_window_update_crystal_model (self, _tmp65_);
5859 hkl_gui_window_update_UB (self);
5861 hkl_gui_window_update_UxUyUz (self);
5863 hkl_gui_window_update_pseudo_axes (self);
5865 hkl_gui_window_update_pseudo_axes_frames (self);
5867 (&UB);
5873 static void hkl_gui_window_on_toolbutton_computeUB_clicked (HklGuiWindow* self) {
5874 HklSampleList* _tmp0_;
5875 HklSample* _tmp1_;
5876 HklSample* sample;
5877 HklSample* _tmp2_;
5879 g_return_if_fail (self != NULL);
5881 _tmp0_ = priv->samples;
5883 _tmp1_ = _tmp0_->current;
5885 sample = _tmp1_;
5887 _tmp2_ = sample;
5889 if (_tmp2_ != NULL) {
5891 HklSample* _tmp3_;
5893 _tmp3_ = sample;
5895 hkl_sample_compute_UB_busing_levy (_tmp3_, (gsize) 0, (gsize) 1);
5897 hkl_gui_window_update_UB (self);
5899 hkl_gui_window_update_UxUyUz (self);
5901 hkl_gui_window_update_pseudo_axes (self);
5903 hkl_gui_window_update_pseudo_axes_frames (self);
5909 static void hkl_gui_window_on_toolbutton_add_crystal_clicked (HklGuiWindow* self) {
5910 HklSample* sample = NULL;
5911 HklSample* _tmp0_;
5912 HklSample* _tmp1_;
5914 g_return_if_fail (self != NULL);
5916 _tmp0_ = hkl_sample_new ("new_sample", HKL_SAMPLE_TYPE_MONOCRYSTAL);
5918 sample = _tmp0_;
5920 _tmp1_ = sample;
5922 if (_tmp1_ != NULL) {
5924 GtkTreePath* path = NULL;
5925 GtkTreeViewColumn* column = NULL;
5926 HklSampleList* _tmp2_;
5927 HklSample* _tmp3_;
5928 HklSampleList* _tmp4_;
5929 GtkTreeView* _tmp5_;
5930 GtkTreePath* _tmp6_ = NULL;
5931 GtkTreeViewColumn* _tmp7_ = NULL;
5932 GtkTreeViewColumn* _tmp8_;
5933 GtkTreeView* _tmp9_;
5934 GtkTreeViewColumn* _tmp10_ = NULL;
5935 GtkTreeViewColumn* _tmp11_;
5936 GtkTreeView* _tmp12_;
5937 GtkTreePath* _tmp13_;
5938 GtkTreeViewColumn* _tmp14_;
5940 _tmp2_ = priv->samples;
5942 _tmp3_ = sample;
5944 sample = NULL;
5946 hkl_sample_list_append (_tmp2_, _tmp3_);
5948 _tmp4_ = priv->samples;
5950 hkl_sample_list_select_current (_tmp4_, "new_sample");
5952 hkl_gui_window_update_tree_view_crystals (self);
5954 _tmp5_ = priv->_treeview_crystals;
5956 gtk_tree_view_get_cursor (_tmp5_, &_tmp6_, &_tmp7_);
5958 _gtk_tree_path_free0 (path);
5960 path = _tmp6_;
5962 _g_object_unref0 (column);
5964 _tmp8_ = _g_object_ref0 (_tmp7_);
5966 column = _tmp8_;
5968 _tmp9_ = priv->_treeview_crystals;
5970 _tmp10_ = gtk_tree_view_get_column (_tmp9_, 0);
5972 _tmp11_ = _g_object_ref0 (_tmp10_);
5974 _g_object_unref0 (column);
5976 column = _tmp11_;
5978 _tmp12_ = priv->_treeview_crystals;
5980 _tmp13_ = path;
5982 _tmp14_ = column;
5984 gtk_tree_view_set_cursor (_tmp12_, _tmp13_, _tmp14_, TRUE);
5986 _g_object_unref0 (column);
5988 _gtk_tree_path_free0 (path);
5994 static void hkl_gui_window_on_toolbutton_copy_crystal_clicked (HklGuiWindow* self) {
5995 GtkTreePath* path = NULL;
5996 GtkTreeViewColumn* column = NULL;
5997 HklSampleList* _tmp0_;
5998 HklSample* _tmp1_;
5999 HklSample* old_sample;
6000 HklSample* _tmp2_;
6001 HklSampleList* _tmp4_;
6002 HklSample* _tmp5_;
6003 HklSample* _tmp6_;
6004 HklSample* sample;
6005 HklSample* _tmp7_;
6006 HklSampleList* _tmp8_;
6007 HklSample* _tmp9_;
6008 HklSampleList* _tmp10_;
6009 GtkTreeView* _tmp11_;
6010 GtkTreePath* _tmp12_ = NULL;
6011 GtkTreeViewColumn* _tmp13_ = NULL;
6012 GtkTreeViewColumn* _tmp14_;
6013 GtkTreeView* _tmp15_;
6014 GtkTreeViewColumn* _tmp16_ = NULL;
6015 GtkTreeViewColumn* _tmp17_;
6016 GtkTreeView* _tmp18_;
6017 GtkTreePath* _tmp19_;
6018 GtkTreeViewColumn* _tmp20_;
6020 g_return_if_fail (self != NULL);
6022 _tmp0_ = priv->samples;
6024 _tmp1_ = _tmp0_->current;
6026 old_sample = _tmp1_;
6028 _tmp2_ = old_sample;
6030 if (_tmp2_ == NULL) {
6032 GtkStatusbar* _tmp3_;
6034 _tmp3_ = priv->_statusBar;
6036 gtk_statusbar_push (_tmp3_, (guint) 0, "Please select a crystal to copy.");
6038 _g_object_unref0 (column);
6040 _gtk_tree_path_free0 (path);
6042 return;
6046 _tmp4_ = priv->samples;
6048 _tmp5_ = _tmp4_->current;
6050 _tmp6_ = hkl_sample_new_copy (_tmp5_);
6052 sample = _tmp6_;
6054 _tmp7_ = sample;
6056 hkl_sample_set_name (_tmp7_, "copy");
6058 _tmp8_ = priv->samples;
6060 _tmp9_ = sample;
6062 sample = NULL;
6064 hkl_sample_list_append (_tmp8_, _tmp9_);
6066 _tmp10_ = priv->samples;
6068 hkl_sample_list_select_current (_tmp10_, "copy");
6070 hkl_gui_window_update_tree_view_crystals (self);
6072 _tmp11_ = priv->_treeview_crystals;
6074 gtk_tree_view_get_cursor (_tmp11_, &_tmp12_, &_tmp13_);
6076 _gtk_tree_path_free0 (path);
6078 path = _tmp12_;
6080 _g_object_unref0 (column);
6082 _tmp14_ = _g_object_ref0 (_tmp13_);
6084 column = _tmp14_;
6086 _tmp15_ = priv->_treeview_crystals;
6088 _tmp16_ = gtk_tree_view_get_column (_tmp15_, 0);
6090 _tmp17_ = _g_object_ref0 (_tmp16_);
6092 _g_object_unref0 (column);
6094 column = _tmp17_;
6096 _tmp18_ = priv->_treeview_crystals;
6098 _tmp19_ = path;
6100 _tmp20_ = column;
6102 gtk_tree_view_set_cursor (_tmp18_, _tmp19_, _tmp20_, TRUE);
6104 _g_object_unref0 (column);
6106 _gtk_tree_path_free0 (path);
6111 static void hkl_gui_window_on_toolbutton_del_crystal_clicked (HklGuiWindow* self) {
6112 HklSampleList* _tmp0_;
6113 HklSample* _tmp1_;
6115 g_return_if_fail (self != NULL);
6117 _tmp0_ = priv->samples;
6119 _tmp1_ = _tmp0_->current;
6121 if (_tmp1_ != NULL) {
6123 HklSampleList* _tmp2_;
6124 HklSampleList* _tmp3_;
6125 HklSample* _tmp4_;
6127 _tmp2_ = priv->samples;
6129 _tmp3_ = priv->samples;
6131 _tmp4_ = _tmp3_->current;
6133 hkl_sample_list_del (_tmp2_, _tmp4_);
6135 hkl_gui_window_update_tree_view_crystals (self);
6141 static void hkl_gui_window_on_toolbutton_affiner_clicked (HklGuiWindow* self) {
6142 HklSampleList* _tmp0_;
6143 HklSample* _tmp1_;
6144 HklSample* sample;
6145 HklSample* _tmp2_;
6146 HklSample* _tmp4_;
6148 g_return_if_fail (self != NULL);
6150 _tmp0_ = priv->samples;
6152 _tmp1_ = _tmp0_->current;
6154 sample = _tmp1_;
6156 _tmp2_ = sample;
6158 if (_tmp2_ != NULL) {
6160 HklSample* _tmp3_;
6162 _tmp3_ = sample;
6164 hkl_sample_affine (_tmp3_);
6168 _tmp4_ = sample;
6170 hkl_gui_window_update_crystal_model (self, _tmp4_);
6172 hkl_gui_window_update_lattice (self);
6174 hkl_gui_window_update_reciprocal_lattice (self);
6176 hkl_gui_window_update_UB (self);
6178 hkl_gui_window_update_UxUyUz (self);
6183 static gboolean hkl_gui_window_on_tree_view_reflections_key_press_event (GdkEventKey* event, HklGuiWindow* self) {
6184 gboolean result = FALSE;
6186 g_return_val_if_fail (self != NULL, FALSE);
6188 g_return_val_if_fail (event != NULL, FALSE);
6190 result = TRUE;
6192 return result;
6197 static gboolean hkl_gui_window_on_tree_view_crystals_key_press_event (GdkEventKey* event, HklGuiWindow* self) {
6198 gboolean result = FALSE;
6200 g_return_val_if_fail (self != NULL, FALSE);
6202 g_return_val_if_fail (event != NULL, FALSE);
6204 result = TRUE;
6206 return result;
6211 static void hkl_gui_window_on_menuitem5_activate (HklGuiWindow* self) {
6212 GtkDialog* _tmp0_;
6214 g_return_if_fail (self != NULL);
6216 _tmp0_ = priv->_dialog1;
6218 gtk_widget_show ((GtkWidget*) _tmp0_);
6223 void hkl_gui_window_on_button1_clicked (HklGuiWindow* self) {
6224 GtkDialog* _tmp0_;
6226 g_return_if_fail (self != NULL);
6228 _tmp0_ = priv->_dialog1;
6230 gtk_widget_hide ((GtkWidget*) _tmp0_);
6235 void hkl_gui_window_on_combobox1_changed (HklGuiWindow* self) {
6236 gsize idx = 0UL;
6237 HklGeometryConfig config = {0};
6238 GtkComboBox* _tmp0_;
6239 gint _tmp1_ = 0;
6240 HklGeometryConfig _tmp2_;
6241 HklGeometryConfig _tmp3_;
6242 HklGeometry* _tmp4_ = NULL;
6243 HklGeometryConfig _tmp5_;
6244 HklPseudoAxisEngineList* _tmp6_ = NULL;
6245 HklPseudoAxisEngineList* _tmp7_;
6246 HklGeometry* _tmp8_;
6247 HklDetector* _tmp9_;
6248 HklSampleList* _tmp10_;
6249 HklSample* _tmp11_;
6251 g_return_if_fail (self != NULL);
6253 _tmp0_ = priv->_combobox1;
6255 _tmp1_ = gtk_combo_box_get_active (_tmp0_);
6257 idx = (gsize) _tmp1_;
6259 _tmp2_ = hkl_geometry_factory_configs[idx];
6261 config = _tmp2_;
6263 _tmp3_ = config;
6265 _tmp4_ = hkl_geometry_factory_new (&_tmp3_, 50 * HKL_DEGTORAD);
6267 _hkl_geometry_free0 (priv->geometry);
6269 priv->geometry = _tmp4_;
6271 _tmp5_ = config;
6273 _tmp6_ = hkl_pseudo_axis_engine_list_factory (&_tmp5_);
6275 _hkl_pseudo_axis_engine_list_free0 (priv->engines);
6277 priv->engines = _tmp6_;
6279 _tmp7_ = priv->engines;
6281 _tmp8_ = priv->geometry;
6283 _tmp9_ = priv->detector;
6285 _tmp10_ = priv->samples;
6287 _tmp11_ = _tmp10_->current;
6289 hkl_pseudo_axis_engine_list_init (_tmp7_, _tmp8_, _tmp9_, _tmp11_);
6291 hkl_gui_window_set_up_pseudo_axes_frames (self);
6293 hkl_gui_window_set_up_tree_view_axes (self);
6295 hkl_gui_window_set_up_tree_view_pseudo_axes_parameters (self);
6297 hkl_gui_window_set_up_tree_view_pseudo_axes (self);
6299 hkl_gui_window_set_up_tree_view_treeview1 (self);
6301 hkl_gui_window_set_up_3D (self);
6307 static void
6308 hkl_gui_window_class_init (HklGuiWindowClass *class)
6310 GObjectClass *gobject_class = G_OBJECT_CLASS (class);
6312 g_type_class_add_private (class, sizeof (HklGuiWindowPrivate));
6314 /* virtual method */
6315 gobject_class->finalize = finalize;
6319 static void hkl_gui_window_init (HklGuiWindow * self)
6321 HklGuiWindowPrivate *priv = HKL_GUI_WINDOW_GET_PRIVATE(self);
6323 priv->diffractometer = NULL;
6325 darray_init(priv->pseudo_frames);
6327 priv->sample = hkl_sample_new ("test");
6328 priv->reciprocal = hkl_lattice_new_default ();
6330 hkl_gui_window_get_widgets_and_objects_from_ui (self);
6332 set_up_diffractometer_model (self);
6334 //hkl_gui_window_set_up_tree_view_crystals (self);
6336 //hkl_gui_window_update_tree_view_crystals (self);
6338 //hkl_gui_window_update_source (self);
6340 //hkl_gui_window_update_lattice (self);
6342 //hkl_gui_window_update_lattice_parameters (self);
6344 //hkl_gui_window_update_reciprocal_lattice (self);
6346 //hkl_gui_window_update_UxUyUz (self);
6348 //hkl_gui_window_update_UB (self);
6350 //hkl_gui_window_connect_all_signals (self);
6353 int main (int argc, char ** argv)
6355 gtk_init (&argc, &argv);
6357 hkl_gui_window_new ();
6359 gtk_main ();
6361 return 0;