71 int bid = cid - rid*4;
72 but -> red = (rid < 6) ? 0.0 : (rid < 11) ? 0.2 * (rid - 5) : 1.0;
73 but -> green = (rid < 6) ? 0.2*rid : (rid < 11) ? 1.0 - 0.2 * (rid - 5) : 0.2 * (rid - 10);
74 but -> blue = bid * 0.333;
75 if (bid == 3) but -> blue = 1.0;
91 cairo_surface_t * cst;
93 cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
x,
y);
94 tcst = cairo_create (cst);
95 cairo_set_source_rgb (tcst, r, g,
b);
114 this_proj -> modelgl -> anim -> last ->
img -> back -> gradient = 0;
116 if (this_proj -> modelgl -> gradient_win)
update_gradient_widgets (this_proj -> modelgl -> gradient_win, this_proj -> modelgl -> anim -> last ->
img -> back);
117 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
118 update (this_proj -> modelgl);
134 this_proj -> modelgl -> create_shaders[
MDBOX] = TRUE;
135 update (this_proj -> modelgl);
153 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
154 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] == 0) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
155 update (this_proj -> modelgl);
173 update (this_proj -> modelgl);
191 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
192 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] == 1) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
193 update (this_proj -> modelgl);
211 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
212 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] == 2) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
213 update (this_proj -> modelgl);
231 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
232 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] ==
col ->
b + 1) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
233 update (this_proj -> modelgl);
266 GtkWidget * coltable;
268 coltable = gtk_menu_new ();
282 but =
gtk3_menu_item (NULL, NULL,
IMG_SURFACE, (gpointer)surface, NULL, NULL, FALSE, 0, 0, FALSE, FALSE, FALSE);
291 cairo_surface_destroy (surface);
295 view -> gcid[4+spec][geo][l].a = p;
296 view -> gcid[4+spec][geo][l].b = spec;
297 view -> gcid[4+spec][geo][l].c = geo;
298 view -> gcid[4+spec][geo][l].d = l;
300 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_rings_color), & view -> gcid[4+spec][geo][l]);
306 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_back_color), & view ->
colorp[l][0]);
312 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_box_color), & view ->
colorp[l][0]);
315 else if (ideo < this_proj -> nspec*2)
318 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_at_color), & view ->
colorp[l][ideo]);
321 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0])
323 n = ideo - 2*this_proj -> nspec;
324 view -> gcid[0][n][l].a = p;
325 view -> gcid[0][n][l].b = spec;
326 view -> gcid[0][n][l].c = geo;
327 view -> gcid[0][n][l].d = l;
329 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_total_coord_color), & view -> gcid[0][n][l]);
332 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1])
334 n = ideo - 2*this_proj -> nspec - this_proj -> coord -> totcoord[0];
335 view -> gcid[1][n][l].a = p;
336 view -> gcid[1][n][l].b = spec;
337 view -> gcid[1][n][l].c = geo;
338 view -> gcid[1][n][l].d = l;
345 n = ideo - 2*this_proj -> nspec;
346 for (m= 0; m<spec; m++)
348 n -= this_proj -> coord -> totcoord[m];
350 view -> gcid[spec][n][l].a = p;
351 view -> gcid[spec][n][l].b = spec;
352 view -> gcid[spec][n][l].c = geo;
353 view -> gcid[spec][n][l].d = l;
355 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_frag_mol_color), & view -> gcid[spec][n][l]);
360 gtk_menu_attach (GTK_MENU(coltable), but, l-m*4, l+1-m*4, m, m+1);
367 gtk_menu_shell_append ((GtkMenuShell *)coltable, but);
370 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[4+spec][geo][4+spec]);
380 else if (ideo < this_proj -> nspec*2)
384 else if (ideo < this_proj -> nspec*2 + this_proj -> coord -> totcoord[0])
386 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[0][n][0]);
388 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1])
390 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[1][n][1]);
394 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[spec][n][spec]);
412GtkWidget * color_palette (
glwin * view,
int ideo,
int spec,
int geo)
417 GtkWidget * coltable = gtk_grid_new ();
427 but = gtk_button_new ();
429 gtk_button_set_has_frame ((GtkButton *)but, FALSE);
431 cairo_surface_destroy (surface);
434 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_rings_color), & view -> gcid[4+spec][geo][l]);
438 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_back_color), & view ->
colorp[l][0]);
442 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_box_color), & view ->
colorp[l][0]);
444 else if (ideo < this_proj -> nspec*2)
446 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_at_color), & view ->
colorp[l][ideo]);
448 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0])
450 n = ideo - 2*this_proj -> nspec;
451 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_total_coord_color), & view -> gcid[0][n][l]);
453 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1])
455 n = ideo - 2*this_proj -> nspec - this_proj -> coord -> totcoord[0];
460 n = ideo - 2*this_proj -> nspec;
461 for (m= 0;
m<spec;
m++)
463 n -= this_proj -> coord -> totcoord[
m];
465 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_frag_mol_color), & view -> gcid[spec][n][l]);
468 gtk_grid_attach (GTK_GRID(coltable), but, l-m*4, m, 1, 1);
G_MODULE_EXPORT void set_box_color(GtkWidget *widg, gpointer data)
set box color
G_MODULE_EXPORT void set_frag_mol_color(GtkWidget *widg, gpointer data)
set fragment color
G_MODULE_EXPORT void set_back_color(GtkWidget *widg, gpointer data)
set background color
G_MODULE_EXPORT void set_at_color(GtkWidget *widg, gpointer data)
set atomic species color
GtkWidget * color_box(glwin *view, int ideo, int spec, int geo)
create the color palette pointers and menus GTK3 version
cairo_surface_t * col_surface(double r, double g, double b, int x, int y)
create a cairo sufrace painted with the appropriate color
G_MODULE_EXPORT void set_rings_color(GtkWidget *widg, gpointer data)
set ring polyhedra color
G_MODULE_EXPORT void set_partial_coord_color(GtkWidget *widg, gpointer data)
set partial coordination color
void update_gradient_widgets(gradient_edition *gradient_win, background *back)
update the widgets of the gradient window
void get_color(ColRGBA *but, int cid)
get color from the color palette id
G_MODULE_EXPORT void set_total_coord_color(GtkWidget *widg, gpointer data)
set total coordination color
Structure definitions for color management Function declarations for color management.
G_MODULE_EXPORT void to_run_back_color_window(GtkWidget *widg, gpointer data)
to run background color selection window callback GTK3
G_MODULE_EXPORT void to_run_box_color_window(GtkWidget *widg, gpointer data)
to run box color selection window callback GTK3
G_MODULE_EXPORT void window_color_coord(GtkWidget *widg, gpointer data)
create a window to select a color callback GTK3
G_MODULE_EXPORT void to_run_atom_color_window(GtkWidget *widg, gpointer data)
to run atom color selection window callback GTK3
Global variable declarations Global convenience function declarations Global data structure defin...
GtkWidget * gtk3_menu_item(GtkWidget *menu, gchar *name, int icon_format, gpointer item_icon, GCallback handler, gpointer data, gboolean accel, guint key, GdkModifierType mod, gboolean check, gboolean radio, gboolean status)
GtkWidget * create_image_from_data(int format, gpointer item_image)
create Gtk image for data
GtkWidget * create_menu_item(gboolean add_mnemo, gchar *action)
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 update(glwin *view)
update the rendering of the OpenGL window
Variable declarations related to the OpenGL window Function declarations related to the OpenGL wind...
void re_create_md_shaders(int nshaders, int shaders[nshaders], project *this_proj)
re-initialize some MD dependent OpenGL shaders
void cleaning_shaders(glwin *view, int shader)
re-initialize an OpenGL shader
shaders
The different types of shaders in the atomes program.
Function declarations for the creation of the OpenGL window.
Messaging function declarations.
Function declarations for reading atomes project file Function declarations for saving atomes proje...