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.274 by root, Sat Jun 3 22:20:52 2006 UTC vs.
Revision 1.277 by root, Sun Jun 4 00:21:52 2006 UTC

1160 my $dy = $ev->{y} - $oy; 1160 my $dy = $ev->{y} - $oy;
1161 1161
1162 $self->{force_w} = $bw + $dx * ($mx ? -1 : 1); 1162 $self->{force_w} = $bw + $dx * ($mx ? -1 : 1);
1163 $self->{force_h} = $bh + $dy * ($my ? -1 : 1); 1163 $self->{force_h} = $bh + $dy * ($my ? -1 : 1);
1164 1164
1165 $self->move_abs ($wx + $dx * $mx, $wy + $dy * $my);
1165 $self->realloc; 1166 $self->realloc;
1166 $self->move_abs ($wx + $dx * $mx, $wy + $dy * $my);
1167 }; 1167 };
1168 1168
1169 } elsif ($lr ^ $td) { 1169 } elsif ($lr ^ $td) {
1170 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 1170 my ($ox, $oy) = ($ev->{x}, $ev->{y});
1171 my ($bx, $by) = ($self->{x}, $self->{y}); 1171 my ($bx, $by) = ($self->{x}, $self->{y});
1174 my ($ev, $x, $y) = @_; 1174 my ($ev, $x, $y) = @_;
1175 1175
1176 ($x, $y) = ($ev->{x}, $ev->{y}); 1176 ($x, $y) = ($ev->{x}, $ev->{y});
1177 1177
1178 $self->move_abs ($bx + $x - $ox, $by + $y - $oy); 1178 $self->move_abs ($bx + $x - $ox, $by + $y - $oy);
1179 # HACK: the next line is required to enforce placement
1180 $self->{parent}->size_allocate ($self->{parent}{w}, $self->{parent}{h});
1179 }; 1181 };
1180 } else { 1182 } else {
1181 return 0; 1183 return 0;
1182 } 1184 }
1183 1185
1676 1678
1677 delete $self->{cur_h}; 1679 delete $self->{cur_h};
1678 1680
1679 return if $self->{text} eq $text; 1681 return if $self->{text} eq $text;
1680 1682
1681 delete $self->{texture};
1682
1683 $self->{last_activity} = $::NOW; 1683 $self->{last_activity} = $::NOW;
1684 $self->{text} = $text; 1684 $self->{text} = $text;
1685 1685
1686 $text =~ s/./*/g if $self->{hidden}; 1686 $text =~ s/./*/g if $self->{hidden};
1687 $self->{layout}->set_text ("$text "); 1687 $self->{layout}->set_text ("$text ");
1688 1688
1689 $self->_emit (changed => $self->{text}); 1689 $self->_emit (changed => $self->{text});
1690 $self->update;
1690} 1691}
1691 1692
1692sub set_text { 1693sub set_text {
1693 my ($self, $text) = @_; 1694 my ($self, $text) = @_;
1694 1695
2344} 2345}
2345 2346
2346sub update { 2347sub update {
2347 my ($self) = @_; 2348 my ($self) = @_;
2348 2349
2349 $CFClient::UI::ROOT->on_post_alloc ($self => sub { 2350 delete $self->{knob_w};
2351 $self->SUPER::update;
2352}
2353
2354sub _draw {
2355 my ($self) = @_;
2356
2357 unless ($self->{knob_w}) {
2350 $self->set_value ($self->{range}[0]); 2358 $self->set_value ($self->{range}[0]);
2351 2359
2352 my ($value, $lo, $hi, $page) = @{$self->{range}}; 2360 my ($value, $lo, $hi, $page) = @{$self->{range}};
2353 my $range = ($hi - $page - $lo) || 1e-100; 2361 my $range = ($hi - $page - $lo) || 1e-100;
2354 2362
2360 $value = ($value - $lo) / $range; 2368 $value = ($value - $lo) / $range;
2361 $value = $value * $self->{scale} + $self->{offset}; 2369 $value = $value * $self->{scale} + $self->{offset};
2362 2370
2363 $self->{knob_x} = $value - $knob_w * 0.5; 2371 $self->{knob_x} = $value - $knob_w * 0.5;
2364 $self->{knob_w} = $knob_w; 2372 $self->{knob_w} = $knob_w;
2365 }); 2373 }
2366
2367 $self->SUPER::update;
2368}
2369
2370sub _draw {
2371 my ($self) = @_;
2372 2374
2373 $self->SUPER::_draw (); 2375 $self->SUPER::_draw ();
2374 2376
2375 glScale $self->{w}, $self->{h}; 2377 glScale $self->{w}, $self->{h};
2376 2378

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines