60gchar *
action_name[5] = {
"Move",
"Replace",
"Remove",
"Insert",
"Random move"};
61gchar *
action_atoms[3] = {
"All non-selected atoms",
"All selected atoms",
"All atoms"};
75 return view -> atom_win -> visible;
89 if (this_proj -> modelgl -> coord_win)
93 gtk_window_get_position (GTK_WINDOW(this_proj -> modelgl -> coord_win -> win), &
x, &
y);
95 this_proj -> modelgl -> coord_win -> win =
destroy_this_widget (this_proj -> modelgl -> coord_win -> win);
98 gtk_window_move (GTK_WINDOW(this_proj -> modelgl -> coord_win -> win),
x ,
y);
114 if (this_proj -> modelgl -> cell_win)
116 if (this_proj -> modelgl -> cell_win -> win && ! this_proj -> modelgl -> cell_win -> slab_passivate)
118 i = gtk_notebook_get_current_page (GTK_NOTEBOOK (this_proj -> modelgl -> cell_win -> notebook));
121 gtk_window_get_position (GTK_WINDOW(this_proj -> modelgl -> cell_win -> win), &
x, &
y);
123 this_proj -> modelgl -> cell_win -> win =
destroy_this_widget (this_proj -> modelgl -> cell_win -> win);
124 this_proj -> modelgl -> cell_win -> density = NULL;
125 if (this_proj -> modelgl -> cell_win -> slab_lot) g_free (this_proj -> modelgl -> cell_win -> slab_lot);
126 this_proj -> modelgl -> cell_win -> slab_lot =
allocint (this_proj -> nspec);
127 this_proj -> modelgl -> cell_win -> slab_info = NULL;
128 if (this_proj -> natomes)
131 gtk_notebook_set_current_page (GTK_NOTEBOOK (this_proj -> modelgl -> cell_win -> notebook), i);
133 gtk_window_move (GTK_WINDOW(this_proj -> modelgl -> cell_win -> win),
x ,
y);
138 if (i < 3)
hide_the_widgets (this_proj -> modelgl -> cell_win -> slab_hbox[i]);
164 this_proj -> modelgl -> anim -> last ->
img -> box_axis[
AXIS] = this_proj -> modelgl -> atom_win -> old_axis;
165 this_proj -> modelgl -> atom_win -> win =
destroy_this_widget (this_proj -> modelgl -> atom_win -> win);
168 g_free (this_proj -> modelgl -> atom_win);
169 this_proj -> modelgl -> atom_win = NULL;
173 this_proj -> modelgl -> atom_win -> visible = FALSE;
177 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
178 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
179 this_proj -> modelgl -> create_shaders[
MAXIS] = TRUE;
180 this_proj -> modelgl -> create_shaders[
PICKS] = TRUE;
184 if (this_proj -> modelgl -> saved_coord[i] != NULL)
186 g_free (this_proj -> modelgl -> saved_coord[i]);
187 this_proj -> modelgl -> saved_coord[i] = NULL;
191 update (this_proj -> modelgl);
202G_MODULE_EXPORT
void close_edit (GtkButton * but, gpointer data)
204 int id = GPOINTER_TO_INT(data);
206 gboolean leave = (this_proj -> modelgl ->
was_moved) ?
ask_yes_no(
"Leaving without saving ?",
207 "To preserve atom(s) displacement(s) press the 'Apply' button\n"
208 "Otherwise initial atom positions will be restored ...\n"
209 "\t\t\t Are you sure to leave ?" ,
210 GTK_MESSAGE_QUESTION, this_proj -> modelgl -> atom_win -> win) : TRUE;
211 if (leave && this_proj -> modelgl -> atom_win)
221 g_free (this_proj -> modelgl -> search_widg[h]);
222 this_proj -> modelgl -> search_widg[h]= NULL;
224 this_proj -> modelgl ->
was_moved = FALSE;
238G_MODULE_EXPORT gboolean
delete_action (GtkWindow * widg, gpointer data)
249G_MODULE_EXPORT gboolean
delete_action (GtkWidget * widg, GdkEvent * event, gpointer data)
267 if (gtk_check_button_get_active (but))
279 if (gtk_toggle_button_get_active (but))
284 if (
ask_yes_no(
"Reset",
"Reset and get back to initial coordinates ?\n This will affect all atoms !",
285 GTK_MESSAGE_WARNING, this_proj -> modelgl -> atom_win -> win))
294 this_proj -> modelgl -> atom_win -> new_param[h][i][j] = this_proj -> modelgl -> edition_param[h][i][j];
295 gtk_range_set_value (GTK_RANGE(this_proj -> modelgl -> atom_win -> edit_scale[j]), this_proj -> modelgl -> atom_win -> new_param[h][i][j]);
307 update (this_proj -> modelgl);
310 gtk_check_button_set_active (but, FALSE);
312 gtk_toggle_button_set_active (but, FALSE);
325G_MODULE_EXPORT
void apply_edit (GtkButton * but, gpointer data)
327 int id = GPOINTER_TO_INT(data);
330 i = this_proj -> modelgl -> mode;
331 this_proj -> modelgl -> mode =
ANALYZE;
332 image * last = this_proj -> modelgl -> anim -> last ->
img;
333 vec4_t q = last -> rotation_quaternion;
335 last -> rotation_quaternion = q;
336 this_proj -> modelgl -> mode = i;
343 this_proj -> modelgl -> edition_param[h][i][j] = this_proj -> modelgl -> atom_win -> new_param[h][i][j];
344 this_proj -> modelgl -> atom_win -> old_param[h][i][j] = this_proj -> modelgl -> atom_win -> new_param[h][i][j];
350 g_free (this_proj -> modelgl -> saved_coord[h]);
353 this_proj -> modelgl ->
was_moved = FALSE;
367 GtkWidget * notebook = gtk_notebook_new ();
373 str = g_strdup_printf (
"<b>%s</b>",
action_name[i]);
374 gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
action_tab(i, this_proj),
markup_label(str, -1, -1, 0.0, 0.5));
394 atom_search * asearch = g_malloc0 (
sizeof*asearch);
395 asearch -> search_digit = -1;
401 asearch -> pointer[i].a =
proj;
402 asearch -> pointer[i].b =
TOLAB+i;
403 asearch -> pointer[i].c = searchid;
405 asearch -> recompute_bonding = FALSE;
420 gchar * str = g_strdup_printf (
"Model edition - %s", this_proj -> name);
421 this_proj -> modelgl ->
was_moved = FALSE;
422 GtkWidget * win =
create_win (str, this_proj -> modelgl -> win, FALSE, FALSE);
427 if (this_proj -> modelgl -> search_widg[i] == NULL)
429 this_proj -> modelgl -> search_widg[i] =
allocate_atom_search (this_proj ->
id, i, i, this_proj -> natomes);
430 this_proj -> modelgl -> search_widg[i] ->
status = (this_proj -> modelgl -> anim -> last ->
img -> selected[0] -> selected) ? 1 : 2;
435 gtk_widget_set_size_request (this_proj -> modelgl -> atom_win ->
vbox, 760, -1);
439 for (j=0; j<2; j++) this_proj -> modelgl -> rebuild[i][j] = TRUE;
441 this_proj -> modelgl -> atom_win -> notebook =
create_atom_notebook (this_proj, this_proj -> modelgl -> atom_win ->
vbox);
464 if (this_proj -> modelgl -> atom_win == NULL)
466 this_proj -> modelgl -> atom_win = g_malloc0 (
sizeof*this_proj -> modelgl -> atom_win);
467 for (i=0; i<2; i++) this_proj -> modelgl -> atom_win -> adv_bonding[i] = this_proj -> modelgl -> adv_bonding[i];
468 if (this_proj -> modelgl -> anim)
470 this_proj -> modelgl -> atom_win -> old_axis = this_proj -> modelgl -> anim -> last ->
img -> box_axis[
AXIS];
476 this_proj -> modelgl -> atom_win ->
msd =
allocfloat (this_proj -> natomes);
477 this_proj -> modelgl -> atom_win -> msd_all =
allocfloat (this_proj -> nspec);
478 this_proj -> modelgl -> atom_win ->
repeat_move = 1;
480 this_proj -> modelgl -> atom_win -> visible = visible;
485 gtk_notebook_set_current_page (GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook),
id ->
b);
490 if (this_proj -> modelgl -> search_widg[i+2] -> todo_size < 10000)
499 widget_set_sensitive (gtk_notebook_get_nth_page(GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook), i), this_proj -> natomes);
501 widget_set_sensitive (gtk_notebook_get_nth_page(GTK_NOTEBOOK (this_proj -> modelgl -> atom_win -> notebook), 3), 1);
502 if (this_proj -> modelgl -> mode ==
EDITION)
508 gtk_check_menu_item_set_active ((GtkCheckMenuItem *)this_proj -> modelgl -> ogl_mode[0], TRUE);
509 set_mode (this_proj -> modelgl -> ogl_mode[0], & this_proj -> modelgl ->
colorp[0][0]);
525G_MODULE_EXPORT
void action_window (GSimpleAction *
action, GVariant * parameter, gpointer data)
G_MODULE_EXPORT void close_edit(GtkButton *but, gpointer data)
close model edition window
void clean_atom_win(project *this_proj)
clean model edition data
void clean_coord_window(project *this_proj)
update the environment configuration window after edtion
gboolean is_atom_win_active(glwin *view)
is the model edition window visible ?
void prepare_atom_edition(gpointer data, gboolean visible)
prepare atom edition
G_MODULE_EXPORT void set_reset_transformation(GtkToggleButton *but, gpointer data)
reset model transformation toggle callback GTK3
void clean_other_window_after_edit(project *this_proj)
update other windows after model edition if required
atom_search * allocate_atom_search(int proj, int action, int searchid, int tsize)
allocate atom search data structure
GtkWidget * create_edition_window(project *this_proj)
create the model edition window
G_MODULE_EXPORT void action_window(GtkWidget *widg, gpointer data)
open model edition window callback GTK3
G_MODULE_EXPORT gboolean delete_action(GtkWidget *widg, GdkEvent *event, gpointer data)
model edition window close event callback GTK3
G_MODULE_EXPORT void apply_edit(GtkButton *but, gpointer data)
apply edition action callback
GtkWidget * create_atom_notebook(project *this_proj, GtkWidget *vbox)
create the model edition notebook
Function declarations for the mode edition window.
double ** save_coordinates(project *this_proj, int status)
save atomic coordinates
G_MODULE_EXPORT void repeat_move(GtkSpinButton *res, gpointer data)
repeat motion callback
GtkWidget * action_tab(int aid, project *this_proj)
create model edtion action tab
void init_coordinates(project *this_proj, int status, gboolean win, gboolean init)
preserve atomic coordinates
GtkWidget * create_cell_edition_window(project *this_proj, gpointer data)
create the cell editon window
void reset_coordinates(project *this_proj, int status)
reset transformation and restore saved atomic coordinates
GtkWidget * advanced_coord_properties(glwin *view, int page)
create the environments configuration window
void clean_picked_and_labelled(atom_search *asearch, gboolean clean_msd)
initialize atom search data buffers
void update_range_and_entry(project *this_proj, int i, int j, int k)
update motion range
void allocate_todo(atom_search *asearch, int tsize)
allocate the selection list data buffer
GtkWidget * builder_win(project *this_proj, gpointer data)
create crystal builder window
void init_default_shaders(glwin *view)
re-initialize the default OpenGL shaders
int * allocint(int val)
allocate an int * pointer
float * allocfloat(int val)
allocate a float * pointer
GtkWidget * create_win(gchar *str, GtkWidget *parent, gboolean modal, gboolean resiz)
create a new GtkWindow
void add_gtk_close_event(GtkWidget *widg, GCallback handler, gpointer data)
add a close event signal and callback to a GtkWidget
GtkWidget * create_button(gchar *text, int image_format, gchar *image, int dimx, int dimy, int relief, GCallback handler, gpointer data)
create a simple button
GtkWidget * markup_label(gchar *text, int dimx, int dimy, float ax, float ay)
void add_box_child_start(int orientation, GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the initial position.
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
GtkWidget * create_hbox(int spacing)
create a GtkBox with horizontal orientation
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
void add_box_child_end(GtkWidget *widg, GtkWidget *child, gboolean expand, gboolean fill, int padding)
Add a GtkWidget in a GtkBox at the end position.
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void hide_the_widgets(GtkWidget *widg)
hide GtkWidget
GtkWidget * create_vbox(int spacing)
create a GtkBox with vertical orientation
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
void update(glwin *view)
update the rendering of the OpenGL window
void init_camera(project *this_proj, int get_depth)
intialize the OpenGL camera settings
void re_create_md_shaders(int nshaders, int shaders[nshaders], project *this_proj)
re-initialize some MD dependent OpenGL shaders
shaders
The different types of shaders in the atomes program.
gboolean ask_yes_no(gchar *title, gchar *text, int type, GtkWidget *widg)
ask yes or no for something: prepare dialog
integer(kind=c_int) function msd(dlt, ndts)