[opendemo-cvs] CVS: opendemo/tools/odcut odcutgui.pm,1.41,1.42
Status: Beta
Brought to you by:
girlich
From: Uwe G. <gi...@us...> - 2004-10-24 19:29:05
|
Update of /cvsroot/opendemo/opendemo/tools/odcut In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29094 Modified Files: odcutgui.pm Log Message: handling 2 different timer event with double EVT_TIMER calls does not work as expected. An additional class is needed. Index: odcutgui.pm =================================================================== RCS file: /cvsroot/opendemo/opendemo/tools/odcut/odcutgui.pm,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** odcutgui.pm 24 Oct 2004 18:49:00 -0000 1.41 --- odcutgui.pm 24 Oct 2004 19:28:55 -0000 1.42 *************** *** 214,220 **** $sa->SetSizeHints($self); # connect sizer with frame ! # Timer ! $self->{TIMER} = Wx::Timer->new($self, 1); ! EVT_TIMER($self, 1, \&OnTimer); # Idle --- 214,220 ---- $sa->SetSizeHints($self); # connect sizer with frame ! # Timer will be created on the fly. ! # $self->{TIMER} = Wx::Timer->new($self, 1); ! # EVT_TIMER($self, 1, \&OnTimer); # Idle *************** *** 582,586 **** # Make sure the timer is running in interactive mode. if ($self->{"output"}->interactive()==1) { ! if ($self->{TIMER}->IsRunning==0) { print STDERR "Timer is not running. Start it.\n"; $self->StartTimer(); --- 582,586 ---- # Make sure the timer is running in interactive mode. if ($self->{"output"}->interactive()==1) { ! if (!defined $self->{TIMER} || $self->{TIMER}->IsRunning==0) { print STDERR "Timer is not running. Start it.\n"; $self->StartTimer(); *************** *** 589,593 **** else { # Make sure the timer is not running in non-interactive mode. ! if ($self->{TIMER}->IsRunning==1) { print STDERR "Timer is running in non-interactive mode. Stop it.\n"; $self->{TIMER}->Stop(); --- 589,593 ---- else { # Make sure the timer is not running in non-interactive mode. ! if (defined $self->{TIMER} && $self->{TIMER}->IsRunning==1) { print STDERR "Timer is running in non-interactive mode. Stop it.\n"; $self->{TIMER}->Stop(); *************** *** 653,656 **** --- 653,657 ---- my ($self) = @_; + if (0) { # Deactivate game timer. # Make sure the timer exists. if (!exists $self->{"gametimer"}) { *************** *** 659,662 **** --- 660,664 ---- } $self->{"gametimer"}->Start(1000, 1); + } } *************** *** 914,917 **** --- 916,922 ---- } printf STDERR "Start timer in %fsec ... ", $waitsec; + if (!exists $self->{TIMER}) { + $self->{TIMER} = odinteractivetimer->new($self); + } $self->{TIMER}->Start($waitsec * 1000.0, 1); if ($self->{TIMER}->IsRunning == 0) { *************** *** 935,938 **** --- 940,976 ---- + ###################################################################### + + + package odinteractivetimer; + + use vars qw(@ISA); + @ISA = qw(Wx::Timer); + + + sub new { + # Get the class name. + my $class = shift; + # Init the super class Wx::Timer. + my $self = $class->SUPER::new( @_ ); + # Remember the object itself. + $self->{"object"} = shift; + + return $self; + } + + + sub Notify() + { + my ($self) = @_; + my $object = $self->{"object"}; + printf STDERR "Overriding Notify works"; + $object->OnTimer(1); + } + + + ###################################################################### + + package odcuttab; |