summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-03-04 01:02:00 +0000
committerdamien <damien@mandriva.com>2001-03-04 01:02:00 +0000
commitb0aac95d94563ca2926126db24f7aae299185e52 (patch)
treee97ff8179e44452963090f014b119f9a175d998a
parentac53906dc45ffaf83f5a9c7a1f63515842ac1422 (diff)
downloadcontrol-center-b0aac95d94563ca2926126db24f7aae299185e52.tar
control-center-b0aac95d94563ca2926126db24f7aae299185e52.tar.gz
control-center-b0aac95d94563ca2926126db24f7aae299185e52.tar.bz2
control-center-b0aac95d94563ca2926126db24f7aae299185e52.tar.xz
control-center-b0aac95d94563ca2926126db24f7aae299185e52.zip
updated
-rwxr-xr-xclock.pm31
1 files changed, 29 insertions, 2 deletions
diff --git a/clock.pm b/clock.pm
index 408596f8..425c8b1c 100755
--- a/clock.pm
+++ b/clock.pm
@@ -18,6 +18,7 @@ my $timer;
my $midx, $midy;
my $first=1;
my $is24;
+my $h_old;
my $window = $::isEmbedded ? new Gtk::Plug ($::XID) : new Gtk::Window -toplevel;
my $vbox = new Gtk::VBox(0,0);
$window->add($vbox);
@@ -48,6 +49,7 @@ $hbox2->pack_start($spinner_h, 0, 0, 0);
$spinner_h->set_wrap(1);
$spinner_h->signal_connect ( activate => \&spinned);
$spinner_h->signal_connect ( button_release_event => \&spinned);
+$spinner_h->signal_connect ( changed => \&changed );
my $adj_m = new Gtk::Adjustment 0.0, 0.0, 59.0, 1.0, 5.0, 0.0;
my $spinner_m = new Gtk::SpinButton $adj_m, 0, 0;
$hbox2->pack_start($spinner_m, 0, 0, 0);
@@ -95,9 +97,35 @@ Gtk->main_iteration while Gtk->events_pending;
$::isEmbedded and kill USR2, $::CCPID;
Gtk->main;
+sub changed {
+ if ($h_old > $adj_h->get_value && $adj_h->get_value < ($is24 ? 18 : 6) && $h_old > ($is24 ? 18 : 6) && $h_old < ($is24 ? 24 : 12)) {
+ print "LLLLLL $h_old " . $adj_h->get_value . " $is24\n";
+ $h_old= $adj_h->get_value;
+ $is24 = !$is24;
+ print "MMMMMM $h_old " . $adj_h->get_value . " $is24\n";
+ }
+ elsif ($h_old < $adj_h->get_value && $adj_h->get_value > ($is24 ? 18 : 6) && $h_old < ($is24 ? 18 : 6) && ($adj_h->get_value-$h_old !=12 )) {
+ print "llllll $h_old " . $adj_h->get_value . " $is24\n";
+ $h_old= $adj_h->get_value;
+ $is24 = !$is24;
+ print "mmmmmm $h_old " . $adj_h->get_value . " $is24\n";
+ }
+# elsif ($h_old < $adj_h->get_value && $adj_h->get_value > 6 && $h_old < 6) {
+# print "0\n";
+# $is24 = 0;
+# }
+# $is24 and $adj_h->set_value($real_h+12);
+# $is24 or $adj_h->set_value($adj_h->get_value-12);
+ $h_old=$adj_h->get_value;
+# my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
+# time_to_rad($adj_s->get_value,$adj_m->get_value,$adj_h->get_value,$mday,$mon,$year,$wday,$yday,$isdst);
+# Repaint($drawing_area);
+}
+
sub spinned {
Gtk->timeout_remove($timer);
$button_reset->set_sensitive(1);
+
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
time_to_rad($adj_s->get_value,$adj_m->get_value,$adj_h->get_value,$mday,$mon,$year,$wday,$yday,$isdst);
Repaint($drawing_area);
@@ -156,7 +184,7 @@ sub configure_event {
sub rad_to_time {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);# now_tm = localtime (&now);
- $adj_h->set_value(POSIX::floor($dRadians_hour * 6 / $pi));#$dRadians_hour * 6 / $pi);
+ $adj_h->set_value(POSIX::floor($dRadians_hour * 6 / $pi) + ($is24 ? 12 : 0));#$dRadians_hour * 6 / $pi);
$adj_m->set_value(POSIX::floor($dRadians_min*30/$pi));
$adj_s->set_value(POSIX::floor($dRadians_sec*30/$pi));
}
@@ -169,7 +197,6 @@ sub time_to_rad {
$adj_h->set_value($hour);
$adj_m->set_value($min);
$adj_s->set_value($sec);
- $is24=$hour>12;
}
sub Repaint {