diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-17 19:48:37 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2007-12-17 19:48:37 (GMT) |
commit | 9363bc6887a7ffb9ea6c0f6a63a93c215e227502 (patch) | |
tree | dc5f962bdcc413a5bd4bff4d85c7842522a73fb3 /Smoke/gtk.c | |
parent | 1d771540b16ba07cb02be5490892465a2a5ab89a (diff) | |
download | 2iv35-9363bc6887a7ffb9ea6c0f6a63a93c215e227502.zip 2iv35-9363bc6887a7ffb9ea6c0f6a63a93c215e227502.tar.gz 2iv35-9363bc6887a7ffb9ea6c0f6a63a93c215e227502.tar.bz2 |
Added/splitted colormaps to a seperate file.
Diffstat (limited to 'Smoke/gtk.c')
-rw-r--r-- | Smoke/gtk.c | 73 |
1 files changed, 14 insertions, 59 deletions
diff --git a/Smoke/gtk.c b/Smoke/gtk.c index 030a9bb..474ebb6 100644 --- a/Smoke/gtk.c +++ b/Smoke/gtk.c @@ -51,6 +51,7 @@ #include "palette.h" #include "seedpoint.h" +#include "gtk_colormap.h" /************************************************************************** * The following section contains all the macro definitions. @@ -65,7 +66,7 @@ #define DEFAULT_HEIGHT 600 #define DEFAULT_TITLE "2iv35 \"Smoke\" by Wilrik & Oliver" -#define TIMEOUT_INTERVAL 10 +#define TIMEOUT_INTERVAL 20 /************************************************************************** @@ -598,15 +599,13 @@ void show_settings(GtkWidget *notebook) } #endif -static gboolean -select_colormap (GtkComboBox *combo, - gpointer data) { +static gboolean +select_palette(GtkComboBox *combo, gpointer data) { g_print("combo: %d\n", gtk_combo_box_get_active(combo)); selectColor(gtk_combo_box_get_active(combo)); } - /* * Draw main notebook page */ @@ -618,6 +617,7 @@ GtkWidget *create_main_page(void) GtkWidget *frame; GtkWidget *box; GtkWidget *button; + GtkWidget *combo; GSList *dataset_group; page = gtk_vbox_new(FALSE, 0); @@ -668,51 +668,7 @@ GtkWidget *create_main_page(void) gtk_box_pack_start (GTK_BOX(page), frame, FALSE, TRUE, 0); gtk_widget_show(frame); - - return page; -} - - -/* - * Draw colormap notebook page - */ -GtkWidget *create_colormap_page(void) -{ - /* in reality a page is really just a vbox filled with other widgets - */ - GtkWidget *page; - GtkWidget *frame; - GtkWidget *box; - GtkWidget *button; - GtkWidget *combo; - - page = gtk_vbox_new(FALSE, 0); - - frame = gtk_frame_new("Scaling & Clamping"); - - box = gtk_vbox_new(FALSE, 0); - - button = gtk_check_button_new_with_label("Scaling"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); - g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_autoscale), NULL); - gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - button = gtk_check_button_new_with_label("Clamping"); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); - g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(toggle_clamping), NULL); - gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0); - gtk_widget_show(button); - - gtk_container_add(GTK_CONTAINER(frame), box); - gtk_widget_show(box); - - gtk_box_pack_start (GTK_BOX(page), frame, FALSE, TRUE, 0); - - gtk_widget_show(frame); - - - frame = gtk_frame_new("Colormap"); + frame = gtk_frame_new("Colormap"); box = gtk_hbox_new(FALSE, 0); @@ -725,7 +681,7 @@ GtkWidget *create_colormap_page(void) gtk_combo_box_append_text(GTK_COMBO_BOX(combo), "Oliver"); g_signal_connect(combo, "changed", - G_CALLBACK(select_colormap), (gpointer)NULL); + G_CALLBACK(select_palette), (gpointer)NULL); gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0); @@ -739,7 +695,6 @@ GtkWidget *create_colormap_page(void) gtk_widget_show(frame); - return page; } @@ -1130,14 +1085,14 @@ main (int argc, init_simulation(DIM); - gtk_main (); + gtk_main(); - printf("Colormap RGB: %lf, %lf, %lf\n", 0.2, 0.44, 0.666); - for (i = 0; i < 200; i++) { - value = (float)((float)i/200); - colormap = set_colormap(0, value, 1.0f); - printf("Colormap RGB: %lf, %lf, %lf\n", colormap.r, colormap.b, colormap.g); - } +// printf("Colormap RGB: %lf, %lf, %lf\n", 0.2, 0.44, 0.666); +// for (i = 0; i < 200; i++) { +// value = (float)((float)i/200); +// colormap = set_palette(0, value, 6); +// printf("Colormap RGB: %lf, %lf, %lf\n", colormap.r, colormap.b, colormap.g); +// } return 0; } |