From 355dfd6be1a2c9773a9e6ed72903cda12a2c7c7b Mon Sep 17 00:00:00 2001 From: damien Date: Sat, 3 Mar 2001 06:20:43 +0000 Subject: updated --- clock.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'clock.pm') diff --git a/clock.pm b/clock.pm index 5c96ae65..d39d038b 100755 --- a/clock.pm +++ b/clock.pm @@ -57,7 +57,7 @@ $hbox2->pack_start($spinner_s, 0, 0, 0); my $bbox = new Gtk::HButtonBox; $bbox->set_layout(-end); -$vbox->pack_start($bbox, 1, 1, 5); +$vbox->pack_start($bbox, 0, 0, 5); my $button_ok = new Gtk::Button "OK"; $button_ok->signal_connect ( clicked => sub { system("date -s " . $adj_h->set_value($hour) . ":" . $adj_m->set_value($min) . ":" . $adj_s->set_value($sec)); @@ -67,10 +67,11 @@ $bbox->add($button_ok ); my $button_cancel = new Gtk::Button "Cancel"; my $button_reset = new Gtk::Button "Reset"; $button_cancel->signal_connect ( clicked => sub { + quit_global(); + Gtk->timeout_remove($timer); $timer=Gtk->timeout_add(120, sub { time_to_rad(); Repaint($drawing_area) }); time_to_rad(); Repaint($drawing_area); $button_reset->set_sensitive(0); - quit_global(); }); $bbox->add($button_cancel ); $button_reset->signal_connect ( clicked => sub { @@ -84,6 +85,8 @@ $button_reset->set_sensitive(0); $window->show_all; $timer=Gtk->timeout_add(120, sub { time_to_rad(); Repaint($drawing_area) }); +Gtk->main_iteration while Gtk->events_pending; +$::isEmbedded and kill USR2, $::CCPID; Gtk->main; @@ -147,7 +150,7 @@ sub rad_to_time { sub time_to_rad { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);# now_tm = localtime (&now); - $dRadians_hour = $hour % 12 * $pi / 6.0; + $dRadians_hour = $hour % 12 * $pi / 6.0 + ($pi * $min / 360.0); $dRadians_min = $min * $pi / 30.0; $dRadians_sec = $sec * $pi / 30.0; $adj_h->set_value($hour); @@ -160,7 +163,7 @@ sub Repaint { my ($drawing_area) = @_; - $dRadians_hour = POSIX::floor($dRadians_hour / $pi * 6 + 0.5) * $pi / 6.0; + my $dRadians_hour_real = POSIX::floor($dRadians_hour / $pi*6 + 0.5) * $pi/6.0 + $dRadians_min / 12; $dRadians_min = POSIX::floor($dRadians_min / $pi * 30 + 0.5) * $pi / 30.0; $dRadians_sec = POSIX::floor($dRadians_sec / $pi * 30 + 0.5) * $pi / 30.0; $pixmap->draw_rectangle($drawing_area->style->white_gc, 1, 0, 0, @@ -178,7 +181,7 @@ sub Repaint my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);# now_tm = localtime (&now); my $dRadians; foreach ([$gray_gc, 5], [$black_gc, 0]) { - DrawHour ($pixmap, $_->[0], $midx, $midy, $dRadians_hour, $_->[1]); + DrawHour ($pixmap, $_->[0], $midx, $midy, $dRadians_hour_real, $_->[1]); DrawMin ($pixmap, $_->[0], $midx, $midy, $dRadians_min, $_->[1]); DrawSec ($pixmap, $_->[0], $midx, $midy, $dRadians_sec, $_->[1]); } -- cgit v1.2.1