Beispiel #1
0
void update_attributes(void)
{
	update_text_controls();
	update_general_controls();
	update_onscreen_w_ranges();
	update_onscreen_a_ranges();
	update_onscreen_tblocks();
	update_onscreen_tgroups();
	update_onscreen_polygons();
	return;
}
Beispiel #2
0
gboolean remove_w_range(GtkWidget * widget, gpointer data)
{
	gint index = -1;
	if (!GTK_IS_WIDGET(gauge))
		return FALSE;

	index = (GINT)OBJ_GET((widget),"range_index");
	mtx_gauge_face_remove_warning_range(MTX_GAUGE_FACE(gauge),index);
	changed = TRUE;
	update_onscreen_w_ranges();

	return TRUE;
}
Beispiel #3
0
G_MODULE_EXPORT gboolean create_warning_span_event(GtkWidget * widget, gpointer data)
{
	GtkBuilder *warnings;
	GtkWidget *dialog = NULL;
	GtkWidget *spinner = NULL;
	GtkWidget *tmpwidget = NULL;
	GtkWidget *cbutton = NULL;
	MtxWarningRange *range = NULL;
	gfloat lbound = 0.0;
	gfloat ubound = 0.0;
	gchar * filename = NULL;
	gint result = 0;
	GError *error = NULL;
	gchar *pathstub = NULL;


	if (!GTK_IS_WIDGET(gauge))
		return FALSE;

	pathstub = g_build_filename(GAUGEDESIGNER_GLADE_DIR,"w_range.ui",NULL);
	filename = get_file(NULL,pathstub,NULL);
	g_free(pathstub);
	if (filename)
	{
		warnings = gtk_builder_new();
		if(!gtk_builder_add_from_file(warnings,filename,&error))
		{
			g_warning ("Couldn't load builder file: %s", error->message);
			g_error_free(error);
			exit(-1);
		}
		g_free(filename);
	}
	else
	{
		printf("Can't locate primary ui file!!!!\n");
		exit(-1);
	}

	gtk_builder_connect_signals(warnings,NULL);
	dialog = GTK_WIDGET (gtk_builder_get_object(warnings,"w_range_dialog"));
	cbutton = GTK_WIDGET (gtk_builder_get_object(warnings,"range_day_colorbutton"));
	gtk_color_button_set_color(GTK_COLOR_BUTTON(cbutton),&white);
	cbutton = GTK_WIDGET (gtk_builder_get_object(warnings,"range_nite_colorbutton"));
	gtk_color_button_set_color(GTK_COLOR_BUTTON(cbutton),&black);
	if (!GTK_IS_WIDGET(dialog))
	{
		return FALSE;
	}

	/* Set the controls to sane ranges corresponding to the gauge */
	mtx_gauge_face_get_attribute(MTX_GAUGE_FACE(gauge), LBOUND, &lbound);
	mtx_gauge_face_get_attribute(MTX_GAUGE_FACE(gauge), UBOUND, &ubound);
	spinner = GTK_WIDGET (gtk_builder_get_object(warnings,"range_lowpoint_spin"));
	OBJ_SET(spinner,"builder",warnings);
	gtk_spin_button_set_range(GTK_SPIN_BUTTON(spinner),lbound,ubound);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner),(ubound-lbound)/2.0);
	spinner = GTK_WIDGET (gtk_builder_get_object(warnings,"range_highpoint_spin"));
	OBJ_SET(spinner,"builder",warnings);
	gtk_spin_button_set_range(GTK_SPIN_BUTTON(spinner),lbound,ubound);
	gtk_spin_button_set_value(GTK_SPIN_BUTTON(spinner),ubound);

	result = gtk_dialog_run(GTK_DIALOG(dialog));
	switch (result)
	{
		case GTK_RESPONSE_APPLY:
			range = g_new0(MtxWarningRange, 1);
			range->lowpoint = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(warnings,"range_lowpoint_spin")));
			range->highpoint = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(warnings,"range_highpoint_spin")));
			range->inset = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(warnings,"range_inset_spin")));
			range->lwidth = gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(warnings,"range_lwidth_spin")));
			gtk_color_button_get_color(GTK_COLOR_BUTTON(gtk_builder_get_object(warnings,"range_day_colorbutton")),&range->color[MTX_DAY]);
			gtk_color_button_get_color(GTK_COLOR_BUTTON(gtk_builder_get_object(warnings,"range_nite_colorbutton")),&range->color[MTX_NITE]);
			changed = TRUE;
			mtx_gauge_face_set_warning_range_struct(MTX_GAUGE_FACE(gauge),range);
			g_free(range);
			update_onscreen_w_ranges();

			break;
		default:
			break;
	}
	if (GTK_IS_WIDGET(dialog))
		gtk_widget_destroy(dialog);

	return (FALSE);
}