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>
25 #include <glib-object.h>
28 #include "hkl-gui-pseudoaxes.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 #define EMBED_BREAKPOINT asm volatile ("int3;")
45 G_DEFINE_TYPE (HklGuiWindow
, hkl_gui_window
, G_TYPE_OBJECT
);
48 REFLECTION_COL_INDEX
= 0,
53 REFLECTION_COL_REFLECTION
,
54 REFLECTION_COL_N_COLUMNS
68 PSEUDO_AXIS_COL_PARAMETER
= 0,
69 PSEUDO_AXIS_COL_ENGINE
,
72 PSEUDO_AXIS_COL_WRITE
,
73 PSEUDO_AXIS_COL_N_COLUMNS
77 PARAMETER_COL_PARAMETER
= 0,
80 PARAMETER_COL_N_COLUMNS
84 SAMPLE_COL_SAMPLE
= 0,
96 SOLUTION_COL_INDEX
= 0,
97 SOLUTION_COL_N_COLUMNS
101 DIFFRACTOMETER_COL_NAME
= 0,
102 DIFFRACTOMETER_COL_FACTORY
,
103 DIFFRACTOMETER_COL_DIFFRACTOMETER
,
104 DIFFRACTOMETER_COL_N_COLUMNS
111 struct diffractometer_t
{
112 HklGeometry
*geometry
;
113 HklDetector
*detector
;
114 HklEngineList
*engines
;
118 static struct diffractometer_t
*
119 create_diffractometer(HklFactory
*factory
)
121 struct diffractometer_t
*self
;
123 self
= malloc(sizeof(*self
));
125 self
->geometry
= hkl_factory_create_new_geometry (factory
);
126 self
->engines
= hkl_factory_create_new_engine_list (factory
);
127 self
->detector
= hkl_detector_factory_new (HKL_DETECTOR_TYPE_0D
);
128 hkl_detector_idx_set (self
->detector
, 1);
134 delete_diffractometer(struct diffractometer_t
*self
)
136 hkl_geometry_free(self
->geometry
);
137 hkl_engine_list_free(self
->engines
);
138 hkl_detector_free(self
->detector
);
143 dump_diffractometer(struct diffractometer_t
*self
)
145 /* hkl_geometry_fprintf(stderr, self->geometry); */
146 /* hkl_engine_list_fprintf(stderr, self->engines); */
147 /* hkl_detector_fprintf(stderr, self->detector); */
151 diffractometer_get_pseudo(struct diffractometer_t
*self
)
153 hkl_engine_list_get(self
->engines
);
157 diffractometer_engine_list_init(struct diffractometer_t
*self
,
160 g_return_if_fail(self
!= NULL
);
161 g_return_if_fail(sample
!= NULL
);
163 hkl_engine_list_init(self
->engines
,
167 diffractometer_get_pseudo(self
);
174 struct _HklGuiWindowPrivate
{
176 GtkLabel
* _label_UB11
;
177 GtkLabel
* _label_UB12
;
178 GtkLabel
* _label_UB13
;
179 GtkLabel
* _label_UB21
;
180 GtkLabel
* _label_UB22
;
181 GtkLabel
* _label_UB23
;
182 GtkLabel
* _label_UB31
;
183 GtkLabel
* _label_UB32
;
184 GtkLabel
* _label_UB33
;
186 GtkSpinButton
* _spinbutton_a
;
187 GtkSpinButton
* _spinbutton_b
;
188 GtkSpinButton
* _spinbutton_c
;
189 GtkSpinButton
* _spinbutton_alpha
;
190 GtkSpinButton
* _spinbutton_beta
;
191 GtkSpinButton
* _spinbutton_gamma
;
192 GtkSpinButton
* _spinbutton_a_min
;
193 GtkSpinButton
* _spinbutton_b_min
;
194 GtkSpinButton
* _spinbutton_c_min
;
195 GtkSpinButton
* _spinbutton_alpha_min
;
196 GtkSpinButton
* _spinbutton_beta_min
;
197 GtkSpinButton
* _spinbutton_gamma_min
;
198 GtkSpinButton
* _spinbutton_a_max
;
199 GtkSpinButton
* _spinbutton_b_max
;
200 GtkSpinButton
* _spinbutton_c_max
;
201 GtkSpinButton
* _spinbutton_alpha_max
;
202 GtkSpinButton
* _spinbutton_beta_max
;
203 GtkSpinButton
* _spinbutton_gamma_max
;
204 GtkSpinButton
* _spinbutton_lambda
;
205 GtkSpinButton
* _spinbutton_a_star
;
206 GtkSpinButton
* _spinbutton_b_star
;
207 GtkSpinButton
* _spinbutton_c_star
;
208 GtkSpinButton
* _spinbutton_alpha_star
;
209 GtkSpinButton
* _spinbutton_beta_star
;
210 GtkSpinButton
* _spinbutton_gamma_star
;
211 GtkSpinButton
* _spinbutton_ux
;
212 GtkSpinButton
* _spinbutton_uy
;
213 GtkSpinButton
* _spinbutton_uz
;
214 GtkSpinButton
* _spinbutton_U11
;
215 GtkSpinButton
* _spinbutton_U12
;
216 GtkSpinButton
* _spinbutton_U13
;
217 GtkSpinButton
* _spinbutton_U21
;
218 GtkSpinButton
* _spinbutton_U22
;
219 GtkSpinButton
* _spinbutton_U23
;
220 GtkSpinButton
* _spinbutton_U31
;
221 GtkSpinButton
* _spinbutton_U32
;
222 GtkSpinButton
* _spinbutton_U33
;
223 GtkCheckButton
* _checkbutton_a
;
224 GtkCheckButton
* _checkbutton_b
;
225 GtkCheckButton
* _checkbutton_c
;
226 GtkCheckButton
* _checkbutton_alpha
;
227 GtkCheckButton
* _checkbutton_beta
;
228 GtkCheckButton
* _checkbutton_gamma
;
229 GtkCheckButton
* _checkbutton_ux
;
230 GtkCheckButton
* _checkbutton_uy
;
231 GtkCheckButton
* _checkbutton_uz
;
232 GtkTreeView
* _treeview_reflections
;
233 GtkTreeView
* _treeview_crystals
;
234 GtkTreeView
* _treeview_axes
;
235 GtkTreeView
* _treeview_pseudo_axes
;
236 GtkTreeView
* _treeview_solutions
;
237 GtkToolButton
* _toolbutton_add_reflection
;
238 GtkToolButton
* _toolbutton_goto_reflection
;
239 GtkToolButton
* _toolbutton_del_reflection
;
240 GtkToolButton
* _toolbutton_setUB
;
241 GtkToolButton
* _toolbutton_computeUB
;
242 GtkToolButton
* _toolbutton_add_crystal
;
243 GtkToolButton
* _toolbutton_copy_crystal
;
244 GtkToolButton
* _toolbutton_del_crystal
;
245 GtkToolButton
* _toolbutton_affiner
;
246 GtkStatusbar
* _statusbar
;
247 GtkImageMenuItem
* _menuitem5
;
248 GtkVBox
* _box_info_bar
; /* fake for the infor bar */
253 GtkComboBox
* _combobox1
;
254 GtkListStore
* _liststore_diffractometer
;
255 GtkListStore
* _liststore_axis
;
256 GtkListStore
* _liststore_pseudo_axes
;
257 GtkListStore
* _liststore_solutions
;
258 GtkListStore
* _liststore_reflections
;
259 GtkListStore
* _liststore_crystals
;
261 GtkInfoBar
*info_bar
;
262 GtkLabel
*info_message
;
264 darray(HklGuiEngine
*) pseudo_frames
;
266 struct diffractometer_t
*diffractometer
; /* unowned */
267 HklSample
*sample
; /* unowned */
268 HklLattice
*reciprocal
;
271 #define HKL_GUI_WINDOW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), HKL_GUI_TYPE_WINDOW, HklGuiWindowPrivate))
274 finalize_liststore_diffractometer(GtkTreeModel
*model
,
279 struct diffractometer_t
*diffractometer
;
281 gtk_tree_model_get(model
, iter
,
282 DIFFRACTOMETER_COL_DIFFRACTOMETER
, &diffractometer
,
284 delete_diffractometer(diffractometer
);
289 finalize_liststore_samples(GtkTreeModel
*model
,
294 HklSample
*sample
= NULL
;
296 gtk_tree_model_get(model
, iter
,
297 SAMPLE_COL_SAMPLE
, &sample
,
299 hkl_sample_free(sample
);
304 finalize (GObject
* object
)
306 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(object
);
308 g_object_unref(priv
->builder
);
310 darray_free(priv
->pseudo_frames
);
312 gtk_tree_model_foreach(GTK_TREE_MODEL(priv
->_liststore_diffractometer
),
313 finalize_liststore_diffractometer
,
316 gtk_tree_model_foreach(GTK_TREE_MODEL(priv
->_liststore_crystals
),
317 finalize_liststore_samples
,
320 G_OBJECT_CLASS (hkl_gui_window_parent_class
)->finalize (object
);
323 HklGuiWindow
* hkl_gui_window_new (void)
325 return g_object_new (HKL_GUI_TYPE_WINDOW
, NULL
);
329 #define get_object(builder, type, priv, name) priv->_ ## name = type(gtk_builder_get_object(builder, #name))
332 hkl_gui_window_get_widgets_and_objects_from_ui (HklGuiWindow
* self
)
334 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
337 g_return_if_fail (self
!= NULL
);
339 priv
->builder
= builder
= gtk_builder_new ();
340 gtk_builder_add_from_file (builder
, "ghkl.ui", NULL
);
342 get_object(builder
, GTK_LIST_STORE
, priv
, liststore_diffractometer
);
343 get_object(builder
, GTK_LIST_STORE
, priv
, liststore_axis
);
344 get_object(builder
, GTK_LIST_STORE
, priv
, liststore_pseudo_axes
);
345 get_object(builder
, GTK_LIST_STORE
, priv
, liststore_reflections
);
346 get_object(builder
, GTK_LIST_STORE
, priv
, liststore_crystals
);
348 get_object(builder
, GTK_LABEL
, priv
, label_UB11
);
349 get_object(builder
, GTK_LABEL
, priv
, label_UB12
);
350 get_object(builder
, GTK_LABEL
, priv
, label_UB13
);
351 get_object(builder
, GTK_LABEL
, priv
, label_UB21
);
352 get_object(builder
, GTK_LABEL
, priv
, label_UB22
);
353 get_object(builder
, GTK_LABEL
, priv
, label_UB23
);
354 get_object(builder
, GTK_LABEL
, priv
, label_UB31
);
355 get_object(builder
, GTK_LABEL
, priv
, label_UB32
);
356 get_object(builder
, GTK_LABEL
, priv
, label_UB33
);
358 get_object(builder
, GTK_BUTTON
, priv
, button2
);
360 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_a
);
361 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_a_min
);
362 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_a_max
);
363 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_a_star
);
365 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_b
);
366 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_b_min
);
367 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_b_max
);
368 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_b_star
);
370 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_c
);
371 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_c_min
);
372 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_c_max
);
373 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_c_star
);
375 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_alpha
);
376 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_alpha_min
);
377 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_alpha_max
);
378 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_alpha_star
);
380 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_beta
);
381 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_beta_min
);
382 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_beta_max
);
383 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_beta_star
);
385 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_gamma
);
386 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_gamma_min
);
387 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_gamma_max
);
388 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_gamma_star
);
390 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_lambda
);
392 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_ux
);
393 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_uy
);
394 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_uz
);
396 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U11
);
397 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U12
);
398 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U13
);
399 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U21
);
400 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U22
);
401 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U23
);
402 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U31
);
403 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U32
);
404 get_object(builder
, GTK_SPIN_BUTTON
, priv
, spinbutton_U33
);
407 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_a
);
408 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_b
);
409 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_c
);
410 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_alpha
);
411 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_beta
);
412 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_gamma
);
413 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_ux
);
414 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_uy
);
415 get_object(builder
, GTK_CHECK_BUTTON
, priv
, checkbutton_uz
);
418 get_object(builder
, GTK_TREE_VIEW
, priv
, treeview_reflections
);
419 get_object(builder
, GTK_TREE_VIEW
, priv
, treeview_crystals
);
420 get_object(builder
, GTK_TREE_VIEW
, priv
, treeview_axes
);
421 get_object(builder
, GTK_TREE_VIEW
, priv
, treeview_pseudo_axes
);
422 get_object(builder
, GTK_TREE_VIEW
, priv
, treeview_solutions
);
424 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_add_reflection
);
425 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_goto_reflection
);
426 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_del_reflection
);
427 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_setUB
);
428 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_computeUB
);
429 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_add_crystal
);
430 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_copy_crystal
);
431 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_del_crystal
);
432 get_object(builder
, GTK_TOOL_BUTTON
, priv
, toolbutton_affiner
);
434 get_object(builder
, GTK_STATUSBAR
, priv
, statusbar
);
436 get_object(builder
, GTK_IMAGE_MENU_ITEM
, priv
, menuitem5
);
438 get_object(builder
, GTK_VBOX
, priv
, vbox7
);
439 get_object(builder
, GTK_VBOX
, priv
, vbox2
);
440 get_object(builder
, GTK_VBOX
, priv
, box_info_bar
);
442 get_object(builder
, GTK_DIALOG
, priv
, dialog1
);
444 get_object(builder
, GTK_COMBO_BOX
, priv
, combobox1
);
446 gtk_builder_connect_signals (builder
, self
);
450 update_pseudo_axes_frames (HklGuiWindow
* self
)
452 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
453 HklGuiEngine
**engine
;
455 g_return_if_fail (self
!= NULL
);
457 darray_foreach(engine
, priv
->pseudo_frames
){
458 hkl_gui_engine_update(*engine
);
463 raise_error(HklGuiWindow
*self
, HklError
**error
)
465 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
467 g_return_if_fail (self
!= NULL
);
468 g_return_if_fail (error
!= NULL
);
470 /* show an error message */
471 gtk_label_set_text (GTK_LABEL (priv
->info_message
),
472 hkl_error_message_get(*error
));
473 gtk_info_bar_set_message_type (priv
->info_bar
,
475 gtk_widget_show (GTK_WIDGET(priv
->info_bar
));
477 hkl_error_clear(error
);
481 clear_error(HklGuiWindow
*self
, HklError
**error
)
483 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
485 g_return_if_fail (self
!= NULL
);
487 gtk_widget_hide(GTK_WIDGET(priv
->info_bar
));
491 _update_axis (GtkTreeModel
*model
, GtkTreePath
*path
,
492 GtkTreeIter
*iter
, gpointer data
)
494 HklParameter
*parameter
;
495 gdouble value
, min
, max
;
497 gtk_tree_model_get (model
, iter
,
498 AXIS_COL_AXIS
, ¶meter
,
501 hkl_parameter_min_max_unit_get(parameter
, &min
, &max
);
502 value
= hkl_parameter_value_unit_get(parameter
);
504 gtk_list_store_set(GTK_LIST_STORE(model
), iter
,
505 AXIS_COL_READ
, value
,
506 AXIS_COL_WRITE
, value
,
514 update_axes (HklGuiWindow
* self
)
516 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
518 g_return_if_fail (self
!= NULL
);
520 gtk_tree_model_foreach(GTK_TREE_MODEL(priv
->_liststore_axis
),
526 _update_pseudo_axes (GtkTreeModel
*model
, GtkTreePath
*path
,
527 GtkTreeIter
*iter
, gpointer data
)
529 HklParameter
*parameter
;
530 gdouble value
, min
, max
;
532 gtk_tree_model_get (model
, iter
,
533 PSEUDO_AXIS_COL_PARAMETER
, ¶meter
,
536 hkl_parameter_min_max_unit_get(parameter
, &min
, &max
);
537 value
= hkl_parameter_value_unit_get(parameter
);
539 gtk_list_store_set(GTK_LIST_STORE(model
), iter
,
540 PSEUDO_AXIS_COL_READ
, value
,
541 PSEUDO_AXIS_COL_WRITE
, value
,
547 update_pseudo_axes (HklGuiWindow
* self
)
549 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
551 g_return_if_fail (self
!= NULL
);
553 gtk_tree_model_foreach(GTK_TREE_MODEL(priv
->_liststore_pseudo_axes
),
559 update_solutions (HklGuiWindow
* self
)
561 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
562 const HklGeometryList
*geometries
;
563 const darray_item
*items
;
564 GtkTreeIter iter
= {0};
566 g_return_if_fail (self
!= NULL
);
568 geometries
= hkl_engine_list_geometries(priv
->diffractometer
->engines
);
570 gtk_list_store_clear(priv
->_liststore_solutions
);
571 items
= hkl_geometry_list_items_get(geometries
);
572 if (darray_size(*items
)){
573 gint n_values
= gtk_tree_model_get_n_columns (GTK_TREE_MODEL(priv
->_liststore_solutions
));
574 GValue
*values
= g_new0(GValue
, n_values
);
575 gint
*columns
= g_new0(gint
, n_values
);
578 /* prepare the GValue before using them */
579 g_value_init(&values
[0], G_TYPE_INT
);
580 for(i
=1; i
<n_values
; ++i
)
581 g_value_init(&values
[i
], G_TYPE_DOUBLE
);
583 for(i
=0; i
<darray_size(*items
);++i
){
585 const HklGeometry
*geometry
;
586 HklParameter
**parameter
;
587 const darray_parameter
*parameters
;
589 geometry
= hkl_geometry_list_item_geometry_get(darray_item(*items
, i
));
590 parameters
= hkl_geometry_axes_get(geometry
);
592 g_value_set_int(&values
[column
], i
);
595 darray_foreach(parameter
, *parameters
){
596 double value
= hkl_parameter_value_unit_get(*parameter
);
599 g_value_set_double(&values
[column
], value
);
600 columns
[column
] = column
;
602 gtk_list_store_insert_with_valuesv(priv
->_liststore_solutions
,
604 columns
, values
, n_values
);
612 update_source (HklGuiWindow
* self
)
614 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
616 g_return_if_fail (self
!= NULL
);
618 gtk_spin_button_set_value (priv
->_spinbutton_lambda
,
619 hkl_geometry_wavelength_get(priv
->diffractometer
->geometry
));
623 update_reflections (HklGuiWindow
*self
)
625 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
627 gtk_list_store_clear (priv
->_liststore_reflections
);
630 HklSampleReflection
* reflection
= NULL
;
633 reflection
= hkl_sample_first_reflection_get(priv
->sample
);
635 GtkTreeIter iter
= {0};
639 hkl_sample_reflection_hkl_get(reflection
, &h
, &k
, &l
);
640 flag
= hkl_sample_reflection_flag_get(reflection
);
642 gtk_list_store_append (priv
->_liststore_reflections
, &iter
);
644 gtk_list_store_set (priv
->_liststore_reflections
,
646 REFLECTION_COL_INDEX
, index
++,
650 REFLECTION_COL_FLAG
, flag
,
651 REFLECTION_COL_REFLECTION
, reflection
,
653 reflection
= hkl_sample_next_reflection_get(priv
->sample
,
660 hkl_engine_to_axes(HklGuiWindow
*self
, HklEngine
*engine
)
662 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
663 HklError
*error
= NULL
;
666 g_return_val_if_fail (self
!= NULL
, FALSE
);
667 g_return_val_if_fail (engine
!= NULL
, FALSE
);
669 if(hkl_engine_set(engine
, &error
)){
670 clear_error(self
, &error
);
671 hkl_engine_list_select_solution(priv
->diffractometer
->engines
, 0);
672 hkl_engine_list_get(priv
->diffractometer
->engines
);
675 update_pseudo_axes (self
);
676 update_pseudo_axes_frames (self
);
678 raise_error(self
, &error
);
679 dump_diffractometer(priv
->diffractometer
);
682 update_solutions (self
);
687 pseudo_axes_frame_changed_cb (HklGuiEngine
*gui_engine
, HklGuiWindow
*self
)
691 g_return_if_fail (self
!= NULL
);
693 g_object_get(G_OBJECT(gui_engine
),
697 hkl_engine_to_axes(self
, engine
);
701 set_up_pseudo_axes_frames (HklGuiWindow
* self
)
703 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
704 HklGuiEngine
**pseudo
;
707 darray_engine
*engines
;
709 g_return_if_fail (self
!= NULL
);
711 darray_foreach (pseudo
, priv
->pseudo_frames
){
712 gtk_container_remove(GTK_CONTAINER(priv
->_vbox2
),
713 GTK_WIDGET (hkl_gui_engine_get_frame (*pseudo
)));
714 g_object_unref(*pseudo
);
716 darray_size (priv
->pseudo_frames
) = 0;
718 engines
= hkl_engine_list_engines (priv
->diffractometer
->engines
);
719 darray_foreach (engine
, *engines
){
720 HklGuiEngine
*pseudo
;
722 pseudo
= hkl_gui_engine_new (*engine
);
723 darray_append(priv
->pseudo_frames
, pseudo
);
724 gtk_container_add (GTK_CONTAINER (priv
->_vbox2
),
725 GTK_WIDGET (hkl_gui_engine_get_frame(pseudo
)));
727 g_signal_connect_object (pseudo
,
729 G_CALLBACK(pseudo_axes_frame_changed_cb
),
733 gtk_widget_show_all (GTK_WIDGET (priv
->_vbox2
));
738 set_up_diffractometer_model (HklGuiWindow
* self
)
740 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
742 HklFactory
**factories
;
744 g_return_if_fail (self
!= NULL
);
746 factories
= hkl_factory_get_all(&n
);
748 GtkTreeIter iter
= {0};
750 gtk_list_store_append (priv
->_liststore_diffractometer
, &iter
);
751 gtk_list_store_set (priv
->_liststore_diffractometer
,
753 DIFFRACTOMETER_COL_NAME
, hkl_factory_name(factories
[i
]),
754 DIFFRACTOMETER_COL_FACTORY
, factories
[i
],
755 DIFFRACTOMETER_COL_DIFFRACTOMETER
, NULL
,
761 set_up_tree_view_axes (HklGuiWindow
* self
)
763 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
764 HklParameter
**parameter
;
765 const darray_parameter
*parameters
;
766 GtkCellRenderer
* renderer
= NULL
;
767 GtkTreeViewColumn
* column
= NULL
;
770 g_return_if_fail (self
!= NULL
);
772 gtk_list_store_clear (priv
->_liststore_axis
);
774 parameters
= hkl_geometry_axes_get(priv
->diffractometer
->geometry
);
775 darray_foreach (parameter
, *parameters
){
776 GtkTreeIter iter
= {0};
778 gtk_list_store_append (priv
->_liststore_axis
, &iter
);
779 gtk_list_store_set (priv
->_liststore_axis
, &iter
,
780 AXIS_COL_AXIS
, *parameter
,
781 AXIS_COL_NAME
, hkl_parameter_name_get(*parameter
),
789 set_up_tree_view_pseudo_axes (HklGuiWindow
* self
)
791 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
792 HklParameter
**parameter
;
793 const darray_parameter
*parameters
;
795 const darray_engine
*engines
;
797 GtkCellRendererText
* renderer
= NULL
;
798 GtkTreeViewColumn
* column
= NULL
;
801 g_return_if_fail (self
!= NULL
);
803 gtk_list_store_clear(priv
->_liststore_pseudo_axes
);
805 engines
= hkl_engine_list_engines(priv
->diffractometer
->engines
);
806 darray_foreach(engine
, *engines
){
807 parameters
= hkl_engine_pseudo_axes(*engine
);
808 darray_foreach(parameter
, *parameters
){
809 GtkTreeIter iter
= {0};
811 gtk_list_store_append (priv
->_liststore_pseudo_axes
, &iter
);
812 gtk_list_store_set (priv
->_liststore_pseudo_axes
, &iter
,
813 PSEUDO_AXIS_COL_PARAMETER
, *parameter
,
814 PSEUDO_AXIS_COL_ENGINE
, *engine
,
815 PSEUDO_AXIS_COL_NAME
, hkl_parameter_name_get(*parameter
),
820 update_pseudo_axes (self
);
824 _delete_column(gpointer data
,
827 gtk_tree_view_remove_column (GTK_TREE_VIEW(user_data
),
828 GTK_TREE_VIEW_COLUMN(data
));
832 set_up_tree_view_solutions (HklGuiWindow
* self
)
834 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
835 const darray_parameter
*parameters
;
837 GtkCellRenderer
* renderer
= NULL
;
838 GtkTreeViewColumn
* column
= NULL
;
843 g_return_if_fail (self
!= NULL
);
845 parameters
= hkl_geometry_axes_get(priv
->diffractometer
->geometry
);
847 n_columns
= SOLUTION_COL_N_COLUMNS
+ darray_size(*parameters
);
849 /* prepare types for the liststore */
850 types
= g_new0 (GType
, n_columns
);
852 /* first remove all the columns */
853 columns
= gtk_tree_view_get_columns (priv
->_treeview_solutions
);
854 g_list_foreach(columns
, _delete_column
, priv
->_treeview_solutions
);
855 g_list_free(columns
);
857 /* now add the index column */
858 renderer
= gtk_cell_renderer_text_new ();
859 column
= gtk_tree_view_column_new_with_attributes ("index",
861 SOLUTION_COL_INDEX
, NULL
);
863 gtk_tree_view_append_column (priv
->_treeview_solutions
, column
);
864 types
[0] = G_TYPE_INT
;
866 /* add the axes column */
867 for(i
=1; i
<n_columns
; ++i
){
868 HklParameter
*parameter
;
870 parameter
= darray_item(*parameters
, i
- SOLUTION_COL_N_COLUMNS
);
871 renderer
= gtk_cell_renderer_text_new ();
872 column
= gtk_tree_view_column_new_with_attributes (hkl_parameter_name_get(parameter
),
876 gtk_tree_view_append_column (priv
->_treeview_solutions
, column
);
877 types
[i
] = G_TYPE_DOUBLE
;
880 if (priv
->_liststore_solutions
)
881 g_object_unref(priv
->_liststore_solutions
);
882 priv
->_liststore_solutions
= gtk_list_store_newv (n_columns
, types
);
885 gtk_tree_view_set_model (priv
->_treeview_solutions
,
886 GTK_TREE_MODEL(priv
->_liststore_solutions
));
888 update_solutions (self
);
892 set_up_info_bar(HklGuiWindow
*self
)
894 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
895 GtkWidget
*content_area
;
897 g_return_if_fail (self
!= NULL
);
899 /* set up info bar until we can use glade for this purpose or
904 priv
->info_bar
= GTK_INFO_BAR(gtk_info_bar_new ());
905 gtk_widget_set_no_show_all (GTK_WIDGET(priv
->info_bar
), TRUE
);
907 priv
->info_message
= GTK_LABEL(gtk_label_new (""));
908 gtk_widget_show (GTK_WIDGET(priv
->info_message
));
910 content_area
= gtk_info_bar_get_content_area (GTK_INFO_BAR (priv
->info_bar
));
911 gtk_container_add (GTK_CONTAINER (content_area
),
912 GTK_WIDGET(priv
->info_message
));
913 gtk_info_bar_add_button (priv
->info_bar
,
914 GTK_STOCK_OK
, GTK_RESPONSE_OK
);
915 g_signal_connect (priv
->info_bar
, "response",
916 G_CALLBACK (gtk_widget_hide
), NULL
);
918 gtk_box_pack_start(GTK_BOX(priv
->_box_info_bar
),
919 GTK_WIDGET(priv
->info_bar
),
924 hkl_gui_window_combobox1_changed_cb(GtkComboBox
*combobox
, gpointer
*user_data
)
926 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
927 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
929 struct diffractometer_t
*dif
= NULL
;
931 GtkTreeIter iter
= {0};
933 if(gtk_combo_box_get_active_iter (combobox
, &iter
)){
934 gtk_tree_model_get(GTK_TREE_MODEL(priv
->_liststore_diffractometer
),
936 DIFFRACTOMETER_COL_FACTORY
, &factory
,
937 DIFFRACTOMETER_COL_DIFFRACTOMETER
, &dif
,
941 dif
= create_diffractometer(factory
);
942 gtk_list_store_set(priv
->_liststore_diffractometer
,
944 DIFFRACTOMETER_COL_DIFFRACTOMETER
, dif
,
949 priv
->diffractometer
= dif
;
950 /* TODO check if this is the right place for this */
951 hkl_engine_list_init(dif
->engines
, dif
->geometry
, dif
->detector
, priv
->sample
);
953 set_up_pseudo_axes_frames(self
);
954 set_up_tree_view_axes(self
);
955 set_up_tree_view_pseudo_axes(self
);
957 /* FIXME create the right solution Model Column */
958 /* this._solutionModelColumns = 0; */
959 set_up_tree_view_solutions(self
);
960 set_up_info_bar(self
);
969 hkl_gui_window_cellrendererspin1_edited_cb(GtkCellRendererText
*renderer
,
974 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
975 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
976 GtkTreeIter iter
= {0};
978 HklParameter
* parameter
= NULL
;
980 g_return_if_fail (renderer
!= NULL
);
981 g_return_if_fail (path
!= NULL
);
982 g_return_if_fail (new_text
!= NULL
);
983 g_return_if_fail (user_data
!= NULL
);
985 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_axis
),
988 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_axis
), &iter
,
989 AXIS_COL_AXIS
, ¶meter
,
992 value
= atof(new_text
); /* TODO need to check for the right conversion */
993 hkl_parameter_value_unit_set (parameter
, value
, NULL
);
994 hkl_geometry_axis_set(priv
->diffractometer
->geometry
,
997 hkl_engine_list_get(priv
->diffractometer
->engines
);
999 /* ok so set the model with the new value */
1000 gtk_list_store_set (priv
->_liststore_axis
, &iter
,
1001 AXIS_COL_READ
, value
,
1002 AXIS_COL_WRITE
, value
,
1005 update_pseudo_axes (self
);
1006 update_pseudo_axes_frames (self
);
1012 hkl_gui_window_cellrendererspin3_edited_cb(GtkCellRendererText
*renderer
,
1017 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1018 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1019 GtkTreeIter iter
= {0};
1020 gdouble value
= 0.0;
1021 HklParameter
* parameter
= NULL
;
1024 g_return_if_fail (renderer
!= NULL
);
1025 g_return_if_fail (path
!= NULL
);
1026 g_return_if_fail (new_text
!= NULL
);
1027 g_return_if_fail (user_data
!= NULL
);
1029 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_axis
),
1032 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_axis
), &iter
,
1033 AXIS_COL_AXIS
, ¶meter
,
1036 value
= atof(new_text
); /* TODO need to check for the right conversion */
1037 hkl_parameter_min_max_unit_get (parameter
, &shit
, &max
);
1038 hkl_parameter_min_max_unit_set (parameter
, value
, max
);
1040 gtk_list_store_set (priv
->_liststore_axis
, &iter
,
1041 AXIS_COL_MIN
, value
,
1044 update_pseudo_axes (self
);
1050 hkl_gui_window_cellrendererspin4_edited_cb(GtkCellRendererText
*renderer
,
1055 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1056 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1057 GtkTreeIter iter
= {0};
1058 gdouble value
= 0.0;
1059 HklParameter
* parameter
= NULL
;
1062 g_return_if_fail (renderer
!= NULL
);
1063 g_return_if_fail (path
!= NULL
);
1064 g_return_if_fail (new_text
!= NULL
);
1065 g_return_if_fail (user_data
!= NULL
);
1067 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_axis
),
1070 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_axis
), &iter
,
1071 AXIS_COL_AXIS
, ¶meter
,
1074 value
= atof(new_text
); /* TODO need to check for the right conversion */
1075 hkl_parameter_min_max_unit_get (parameter
, &min
, &shit
);
1076 hkl_parameter_min_max_unit_set (parameter
, min
, value
);
1078 gtk_list_store_set (priv
->_liststore_axis
, &iter
,
1079 AXIS_COL_MAX
, value
,
1082 update_pseudo_axes (self
);
1086 /* pseudo axis write */
1088 hkl_gui_window_cellrenderertext5_edited_cb(GtkCellRendererText
*renderer
,
1093 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1094 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1095 GtkTreeIter iter
= {0};
1096 gdouble value
= 0.0;
1098 HklParameter
* parameter
= NULL
;
1099 HklEngine
*engine
= NULL
;
1100 HklError
*error
= NULL
;
1102 g_return_if_fail (renderer
!= NULL
);
1103 g_return_if_fail (path
!= NULL
);
1104 g_return_if_fail (new_text
!= NULL
);
1105 g_return_if_fail (user_data
!= NULL
);
1107 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_pseudo_axes
),
1110 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_pseudo_axes
), &iter
,
1111 PSEUDO_AXIS_COL_PARAMETER
, ¶meter
,
1112 PSEUDO_AXIS_COL_ENGINE
, &engine
,
1115 value
= atof(new_text
); /* TODO need to check for the right conversion */
1116 old_value
= hkl_parameter_value_unit_get(parameter
);
1118 g_assert(error
!= NULL
|| error
== NULL
);
1119 hkl_parameter_value_unit_set (parameter
, value
, &error
);
1121 raise_error(self
, &error
);
1124 if (hkl_engine_to_axes(self
, engine
)){
1125 gtk_list_store_set (priv
->_liststore_pseudo_axes
,
1127 PSEUDO_AXIS_COL_WRITE
, value
,
1130 hkl_parameter_value_unit_set(parameter
, old_value
, NULL
);
1136 hkl_gui_window_treeview_solutions_cursor_changed_cb (GtkTreeView
*tree_view
,
1139 HklGuiWindow
* self
= HKL_GUI_WINDOW(user_data
);
1140 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1142 GtkTreePath
* path
= NULL
;
1143 GtkTreeViewColumn
* focus_column
= NULL
;
1144 GtkTreeIter iter
= {0};
1147 g_return_if_fail (tree_view
!= NULL
);
1148 g_return_if_fail (user_data
!= NULL
);
1150 gtk_tree_view_get_cursor (tree_view
, &path
, &focus_column
);
1151 gtk_tree_model_get_iter (GTK_TREE_MODEL(priv
->_liststore_solutions
), &iter
, path
);
1152 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_solutions
), &iter
,
1153 SOLUTION_COL_INDEX
, &index
,
1156 hkl_engine_list_select_solution (priv
->diffractometer
->engines
, index
);
1157 hkl_engine_list_get (priv
->diffractometer
->engines
);
1160 update_pseudo_axes (self
);
1161 update_pseudo_axes_frames (self
);
1163 gtk_tree_path_free (path
);
1168 hkl_gui_window_cellrenderertext7_edited_cb(GtkCellRendererText
* _sender
, const gchar
* path
,
1169 const gchar
* new_text
, gpointer self
)
1171 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1173 g_return_if_fail (self
!= NULL
);
1174 g_return_if_fail (path
!= NULL
);
1175 g_return_if_fail (new_text
!= NULL
);
1181 HklSampleReflection
* reflection
= NULL
;
1182 GtkTreeIter iter
= {0};
1184 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1186 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1188 REFLECTION_COL_REFLECTION
, &reflection
,
1191 hkl_sample_reflection_hkl_get (reflection
, &h
, &k
, &l
);
1193 hkl_sample_reflection_hkl_set (reflection
, h
, k
, l
);
1194 gtk_list_store_set (priv
->_liststore_reflections
,
1196 REFLECTION_COL_H
, h
,
1203 hkl_gui_window_cellrenderertext8_edited_cb (GtkCellRendererText
* _sender
, const gchar
* path
,
1204 const gchar
* new_text
, gpointer self
)
1206 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1208 g_return_if_fail (self
!= NULL
);
1209 g_return_if_fail (path
!= NULL
);
1210 g_return_if_fail (new_text
!= NULL
);
1216 HklSampleReflection
* reflection
= NULL
;
1217 GtkTreeIter iter
= {0};
1219 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1221 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1223 REFLECTION_COL_REFLECTION
, &reflection
,
1226 hkl_sample_reflection_hkl_get (reflection
, &h
, &k
, &l
);
1228 hkl_sample_reflection_hkl_set (reflection
, h
, k
, l
);
1229 gtk_list_store_set (priv
->_liststore_reflections
,
1231 REFLECTION_COL_K
, k
,
1238 hkl_gui_window_cellrenderertext9_edited_cb (GtkCellRendererText
* _sender
, const gchar
* path
,
1239 const gchar
* new_text
, gpointer self
)
1241 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1243 g_return_if_fail (self
!= NULL
);
1244 g_return_if_fail (path
!= NULL
);
1245 g_return_if_fail (new_text
!= NULL
);
1251 HklSampleReflection
* reflection
= NULL
;
1252 GtkTreeIter iter
= {0};
1254 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1256 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1258 REFLECTION_COL_REFLECTION
, &reflection
,
1261 hkl_sample_reflection_hkl_get (reflection
, &h
, &k
, &l
);
1263 hkl_sample_reflection_hkl_set (reflection
, h
, k
, l
);
1264 gtk_list_store_set (priv
->_liststore_reflections
,
1266 REFLECTION_COL_L
, l
,
1271 /* reflection flag */
1273 hkl_gui_window_cellrenderertoggle1_toggled_cb (GtkCellRendererToggle
* renderer
, const gchar
* path
,
1276 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1278 g_return_if_fail (self
!= NULL
);
1279 g_return_if_fail (path
!= NULL
);
1283 HklSampleReflection
* reflection
= NULL
;
1284 GtkTreeIter iter
= {0};
1286 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1288 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1290 REFLECTION_COL_REFLECTION
, &reflection
,
1293 flag
= gtk_cell_renderer_toggle_get_active(renderer
);
1294 hkl_sample_reflection_flag_set (reflection
, flag
);
1295 gtk_list_store_set (priv
->_liststore_reflections
,
1297 REFLECTION_COL_FLAG
, flag
,
1303 hkl_gui_window_treeview_reflections_key_press_event_cb (GtkWidget
* _sender
, GdkEventKey
* event
,
1310 hkl_gui_window_toolbutton_add_reflection_clicked_cb(GtkToolButton
* _sender
,
1313 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1315 if (priv
->diffractometer
== NULL
){
1316 gtk_statusbar_push (priv
->_statusbar
, 0,
1317 "Please select a diffractometer before adding reflections");
1322 HklSampleReflection
*reflection
= NULL
;
1323 GtkTreeIter iter
= {0};
1327 reflection
= hkl_sample_reflection_new(priv
->diffractometer
->geometry
,
1328 priv
->diffractometer
->detector
,
1330 hkl_sample_add_reflection(priv
->sample
, reflection
);
1331 flag
= hkl_sample_reflection_flag_get(reflection
);
1333 n_rows
= gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv
->_liststore_reflections
),
1335 gtk_list_store_insert_with_values (priv
->_liststore_reflections
,
1337 REFLECTION_COL_INDEX
, n_rows
,
1338 REFLECTION_COL_H
, 0.,
1339 REFLECTION_COL_K
, 0.,
1340 REFLECTION_COL_L
, 0.,
1341 REFLECTION_COL_FLAG
, flag
,
1342 REFLECTION_COL_REFLECTION
, reflection
,
1348 hkl_gui_window_toolbutton_goto_reflection_clicked_cb (GtkToolButton
* _sender
, gpointer user_data
)
1350 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1351 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1353 g_return_if_fail (self
!= NULL
);
1356 GtkTreeSelection
* selection
= NULL
;
1359 selection
= gtk_tree_view_get_selection (priv
->_treeview_reflections
);
1360 nb_rows
= gtk_tree_selection_count_selected_rows (selection
);
1363 HklSampleReflection
*reflection
;
1364 GtkTreeIter iter
= {0};
1365 GtkTreeModel
* model
= NULL
;
1366 GtkTreePath
*treepath
;
1369 model
= GTK_TREE_MODEL(priv
->_liststore_reflections
);
1371 list
= gtk_tree_selection_get_selected_rows (selection
,
1374 treepath
= g_list_nth_data(list
, 0);
1376 gtk_tree_model_get_iter (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1379 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1381 REFLECTION_COL_REFLECTION
, &reflection
,
1384 hkl_geometry_set (priv
->diffractometer
->geometry
,
1385 hkl_sample_reflection_geometry_get(reflection
));
1387 update_source (self
);
1391 update_pseudo_axes (self
);
1393 g_list_free_full (list
, (GDestroyNotify
) gtk_tree_path_free
);
1396 gtk_statusbar_push (priv
->_statusbar
, 0,
1397 "Please select only one reflection.");
1399 gtk_statusbar_push (priv
->_statusbar
, 0,
1400 "Please select at least one reflection.");
1405 _del_reflection(gpointer data
, gpointer user_data
)
1407 HklSampleReflection
*reflection
;
1408 GtkTreeIter iter
= {0};
1409 GtkTreePath
*treepath
= data
;
1410 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1412 gtk_tree_model_get_iter (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1415 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_reflections
),
1417 REFLECTION_COL_REFLECTION
, &reflection
,
1419 hkl_sample_del_reflection(priv
->sample
, reflection
);
1423 hkl_gui_window_toolbutton_del_reflection_clicked_cb (GtkToolButton
* _sender
, gpointer user_data
)
1425 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1426 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1427 HklSample
* sample
= NULL
;
1429 g_return_if_fail (self
!= NULL
);
1432 GtkTreeSelection
* selection
= NULL
;
1435 selection
= gtk_tree_view_get_selection (priv
->_treeview_reflections
);
1436 nb_rows
= gtk_tree_selection_count_selected_rows (selection
);
1438 GtkTreeModel
* model
= NULL
;
1442 GtkMessageDialog
* dialog
;
1444 model
= GTK_TREE_MODEL(priv
->_liststore_reflections
);
1445 list
= gtk_tree_selection_get_selected_rows (selection
, &model
);
1448 dialog
= GTK_MESSAGE_DIALOG(
1449 gtk_message_dialog_new (NULL
,
1450 GTK_DIALOG_DESTROY_WITH_PARENT
,
1451 GTK_MESSAGE_WARNING
,
1453 "Are you sure that you want to delete reflections"));
1455 switch (gtk_dialog_run (GTK_DIALOG(dialog
))) {
1456 case GTK_RESPONSE_YES
:
1458 g_list_foreach(list
, _del_reflection
, self
);
1459 update_reflections (self
);
1465 gtk_widget_destroy (GTK_WIDGET(dialog
));
1466 g_list_free_full (list
, (GDestroyNotify
) gtk_tree_path_free
);
1468 gtk_statusbar_push (priv
->_statusbar
, 0,
1469 "Please select at least one reflection.");
1476 hkl_gui_window_cellrenderertext10_edited_cb(GtkCellRendererText
* _sender
, const gchar
* path
,
1477 const gchar
* new_text
, gpointer user_data
)
1479 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1481 GtkTreeModel
* model
= NULL
;
1482 GtkTreeIter iter
= {0};
1483 HklSample
* sample
= NULL
;
1486 g_return_if_fail (user_data
!= NULL
);
1487 g_return_if_fail (path
!= NULL
);
1488 g_return_if_fail (new_text
!= NULL
);
1490 model
= GTK_TREE_MODEL(priv
->_liststore_crystals
);
1492 gtk_tree_model_get_iter_from_string (model
, &iter
, path
);
1494 gtk_tree_model_get (model
, &iter
,
1495 SAMPLE_COL_SAMPLE
, &sample
,
1498 hkl_sample_name_set (sample
, new_text
);
1500 gtk_list_store_set(priv
->_liststore_crystals
, &iter
,
1501 SAMPLE_COL_NAME
, new_text
,
1505 #define set_lattice(lattice, parameter) do{ \
1506 const HklParameter *p; \
1507 gdouble min, max, value; \
1509 p = hkl_lattice_## parameter ##_get((lattice)); \
1510 value = hkl_parameter_value_unit_get(p); \
1511 hkl_parameter_min_max_unit_get(p, &min, &max); \
1512 fit = hkl_parameter_fit_get(p); \
1513 gtk_spin_button_set_value(priv->_spinbutton_## parameter, value); \
1514 gtk_spin_button_set_value(priv->_spinbutton_## parameter ##_min, min); \
1515 gtk_spin_button_set_value(priv->_spinbutton_## parameter ##_max, max); \
1516 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->_checkbutton_ ## parameter), fit); \
1520 update_lattice (HklGuiWindow
* self
)
1522 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1524 g_return_if_fail (self
!= NULL
);
1526 if (priv
->sample
!= NULL
) {
1527 const HklLattice
*lattice
;
1528 lattice
= hkl_sample_lattice_get(priv
->sample
);
1529 set_lattice(lattice
, a
);
1530 set_lattice(lattice
, b
);
1531 set_lattice(lattice
, c
);
1532 set_lattice(lattice
, alpha
);
1533 set_lattice(lattice
, beta
);
1534 set_lattice(lattice
, gamma
);
1538 #define set_reciprocal_lattice(lattice, parameter) do{ \
1539 const HklParameter *p; \
1541 p = hkl_lattice_## parameter ##_get((lattice)); \
1542 value = hkl_parameter_value_unit_get(p); \
1543 gtk_spin_button_set_value(priv->_spinbutton_## parameter ##_star, value); \
1547 update_reciprocal_lattice (HklGuiWindow
* self
)
1549 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1551 g_return_if_fail (self
!= NULL
);
1553 if (priv
->sample
!= NULL
) {
1554 hkl_lattice_reciprocal (hkl_sample_lattice_get(priv
->sample
),
1557 set_reciprocal_lattice(priv
->reciprocal
, a
);
1558 set_reciprocal_lattice(priv
->reciprocal
, b
);
1559 set_reciprocal_lattice(priv
->reciprocal
, c
);
1560 set_reciprocal_lattice(priv
->reciprocal
, alpha
);
1561 set_reciprocal_lattice(priv
->reciprocal
, beta
);
1562 set_reciprocal_lattice(priv
->reciprocal
, gamma
);
1566 #define set_ux_uy_uz(sample, parameter) do { \
1567 const HklParameter *p; \
1568 p = hkl_sample_## parameter ##_get((sample)); \
1569 gboolean fit = hkl_parameter_fit_get(p); \
1570 gtk_spin_button_set_value(priv->_spinbutton_## parameter, \
1571 hkl_parameter_value_unit_get(p)); \
1572 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(priv->_checkbutton_## parameter), fit); \
1576 update_ux_uy_uz (HklGuiWindow
* self
)
1578 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1580 g_return_if_fail (self
!= NULL
);
1582 if (priv
->sample
!= NULL
) {
1583 set_ux_uy_uz(priv
->sample
, ux
);
1584 set_ux_uy_uz(priv
->sample
, uy
);
1585 set_ux_uy_uz(priv
->sample
, uz
);
1590 update_UB (HklGuiWindow
* self
)
1592 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1594 g_return_if_fail (self
!= NULL
);
1596 if (priv
->sample
!= NULL
) {
1597 const HklMatrix
*UB
= hkl_sample_UB_get (priv
->sample
);
1598 gchar
*text
= g_new0 (gchar
, G_ASCII_DTOSTR_BUF_SIZE
);
1600 gtk_label_set_text(priv
->_label_UB11
,
1601 g_ascii_dtostr(text
,
1602 G_ASCII_DTOSTR_BUF_SIZE
,
1603 hkl_matrix_get(UB
, 0, 0)));
1604 gtk_label_set_text(priv
->_label_UB12
,
1605 g_ascii_dtostr(text
,
1606 G_ASCII_DTOSTR_BUF_SIZE
,
1607 hkl_matrix_get(UB
, 0, 1)));
1608 gtk_label_set_text(priv
->_label_UB13
,
1609 g_ascii_dtostr(text
,
1610 G_ASCII_DTOSTR_BUF_SIZE
,
1611 hkl_matrix_get(UB
, 0, 2)));
1612 gtk_label_set_text(priv
->_label_UB21
,
1613 g_ascii_dtostr(text
,
1614 G_ASCII_DTOSTR_BUF_SIZE
,
1615 hkl_matrix_get(UB
, 1, 0)));
1616 gtk_label_set_text(priv
->_label_UB22
,
1617 g_ascii_dtostr(text
,
1618 G_ASCII_DTOSTR_BUF_SIZE
,
1619 hkl_matrix_get(UB
, 1, 1)));
1620 gtk_label_set_text(priv
->_label_UB23
,
1621 g_ascii_dtostr(text
,
1622 G_ASCII_DTOSTR_BUF_SIZE
,
1623 hkl_matrix_get(UB
, 1, 2)));
1624 gtk_label_set_text(priv
->_label_UB31
,
1625 g_ascii_dtostr(text
,
1626 G_ASCII_DTOSTR_BUF_SIZE
,
1627 hkl_matrix_get(UB
, 2, 0)));
1628 gtk_label_set_text(priv
->_label_UB32
,
1629 g_ascii_dtostr(text
,
1630 G_ASCII_DTOSTR_BUF_SIZE
,
1631 hkl_matrix_get(UB
, 2, 1)));
1632 gtk_label_set_text(priv
->_label_UB33
,
1633 g_ascii_dtostr(text
,
1634 G_ASCII_DTOSTR_BUF_SIZE
,
1635 hkl_matrix_get(UB
, 2, 2)));
1641 hkl_gui_window_treeview_crystals_cursor_changed_cb (GtkTreeView
* _sender
, gpointer user_data
)
1643 GtkTreePath
* path
= NULL
;
1644 GtkTreeViewColumn
* column
= NULL
;
1645 GtkTreeIter iter
= {0};
1647 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1648 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1651 g_return_if_fail (user_data
!= NULL
);
1653 gtk_tree_view_get_cursor (priv
->_treeview_crystals
, &path
, &column
);
1655 if (gtk_tree_model_get_iter (GTK_TREE_MODEL(priv
->_liststore_crystals
),
1656 &iter
, path
) == TRUE
){
1657 gtk_tree_model_get (GTK_TREE_MODEL(priv
->_liststore_crystals
),
1659 SAMPLE_COL_SAMPLE
, &sample
,
1663 priv
->sample
= sample
;
1664 diffractometer_engine_list_init(priv
->diffractometer
,
1666 update_reflections(self
);
1667 update_lattice(self
);
1668 update_reciprocal_lattice (self
);
1669 update_ux_uy_uz (self
);
1671 update_pseudo_axes (self
);
1672 update_pseudo_axes_frames (self
);
1675 gtk_tree_path_free (path
);
1682 _add_sample(HklGuiWindow
*self
, HklSample
*sample
)
1684 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1685 GtkTreeIter iter
= {0};
1686 const HklLattice
*lattice
;
1687 gdouble a
, b
, c
, alpha
, beta
, gamma
;
1689 g_return_val_if_fail (self
!= NULL
, iter
);
1691 lattice
= hkl_sample_lattice_get(sample
);
1692 a
= hkl_parameter_value_unit_get(hkl_lattice_a_get(lattice
));
1693 b
= hkl_parameter_value_unit_get(hkl_lattice_b_get(lattice
));
1694 c
= hkl_parameter_value_unit_get(hkl_lattice_c_get(lattice
));
1695 alpha
= hkl_parameter_value_unit_get(hkl_lattice_alpha_get(lattice
));
1696 beta
= hkl_parameter_value_unit_get(hkl_lattice_beta_get(lattice
));
1697 gamma
= hkl_parameter_value_unit_get(hkl_lattice_gamma_get(lattice
));
1699 gtk_list_store_insert_with_values(priv
->_liststore_crystals
,
1701 SAMPLE_COL_SAMPLE
, sample
,
1702 SAMPLE_COL_NAME
, hkl_sample_name_get(sample
),
1706 SAMPLE_COL_ALPHA
, alpha
,
1707 SAMPLE_COL_BETA
, beta
,
1708 SAMPLE_COL_GAMMA
, gamma
,
1714 set_up_tree_view_crystals (HklGuiWindow
* self
)
1716 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1717 GtkTreeIter iter
= {0};
1718 GtkTreePath
*path
= NULL
;
1720 g_return_if_fail (self
!= NULL
);
1722 iter
= _add_sample(self
, priv
->sample
);
1724 path
= gtk_tree_model_get_path(GTK_TREE_MODEL(priv
->_liststore_crystals
),
1727 gtk_tree_view_set_cursor(priv
->_treeview_crystals
, path
, NULL
, FALSE
);
1729 gtk_tree_path_free(path
);
1733 _add_sample_and_edit_name(HklGuiWindow
*self
, HklSample
*sample
)
1735 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1736 GtkTreeIter iter
= {0};
1737 GtkTreePath
* path
= NULL
;
1738 GtkTreeViewColumn
* column
= NULL
;
1740 iter
= _add_sample(self
, sample
);
1742 path
= gtk_tree_model_get_path(GTK_TREE_MODEL(priv
->_liststore_crystals
),
1744 column
= gtk_tree_view_get_column (priv
->_treeview_crystals
, 0);
1745 gtk_tree_view_set_cursor (priv
->_treeview_crystals
, path
, column
, TRUE
);
1747 gtk_tree_path_free(path
);
1751 hkl_gui_window_toolbutton_add_crystal_clicked_cb (GtkToolButton
* _sender
, gpointer user_data
)
1753 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1754 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1757 g_return_if_fail (user_data
!= NULL
);
1759 sample
= hkl_sample_new ("new");
1761 _add_sample_and_edit_name(self
, sample
);
1765 hkl_gui_window_toolbutton_copy_crystal_clicked_cb (GtkToolButton
* _sender
, gpointer user_data
)
1767 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1768 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1769 HklSample
*copy
= NULL
;
1771 g_return_if_fail (self
!= NULL
);
1774 copy
= hkl_sample_new_copy(priv
->sample
);
1776 _add_sample_and_edit_name(self
, copy
);
1778 gtk_statusbar_push (priv
->_statusbar
, (guint
) 0, "Please select a crystal to copy.");
1782 hkl_gui_window_toolbutton_del_crystal_clicked_cb (GtkToolButton
* _sender
, gpointer user_data
)
1784 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1785 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1787 g_return_if_fail (user_data
!= NULL
);
1789 if (priv
->sample
!= NULL
) {
1792 n_rows
= gtk_tree_model_iter_n_children(GTK_TREE_MODEL(priv
->_liststore_crystals
),
1797 GtkTreeIter iter
= {0};
1798 GtkTreePath
*path
= NULL
;
1799 GtkTreeViewColumn
*column
= NULL
;
1801 gtk_tree_view_get_cursor(priv
->_treeview_crystals
,
1804 if (gtk_tree_model_get_iter (GTK_TREE_MODEL(priv
->_liststore_crystals
),
1805 &iter
, path
) == TRUE
) {
1806 gtk_tree_path_free(path
);
1808 hkl_sample_free(priv
->sample
);
1809 if (gtk_list_store_remove(priv
->_liststore_crystals
,
1811 path
= gtk_tree_model_get_path(GTK_TREE_MODEL(priv
->_liststore_crystals
),
1813 gtk_tree_view_set_cursor(priv
->_treeview_crystals
,
1822 #define get_lattice_parameter(lattice, parameter) do{ \
1823 HklParameter *p = hkl_parameter_new_copy(hkl_lattice_## parameter ##_get(lattice)); \
1824 hkl_parameter_min_max_unit_set(p, \
1825 gtk_spin_button_get_value(priv->_spinbutton_## parameter ##_min), \
1826 gtk_spin_button_get_value(priv->_spinbutton_## parameter ##_max)); \
1827 hkl_parameter_fit_set(p, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->_checkbutton_## parameter))); \
1828 hkl_lattice_## parameter ##_set(lattice, p); \
1829 hkl_parameter_free(p); \
1832 #define get_ux_uy_uz(sample, parameter) do { \
1834 p = hkl_parameter_new_copy(hkl_sample_## parameter ##_get(sample)); \
1835 hkl_parameter_value_unit_set(p, \
1836 gtk_spin_button_get_value (priv->_spinbutton_## parameter), \
1838 hkl_parameter_fit_set(p, \
1839 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(priv->_checkbutton_## parameter))); \
1840 hkl_sample_## parameter ##_set(sample, p); \
1841 hkl_parameter_free(p); \
1846 _update_crystal_model(GtkTreeModel
*model
,
1851 HklGuiWindow
*self
= HKL_GUI_WINDOW(data
);
1852 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(data
);
1853 HklSample
*sample
= NULL
;
1855 gtk_tree_model_get(model
, iter
,
1856 SAMPLE_COL_SAMPLE
, &sample
,
1858 if(priv
->sample
== sample
){
1859 const HklLattice
*lattice
;
1860 gdouble a
, b
, c
, alpha
, beta
, gamma
;
1862 lattice
= hkl_sample_lattice_get(sample
);
1863 a
= hkl_parameter_value_unit_get(hkl_lattice_a_get(lattice
));
1864 b
= hkl_parameter_value_unit_get(hkl_lattice_b_get(lattice
));
1865 c
= hkl_parameter_value_unit_get(hkl_lattice_c_get(lattice
));
1866 alpha
= hkl_parameter_value_unit_get(hkl_lattice_alpha_get(lattice
));
1867 beta
= hkl_parameter_value_unit_get(hkl_lattice_beta_get(lattice
));
1868 gamma
= hkl_parameter_value_unit_get(hkl_lattice_gamma_get(lattice
));
1870 gtk_list_store_set(priv
->_liststore_crystals
,
1872 SAMPLE_COL_NAME
, hkl_sample_name_get(sample
),
1876 SAMPLE_COL_ALPHA
, alpha
,
1877 SAMPLE_COL_BETA
, beta
,
1878 SAMPLE_COL_GAMMA
, gamma
,
1880 diffractometer_get_pseudo(priv
->diffractometer
);
1888 update_crystal_model(HklGuiWindow
*self
)
1890 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
1892 gtk_tree_model_foreach(GTK_TREE_MODEL(priv
->_liststore_crystals
),
1893 _update_crystal_model
,
1897 /* apply crystal parameters */
1899 hkl_gui_window_button2_clicked_cb (GtkButton
* _sender
, gpointer user_data
)
1901 HklGuiWindow
*self
= HKL_GUI_WINDOW(user_data
);
1902 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(user_data
);
1904 g_return_if_fail (self
!= NULL
);
1906 if (priv
->sample
!= NULL
) {
1907 gdouble a
, b
, c
, alpha
, beta
, gamma
;
1909 HklLattice
*lattice
;
1912 fprintf(stderr
, "%s\n", __func__
);
1913 /* lattice parameters */
1914 a
= gtk_spin_button_get_value (priv
->_spinbutton_a
);
1915 b
= gtk_spin_button_get_value (priv
->_spinbutton_b
);
1916 c
= gtk_spin_button_get_value (priv
->_spinbutton_c
);
1917 alpha
= gtk_spin_button_get_value (priv
->_spinbutton_alpha
);
1918 beta
= gtk_spin_button_get_value (priv
->_spinbutton_beta
);
1919 gamma
= gtk_spin_button_get_value (priv
->_spinbutton_gamma
);
1921 lattice
= hkl_lattice_new(a
, b
, c
,
1922 alpha
* HKL_DEGTORAD
,
1923 beta
* HKL_DEGTORAD
,
1924 gamma
* HKL_DEGTORAD
);
1926 get_lattice_parameter(lattice
, a
);
1927 get_lattice_parameter(lattice
, b
);
1928 get_lattice_parameter(lattice
, c
);
1929 get_lattice_parameter(lattice
, alpha
);
1930 get_lattice_parameter(lattice
, beta
);
1931 get_lattice_parameter(lattice
, gamma
);
1933 hkl_sample_lattice_set(priv
->sample
, lattice
);
1935 hkl_lattice_free(lattice
);
1938 get_ux_uy_uz(priv
->sample
, ux
);
1939 get_ux_uy_uz(priv
->sample
, uy
);
1940 get_ux_uy_uz(priv
->sample
, uz
);
1942 update_crystal_model (self
);
1943 update_reciprocal_lattice (self
);
1945 update_pseudo_axes (self
);
1946 update_pseudo_axes_frames (self
);
1955 static void _hkl_gui_window_on_spinbutton_lambda_value_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
1957 hkl_gui_window_on_spinbutton_lambda_value_changed (self);
1962 static void _hkl_gui_window_on_spinbutton_uxuyuz_value_changed_gtk_spin_button_value_changed (GtkSpinButton* _sender, gpointer self) {
1964 hkl_gui_window_on_spinbutton_uxuyuz_value_changed (self);
1969 static void _hkl_gui_window_on_checkbutton_a_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1971 hkl_gui_window_on_checkbutton_a_toggled (self);
1976 static void _hkl_gui_window_on_checkbutton_b_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1978 hkl_gui_window_on_checkbutton_b_toggled (self);
1983 static void _hkl_gui_window_on_checkbutton_c_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1985 hkl_gui_window_on_checkbutton_c_toggled (self);
1990 static void _hkl_gui_window_on_checkbutton_alpha_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1992 hkl_gui_window_on_checkbutton_alpha_toggled (self);
1997 static void _hkl_gui_window_on_checkbutton_beta_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
1999 hkl_gui_window_on_checkbutton_beta_toggled (self);
2004 static void _hkl_gui_window_on_checkbutton_gamma_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
2006 hkl_gui_window_on_checkbutton_gamma_toggled (self);
2011 static void _hkl_gui_window_on_checkbutton_Ux_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
2013 hkl_gui_window_on_checkbutton_Ux_toggled (self);
2018 static void _hkl_gui_window_on_checkbutton_Uy_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
2020 hkl_gui_window_on_checkbutton_Uy_toggled (self);
2025 static void _hkl_gui_window_on_checkbutton_Uz_toggled_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
2027 hkl_gui_window_on_checkbutton_Uz_toggled (self);
2032 static void _hkl_gui_window_on_tree_view_pseudo_axes_cursor_changed_gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self) {
2034 hkl_gui_window_on_tree_view_pseudo_axes_cursor_changed (self);
2039 static gboolean _hkl_gui_window_on_tree_view_crystals_key_press_event_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
2041 result = hkl_gui_window_on_tree_view_crystals_key_press_event (event, self);
2050 static void _hkl_gui_window_on_toolbutton_setUB_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
2052 hkl_gui_window_on_toolbutton_setUB_clicked (self);
2057 static void _hkl_gui_window_on_toolbutton_computeUB_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
2059 hkl_gui_window_on_toolbutton_computeUB_clicked (self);
2064 static void _hkl_gui_window_on_toolbutton_affiner_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
2066 hkl_gui_window_on_toolbutton_affiner_clicked (self);
2071 static void _hkl_gui_window_on_menuitem5_activate_gtk_menu_item_activate (GtkMenuItem* _sender, gpointer self) {
2073 hkl_gui_window_on_menuitem5_activate (self);
2078 static void _hkl_gui_window_on_button1_clicked_gtk_button_clicked (GtkButton* _sender, gpointer self) {
2080 hkl_gui_window_on_button1_clicked (self);
2085 static void _hkl_gui_window_on_combobox1_changed_gtk_combo_box_changed (GtkComboBox* _sender, gpointer self) {
2087 hkl_gui_window_on_combobox1_changed (self);
2090 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) {
2092 hkl_gui_window_on_cell_tree_view_pseudo_axes_is_initialized_toggled (path, self);
2099 static void _hkl_gui_window_on_tree_view1_cursor_changed_gtk_tree_view_cursor_changed (GtkTreeView* _sender, gpointer self) {
2101 hkl_gui_window_on_tree_view1_cursor_changed (self);
2111 static void hkl_gui_window_set_up_3D (HklGuiWindow* self) {
2112 HklGeometry* _tmp0_;
2113 HklGeometryConfig* _tmp1_;
2114 HklGeometryType _tmp2_;
2116 HklGui3DFrame* _tmp8_;
2117 GtkFrame* _tmp9_ = NULL;
2121 g_return_if_fail (self != NULL);
2123 _tmp0_ = priv->geometry;
2125 _tmp1_ = _tmp0_->config;
2127 _tmp2_ = (*_tmp1_).type;
2131 case HKL_GEOMETRY_TYPE_KAPPA6C:
2134 HklGeometry* _tmp3_;
2135 HklGui3DFrame* _tmp4_;
2137 _tmp3_ = priv->geometry;
2139 _tmp4_ = hkl_gui_3d_frame_new ("../data/diffabs.yaml", _tmp3_);
2141 _g_object_unref0 (priv->Frame3D);
2143 priv->Frame3D = _tmp4_;
2149 case HKL_GEOMETRY_TYPE_KAPPA4C_VERTICAL:
2152 HklGeometry* _tmp5_;
2153 HklGui3DFrame* _tmp6_;
2155 _tmp5_ = priv->geometry;
2157 _tmp6_ = hkl_gui_3d_frame_new ("../data/cristal4C.yaml", _tmp5_);
2159 _g_object_unref0 (priv->Frame3D);
2161 priv->Frame3D = _tmp6_;
2172 _tmp7_ = priv->_vbox7;
2174 _tmp8_ = priv->Frame3D;
2176 _tmp9_ = hkl_gui_3d_frame_frame (_tmp8_);
2180 gtk_box_pack_start ((GtkBox*) _tmp7_, (GtkWidget*) _tmp10_, TRUE, TRUE, (guint) 0);
2182 _g_object_unref0 (_tmp10_);
2184 _tmp11_ = priv->_vbox7;
2186 gtk_widget_show_all ((GtkWidget*) _tmp11_);
2194 static void hkl_gui_window_on_spinbutton_lambda_value_changed (HklGuiWindow* self) {
2195 HklGeometry* _tmp0_;
2196 GtkSpinButton* _tmp1_;
2197 gdouble _tmp2_ = 0.0;
2199 g_return_if_fail (self != NULL);
2201 _tmp0_ = priv->geometry;
2203 _tmp1_ = priv->_spinbutton_lambda;
2205 _tmp2_ = gtk_spin_button_get_value (_tmp1_);
2207 _tmp0_->source.wave_length = _tmp2_;
2209 hkl_gui_window_update_pseudo_axes (self);
2211 hkl_gui_window_update_pseudo_axes_frames (self);
2216 static void hkl_gui_window_on_spinbutton_uxuyuz_value_changed (HklGuiWindow* self) {
2218 g_return_if_fail (self != NULL);
2225 static void hkl_gui_window_on_checkbutton_a_toggled (HklGuiWindow* self) {
2226 HklSampleList* _tmp0_;
2231 g_return_if_fail (self != NULL);
2233 _tmp0_ = priv->samples;
2235 _tmp1_ = _tmp0_->current;
2241 if (_tmp2_ != NULL) {
2245 HklParameter* _tmp5_;
2246 GtkCheckButton* _tmp6_;
2247 gboolean _tmp7_ = FALSE;
2251 _tmp4_ = _tmp3_->lattice;
2255 _tmp6_ = priv->_checkbutton_a;
2257 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
2259 (*_tmp5_).fit = _tmp7_;
2265 static void hkl_gui_window_on_checkbutton_b_toggled (HklGuiWindow* self) {
2266 HklSampleList* _tmp0_;
2271 g_return_if_fail (self != NULL);
2273 _tmp0_ = priv->samples;
2275 _tmp1_ = _tmp0_->current;
2281 if (_tmp2_ != NULL) {
2285 HklParameter* _tmp5_;
2286 GtkCheckButton* _tmp6_;
2287 gboolean _tmp7_ = FALSE;
2291 _tmp4_ = _tmp3_->lattice;
2295 _tmp6_ = priv->_checkbutton_b;
2297 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
2299 (*_tmp5_).fit = _tmp7_;
2305 static void hkl_gui_window_on_checkbutton_c_toggled (HklGuiWindow* self) {
2306 HklSampleList* _tmp0_;
2311 g_return_if_fail (self != NULL);
2313 _tmp0_ = priv->samples;
2315 _tmp1_ = _tmp0_->current;
2321 if (_tmp2_ != NULL) {
2325 HklParameter* _tmp5_;
2326 GtkCheckButton* _tmp6_;
2327 gboolean _tmp7_ = FALSE;
2331 _tmp4_ = _tmp3_->lattice;
2335 _tmp6_ = priv->_checkbutton_c;
2337 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
2339 (*_tmp5_).fit = _tmp7_;
2345 static void hkl_gui_window_on_checkbutton_alpha_toggled (HklGuiWindow* self) {
2346 HklSampleList* _tmp0_;
2351 g_return_if_fail (self != NULL);
2353 _tmp0_ = priv->samples;
2355 _tmp1_ = _tmp0_->current;
2361 if (_tmp2_ != NULL) {
2365 HklParameter* _tmp5_;
2366 GtkCheckButton* _tmp6_;
2367 gboolean _tmp7_ = FALSE;
2371 _tmp4_ = _tmp3_->lattice;
2373 _tmp5_ = _tmp4_->alpha;
2375 _tmp6_ = priv->_checkbutton_alpha;
2377 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
2379 (*_tmp5_).fit = _tmp7_;
2385 static void hkl_gui_window_on_checkbutton_beta_toggled (HklGuiWindow* self) {
2386 HklSampleList* _tmp0_;
2391 g_return_if_fail (self != NULL);
2393 _tmp0_ = priv->samples;
2395 _tmp1_ = _tmp0_->current;
2401 if (_tmp2_ != NULL) {
2405 HklParameter* _tmp5_;
2406 GtkCheckButton* _tmp6_;
2407 gboolean _tmp7_ = FALSE;
2411 _tmp4_ = _tmp3_->lattice;
2413 _tmp5_ = _tmp4_->beta;
2415 _tmp6_ = priv->_checkbutton_beta;
2417 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
2419 (*_tmp5_).fit = _tmp7_;
2425 static void hkl_gui_window_on_checkbutton_gamma_toggled (HklGuiWindow* self) {
2426 HklSampleList* _tmp0_;
2431 g_return_if_fail (self != NULL);
2433 _tmp0_ = priv->samples;
2435 _tmp1_ = _tmp0_->current;
2441 if (_tmp2_ != NULL) {
2445 HklParameter* _tmp5_;
2446 GtkCheckButton* _tmp6_;
2447 gboolean _tmp7_ = FALSE;
2451 _tmp4_ = _tmp3_->lattice;
2453 _tmp5_ = _tmp4_->gamma;
2455 _tmp6_ = priv->_checkbutton_gamma;
2457 _tmp7_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp6_);
2459 (*_tmp5_).fit = _tmp7_;
2465 static void hkl_gui_window_on_checkbutton_Ux_toggled (HklGuiWindow* self) {
2466 HklSampleList* _tmp0_;
2471 g_return_if_fail (self != NULL);
2473 _tmp0_ = priv->samples;
2475 _tmp1_ = _tmp0_->current;
2481 if (_tmp2_ != NULL) {
2484 HklParameter* _tmp4_;
2485 GtkCheckButton* _tmp5_;
2486 gboolean _tmp6_ = FALSE;
2490 _tmp4_ = _tmp3_->ux;
2492 _tmp5_ = priv->_checkbutton_Ux;
2494 _tmp6_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp5_);
2496 (*_tmp4_).fit = _tmp6_;
2502 static void hkl_gui_window_on_checkbutton_Uy_toggled (HklGuiWindow* self) {
2503 HklSampleList* _tmp0_;
2508 g_return_if_fail (self != NULL);
2510 _tmp0_ = priv->samples;
2512 _tmp1_ = _tmp0_->current;
2518 if (_tmp2_ != NULL) {
2521 HklParameter* _tmp4_;
2522 GtkCheckButton* _tmp5_;
2523 gboolean _tmp6_ = FALSE;
2527 _tmp4_ = _tmp3_->uy;
2529 _tmp5_ = priv->_checkbutton_Uy;
2531 _tmp6_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp5_);
2533 (*_tmp4_).fit = _tmp6_;
2539 static void hkl_gui_window_on_checkbutton_Uz_toggled (HklGuiWindow* self) {
2540 HklSampleList* _tmp0_;
2545 g_return_if_fail (self != NULL);
2547 _tmp0_ = priv->samples;
2549 _tmp1_ = _tmp0_->current;
2555 if (_tmp2_ != NULL) {
2558 HklParameter* _tmp4_;
2559 GtkCheckButton* _tmp5_;
2560 gboolean _tmp6_ = FALSE;
2564 _tmp4_ = _tmp3_->uz;
2566 _tmp5_ = priv->_checkbutton_Uz;
2568 _tmp6_ = gtk_toggle_button_get_active ((GtkToggleButton*) _tmp5_);
2570 (*_tmp4_).fit = _tmp6_;
2575 static void hkl_gui_window_on_cell_tree_view_pseudo_axes_is_initialized_toggled (const gchar* path, HklGuiWindow* self) {
2576 GtkTreeModel* model = NULL;
2577 GtkTreeIter iter = {0};
2578 HklPseudoAxis* pseudoAxis = NULL;
2579 gboolean old_flag = FALSE;
2580 GtkTreeView* _tmp0_;
2581 GtkTreeModel* _tmp1_ = NULL;
2582 GtkTreeModel* _tmp2_;
2583 GtkTreeModel* _tmp3_;
2584 const gchar* _tmp4_;
2585 GtkTreeIter _tmp5_ = {0};
2586 GtkTreeModel* _tmp6_;
2590 g_return_if_fail (self != NULL);
2592 g_return_if_fail (path != NULL);
2594 _tmp0_ = priv->_treeview_pseudo_axes;
2596 _tmp1_ = gtk_tree_view_get_model (_tmp0_);
2598 _tmp2_ = _g_object_ref0 (_tmp1_);
2600 _g_object_unref0 (model);
2608 gtk_tree_model_get_iter_from_string (_tmp3_, &_tmp5_, _tmp4_);
2616 gtk_tree_model_get (_tmp6_, &_tmp7_, PSEUDO_AXIS_COL_PSEUDOAXIS, &pseudoAxis, PSEUDO_AXIS_COL_INITIALIZED, &old_flag, -1);
2622 HklPseudoAxis* _tmp9_;
2623 HklPseudoAxisEngine* _tmp10_;
2624 gboolean _tmp11_ = FALSE;
2626 _tmp9_ = pseudoAxis;
2628 _tmp10_ = _tmp9_->engine;
2630 _tmp11_ = hkl_pseudo_axis_engine_initialize (_tmp10_, NULL);
2634 hkl_gui_window_update_pseudo_axes (self);
2639 _g_object_unref0 (model);
2643 static void hkl_gui_window_on_toolbutton_setUB_clicked (HklGuiWindow* self) {
2644 HklSampleList* _tmp0_;
2647 g_return_if_fail (self != NULL);
2649 _tmp0_ = priv->samples;
2651 _tmp1_ = _tmp0_->current;
2653 if (_tmp1_ != NULL) {
2656 HklSampleList* _tmp2_;
2658 HklMatrix _tmp4_ = {0};
2661 gint _tmp6__length1;
2663 gint _tmp7__length1;
2664 GtkSpinButton* _tmp8_;
2665 gdouble _tmp9_ = 0.0;
2669 gint _tmp12__length1;
2671 gint _tmp13__length1;
2672 GtkSpinButton* _tmp14_;
2673 gdouble _tmp15_ = 0.0;
2677 gint _tmp18__length1;
2679 gint _tmp19__length1;
2680 GtkSpinButton* _tmp20_;
2681 gdouble _tmp21_ = 0.0;
2685 gint _tmp24__length1;
2687 gint _tmp25__length1;
2688 GtkSpinButton* _tmp26_;
2689 gdouble _tmp27_ = 0.0;
2693 gint _tmp30__length1;
2695 gint _tmp31__length1;
2696 GtkSpinButton* _tmp32_;
2697 gdouble _tmp33_ = 0.0;
2701 gint _tmp36__length1;
2703 gint _tmp37__length1;
2704 GtkSpinButton* _tmp38_;
2705 gdouble _tmp39_ = 0.0;
2709 gint _tmp42__length1;
2711 gint _tmp43__length1;
2712 GtkSpinButton* _tmp44_;
2713 gdouble _tmp45_ = 0.0;
2717 gint _tmp48__length1;
2719 gint _tmp49__length1;
2720 GtkSpinButton* _tmp50_;
2721 gdouble _tmp51_ = 0.0;
2725 gint _tmp54__length1;
2727 gint _tmp55__length1;
2728 GtkSpinButton* _tmp56_;
2729 gdouble _tmp57_ = 0.0;
2731 HklSampleList* _tmp59_;
2733 HklSampleList* _tmp61_;
2736 HklSampleList* _tmp64_;
2739 _tmp2_ = priv->samples;
2741 _tmp3_ = _tmp2_->current;
2743 hkl_sample_get_UB (_tmp3_, &_tmp4_);
2751 _tmp6_ = _tmp5_.data;
2753 _tmp6__length1 = -1;
2757 _tmp7__length1 = -1;
2759 _tmp8_ = priv->_spinbutton_U11;
2761 _tmp9_ = gtk_spin_button_get_value (_tmp8_);
2765 _tmp10_ = _tmp7_[0];
2769 _tmp12_ = _tmp11_.data;
2771 _tmp12__length1 = -1;
2773 _tmp13_ = _tmp12_[0];
2775 _tmp13__length1 = -1;
2777 _tmp14_ = priv->_spinbutton_U12;
2779 _tmp15_ = gtk_spin_button_get_value (_tmp14_);
2781 _tmp13_[1] = _tmp15_;
2783 _tmp16_ = _tmp13_[1];
2787 _tmp18_ = _tmp17_.data;
2789 _tmp18__length1 = -1;
2791 _tmp19_ = _tmp18_[0];
2793 _tmp19__length1 = -1;
2795 _tmp20_ = priv->_spinbutton_U13;
2797 _tmp21_ = gtk_spin_button_get_value (_tmp20_);
2799 _tmp19_[2] = _tmp21_;
2801 _tmp22_ = _tmp19_[2];
2805 _tmp24_ = _tmp23_.data;
2807 _tmp24__length1 = -1;
2809 _tmp25_ = _tmp24_[1];
2811 _tmp25__length1 = -1;
2813 _tmp26_ = priv->_spinbutton_U21;
2815 _tmp27_ = gtk_spin_button_get_value (_tmp26_);
2817 _tmp25_[0] = _tmp27_;
2819 _tmp28_ = _tmp25_[0];
2823 _tmp30_ = _tmp29_.data;
2825 _tmp30__length1 = -1;
2827 _tmp31_ = _tmp30_[1];
2829 _tmp31__length1 = -1;
2831 _tmp32_ = priv->_spinbutton_U22;
2833 _tmp33_ = gtk_spin_button_get_value (_tmp32_);
2835 _tmp31_[1] = _tmp33_;
2837 _tmp34_ = _tmp31_[1];
2841 _tmp36_ = _tmp35_.data;
2843 _tmp36__length1 = -1;
2845 _tmp37_ = _tmp36_[1];
2847 _tmp37__length1 = -1;
2849 _tmp38_ = priv->_spinbutton_U23;
2851 _tmp39_ = gtk_spin_button_get_value (_tmp38_);
2853 _tmp37_[2] = _tmp39_;
2855 _tmp40_ = _tmp37_[2];
2859 _tmp42_ = _tmp41_.data;
2861 _tmp42__length1 = -1;
2863 _tmp43_ = _tmp42_[2];
2865 _tmp43__length1 = -1;
2867 _tmp44_ = priv->_spinbutton_U31;
2869 _tmp45_ = gtk_spin_button_get_value (_tmp44_);
2871 _tmp43_[0] = _tmp45_;
2873 _tmp46_ = _tmp43_[0];
2877 _tmp48_ = _tmp47_.data;
2879 _tmp48__length1 = -1;
2881 _tmp49_ = _tmp48_[2];
2883 _tmp49__length1 = -1;
2885 _tmp50_ = priv->_spinbutton_U32;
2887 _tmp51_ = gtk_spin_button_get_value (_tmp50_);
2889 _tmp49_[1] = _tmp51_;
2891 _tmp52_ = _tmp49_[1];
2895 _tmp54_ = _tmp53_.data;
2897 _tmp54__length1 = -1;
2899 _tmp55_ = _tmp54_[2];
2901 _tmp55__length1 = -1;
2903 _tmp56_ = priv->_spinbutton_U33;
2905 _tmp57_ = gtk_spin_button_get_value (_tmp56_);
2907 _tmp55_[2] = _tmp57_;
2909 _tmp58_ = _tmp55_[2];
2911 _tmp59_ = priv->samples;
2913 _tmp60_ = _tmp59_->current;
2915 hkl_sample_set_UB (_tmp60_, &UB);
2917 _tmp61_ = priv->samples;
2919 _tmp62_ = _tmp61_->current;
2923 hkl_sample_fprintf (_tmp63_, _tmp62_);
2925 hkl_gui_window_update_lattice (self);
2927 hkl_gui_window_update_lattice_parameters (self);
2929 hkl_gui_window_update_reciprocal_lattice (self);
2931 _tmp64_ = priv->samples;
2933 _tmp65_ = _tmp64_->current;
2935 hkl_gui_window_update_crystal_model (self, _tmp65_);
2937 hkl_gui_window_update_UB (self);
2939 hkl_gui_window_update_UxUyUz (self);
2941 hkl_gui_window_update_pseudo_axes (self);
2943 hkl_gui_window_update_pseudo_axes_frames (self);
2951 static void hkl_gui_window_on_toolbutton_computeUB_clicked (HklGuiWindow* self) {
2952 HklSampleList* _tmp0_;
2957 g_return_if_fail (self != NULL);
2959 _tmp0_ = priv->samples;
2961 _tmp1_ = _tmp0_->current;
2967 if (_tmp2_ != NULL) {
2973 hkl_sample_compute_UB_busing_levy (_tmp3_, (gsize) 0, (gsize) 1);
2975 hkl_gui_window_update_UB (self);
2977 hkl_gui_window_update_UxUyUz (self);
2979 hkl_gui_window_update_pseudo_axes (self);
2981 hkl_gui_window_update_pseudo_axes_frames (self);
2987 static void hkl_gui_window_on_toolbutton_affiner_clicked (HklGuiWindow* self) {
2988 HklSampleList* _tmp0_;
2994 g_return_if_fail (self != NULL);
2996 _tmp0_ = priv->samples;
2998 _tmp1_ = _tmp0_->current;
3004 if (_tmp2_ != NULL) {
3010 hkl_sample_affine (_tmp3_);
3016 hkl_gui_window_update_crystal_model (self, _tmp4_);
3018 hkl_gui_window_update_lattice (self);
3020 hkl_gui_window_update_reciprocal_lattice (self);
3022 hkl_gui_window_update_UB (self);
3024 hkl_gui_window_update_UxUyUz (self);
3031 static gboolean hkl_gui_window_on_tree_view_crystals_key_press_event (GdkEventKey* event, HklGuiWindow* self) {
3032 gboolean result = FALSE;
3034 g_return_val_if_fail (self != NULL, FALSE);
3036 g_return_val_if_fail (event != NULL, FALSE);
3045 static void hkl_gui_window_on_menuitem5_activate (HklGuiWindow* self) {
3048 g_return_if_fail (self != NULL);
3050 _tmp0_ = priv->_dialog1;
3052 gtk_widget_show ((GtkWidget*) _tmp0_);
3057 void hkl_gui_window_on_button1_clicked (HklGuiWindow* self) {
3060 g_return_if_fail (self != NULL);
3062 _tmp0_ = priv->_dialog1;
3064 gtk_widget_hide ((GtkWidget*) _tmp0_);
3071 hkl_gui_window_class_init (HklGuiWindowClass
*class)
3073 GObjectClass
*gobject_class
= G_OBJECT_CLASS (class);
3075 g_type_class_add_private (class, sizeof (HklGuiWindowPrivate
));
3077 /* virtual method */
3078 gobject_class
->finalize
= finalize
;
3082 static void hkl_gui_window_init (HklGuiWindow
* self
)
3084 HklGuiWindowPrivate
*priv
= HKL_GUI_WINDOW_GET_PRIVATE(self
);
3086 priv
->diffractometer
= NULL
;
3088 darray_init(priv
->pseudo_frames
);
3090 priv
->sample
= hkl_sample_new ("test");
3091 priv
->reciprocal
= hkl_lattice_new_default ();
3093 hkl_gui_window_get_widgets_and_objects_from_ui (self
);
3095 set_up_diffractometer_model (self
);
3097 set_up_tree_view_crystals (self
);
3100 int main (int argc
, char ** argv
)
3102 gtk_init (&argc
, &argv
);
3104 hkl_gui_window_new ();