summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclock.pm41
1 files changed, 20 insertions, 21 deletions
diff --git a/clock.pm b/clock.pm
index 793876ad..adb5476e 100755
--- a/clock.pm
+++ b/clock.pm
@@ -5,11 +5,11 @@ use Gtk;
use lib qw(/usr/lib/libDrakX);
use interactive;
use standalone;
-use common qw(:common :file :functional :system);
use timezone;
init Gtk;
#use strict;
use Locale::GetText;
+use MDK::Common;
setlocale (LC_ALL, "");
Locale::GetText::textdomain ("DrakConf");
@@ -23,7 +23,6 @@ sub _ {
$::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/;
my $in = vnew interactive('su');
-my $pi=3.1416;
my $pixmap;
my $radius;
my $dRadians_hour;
@@ -187,7 +186,7 @@ sub motion_event {
$button_reset->set_sensitive(1);
}
- $$Radian=-atan2(($event->{'x'}-$midx),($event->{'y'}-$midy)) + $pi;
+ $$Radian=-atan2(($event->{'x'}-$midx),($event->{'y'}-$midy)) + $PI;
Repaint($widget);
rad_to_time();
@@ -232,16 +231,16 @@ sub configure_event {
sub rad_to_time {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
- $adj_h->set_value(POSIX::floor($dRadians_hour * 6 / $pi) + ($is24 ? 12 : 0));
- $adj_m->set_value(POSIX::floor($dRadians_min*30/$pi));
- $adj_s->set_value(POSIX::floor($dRadians_sec*30/$pi));
+ $adj_h->set_value(POSIX::floor($dRadians_hour * 6 / $PI) + ($is24 ? 12 : 0));
+ $adj_m->set_value(POSIX::floor($dRadians_min*30/$PI));
+ $adj_s->set_value(POSIX::floor($dRadians_sec*30/$PI));
}
sub time_to_rad {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = @_;
- $dRadians_hour = $hour % 12 * $pi / 6.0;
- $dRadians_min = $min * $pi / 30.0;
- $dRadians_sec = $sec * $pi / 30.0;
+ $dRadians_hour = $hour % 12 * $PI / 6.0;
+ $dRadians_min = $min * $PI / 30.0;
+ $dRadians_sec = $sec * $PI / 30.0;
$adj_h->set_value($hour);
$adj_m->set_value($min);
$adj_s->set_value($sec);
@@ -250,8 +249,8 @@ sub time_to_rad {
sub Repaint {
my ($drawing_area) = @_;
- my $dRadians_hour_real = POSIX::floor($dRadians_hour / $pi*6 ) * $pi/6.0 + $dRadians_min / 12;
- my $dRadians_min_real = POSIX::floor($dRadians_min / $pi * 30 ) * $pi / 30.0;
+ my $dRadians_hour_real = POSIX::floor($dRadians_hour / $PI*6 ) * $PI/6.0 + $dRadians_min / 12;
+ my $dRadians_min_real = POSIX::floor($dRadians_min / $PI * 30 ) * $PI / 30.0;
my $dRadians_sec_real = $dRadians_sec;
$pixmap->draw_rectangle($drawing_area->style->white_gc, 1, 0, 0,
$drawing_area->allocation->[2],
@@ -289,12 +288,12 @@ sub DrawMin {
$pixmap->draw_polygon ($gc, 1,
$midx+$dec - 0.03 * $radius * sin ($dRadians),
$midy+$dec + 0.03 * $radius * cos ($dRadians),
- $midx+$dec - 0.03 * $radius * sin ($dRadians+$pi/2),
- $midy+$dec + 0.03 * $radius * cos ($dRadians+$pi/2),
+ $midx+$dec - 0.03 * $radius * sin ($dRadians+$PI/2),
+ $midy+$dec + 0.03 * $radius * cos ($dRadians+$PI/2),
$midx+$dec + 0.80 * $radius * sin ($dRadians),
$midy+$dec - 0.80 * $radius * cos ($dRadians),
- $midx+$dec + 0.03 * $radius * sin ($dRadians+$pi/2),
- $midy+$dec - 0.03 * $radius * cos ($dRadians+$pi/2));
+ $midx+$dec + 0.03 * $radius * sin ($dRadians+$PI/2),
+ $midy+$dec - 0.03 * $radius * cos ($dRadians+$PI/2));
}
sub DrawHour {
@@ -302,17 +301,17 @@ sub DrawHour {
$pixmap->draw_polygon ($gc, 1,
$midx+$dec - 0.05 * $radius * sin ($dRadians),
$midy+$dec + 0.05 * $radius * cos ($dRadians),
- $midx+$dec - 0.05 * $radius * sin ($dRadians+$pi/2),
- $midy+$dec + 0.05 * $radius * cos ($dRadians+$pi/2),
+ $midx+$dec - 0.05 * $radius * sin ($dRadians+$PI/2),
+ $midy+$dec + 0.05 * $radius * cos ($dRadians+$PI/2),
$midx+$dec + 0.70 * $radius * sin ($dRadians),
$midy+$dec - 0.70 * $radius * cos ($dRadians),
- $midx+$dec + 0.05 * $radius * sin ($dRadians+$pi/2),
- $midy+$dec - 0.05 * $radius * cos ($dRadians+$pi/2));
+ $midx+$dec + 0.05 * $radius * sin ($dRadians+$PI/2),
+ $midy+$dec - 0.05 * $radius * cos ($dRadians+$PI/2));
}
sub DrawTickAt {
my ($pixmap, $black_gc, $gray_gc, $nHour, $cx, $cy) = @_;
- my $dRadians = $nHour * $pi / 6.0;
+ my $dRadians = $nHour * $PI / 6.0;
$pixmap->draw_line ($_->[0],
$cx+$_->[1] + 0.90 * $radius * sin ($dRadians),
@@ -324,7 +323,7 @@ sub DrawTickAt {
sub DrawPointAt {
my ($pixmap, $black_gc, $gray_gc, $nHour, $cx, $cy) = @_;
- my $dRadians = $nHour * $pi / 30.0;
+ my $dRadians = $nHour * $PI / 30.0;
$pixmap->draw_point ($black_gc,
$cx + 0.95 * $radius * sin ($dRadians),