67extern GtkWidget *
work_menu (
int p,
int c);
69GdkPixbuf *
pix = NULL;
70GtkWidget *
img = NULL;
73GtkWidget *
lab = NULL;
74GtkWidget *
lap = NULL;
75GtkWidget *
eap = NULL;
92 i18n(
"Visualization "),
108 GtkTreeIter steplevel;
109 GtkTreeIter optslevel;
114 tmp = g_strdup_printf (
"<b>%s</b>", this_proj -> name);
118 tmp = g_strdup_printf (
"%s", this_proj -> name);
120 gtk_tree_store_set (store, &
piter[i], 0,
THETD, 1, tmp, 2, -1, -1);
121 prpath[i] = gtk_tree_model_get_path (GTK_TREE_MODEL(store), &
piter[i]);
123 gtk_tree_store_append (store, & steplevel, &
piter[i]);
126 gtk_tree_store_append (store, & steplevel, &
piter[i]);
129 gtk_tree_store_append (store, & steplevel, &
piter[i]);
136 gtk_tree_store_append (store, & optslevel, & steplevel);
137 gtk_tree_store_set (store, & optslevel, 0, gdk_pixbuf_new_from_file(
graph_img[j], NULL), 1, _(
graph_name[j]), 2, j, -1);
140 gtk_tree_view_expand_to_path (GTK_TREE_VIEW(
worktree), gtk_tree_model_get_path(GTK_TREE_MODEL(store), &
worklevel));
151static void fill_workspace (GtkTreeStore * store)
155 gtk_tree_store_append (store, &
worklevel, NULL);
181 int id = GPOINTER_TO_INT (data);
189 gchar * tmp = g_strdup_printf (
"<b>%s</b>",
active_project -> name);
206 GtkTreeModel *
model = gtk_tree_view_get_model (treeview);
207 if (gtk_tree_model_get_iter (
model, & iter,
path))
209 gtk_tree_model_get (
model, & iter, 2, & i, -1);
230 if (gtk_tree_path_compare (
prpath[j],
path) <= 0) i = j;
252 GtkTreeViewColumn *
col,
256 GtkTreeModel *
model;
258 model = gtk_tree_view_get_model (treeview);
259 gboolean was = FALSE;
261 g_debug (
"WORKSPACE_ONDC: activep= %d",
activep);
263 if (gtk_tree_model_get_iter (
model, & iter,
path))
266 g_debug (
"WORKSPACE_ONDC: in workspace");
270 if (gtk_tree_path_compare (
path,
prpath[i]) == 0)
279 g_debug (
"WORKSPACE_ONDC: not an activation");
286 g_debug (
"WORKSPACE_ONDC: saving old data");
289 witer = gtk_tree_iter_copy (& iter);
290 gtk_tree_model_get (
model, & iter, 1, &
wchar, -1);
292 g_debug (
"WORKSPACE_ONDC: modifying data");
294 gchar * tmp = g_strdup_printf (
"<b>%s</b>",
wchar);
295 gtk_tree_store_set (GTK_TREE_STORE(
model), & iter, 1, tmp, -1);
298 g_debug (
"WORKSPACE_ONDC: cleaning view");
299 g_debug (
"WORKSPACE_ONDC: wchar = %s",
wchar);
301 gtk_tree_model_get (
model, & iter, 2, & i, -1);
303 g_debug (
"WORKSPACE_ONDC: creating view id= %d", i);
307 g_debug (
"WORKSPACE_ONDC: for project= %d", j);
328 if (GTK_IS_WIDGET(win))
330 gtk_window_set_title (GTK_WINDOW (win), str);
333 if (str) g_free (str);
348 i = GPOINTER_TO_INT (edata);
349 tmp = g_strdup_printf (_(
"Please enter a new name for project N°%d"), i);
351 tmp =
cask(tmp, _(
"Project name"), i, this_proj -> name,
MainWindow);
354 this_proj -> name = g_strdup_printf (
"%s", tmp);
358 tmp = g_strdup_printf (
"<b>%s</b>", this_proj -> name);
364 if (this_proj -> modelgl != NULL)
366 if (this_proj -> modelgl -> win != NULL)
370 gchar * win_title[2]={
i18n(
"Atom(s) configuration"),
i18n(
"Clone(s) configuration")};
373 if (this_proj -> modelgl -> model_win[j] != NULL)
375 correct_this_window_title (this_proj -> modelgl -> model_win[j] -> win, g_strdup_printf (
"%s - %s", _(win_title[j]), tmp_title));
378 if (this_proj -> modelgl -> coord_win != NULL)
380 correct_this_window_title (this_proj -> modelgl -> coord_win -> win, g_strdup_printf (_(
"Environments configuration - %s"), tmp_title));
382 if (this_proj -> modelgl -> atom_win != NULL)
384 correct_this_window_title (this_proj -> modelgl -> atom_win -> win, g_strdup_printf (_(
"Model edition - %s"), tmp_title));
386 if (this_proj -> modelgl -> cell_win != NULL)
388 correct_this_window_title (this_proj -> modelgl -> cell_win -> win, g_strdup_printf (_(
"Cell edition - %s"), tmp_title));
390 if (this_proj -> modelgl -> opengl_win != NULL)
392 correct_this_window_title (this_proj -> modelgl -> opengl_win -> win, g_strdup_printf (_(
"OpenGL material aspect and light settings - %s"), tmp_title));
394 if (this_proj -> modelgl -> spiner != NULL)
398 if (this_proj -> modelgl -> player != NULL)
400 j = this_proj -> modelgl -> anim -> last ->
img ->
step;
401 correct_this_window_title (this_proj -> modelgl -> player -> win, g_strdup_printf (_(
"%s - player - step %d"), tmp_title, j));
403 if (this_proj -> modelgl -> measure_win != NULL)
407 if (this_proj -> modelgl -> gradient_win != NULL)
409 correct_this_window_title (this_proj -> modelgl -> gradient_win -> win, g_strdup_printf (_(
"%s - background settings"), tmp_title));
411 if (this_proj -> modelgl -> box_win != NULL)
415 if (this_proj -> modelgl -> axis_win != NULL)
417 correct_this_window_title (this_proj -> modelgl -> axis_win -> win, g_strdup_printf (_(
"%s - axis settings"), tmp_title));
419 if (this_proj -> modelgl -> rep_win != NULL)
421 correct_this_window_title (this_proj -> modelgl -> rep_win -> win, g_strdup_printf (
"%s - OpenGL camera set-up", tmp_title));
427 if (this_proj -> analysis[j] -> init_ok)
429 for (k=0; k<this_proj -> analysis[j] -> numc; k++)
431 if (this_proj -> analysis[j] -> curves[k] -> window != NULL)
461 gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(tree), (gint)
x, (gint)
y, & mpath, NULL, NULL, NULL);
475 gtk_widget_set_parent (menu, tree);
492G_MODULE_EXPORT
void workspace_popup (GtkGesture * gesture,
int n_press,
double x,
double y, gpointer data)
494 if (gtk_gesture_single_get_current_button ((GtkGestureSingle * )gesture) == GDK_BUTTON_SECONDARY)
511 if (event -> type == GDK_BUTTON_PRESS && event -> button == 3)
520 GtkCellRenderer * renderer,
525 gtk_cell_renderer_set_visible (renderer, FALSE);
535 GtkTreeViewColumn *
col;
536 GtkCellRenderer * renderer;
537 GtkTreeSelection * workselect;
540 workstore = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
546 col = gtk_tree_view_column_new ();
548 renderer = gtk_cell_renderer_pixbuf_new ();
549 gtk_tree_view_column_pack_start (
col, renderer, FALSE);
550 gtk_tree_view_column_set_attributes (
col, renderer,
"pixbuf", 0, NULL);
552 renderer = gtk_cell_renderer_text_new();
553 gtk_tree_view_column_pack_start (
col, renderer, TRUE);
554 gtk_tree_view_column_set_attributes (
col, renderer,
"markup", 1, NULL);
556 renderer = gtk_cell_renderer_text_new ();
557 gtk_tree_view_column_pack_start (
col, renderer, TRUE);
558 gtk_tree_view_column_set_attributes (
col, renderer,
"markup", 2, NULL);
561 gtk_tree_view_append_column(GTK_TREE_VIEW(
worktree),
col);
563 workselect = gtk_tree_view_get_selection (GTK_TREE_VIEW(
worktree));
564 gtk_tree_selection_set_mode (workselect, GTK_SELECTION_SINGLE);
565 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(
worktree), FALSE);
571 add_widget_gesture_and_key_action (
worktree,
"workspace-context-click", G_CALLBACK(workspace_popup), (gpointer)
worktree,
572 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
574 gtk_tree_view_expand_all (GTK_TREE_VIEW(
worktree));
604 GtkTreeIter ** tmpiter;
608 tmpiter[i] = gtk_tree_iter_copy (&
piter[i]);
616 piter[i] = * gtk_tree_iter_copy (tmpiter[i]);
620 if (tmpiter != NULL) g_free (tmpiter);
656 GtkTreeIter ** tmpiter;
678 tmpiter[j] = gtk_tree_iter_copy (&
piter[i]);
693 piter[j] = * gtk_tree_iter_copy (tmpiter[j]);
Callback declarations for main window.
Global variable declarations Global convenience function declarations Global data structure defin...
gchar * graph_img[NCALCS]
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
char * work_menu_items[NITEMS]
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
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