forked from AuroraMiddleware/gtk
use G_PI instead of M_PI.
2002-12-20 Sven Neumann <sven@gimp.org> * examples/gtkdial/gtkdial.c: use G_PI instead of M_PI.
This commit is contained in:
parent
7ec4703c27
commit
869bec21d4
@ -353,7 +353,7 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
if ((upper - lower) == 0)
|
||||
return FALSE;
|
||||
|
||||
increment = (100*M_PI) / (dial->radius*dial->radius);
|
||||
increment = (100*G_PI) / (dial->radius*dial->radius);
|
||||
|
||||
inc = (upper - lower);
|
||||
|
||||
@ -363,7 +363,7 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
|
||||
for (i = 0; i <= inc; i++)
|
||||
{
|
||||
theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
|
||||
theta = ((gfloat)i*G_PI / (18*inc/24.) - G_PI/6.);
|
||||
|
||||
if ((theta - last) < (increment))
|
||||
continue;
|
||||
@ -558,17 +558,17 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
old_value = dial->adjustment->value;
|
||||
dial->angle = atan2(yc-y, x-xc);
|
||||
|
||||
if (dial->angle < -M_PI/2.)
|
||||
dial->angle += 2*M_PI;
|
||||
if (dial->angle < -G_PI/2.)
|
||||
dial->angle += 2*G_PI;
|
||||
|
||||
if (dial->angle < -M_PI/6)
|
||||
dial->angle = -M_PI/6;
|
||||
if (dial->angle < -G_PI/6)
|
||||
dial->angle = -G_PI/6;
|
||||
|
||||
if (dial->angle > 7.*M_PI/6.)
|
||||
dial->angle = 7.*M_PI/6.;
|
||||
if (dial->angle > 7.*G_PI/6.)
|
||||
dial->angle = 7.*G_PI/6.;
|
||||
|
||||
dial->adjustment->value = dial->adjustment->lower + (7.*M_PI/6 - dial->angle) *
|
||||
(dial->adjustment->upper - dial->adjustment->lower) / (4.*M_PI/3.);
|
||||
dial->adjustment->value = dial->adjustment->lower + (7.*G_PI/6 - dial->angle) *
|
||||
(dial->adjustment->upper - dial->adjustment->lower) / (4.*G_PI/3.);
|
||||
|
||||
if (dial->adjustment->value != old_value)
|
||||
{
|
||||
@ -615,7 +615,7 @@ gtk_dial_update (GtkDial *dial)
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
|
||||
dial->angle = 7.*G_PI/6. - (new_value - dial->adjustment->lower) * 4.*G_PI/3. /
|
||||
(dial->adjustment->upper - dial->adjustment->lower);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (dial));
|
||||
|
Loading…
Reference in New Issue
Block a user