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.70 by root, Tue Apr 11 17:33:43 2006 UTC vs.
Revision 1.71 by root, Tue Apr 11 17:39:39 2006 UTC

992our @ISA = CFClient::Widget::DrawBG::; 992our @ISA = CFClient::Widget::DrawBG::;
993 993
994sub size_request { 994sub size_request {
995 my ($self) = @_; 995 my ($self) = @_;
996 996
997 my $w = 20; 997 my $w = 50;
998 my $h = 10; 998 my $h = 10;
999 999
1000 $self->{vertical} ? ($h, $w) : ($w, $h) 1000 $self->{vertical} ? ($h, $w) : ($w, $h)
1001} 1001}
1002 1002
1025 my ($self, $ev, $x, $y) = @_; 1025 my ($self, $ev, $x, $y) = @_;
1026 1026
1027 if ($GRAB == $self) { 1027 if ($GRAB == $self) {
1028 my ($value, $lo, $hi, $page) = @{$self->{range}}; 1028 my ($value, $lo, $hi, $page) = @{$self->{range}};
1029 1029
1030 my ($x, $w) = $self->{vertical} ? ($y, $self->{h}) : ($x, $self->{w});
1031
1030 $x = $x * ($hi - $lo) / $self->{w} + $lo; 1032 $x = $x * ($hi - $lo) / $w + $lo;
1031 $x = $lo if $x < $lo; 1033 $x = $lo if $x < $lo;
1032 $x = $hi - $page if $x > $hi - $page; 1034 $x = $hi - $page if $x > $hi - $page;
1033 $self->{range}[0] = $x; 1035 $self->{range}[0] = $x;
1034 1036
1035 $self->{changed}($x) if $self->{changed}; 1037 $self->{changed}($x) if $self->{changed};
1047 my ($w, $h) = @$self{qw(w h)}; 1049 my ($w, $h) = @$self{qw(w h)};
1048 1050
1049 if ($self->{vertical}) { 1051 if ($self->{vertical}) {
1050 # draw a vertical slider like a rotated horizontal slider 1052 # draw a vertical slider like a rotated horizontal slider
1051 1053
1052 glTranslate 0, $self->{w};
1053 glRotate 90, 0, 0, 1; 1054 glRotate 90, 0, 0, 1;
1055 glTranslate 0, -$self->{w}, 0;
1054 1056
1055 ($w, $h) = ($h, $w); 1057 ($w, $h) = ($h, $w);
1056 } 1058 }
1057 1059
1058 my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg}; 1060 my $fg = $FOCUS == $self ? $self->{active_fg} : $self->{fg};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines