GtkWidget *stretch_dialog_new(gpointer data) { GtkWidget *vbox, *hbox, *frame, *button; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data; frame = options_frame_new("Stretch and compress"); vbox = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(vbox)); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); button = gtk_button_new_with_label (_("Stretch V")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) stretch_v_callb, data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); button = gtk_button_new_with_label (_("Stretch H")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) stretch_h_callb, data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); gtk_box_pack_start (GTK_BOX (vbox), align_widget(hbox,0.5,0.5), FALSE, FALSE, DEF_PAD); gtk_box_pack_start (GTK_BOX (vbox), reset_accept_buttons_new (data, &hfw->hf_options->img->stretch_accept), FALSE, FALSE, DEF_PAD); gtk_container_add(GTK_CONTAINER(frame), vbox); return frame; }
GtkWidget *uniform_dialog_new(gpointer hfo_ptr, gint default_value) { GtkWidget *dialog, *wtmp, *vbox, *hbox; GtkObject *adj; hf_options_struct *hfo = (hf_options_struct *) hfo_ptr; if (!hfo) return gtk_label_new(_("No uniform dialog")); dialog = options_frame_new("Uniform"); vbox = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(dialog),vbox); adj = gtk_adjustment_new (default_value, 0, MAX_HF_VALUE, 1, 1, 0.1); wtmp = gtk_hscale_new (GTK_ADJUSTMENT (adj)); gtk_scale_set_digits (GTK_SCALE (wtmp), 0); gtk_widget_show(GTK_WIDGET(wtmp)); gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC(uniform_scale), hfo->hfw_ptr_ptr); optimize_on_mouse_click (wtmp, hfo->hfw_ptr_ptr); gtk_box_pack_start(GTK_BOX(vbox), wtmp, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE,0); gtk_widget_show(hbox); uniform_percent_buttons_new(hbox, (gpointer) adj); gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0); return dialog; }
GtkWidget *mirror_vertical_dialog_new(gpointer data) { GtkWidget *lbl, *frame; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data; frame = options_frame_new("Vertical mirror"); lbl = gtk_label_new(_("No parameters\nfor this operation")); gtk_widget_show(lbl); gtk_container_add(GTK_CONTAINER(frame), lbl); return frame; }
GtkWidget *slide_dialog_new(gpointer data) { GtkWidget *vbox, *hbox, *frame, *table, *scale; GtkObject *adj; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data; frame = options_frame_new("Translate"); vbox = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(vbox)); table = gtk_table_new(4, 2, FALSE); gtk_widget_show(GTK_WIDGET(table)); define_label_in_table("Horizontal",table,0, 1, 0, 1, DEF_PAD); adj = gtk_adjustment_new (hfw->hf_options->img->slideh, -100, 100, 1, 1, 0.01); scale = define_scale_in_table(adj,table,1, 2, 0, 1, 0, DEF_PAD); optimize_on_mouse_click (scale, data); hfw->hf_options->img->adj_slideh = adj; gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC (slideh_upd), data); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); percent_buttons_negative_new (hbox, (gpointer) adj); gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 1, 2, 0, 0, 0, 0); define_label_in_table("Vertical",table,0, 1, 2, 3, DEF_PAD); adj = gtk_adjustment_new (hfw->hf_options->img->slidev, -100, 100, 1, 1, 0.01); scale = define_scale_in_table(adj,table,1, 2, 2, 3, 0, DEF_PAD); optimize_on_mouse_click (scale, data); hfw->hf_options->img->adj_slidev = adj; gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC (slidev_upd), data); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); percent_buttons_negative_new (hbox, (gpointer) adj); gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 3, 4, 0, 0, 0, 0); gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), reset_accept_buttons_new (data, &hfw->hf_options->img->slide_accept), FALSE, FALSE, DEF_PAD); gtk_container_add(GTK_CONTAINER(frame), vbox); return frame; }
GtkWidget *wind_dialog_new (wind_struct *ws, wind_dialog_struct *wds, hf_wrapper_struct *hfw, gchar *title, gboolean if_a, gboolean if_b) { GtkWidget *vbox, *hbox, *frame, *button; GtkObject *adj; frame = options_frame_new(title); vbox = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(vbox)); gtk_container_add(GTK_CONTAINER(frame), vbox); // Steps hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Steps", hbox, FALSE,TRUE, DEF_PAD); wds->adj_steps = gtk_adjustment_new (ws->steps, 0.0, 100.0, 1.0, 1.0, 0.0); define_scale_in_box(wds->adj_steps,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (wds->adj_steps), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &ws->steps); gtk_signal_connect (GTK_OBJECT (wds->adj_steps),"value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) hfw->if_modified); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); // Wind speed hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Wind speed", hbox, FALSE,TRUE, DEF_PAD); wds->adj_wind_speed = gtk_adjustment_new (ws->wind_speed, 0.0, 10.0, 1.0, 1.0, 0.0); define_scale_in_box(wds->adj_wind_speed,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (wds->adj_wind_speed), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &ws->wind_speed); gtk_signal_connect (GTK_OBJECT (wds->adj_wind_speed), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) hfw->if_modified); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); // Amplitude of the slope derivative factor if (if_a) { hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("A", hbox, FALSE,TRUE, DEF_PAD); wds->adj_a = gtk_adjustment_new (ws->a, 0.0, 10.0, 0.1, 0.1, 0.0); define_scale_in_box(wds->adj_a,hbox,1,DEF_PAD); gtk_signal_connect (GTK_OBJECT (wds->adj_a), "value_changed", GTK_SIGNAL_FUNC (gdouble_adj_callb), (gpointer) &ws->a); gtk_signal_connect (GTK_OBJECT (wds->adj_a), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) hfw->if_modified); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); } // Amplitude of the slope factor if (if_b) { hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Amplitude", hbox, FALSE,TRUE, DEF_PAD); wds->adj_b = gtk_adjustment_new (ws->b, 0.0, 15.0, 0.1, 0.1, 0.0); define_scale_in_box(wds->adj_b,hbox,1,DEF_PAD); gtk_signal_connect (GTK_OBJECT (wds->adj_b), "value_changed", GTK_SIGNAL_FUNC (gdouble_adj_callb), (gpointer) &ws->b); gtk_signal_connect (GTK_OBJECT (wds->adj_b), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) hfw->if_modified); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); } // Slope threshold hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Slope threshold", hbox, FALSE,TRUE, DEF_PAD); wds->adj_slope_threshold = gtk_adjustment_new (ws->slope_threshold, 0.0, 80.0, 1.0, 1.0, 0.0); define_scale_in_box(wds->adj_slope_threshold,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (wds->adj_slope_threshold), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &ws->slope_threshold); gtk_signal_connect (GTK_OBJECT (wds->adj_slope_threshold), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) hfw->if_modified); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); // Refine crests: only for dunes if (!strcmp(title,"Dunes")) { button = define_check_button_in_box ("Refine crests", vbox, TRUE, TRUE, DEF_PAD*0.5); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), ws->refine_crests); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (toggle_check_button_callb), (gpointer) &ws->refine_crests); } // Smooth before button = define_check_button_in_box ("Smooth before", vbox, TRUE, TRUE, 0.5 * DEF_PAD); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), ws->smooth_before); gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC (toggle_check_button_callb), (gpointer) &ws->smooth_before); hbox = gtk_hbox_new(FALSE,0); gtk_widget_show(hbox); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); define_label_in_box ("Radius", hbox, FALSE, FALSE, 0); adj = gtk_adjustment_new (ws->radius, 0, 100, 1, 1, 0.01); define_scale_in_box(adj,hbox,0, DEF_PAD*0.5); gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &ws->radius); gtk_signal_connect (GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(show_if_true), hbox); if (!ws->smooth_before) { gtk_widget_hide(GTK_WIDGET(hbox)); } // Control buttons hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); button = gtk_button_new_with_label (_("Apply")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) apply_wind_callb, (gpointer) wds); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); button = gtk_button_new_with_label (_("Repeat")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) repeat_wind_callb,(gpointer) wds); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); gtk_box_pack_start (GTK_BOX (vbox), align_widget(hbox,0.5,0.5), FALSE, FALSE, DEF_PAD); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); button = gtk_button_new_with_label (_("Reset")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) reset_callb, wds->parent_data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); button = gtk_button_new_with_label (_("Accept")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) accept_callb, wds->parent_data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); wds->accept = button; gtk_box_pack_start (GTK_BOX (vbox), align_widget(hbox,0.5,0.5), FALSE, FALSE, DEF_PAD); return frame; }
GtkWidget * hf_creation_dialog_new(GtkWidget *window, GtkTooltips *tooltips, gpointer hf_options_ptr, gpointer widget_list_ptr) { // Initializes the dialog for creating height fields // Four parts, from top to bottom: // 1. Kind / type of HF // 2. Shape filters // 3. Generic options (size...) // 4. Options for the current HF // Returns a vbox container, allowing to add / substract particular controls // "window" only needed for heritance of characteristics in child toolbar(s) // "tooltips" needed for packing tooltips, could have only one for the whole app. // gpointer hf_options_ptr_pgtr: is normally the address of the current hf_options pointer // (hf_options_struct **) GtkWidget *dialog, *hbox, *vbox, *frame; gint default_hf_size; omenu_struct_type *opt_menu; hf_creation_wdg_struct *wdg_str; // printf("HFO PTR in HF_CREATION_DIALOG_NEW: %d - %x\n",hf_options_ptr, hf_options_ptr); wdg_str = (hf_creation_wdg_struct *) x_calloc(sizeof(hf_creation_wdg_struct),1, "hf_creation_wdg_struct"); *((hf_creation_wdg_struct **) widget_list_ptr) = wdg_str; ((hf_options_struct *)hf_options_ptr)->creation_widgets = wdg_str; frame = options_frame_new("HeightField"); vbox = gtk_vbox_new(FALSE, 0); gtk_widget_show(vbox); // 1st generic option: HF size - a power of 2 // Default: some % of screen width hbox = gtk_hbox_new(FALSE, DEF_PAD); gtk_widget_show(hbox); define_label_in_box("Size", hbox, FALSE, FALSE, DEF_PAD); default_hf_size = hf_default_size(); create_omenu_with_callb_data (&opt_menu, sizes_list, NBSIZES, find_omenu_num(sizes_list, default_hf_size, NBSIZES), hf_options_ptr); gtk_box_pack_start(GTK_BOX(hbox), opt_menu->omenu_ptr, FALSE, FALSE, 0); wdg_str->size_menu = opt_menu; gtk_box_pack_start (GTK_BOX (hbox), create_render_bar (window, tooltips, ((hf_options_struct *)hf_options_ptr)->render_str), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), hf_types_toolbar_new(window, tooltips, &wdg_str->hf_types_toolbar,hf_options_ptr), FALSE, FALSE, 0); // Other generic options ? gtk_container_add(GTK_CONTAINER(frame), vbox); dialog = gtk_vbox_new(FALSE,0); gtk_box_pack_start(GTK_BOX(dialog), frame, FALSE, FALSE, 0); gtk_widget_show(dialog); return dialog; }
GtkWidget *rotate_dialog_new (gpointer data) { GtkWidget *vbox, *hbox, *frame, *button, *scale; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data; frame = options_frame_new("Rotate"); vbox = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(vbox)); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Angle", hbox, FALSE,TRUE, DEF_PAD); hfw->hf_options->img->adj_rotate = gtk_adjustment_new (0, 0.0, 360.0, 1.0, 1.0, 0.0); scale = define_scale_in_box(hfw->hf_options->img->adj_rotate,hbox,0,DEF_PAD); optimize_on_mouse_click (scale, data); gtk_signal_connect (GTK_OBJECT (hfw->hf_options->img->adj_rotate), "value_changed", GTK_SIGNAL_FUNC (rotate_angle_upd), data); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); rotate_buttons_new(hbox, (gpointer) hfw->hf_options->img->adj_rotate); hfw->hf_options->img->auto_rotate = define_check_button_in_box ("Auto update",hbox, FALSE,FALSE,0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (hfw->hf_options->img->auto_rotate), TRUE); gtk_box_pack_start (GTK_BOX (vbox), align_widget(hbox,0.5,0.5), FALSE, FALSE, DEF_PAD); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); button = gtk_button_new_with_label (_("Apply")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) apply_rotate_callb, data); gtk_widget_set_sensitive(GTK_WIDGET(button), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(hfw->hf_options->img->auto_rotate))); gtk_widget_show(button); // The "auto-rotate" button unactivates the "apply" button gtk_signal_connect (GTK_OBJECT(hfw->hf_options->img->auto_rotate ), "toggled", GTK_SIGNAL_FUNC(unsensitive_if_true), button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); button = gtk_button_new_with_label (_("Reset")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) reset_callb, data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); button = gtk_button_new_with_label (_("Accept")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) rotate_remove_tiling_callb, data); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) accept_rotate_callb, data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, DEF_PAD); hfw->hf_options->img->rotate_accept = button; gtk_box_pack_start (GTK_BOX (vbox), align_widget(hbox,0.5,0.5), FALSE, FALSE, DEF_PAD); gtk_container_add(GTK_CONTAINER(frame), vbox); return frame; }
GtkWidget *voronoi_dialog_new (gpointer data) { GtkWidget *vbox, *vbox2, *vbox3, *guide_box, *hbox, *hbox1, *hbox2, *frame, *frame2, *button, *wdg, *check_box, *lblmax, *lblwidth, *button_uniform, *preview_box, *scale; GtkObject *adj; GSList *group = NULL, *group1 = NULL, *group2 = NULL, *group3 = NULL; voronoi_struct *vs; voronoi_dialog_struct *vds; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data; vs = hfw->hf_options->img->voronoi; vds = hfw->hf_options->img->voronoi_dialog; frame = options_frame_new("Cracks network"); vbox = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(vbox)); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Average cell size", hbox, FALSE,TRUE, DEF_PAD); vds->adj_cell_size = gtk_adjustment_new ( vs->cell_size,0.0, 50.0, 0.1, 0.1, 0.0); define_scale_in_box(vds->adj_cell_size,hbox,1,DEF_PAD); gtk_signal_connect (GTK_OBJECT (vds->adj_cell_size), "value_changed", GTK_SIGNAL_FUNC (gdouble_adj_callb), (gpointer) &vs->cell_size); gtk_signal_connect (GTK_OBJECT (vds->adj_cell_size), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), seed_dialog_new(data, vs->seed, change_voronoi_seed), TRUE, TRUE, 0); // ******** Distribution of cells // Box for radio buttons vbox2 = gtk_vbox_new(FALSE,0); gtk_widget_show(GTK_WIDGET(vbox2)); frame2 = define_frame_with_hiding_arrows ("Cell distribution", vbox2, hfw->hf_options->tools_window, FALSE); gtk_box_pack_start(GTK_BOX(vbox), frame2, TRUE, TRUE, 0); // We need a scale for the REGULAR option, for controlling the perturbation hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Random variation", hbox, FALSE,TRUE, DEF_PAD); vds->adj_random_variation = gtk_adjustment_new ( vs->random_variation,0.0, 100.0, 1, 1, 0.0); wdg = define_scale_in_box(vds->adj_random_variation,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (vds->adj_random_variation), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->random_variation); gtk_signal_connect (GTK_OBJECT (vds->adj_random_variation), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); // We need a row of buttons for controlling the scale (multiple or not) hbox1 = gtk_hbox_new(FALSE,DEF_PAD); define_label_in_box("Scale", hbox1, FALSE,TRUE, DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox1)); define_radio_button_in_box_with_data (hbox1, &group1, "1X", set_scale_1x, &vs->scale, (vs->scale==SCALE_1X)) ; define_radio_button_in_box_with_data (hbox1, &group1, "1X+2X", set_scale_1x_2x, &vs->scale, (vs->scale==SCALE_1X_2X)) ; define_radio_button_in_box_with_data (hbox1, &group1, "1X+2X+4X", set_scale_1x_2x_4x, &vs->scale, (vs->scale==SCALE_1X_2X_4X)) ; button = define_radio_button_in_box_with_data (vbox2, &group, "Uniform / random", set_uniform_distrib, &vs->distribution_type, (vs->distribution_type==UNIFORM)) ; gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) hide_if_true, (gpointer) hbox); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) show_if_true, (gpointer) hbox1); button = define_radio_button_in_box_with_data (vbox2, &group, "Centered / random", set_centered_distrib, &vs->distribution_type, (vs->distribution_type==CENTERED)) ; gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) hide_if_true, (gpointer) hbox); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) show_if_true, (gpointer) hbox1); button = define_radio_button_in_box_with_data (vbox2, &group, "Regular / perturbated", set_regular_distrib, &vs->distribution_type, (vs->distribution_type==REGULAR)) ; gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) show_if_true, (gpointer) hbox); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) hide_if_true, (gpointer) hbox1); // At the end, We add the random variation scale for REGULAR // and the radio buttons for the multiple scale control gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); if (vs->distribution_type!=REGULAR) gtk_widget_hide(GTK_WIDGET(hbox)); else gtk_widget_hide(GTK_WIDGET(hbox1)); /*****************************************************/ // Now specify how the current HF should be used vbox2 = gtk_vbox_new(FALSE,0); gtk_widget_show(GTK_WIDGET(vbox2)); frame2 = define_frame_with_hiding_arrows ("Use of current height field", vbox2, hfw->hf_options->tools_window, FALSE); gtk_box_pack_start(GTK_BOX(vbox), frame2, FALSE, FALSE, 0.5*DEF_PAD); // Vbox3: "USE AS GUIDE" dialog (for adding noise) guide_box = gtk_vbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(guide_box)); check_box = define_check_button_in_box ("Gener noise anyway?", guide_box, 0, 0, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_box),vs->gener_noise); gtk_signal_connect (GTK_OBJECT(check_box), "toggled", GTK_SIGNAL_FUNC(toggle_check_button_callb), (gpointer) &vs->gener_noise); // Preview box preview_box = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(preview_box)); vds->noise_preview = view_struct_new(NOISE_PREVIEW_SIZE,NOISE_PREVIEW_SIZE,(gpointer) compute_noise_preview,(gpointer) hfw->hf_options->img); gtk_box_pack_start(GTK_BOX(preview_box), vds->noise_preview->area, TRUE, TRUE, DEF_PAD *0.5); vbox3 = seed_dialog_new_lbl(hfw->hf_options->img, vs->noise_opt->seed, change_noise_seed, FALSE, VERTICAL_BOX ); adj = gtk_adjustment_new (0, -4, 4, 1, 1, 0.1); scale = gtk_hscale_new (GTK_ADJUSTMENT (adj)); gtk_widget_set_usize(scale,75,0); gtk_scale_set_digits (GTK_SCALE (scale), 0); gtk_box_pack_start (GTK_BOX (vbox3), scale, TRUE, TRUE, DEF_PAD*0.5); gtk_widget_show (scale); gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC(gint_adj_callb), &vs->noise_opt->roughness); gtk_signal_connect (GTK_OBJECT (adj), "value_changed", GTK_SIGNAL_FUNC(draw_area_callb), vds->noise_preview); gtk_box_pack_start(GTK_BOX(preview_box), vbox3, TRUE, TRUE, DEF_PAD*0.5); gtk_box_pack_start(GTK_BOX(guide_box), preview_box, FALSE, FALSE, 0.5*DEF_PAD); gtk_signal_connect (GTK_OBJECT (check_box), "toggled", (GtkSignalFunc) show_if_true, (gpointer) preview_box); if (vs->gener_noise==FALSE) gtk_widget_hide(GTK_WIDGET(preview_box)); // Scale for the noise level hbox2 = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox2)); define_label_in_box("Noise level", hbox2, FALSE,TRUE, DEF_PAD); vds->adj_noise_level = gtk_adjustment_new ( vs->noise_level,0.0, 100.0, 1, 1, 0.0); wdg = define_scale_in_box(vds->adj_noise_level,hbox2,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (vds->adj_noise_level), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->noise_level); gtk_signal_connect (GTK_OBJECT (vds->adj_noise_level), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); gtk_signal_connect (GTK_OBJECT (check_box), "toggled", (GtkSignalFunc) show_if_true, (gpointer) hbox2); // hbox for NOISE vs GUIDE radio buttons hbox = gtk_hbox_new(FALSE,0); gtk_widget_show(GTK_WIDGET(hbox)); button = define_radio_button_in_box_with_data (hbox, &group2, "As noise", set_use_as_noise, &vs->hf_use, (vs->hf_use==USE_AS_NOISE)) ; gtk_signal_connect (GTK_OBJECT (button), "toggled", (GtkSignalFunc) hide_if_true, (gpointer) check_box); // Always show the noise scale in that case gtk_signal_connect_object(GTK_OBJECT(button), "toggled", GTK_SIGNAL_FUNC(gtk_widget_show), (gpointer) wdg); button = define_radio_button_in_box_with_data (hbox, &group2, "As guide", set_use_as_guide, &vs->hf_use, (vs->hf_use==USE_AS_GUIDE)) ; gtk_signal_connect (GTK_OBJECT (button), "toggled", (GtkSignalFunc) show_if_true, (gpointer) guide_box); if (vs->hf_use==USE_AS_NOISE) gtk_widget_hide(GTK_WIDGET(guide_box)); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), guide_box, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0); /*********************** Crack width **************************/ vbox2 = gtk_vbox_new(FALSE,0); gtk_widget_show(GTK_WIDGET(vbox2)); frame2 = define_frame_with_hiding_arrows ("Crack width", vbox2, hfw->hf_options->tools_window, FALSE); gtk_box_pack_start(GTK_BOX(vbox), frame2, FALSE, FALSE, 0.5*DEF_PAD); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); button_uniform = define_radio_button_in_box_with_data (hbox, &group3, "Uniform", set_fixed_width, &vs->crack_width_type, vs->crack_width_type==FIXED_WIDTH) ; button = define_radio_button_in_box_with_data (hbox, &group3, "From distance",set_from_distance, &vs->crack_width_type, vs->crack_width_type==FROM_DISTANCE) ; gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); // Width: in pixels for "Uniform", relative for "Varies with distance" hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Min", hbox, FALSE,TRUE, DEF_PAD); vds->adj_min_width = gtk_adjustment_new ( vs->min_width,0.0, 10.0, 1, 1, 0.0); wdg = define_scale_in_box(vds->adj_min_width,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (vds->adj_min_width), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->min_width); gtk_signal_connect (GTK_OBJECT (vds->adj_min_width), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button_uniform), "toggled", (GtkSignalFunc) hide_if_true, (gpointer) hbox); if (vs->crack_width_type==FIXED_WIDTH) gtk_widget_hide(GTK_WIDGET(hbox)); hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); lblmax = define_label_in_box("Max", hbox, FALSE,TRUE, DEF_PAD); lblwidth = define_label_in_box("Width", hbox, FALSE,TRUE, DEF_PAD); vds->adj_max_width = gtk_adjustment_new ( vs->max_width,0.0, 10.0, 1, 1, 0.0); wdg = define_scale_in_box(vds->adj_max_width,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (vds->adj_max_width), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->max_width); gtk_signal_connect (GTK_OBJECT (vds->adj_max_width), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); // Consistency controls (min should be <= max) gtk_signal_connect (GTK_OBJECT (vds->adj_min_width), "value_changed", GTK_SIGNAL_FUNC (check_max_width), (gpointer) hfw->hf_options->img); gtk_signal_connect (GTK_OBJECT (vds->adj_max_width), "value_changed", GTK_SIGNAL_FUNC (check_min_width), (gpointer) hfw->hf_options->img); gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); gtk_signal_connect (GTK_OBJECT (button_uniform), "toggled", (GtkSignalFunc) hide_if_true, (gpointer) lblmax); gtk_signal_connect (GTK_OBJECT (button_uniform), "toggled", (GtkSignalFunc) show_if_true, (gpointer) lblwidth); if (vs->crack_width_type==FIXED_WIDTH) gtk_widget_hide(GTK_WIDGET(lblmax)); button = gtk_button_new_with_label (_("Apply")); gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) apply_voronoi_callb, data); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(vbox), align_widget(button,0.5,0.5), FALSE, FALSE, DEF_PAD); /************************ Edge level control ************************/ hbox = gtk_hbox_new(FALSE,DEF_PAD); gtk_widget_show(GTK_WIDGET(hbox)); define_label_in_box("Edge raising", hbox, FALSE,TRUE, DEF_PAD); vds->adj_edges_level = gtk_adjustment_new ( vs->edges_level,0.0, 100.0, 1, 1, 0.0); vds->wdg_edges_level = define_scale_in_box(vds->adj_edges_level,hbox,0,DEF_PAD); gtk_signal_connect (GTK_OBJECT (vds->adj_edges_level), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->edges_level); gtk_signal_connect (GTK_OBJECT (vds->adj_edges_level), "value_changed", GTK_SIGNAL_FUNC (edges_level_callb), data); gtk_signal_connect (GTK_OBJECT (vds->adj_edges_level), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); // We activate when apply is clicked gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) set_sensitive_callb, (gpointer) vds->wdg_edges_level); gtk_widget_set_sensitive (GTK_WIDGET(vds->wdg_edges_level),FALSE); // Controls gtk_box_pack_start (GTK_BOX (vbox), reset_accept_buttons_new (data, &vds->accept), FALSE, FALSE, DEF_PAD); gtk_container_add(GTK_CONTAINER(frame), vbox); return frame; }