Пример #1
0
void coords_changed(MtxCurve *curve, gpointer data)
{
	gint index = mtx_curve_get_active_coord_index(curve);
	MtxCurveCoord point;
	mtx_curve_get_coords_at_index(curve,index,&point);
	/*printf("changed coord %i, to %.1f,%.1f\n",index,point.x,point.y);*/
	
}
Пример #2
0
/*! 
  \brief signal handler to deal with the user clicking on the curve and moving
  the vertex, which thus updates the corresponding entry
  \param curve is the pointer to the curve object
  \param data is unused
  */
G_MODULE_EXPORT void coords_changed(GtkWidget *curve, gpointer data)
{
	MtxCurveCoord point;
	gint index = 0;
	GArray *array;
	gint precision = 0;
	GtkWidget *entry = NULL;
	gchar * tmpbuf = NULL;

	index = mtx_curve_get_active_coord_index(MTX_CURVE(curve));
	mtx_curve_get_coords_at_index(MTX_CURVE(curve),index,&point);

	if(!mtx_curve_get_x_axis_lock_state(MTX_CURVE(curve)))
	{
		/* X Coord */
		array = OBJ_GET(curve,"x_entries");
		entry = g_array_index(array,GtkWidget *,index);
		precision = (GINT)OBJ_GET(entry, "precision");
		tmpbuf = g_strdup_printf("%1$.*2$f",point.x,precision);
		gtk_entry_set_text(GTK_ENTRY(entry),tmpbuf);
		g_signal_emit_by_name(entry, "activate");
		g_free(tmpbuf);
	}