--- deliantra/Deliantra-Client/DC/UI.pm 2006/05/28 01:40:02 1.249 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/05/28 02:31:03 1.250 @@ -223,16 +223,6 @@ $self } -sub toggle_visibility { - my ($self) = @_; - - if ($self->{visible}) { - $self->hide; - } else { - $self->show; - } -} - sub destroy { my ($self) = @_; @@ -292,6 +282,23 @@ $self->emit (visibility_change => 0); } +sub set_visibility { + my ($self, $visible) = @_; + + return if $self->{visible} == $visible; + + $visible ? $self->hide + : $self->show; +} + +sub toggle_visibility { + my ($self) = @_; + + $self->{visible} + ? $self->hide + : $self->show; +} + sub hide { my ($self) = @_; @@ -347,7 +354,7 @@ } if ($self->{w} != $w || $self->{h} != $h) { - $CFClient::UI::ROOT->{size_alloc}{$self} = [$self, $w, $h]; + $CFClient::UI::ROOT->{size_alloc}{$self+0} = [$self, $w, $h]; } } @@ -3010,7 +3017,7 @@ $Y = $child->{req_y} > 0 ? $child->{req_y} : $h - $H - $child->{req_y} + 1 if exists $child->{req_y}; - delete @$child{qw(req_x req_y)}; + #delete @$child{qw(req_x req_y)};#d# def_x, def_y $X = List::Util::max 0, List::Util::min $w - $W, int $X + 0.5; $Y = List::Util::max 0, List::Util::min $h - $H, int $Y + 0.5; @@ -3093,7 +3100,7 @@ if ($self->{check_size}) { my @queue; - for (;;) { + while () { if ($self->{check_size}) { #TODO use array-of-depth approach @@ -3124,12 +3131,12 @@ } } - while ($self->{size_alloc}) { - for ( - sort { $a->[0]{visible} <=> $b->[0]{visible} } - values %{delete $self->{size_alloc}} - ) { - my ($widget, $w, $h) = @$_; + while (my $size_alloc = delete $self->{size_alloc}) { + my @queue = sort $b->[0]{visible} <=> $a->[0]{visible}, + values %$size_alloc; + + while () { + my ($widget, $w, $h) = @{ pop @queue or last }; $w = 0 if $w < 0; $h = 0 if $h < 0;