69GdkPixbuf *
pix = NULL;
70GtkWidget *
img = NULL;
73GtkWidget *
lab = NULL;
74GtkWidget *
lap = NULL;
75GtkWidget *
eap = NULL;
97 "S(q) from Debye equation ",
98 "g(r) from FFT[S(q) Debye]",
99 "Bonding information ",
100 "Angle distribution ",
103 "Spherical harmonics ",
104 "Mean Square Displacement "};
118 GtkTreeIter steplevel;
119 GtkTreeIter optslevel;
129 gtk_tree_store_set (store, &
piter[i], 0,
THETD, 1, tmp, 2, -1, -1);
130 prpath[i] = gtk_tree_model_get_path (GTK_TREE_MODEL(store), &
piter[i]);
132 gtk_tree_store_append (store, & steplevel, &
piter[i]);
135 gtk_tree_store_append (store, & steplevel, &
piter[i]);
142 gtk_tree_store_append (store, & steplevel, &
piter[i]);
144 for (j=0; j<
NCALCS-2; j++)
148 gtk_tree_store_append (store, & optslevel, & steplevel);
149 gtk_tree_store_set (store, & optslevel, 0, gdk_pixbuf_new_from_file(
graph_img[j], NULL), 1,
work_menu_items[4+j], 2, j, -1);
152 gtk_tree_view_expand_to_path (GTK_TREE_VIEW(
worktree), gtk_tree_model_get_path(GTK_TREE_MODEL(store), &
worklevel));
163static void fill_workspace (GtkTreeStore * store)
167 gtk_tree_store_append (store, &
worklevel, NULL);
193 int id = GPOINTER_TO_INT (data);
201 gchar * tmp = g_strdup_printf (
"<b>%s</b>",
active_project -> name);
218 GtkTreeModel *
model = gtk_tree_view_get_model (treeview);
219 if (gtk_tree_model_get_iter (
model, & iter,
path))
221 gtk_tree_model_get (
model, & iter, 2, & i, -1);
242 if (gtk_tree_path_compare (
prpath[j],
path) <= 0) i = j;
264 GtkTreeViewColumn *
col,
268 GtkTreeModel *
model;
270 model = gtk_tree_view_get_model (treeview);
271 gboolean was = FALSE;
273 g_debug (
"WORKSPACE_ONDC: activep= %d",
activep);
275 if (gtk_tree_model_get_iter (
model, & iter,
path))
278 g_debug (
"WORKSPACE_ONDC: in workspace");
282 if (gtk_tree_path_compare (
path,
prpath[i]) == 0)
291 g_debug (
"WORKSPACE_ONDC: not an activation");
298 g_debug (
"WORKSPACE_ONDC: saving old data");
301 witer = gtk_tree_iter_copy (& iter);
302 gtk_tree_model_get (
model, & iter, 1, &
wchar, -1);
304 g_debug (
"WORKSPACE_ONDC: modifying data");
306 gchar * tmp = g_strdup_printf (
"<b>%s</b>",
wchar);
307 gtk_tree_store_set (GTK_TREE_STORE(
model), & iter, 1, tmp, -1);
310 g_debug (
"WORKSPACE_ONDC: cleaning view");
311 g_debug (
"WORKSPACE_ONDC: wchar = %s",
wchar);
313 gtk_tree_model_get (
model, & iter, 2, & i, -1);
316 g_debug (
"WORKSPACE_ONDC: creating view id= %d", i);
320 g_debug (
"WORKSPACE_ONDC: for project= %d", j);
341 if (GTK_IS_WIDGET(win))
343 gtk_window_set_title (GTK_WINDOW (win), str);
346 if (str) g_free (str);
361 i = GPOINTER_TO_INT (edata);
362 tmp = g_strdup_printf (
"Please enter a new name for project N°%d", i);
364 tmp =
cask(tmp,
"Project name", i, this_proj -> name,
MainWindow);
367 this_proj -> name = g_strdup_printf (
"%s", tmp);
371 tmp = g_strdup_printf (
"<b>%s</b>", this_proj -> name);
377 if (this_proj -> modelgl != NULL)
379 if (this_proj -> modelgl -> win != NULL)
383 gchar * win_title[2]={
"Atom(s) configuration",
"Clone(s) configuration"};
386 if (this_proj -> modelgl -> model_win[j] != NULL)
388 correct_this_window_title (this_proj -> modelgl -> model_win[j] -> win, g_strdup_printf (
"%s - %s", win_title[j], tmp_title));
391 if (this_proj -> modelgl -> coord_win != NULL)
393 correct_this_window_title (this_proj -> modelgl -> coord_win -> win, g_strdup_printf (
"Environments configuration - %s", tmp_title));
395 if (this_proj -> modelgl -> atom_win != NULL)
399 if (this_proj -> modelgl -> cell_win != NULL)
403 if (this_proj -> modelgl -> opengl_win != NULL)
405 correct_this_window_title (this_proj -> modelgl -> opengl_win -> win, g_strdup_printf (
"OpenGL material aspect and light settings - %s", tmp_title));
407 if (this_proj -> modelgl -> spiner != NULL)
411 if (this_proj -> modelgl -> player != NULL)
413 j = this_proj -> modelgl -> anim -> last ->
img ->
step;
414 correct_this_window_title (this_proj -> modelgl -> player -> win, g_strdup_printf (
"%s - player - step %d", tmp_title, j));
416 if (this_proj -> modelgl -> measure_win != NULL)
424 if (this_proj -> initok[j])
426 for (k=0; k<this_proj -> numc[j]; k++)
428 if (this_proj -> curves[j][k] -> window != NULL)
458 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(tree), (gint)
x, (gint)
y, & mpath, NULL, NULL, NULL);
489G_MODULE_EXPORT
void workspace_popup (GtkGesture * gesture,
int n_press,
double x,
double y, gpointer data)
491 if (gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture) == GDK_BUTTON_SECONDARY)
508 if (event -> type == GDK_BUTTON_PRESS && event -> button == 3)
517 GtkCellRenderer * renderer,
522 gtk_cell_renderer_set_visible (renderer, FALSE);
532 GtkTreeViewColumn *
col;
533 GtkCellRenderer * renderer;
534 GtkTreeSelection * workselect;
537 workstore = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
543 col = gtk_tree_view_column_new ();
545 renderer = gtk_cell_renderer_pixbuf_new ();
546 gtk_tree_view_column_pack_start (
col, renderer, FALSE);
547 gtk_tree_view_column_set_attributes (
col, renderer,
"pixbuf", 0, NULL);
549 renderer = gtk_cell_renderer_text_new();
550 gtk_tree_view_column_pack_start (
col, renderer, TRUE);
551 gtk_tree_view_column_set_attributes (
col, renderer,
"markup", 1, NULL);
553 renderer = gtk_cell_renderer_text_new ();
554 gtk_tree_view_column_pack_start (
col, renderer, TRUE);
555 gtk_tree_view_column_set_attributes (
col, renderer,
"markup", 2, NULL);
558 gtk_tree_view_append_column(GTK_TREE_VIEW(
worktree),
col);
560 workselect = gtk_tree_view_get_selection (GTK_TREE_VIEW(
worktree));
561 gtk_tree_selection_set_mode (workselect, GTK_SELECTION_SINGLE);
562 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(
worktree), FALSE);
568 add_widget_gesture_and_key_action (
worktree,
"workspace-context-click", G_CALLBACK(workspace_popup), (gpointer)
worktree,
569 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
571 gtk_tree_view_expand_all (GTK_TREE_VIEW(
worktree));
601 GtkTreeIter ** tmpiter;
605 tmpiter[i] = gtk_tree_iter_copy (&
piter[i]);
613 piter[i] = * gtk_tree_iter_copy (tmpiter[i]);
617 if (tmpiter != NULL) g_free (tmpiter);
653 GtkTreeIter ** tmpiter;
675 tmpiter[j] = gtk_tree_iter_copy (&
piter[i]);
690 piter[j] = * gtk_tree_iter_copy (tmpiter[j]);
Callback declarations for main window.
Global variable declarations Global convenience function declarations Global data structure defin...
struct model model
data structure to describe the topology
gchar * graph_img[NGRAPHS]
void pop_menu_at_pointer(GtkWidget *widg, GdkEvent *event)
popup a menu at pointer location
void widget_set_sensitive(GtkWidget *widg, gboolean sensitive)
Set sensitivity for a GtkWidget, ensuring it is a GtkWidget.
GtkWidget * destroy_this_widget(GtkWidget *widg)
destroy a GtkWidget
gchar * prepare_for_title(gchar *init)
prepare a string for a window title, getting rid of all markup
void add_container_child(int type, GtkWidget *widg, GtkWidget *child)
Add a GtkWidget into another GtkWidget.
void show_the_widgets(GtkWidget *widg)
show GtkWidget
project * get_project_by_id(int p)
get project pointer using id number
void prep_model(int p)
prepare, or display, the OpenGL model window
Function declarations for the creation of the OpenGL window.
gchar * cask(char *question, char *lab, int id, char *old, GtkWidget *win)
enter a string - prepare the dialog
Messaging function declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...
void active_project_changed(int id)
change the active project
int find_calc_by_path(GtkTreeView *treeview, GtkTreePath *path)
find the calculation using the GtkTreePath in the GtkTreeView
void add_project_to_workspace()
add project(s) to the workspace tree
void workspace_set_visible(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *mod, GtkTreeIter *iter, gpointer data)
void remove_project_from_workspace(int id)
remove project from workspace
GtkWidget * create_workspace_tree()
create the workspace tree store
void correct_this_window_title(GtkWidget *win, gchar *str)
use new title for GtkWindow, providing it exists
int projects_in_workspace
void workspace_menu(GtkWidget *tree, gpointer event, double x, double y)
popup the workspace contextual menu in workspace tree view
void create_workspace()
create the workspace
int find_proj_by_path(GtkTreePath *path)
find the project id using the GtkTreePath
GtkWidget * work_menu(int p, int c)
create the workspace popup menu
G_MODULE_EXPORT void activate_project(GtkWidget *widg, gpointer data)
activate a project
void workinfo(project *this_proj, int i)
display information about a workspace menu item for a project
char * work_menu_items[NITEMS-2]
void add_project(GtkTreeStore *store, int i)
add project to the GtkTreeStore of the workspace
G_MODULE_EXPORT void change_project_name(GtkWidget *wid, gpointer edata)
change project name
G_MODULE_EXPORT gboolean on_workspace_button_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
GTK3 button event on workspace to display contextual menu.
G_MODULE_EXPORT void workspace_ondc(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *col, gpointer data)
do something after Double Click in the workspace tree