ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.443 by root, Mon Nov 12 23:25:37 2007 UTC vs.
Revision 1.447 by root, Sat Dec 22 06:50:45 2007 UTC

104 my $widget = $ROOT->find_widget ($x, $y); 104 my $widget = $ROOT->find_widget ($x, $y);
105 105
106 $GRAB = $widget; 106 $GRAB = $widget;
107 $GRAB->update if $GRAB; 107 $GRAB->update if $GRAB;
108 108
109 $TOOLTIP_WATCHER->trigger; 109 $TOOLTIP_WATCHER->invoke;
110 } 110 }
111 111
112 if ($GRAB) { 112 if ($GRAB) {
113 if ($ev->{button} == 4 || $ev->{button} == 5) { 113 if ($ev->{button} == 4 || $ev->{button} == 5) {
114 # mousewheel 114 # mousewheel
139 my $grab = $GRAB; undef $GRAB; 139 my $grab = $GRAB; undef $GRAB;
140 $grab->update if $grab; 140 $grab->update if $grab;
141 $GRAB->update if $GRAB; 141 $GRAB->update if $GRAB;
142 142
143 check_hover $widget; 143 check_hover $widget;
144 $TOOLTIP_WATCHER->trigger; 144 $TOOLTIP_WATCHER->invoke;
145 } 145 }
146} 146}
147 147
148sub feed_sdl_motion_event { 148sub feed_sdl_motion_event {
149 my ($ev) = @_; 149 my ($ev) = @_;
309 delete $self->{root}; 309 delete $self->{root};
310 310
311 undef $GRAB if $GRAB == $self; 311 undef $GRAB if $GRAB == $self;
312 undef $HOVER if $HOVER == $self; 312 undef $HOVER if $HOVER == $self;
313 313
314 $CFPlus::UI::TOOLTIP_WATCHER->trigger 314 $CFPlus::UI::TOOLTIP_WATCHER->invoke
315 if $TOOLTIP->{owner} == $self; 315 if $TOOLTIP->{owner} == $self;
316 316
317 $self->emit ("focus_out"); 317 $self->emit ("focus_out");
318 $self->emit (visibility_change => 0); 318 $self->emit (visibility_change => 0);
319} 319}
440 440
441 $self->{tooltip} = $tooltip; 441 $self->{tooltip} = $tooltip;
442 442
443 if ($CFPlus::UI::TOOLTIP->{owner} == $self) { 443 if ($CFPlus::UI::TOOLTIP->{owner} == $self) {
444 delete $CFPlus::UI::TOOLTIP->{owner}; 444 delete $CFPlus::UI::TOOLTIP->{owner};
445 $CFPlus::UI::TOOLTIP_WATCHER->trigger; 445 $CFPlus::UI::TOOLTIP_WATCHER->invoke;
446 } 446 }
447} 447}
448 448
449# translate global coordinates to local coordinate system 449# translate global coordinates to local coordinate system
450sub coord2local { 450sub coord2local {
451 my ($self, $x, $y) = @_; 451 my ($self, $x, $y) = @_;
452 452
453 Carp::confess unless $self->{parent};#d# 453 return (undef, undef) unless $self->{parent};
454 454
455 $self->{parent}->coord2local ($x - $self->{x}, $y - $self->{y}) 455 $self->{parent}->coord2local ($x - $self->{x}, $y - $self->{y})
456} 456}
457 457
458# translate local coordinates to global coordinate system 458# translate local coordinates to global coordinate system
459sub coord2global { 459sub coord2global {
460 my ($self, $x, $y) = @_; 460 my ($self, $x, $y) = @_;
461 461
462 Carp::confess unless $self->{parent};#d# 462 return (undef, undef) unless $self->{parent};
463 463
464 $self->{parent}->coord2global ($x + $self->{x}, $y + $self->{y}) 464 $self->{parent}->coord2global ($x + $self->{x}, $y + $self->{y})
465} 465}
466 466
467sub invoke_focus_in { 467sub invoke_focus_in {
3701sub update_timer { 3701sub update_timer {
3702 my ($self) = @_; 3702 my ($self) = @_;
3703 3703
3704 return unless $self->{timer}; 3704 return unless $self->{timer};
3705 3705
3706 $self->{timer}->stop;
3706 if ($self->{visible}) { 3707 if ($self->{visible}) {
3707 $self->{timer}->set ( 3708 $self->{timer}->set (
3708 $self->{anim_start} 3709 $self->{anim_start}
3709 + $self->{animspeed} 3710 + $self->{animspeed}
3710 * int 1.5 + (EV::now - $self->{anim_start}) / $self->{animspeed} 3711 * int 1.5 + (EV::now - $self->{anim_start}) / $self->{animspeed}
3711 ); 3712 );
3712 $self->{timer}->start; 3713 $self->{timer}->start;
3713 } else {
3714 $self->{timer}->stop;
3715 } 3714 }
3716} 3715}
3717 3716
3718sub update_face { 3717sub update_face {
3719 my ($self) = @_; 3718 my ($self) = @_;
4181 values %{ $self->{item} }; 4180 values %{ $self->{item} };
4182 4181
4183 while (my ($k, $v) = each %{ $self->{item} }) { 4182 while (my ($k, $v) = each %{ $self->{item} }) {
4184 delete $self->{item}{$k} if $v->{timeout} < $NOW; 4183 delete $self->{item}{$k} if $v->{timeout} < $NOW;
4185 } 4184 }
4186
4187 $self->{timer}->set (1, 1);
4188 4185
4189 my @widgets; 4186 my @widgets;
4190 4187
4191 my @items = sort { 4188 my @items = sort {
4192 $a->{pri} <=> $b->{pri} 4189 $a->{pri} <=> $b->{pri}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines