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.166 by root, Mon Apr 24 08:38:36 2006 UTC vs.
Revision 1.170 by root, Mon Apr 24 11:45:17 2006 UTC

246} 246}
247 247
248# return top left coordinates 248# return top left coordinates
249sub _topleft { 249sub _topleft {
250 my ($self, $x, $y) = @_; 250 my ($self, $x, $y) = @_;
251
252 $self->{parent}
253 or Carp::confess "no parent widget in _topleft\n";#d#
251 254
252 $self->{parent}->_topleft ($x + $self->{x}, $y + $self->{y}); 255 $self->{parent}->_topleft ($x + $self->{x}, $y + $self->{y});
253} 256}
254 257
255# translate global coordinates to local coordinate system 258# translate global coordinates to local coordinate system
1466 my ($self, $ev) = @_; 1469 my ($self, $ev) = @_;
1467 1470
1468 my $sym = $ev->{sym}; 1471 my $sym = $ev->{sym};
1469 1472
1470 if ($sym == 13) { 1473 if ($sym == 13) {
1474 unshift @{$self->{history}},
1475 my $txt = $self->get_text;
1476 $self->{history_pointer} = -1;
1477 $self->{history_saveback} = '';
1471 $self->emit (activate => $self->get_text); 1478 $self->emit (activate => $txt);
1472 $self->update; 1479 $self->update;
1480
1481 } elsif ($sym == CFClient::SDLK_UP) {
1482 if ($self->{history_pointer} < 0) {
1483 $self->{history_saveback} = $self->get_text;
1484 }
1485 if (@{$self->{history} || []} > 0) {
1486 $self->{history_pointer}++;
1487 if ($self->{history_pointer} >= @{$self->{history} || []}) {
1488 $self->{history_pointer} = @{$self->{history} || []} - 1;
1489 }
1490 $self->set_text ($self->{history}->[$self->{history_pointer}]);
1491 }
1492
1493 } elsif ($sym == CFClient::SDLK_DOWN) {
1494 $self->{history_pointer}--;
1495 $self->{history_pointer} = -1 if $self->{history_pointer} < 0;
1496
1497 if ($self->{history_pointer} >= 0) {
1498 $self->set_text ($self->{history}->[$self->{history_pointer}]);
1499 } else {
1500 $self->set_text ($self->{history_saveback});
1501 }
1473 1502
1474 } else { 1503 } else {
1475 $self->SUPER::key_down ($ev); 1504 $self->SUPER::key_down ($ev);
1476 } 1505 }
1477 1506

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines