diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2008-01-05 04:02:07 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2008-01-05 04:02:07 (GMT) |
commit | 11e1578b67647a603e23fae44fe658fe2806e19a (patch) | |
tree | dacfbba0e25b4e86aaf8ab5e36c92099dc442a76 /Smoke/gtk_heightplots.c | |
parent | cf983359977dbea21b49747e3430725209a804ee (diff) | |
download | 2iv35-11e1578b67647a603e23fae44fe658fe2806e19a.zip 2iv35-11e1578b67647a603e23fae44fe658fe2806e19a.tar.gz 2iv35-11e1578b67647a603e23fae44fe658fe2806e19a.tar.bz2 |
heightplots added
Diffstat (limited to 'Smoke/gtk_heightplots.c')
-rw-r--r-- | Smoke/gtk_heightplots.c | 185 |
1 files changed, 180 insertions, 5 deletions
diff --git a/Smoke/gtk_heightplots.c b/Smoke/gtk_heightplots.c index 9e3d52a..42ddf70 100644 --- a/Smoke/gtk_heightplots.c +++ b/Smoke/gtk_heightplots.c @@ -1,20 +1,94 @@ #include <gtk/gtk.h> +#include <rfftw.h> +#include "fluids.h" + +#include "heightplots.h" #include "gtk_heightplots.h" -static gboolean select_colormap(GtkComboBox *combo, gpointer data) + +static GtkWidget *height_scale; +static GtkAdjustment *rho_adj, *vel_adj, *force_adj, *divv_adj, *divf_adj; + + +static gboolean set_dataset(GtkToggleButton *button, gpointer data) { - heightplots_set_colormap(gtk_combo_box_get_active(combo)); -} + GtkAdjustment *temp; + gchar *s; + if (gtk_toggle_button_get_active(button)) { + switch ((int)data) { + default: + break; + case DATASET_RHO: + heightplots_set_dataset(DATASET_RHO); + gtk_range_set_adjustment(GTK_RANGE(height_scale), rho_adj); + gtk_adjustment_set_value(rho_adj, heightplots_get_height()); + break; + case DATASET_VEL: + heightplots_set_dataset(DATASET_VEL); + gtk_range_set_adjustment(GTK_RANGE(height_scale), vel_adj); + gtk_adjustment_set_value(vel_adj, heightplots_get_height()); + break; + case DATASET_FORCE: + heightplots_set_dataset(DATASET_FORCE); + gtk_range_set_adjustment(GTK_RANGE(height_scale), force_adj); + gtk_adjustment_set_value(force_adj, heightplots_get_height()); + break; + case DATASET_DIVV: + heightplots_set_dataset(DATASET_DIVV); + gtk_range_set_adjustment(GTK_RANGE(height_scale), divv_adj); + gtk_adjustment_set_value(force_adj, heightplots_get_height()); + break; + case DATASET_DIVF: + heightplots_set_dataset(DATASET_DIVF); + gtk_range_set_adjustment(GTK_RANGE(height_scale), divf_adj); + gtk_adjustment_set_value(force_adj, heightplots_get_height()); + break; + } + } -static gboolean select_num_colors(GtkRange *adjustment, gpointer data) + return TRUE; +} + +static gboolean select_height(GtkRange *adjustment, gpointer data) { - heightplots_set_num_colors((int)gtk_range_get_value(adjustment)); + heightplots_set_height((int)gtk_range_get_value(adjustment)); + + return TRUE; } +static void init_adjustments(void) +{ + int dataset; + + dataset = heightplots_get_dataset(); + + heightplots_set_dataset(DATASET_RHO); + rho_adj = GTK_ADJUSTMENT(gtk_adjustment_new( + heightplots_get_height(), 1, 500, 5, 50, 0)); + g_object_ref(rho_adj); + heightplots_set_dataset(DATASET_VEL); + vel_adj = GTK_ADJUSTMENT(gtk_adjustment_new( + heightplots_get_height(), 1, 1000, 5, 50, 0)); + g_object_ref(vel_adj); + heightplots_set_dataset(DATASET_FORCE); + force_adj = GTK_ADJUSTMENT(gtk_adjustment_new( + heightplots_get_height(), 1, 2000, 5, 50, 0)); + g_object_ref(force_adj); + heightplots_set_dataset(DATASET_DIVV); + divv_adj = GTK_ADJUSTMENT(gtk_adjustment_new( + heightplots_get_height(), 1, 3000, 5, 50, 0)); + g_object_ref(divv_adj); + heightplots_set_dataset(DATASET_DIVF); + divf_adj = GTK_ADJUSTMENT(gtk_adjustment_new( + heightplots_get_height(), 1, 4000, 5, 50, 0)); + g_object_ref(divf_adj); + + heightplots_set_dataset(dataset); +} GtkWidget *create_heightplots_page(void) @@ -22,8 +96,109 @@ GtkWidget *create_heightplots_page(void) /* in reality a page is really just a vbox filled with other widgets */ GtkWidget *page; + GtkWidget *frame; + GtkWidget *box, *box2; + GtkWidget *button; + GSList *dataset_group; + + + init_adjustments(); page = gtk_vbox_new(FALSE, 0); + frame = gtk_frame_new("Dataset"); + + box = gtk_vbox_new(FALSE, 0); + + box2 = gtk_hbox_new(FALSE, 0); + + button = gtk_radio_button_new_with_label (NULL, "Rho"); + if (heightplots_get_dataset() == DATASET_RHO) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); + } + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_dataset), (gpointer)DATASET_RHO); + gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + dataset_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button)); + + button = gtk_radio_button_new_with_label(dataset_group, "Velocity"); + if (heightplots_get_dataset() == DATASET_VEL) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); + } + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_dataset), (gpointer)DATASET_VEL); + gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + button = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(button), "Force"); + if (heightplots_get_dataset() == DATASET_FORCE) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); + } + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_dataset), (gpointer)DATASET_FORCE); + gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + gtk_box_pack_start(GTK_BOX(box), box2, TRUE, TRUE, 0); + gtk_widget_show(box2); + + box2 = gtk_hbox_new(FALSE, 0); + + dataset_group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(button)); + + button = gtk_radio_button_new_with_label(dataset_group, "Divergence Velocity"); + if (heightplots_get_dataset() == DATASET_DIVV) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); + } + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_dataset), (gpointer)DATASET_DIVV); + gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + button = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(button), "Divergence Force"); + if (heightplots_get_dataset() == DATASET_DIVF) { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); + } else { + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); + } + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(set_dataset), (gpointer)DATASET_DIVF); + gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0); + gtk_widget_show(button); + + + gtk_box_pack_start(GTK_BOX(box), box2, TRUE, TRUE, 0); + gtk_widget_show(box2); + + 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("Muliplier"); + + box = gtk_vbox_new(FALSE, 0); + + height_scale = gtk_hscale_new(rho_adj); + gtk_scale_set_digits(GTK_SCALE(height_scale), 0); + g_signal_connect(GTK_RANGE(height_scale), "value-changed", G_CALLBACK(select_height), NULL); + + gtk_box_pack_start(GTK_BOX(box), height_scale, FALSE, TRUE, 0); + gtk_widget_show(height_scale); + + 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); + + return page; } |