69 int bid = cid - rid*4;
70 but -> red = (rid < 6) ? 0.0 : (rid < 11) ? 0.2 * (rid - 5) : 1.0;
71 but -> green = (rid < 6) ? 0.2*rid : (rid < 11) ? 1.0 - 0.2 * (rid - 5) : 0.2 * (rid - 10);
72 but -> blue = bid * 0.333;
73 if (bid == 3) but -> blue = 1.0;
89 cairo_surface_t * cst;
91 cst = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
x,
y);
92 tcst = cairo_create (cst);
93 cairo_set_source_rgb (tcst, r, g,
b);
111 get_color (& this_proj -> modelgl -> anim -> last ->
img -> backcolor,
col ->
b);
112 this_proj -> modelgl -> create_shaders[
MEASU] = TRUE;
113 update (this_proj -> modelgl);
128 get_color (& this_proj -> modelgl -> anim -> last ->
img -> box_color,
col ->
b);
129 this_proj -> modelgl -> create_shaders[
MDBOX] = TRUE;
130 update (this_proj -> modelgl);
148 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
149 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] == 0) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
150 update (this_proj -> modelgl);
168 update (this_proj -> modelgl);
186 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
187 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] == 1) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
188 update (this_proj -> modelgl);
206 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
207 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] == 2) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
208 update (this_proj -> modelgl);
226 this_proj -> modelgl -> create_shaders[
LABEL] = TRUE;
227 if (this_proj -> modelgl -> anim -> last ->
img -> color_map[1] ==
col ->
b + 1) this_proj -> modelgl -> create_shaders[
POLYS] = TRUE;
228 update (this_proj -> modelgl);
261 GtkWidget * coltable;
263 coltable = gtk_menu_new ();
277 but =
gtk3_menu_item (NULL, NULL,
IMG_SURFACE, (gpointer)surface, NULL, NULL, FALSE, 0, 0, FALSE, FALSE, FALSE);
286 cairo_surface_destroy (surface);
290 view -> gcid[4+spec][geo][l].a = p;
291 view -> gcid[4+spec][geo][l].b = spec;
292 view -> gcid[4+spec][geo][l].c = geo;
293 view -> gcid[4+spec][geo][l].d = l;
295 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_rings_color), & view -> gcid[4+spec][geo][l]);
301 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_back_color), & view ->
colorp[l][0]);
307 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_box_color), & view ->
colorp[l][0]);
310 else if (ideo < this_proj -> nspec*2)
313 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_at_color), & view ->
colorp[l][ideo]);
316 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0])
318 n = ideo - 2*this_proj -> nspec;
319 view -> gcid[0][n][l].a = p;
320 view -> gcid[0][n][l].b = spec;
321 view -> gcid[0][n][l].c = geo;
322 view -> gcid[0][n][l].d = l;
324 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_total_coord_color), & view -> gcid[0][n][l]);
327 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1])
329 n = ideo - 2*this_proj -> nspec - this_proj -> coord -> totcoord[0];
330 view -> gcid[1][n][l].a = p;
331 view -> gcid[1][n][l].b = spec;
332 view -> gcid[1][n][l].c = geo;
333 view -> gcid[1][n][l].d = l;
340 n = ideo - 2*this_proj -> nspec;
341 for (m= 0; m<spec; m++)
343 n -= this_proj -> coord -> totcoord[m];
345 view -> gcid[spec][n][l].a = p;
346 view -> gcid[spec][n][l].b = spec;
347 view -> gcid[spec][n][l].c = geo;
348 view -> gcid[spec][n][l].d = l;
350 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_frag_mol_color), & view -> gcid[spec][n][l]);
355 gtk_menu_attach (GTK_MENU(coltable), but, l-m*4, l+1-m*4, m, m+1);
362 gtk_menu_shell_append ((GtkMenuShell *)coltable, but);
366 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[4+spec][geo][4+spec]);
376 else if (ideo < this_proj -> nspec*2)
380 else if (ideo < this_proj -> nspec*2 + this_proj -> coord -> totcoord[0])
382 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[0][n][0]);
384 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1])
386 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[1][n][1]);
390 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
window_color_coord), & view -> gcid[spec][n][spec]);
408GtkWidget * color_palette (
glwin * view,
int ideo,
int spec,
int geo)
413 GtkWidget * coltable = gtk_grid_new ();
423 but = gtk_button_new ();
425 gtk_button_set_has_frame ((GtkButton *)but, FALSE);
427 cairo_surface_destroy (surface);
430 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_rings_color), & view -> gcid[4+spec][geo][l]);
434 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_back_color), & view ->
colorp[l][0]);
438 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_box_color), & view ->
colorp[l][0]);
440 else if (ideo < this_proj -> nspec*2)
442 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_at_color), & view ->
colorp[l][ideo]);
444 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0])
446 n = ideo - 2*this_proj -> nspec;
447 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_total_coord_color), & view -> gcid[0][n][l]);
449 else if (ideo < 2*this_proj -> nspec + this_proj -> coord -> totcoord[0] + this_proj -> coord -> totcoord[1])
451 n = ideo - 2*this_proj -> nspec - this_proj -> coord -> totcoord[0];
456 n = ideo - 2*this_proj -> nspec;
457 for (m= 0;
m<spec;
m++)
459 n -= this_proj -> coord -> totcoord[
m];
461 g_signal_connect (G_OBJECT (but),
"activate", G_CALLBACK(
set_frag_mol_color), & view -> gcid[spec][n][l]);
464 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 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
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...