--- deliantra/Deliantra-Client/DC/UI.pm 2007/07/24 19:32:21 1.419 +++ deliantra/Deliantra-Client/DC/UI.pm 2007/08/06 05:31:12 1.424 @@ -1029,8 +1029,8 @@ my $self; my $hslider = new CFPlus::UI::Slider - col => 0, - row => 1, + c_col => 0, + c_row => 1, vertical => 0, range => [0, 0, 1, 0.01], # HACK fix on_changed => sub { @@ -1040,8 +1040,8 @@ ; my $vslider = new CFPlus::UI::Slider - col => 1, - row => 0, + c_col => 1, + c_row => 0, vertical => 1, range => [0, 0, 1, 0.01], # HACK fix on_changed => sub { @@ -1062,8 +1062,8 @@ ); $self->{vp} = new CFPlus::UI::ViewPort - col => 0, - row => 0, + c_col => 0, + c_row => 0, expand => 1, scroll_x => $self->{scroll_x}, scroll_y => $self->{scroll_y}, @@ -1600,8 +1600,8 @@ my ($self, @widgets) = @_; for my $child (@widgets) { - $child->{rowspan} ||= 1; - $child->{colspan} ||= 1; + $child->{c_rowspan} ||= 1; + $child->{c_colspan} ||= 1; } $self->SUPER::add (@widgets); @@ -1615,8 +1615,8 @@ while (@_) { my ($col, $row, $child) = splice @_, 0, 3, (); - $child->{row} = $row; - $child->{col} = $col; + $child->{c_row} = $row; + $child->{c_col} = $col; push @widgets, $child; } @@ -1632,8 +1632,8 @@ my @children = $self->children; # first pass, columns - for my $widget (sort { $a->{colspan} <=> $b->{colspan} } @children) { - my ($c, $w, $cs) = @$widget{qw(col req_w colspan)}; + for my $widget (sort { $a->{c_colspan} <=> $b->{c_colspan} } @children) { + my ($c, $w, $cs) = @$widget{qw(c_col req_w c_colspan)}; my $sw = sum @w[$c .. $c + $cs - 1]; @@ -1643,8 +1643,8 @@ } # second pass, rows - for my $widget (sort { $a->{rowspan} <=> $b->{rowspan} } @children) { - my ($r, $h, $rs) = @$widget{qw(row req_h rowspan)}; + for my $widget (sort { $a->{c_rowspan} <=> $b->{c_rowspan} } @children) { + my ($r, $h, $rs) = @$widget{qw(c_row req_h c_rowspan)}; my $sh = sum @h[$r .. $r + $rs - 1]; @@ -1696,7 +1696,7 @@ my @y; for (0 .. $#$hs) { $y[$_ + 1] = $y[$_] + $hs->[$_] } for my $widget ($self->children) { - my ($r, $c, $w, $h, $rs, $cs) = @$widget{qw(row col req_w req_h rowspan colspan)}; + my ($r, $c, $w, $h, $rs, $cs) = @$widget{qw(c_row c_col req_w req_h c_rowspan c_colspan)}; $widget->configure ( $x[$c], $y[$r], @@ -1925,6 +1925,12 @@ $self->SUPER::realloc; } +sub clear { + my ($self) = @_; + + $self->set_text (""); +} + sub set_text { my ($self, $text) = @_; @@ -2076,6 +2082,7 @@ $class->SUPER::new ( fg => [1, 1, 1], bg => [0, 0, 0, 0.2], + outline => [0.6, 0.3, 0.1], active_bg => [0, 0, 1, .2], active_fg => [1, 1, 1], active_outline => [1, 1, 0], @@ -2256,14 +2263,23 @@ glLineWidth 3; glColor @{$self->{active_outline}}; - glTranslate -.375, -.375; glBegin GL_LINE_LOOP; - glVertex 0, 0; - glVertex $self->{w}, 0; - glVertex $self->{w}, $self->{h}; - glVertex 0, $self->{h}; + glVertex 0, 0; + glVertex $self->{w} - 1, 0; + glVertex $self->{w} - 1, $self->{h} - 1; + glVertex 0, $self->{h} - 1; glEnd; glLineWidth 1; + + } else { + glColor @{$self->{outline}}; + glTranslate .375, .375; + glBegin GL_LINE_STRIP; + glVertex 0, $self->{h} * .5; + glVertex 0, $self->{h} - 3; + glVertex $self->{w} - 1, $self->{h} - 3; + glVertex $self->{w} - 1, $self->{h} * .5; + glEnd; } } @@ -3575,7 +3591,11 @@ if ($anim && @$anim) { delete $self->{wait_face}; $self->{face} = $anim->[ $self->{frame} % @$anim ]; - $self->{tex} = $::CONN->{texture}[ $::CONN->{faceid}[$self->{face}] ]; + if (my $tex = $self->{tex} = $::CONN->{texture}[ $::CONN->{faceid}[$self->{face}] ]) { + unless ($tex->{name} || $tex->{loading}) { + $tex->upload (sub { $self->reconfigure }); + } + } } } } @@ -3585,12 +3605,15 @@ if ($::CONN) { if (my $faceid = $::CONN->{faceid}[$self->{face}]) { - if (my $tex = $::CONN->{texture}[$faceid]) { - $self->{tex} = $tex; - return ($self->{size_w} || $tex->{w}, $self->{size_h} || $tex->{h}); + if (my $tex = $self->{tex} = $::CONN->{texture}[$faceid]) { + if ($tex->{name}) { + return ($self->{size_w} || $tex->{w}, $self->{size_h} || $tex->{h}); + } elsif (!$tex->{loading}) { + $tex->upload (sub { $self->reconfigure }); + } } else { $self->{wait_face} ||= $::CONN->connect_face_update ($faceid, sub { - $self->realloc; + $self->reconfigure; }); } }