Exemple #1
0
void MainWindow::BoxChecked(bool t) {
	if (ui->LowPass->isChecked()) {
		set_filter_type(0);
	} else if (ui->HighPass->isChecked()) {
		set_filter_type(1);
	}	else if (ui->BandPass->isChecked()) {
		set_filter_type(2);
	}	else if (ui->BandStop->isChecked()) {
		set_filter_type(3);
	}
	updatePlot();
}
Exemple #2
0
GtkWidget * surfadd_dialog_new(gpointer hfo_ptr) {

	GtkObject *adj;
	GtkWidget *button, *table, *hbox, *vbox, *scale, *scrolled_window;
	GtkWidget *frame;
	static gboolean dummy_flag;

	gpointer data;
	hf_options_struct *hfo = (hf_options_struct *) hfo_ptr;

	if (!hfo)
		return gtk_label_new(_("No surface addition dialog"));

	data = hfo->hfw_ptr_ptr;

//	Main dialog box
	vbox = gtk_vbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(vbox));

//	2008-02 Now with scrolled window
	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_widget_show (scrolled_window);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_window), vbox);

	gtk_widget_set_size_request (scrolled_window, -1, gdk_screen_get_height(gdk_screen_get_default())/3);

//	Seed
	
	gtk_box_pack_start_defaults(GTK_BOX(vbox), 
		seed_dialog_new(data, hfo->surfadd_options->seed, 
		change_surfadd_seed));

	table = gtk_table_new(4, 2, FALSE);
	gtk_widget_show(table);

//	Slope / roughness (kind of)
//	From 0 to 100%
//	100: we keep the same H for each step, even if the surfaces to add are smaller
//	50:  we divide the H by 2 for each step (default), because  the surfaces are divided by two
//	100:  we divide the H by 3 for each step.

	define_label_in_table("Slope",table, 0, 1, 0, 1, 0); 

	adj = gtk_adjustment_new (hfo->surfadd_options->slope, 0, 100, 1, 1, 0.01);

	scale = define_scale_in_table(adj,table,1,2,0,1,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (slope_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Random x-y displacement scale
//	From 0 to 100 % (100 % = twice the size of the current surface to add)

	define_label_in_table("XZ Displacement ",table, 0, 1, 1, 2, 0); 

	adj = gtk_adjustment_new 
		(hfo->surfadd_options->xy_random_range, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,1,2,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (xy_scale_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Random height displacement scale
//	From 0 to 100 % (100 % = twice the height of the current surface to add)

	define_label_in_table("H Displacement ",table, 0, 1, 2, 3, 0); 
	adj = gtk_adjustment_new 
		(hfo->surfadd_options->h_random_range, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,2,3,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (h_scale_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Lateral density variation
//	From 0 to 100 % (100 % = twice the default density)

	define_label_in_table("Density",table, 0, 1, 3, 4, 0); 
	adj = gtk_adjustment_new 
		(hfo->surfadd_options->density, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,3,4,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (density_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(hbox);

	gtk_box_pack_start_defaults(GTK_BOX(hbox), table);

	gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox);

//	Filters for the primitive surface and preview
	frame = frame_new("Primitive surface", DEF_PAD*0.5);
	gtk_container_add(GTK_CONTAINER(vbox), frame);

//	HBOX will contain the shape filter dialog and the preview
	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(hbox);
	
	gtk_container_add(GTK_CONTAINER(frame), hbox);

//	We create the primitive surface, and the preview area at the same time
	hfo->primit_surf = hf_wrapper_new(NULL,NULL,hbox, hbox, 
		hf_options_dialog_new(hfo->tools_window,
			hbox, 
			hfo->tooltips, 
			NULL, 
			&hfo->primit_surf,
			hfo->stack,
			hfo->doc_type,
			hfo->all_docs,
			hfo->get_doc_list_from_type),
		&dummy_flag, &dummy_flag, NULL, NULL, NULL, NULL, HFPRIMITIVE);
//	Shared data:
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->dist_matrix =
			hfo->dist_matrix;

	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_calculation = (gpointer) uniform;
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_callb = NULL;
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_options = (gpointer) hfo->uniform_value;

	set_filter_type (((hf_wrapper_struct *) hfo->primit_surf)->hf_options->creation_fd_struct, MEDIUM_FILTER_1);
	
	set_dependent_process ((hf_wrapper_struct *) hfo->primit_surf, gener_hf_from_ptr_ptr, hfo->hfw_ptr_ptr);

//	Set the merge operation to MULTIPLY:

	set_filter_merge(((hf_wrapper_struct *) hfo->primit_surf)->hf_options->creation_fd_struct, 1);

//	Frequency dialog
	gtk_box_pack_start(GTK_BOX(vbox),
		surfadd_frq_dialog_new(hfo_ptr), FALSE, FALSE,0);

	return define_options_frame_with_hiding_arrows("sum of surfaces", scrolled_window, hfo->tools_window, TRUE);
}