--- deliantra/Deliantra-Client/DC/UI.pm 2006/08/14 01:21:02 1.346 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/10/01 12:08:58 1.351 @@ -900,7 +900,7 @@ { package CFPlus::UI::Base; - ($draw_x, $draw_y, $draw_w, $draw_h) = + local ($draw_x, $draw_y, $draw_w, $draw_h) = (0, 0, $self->{w}, $self->{h}); } @@ -1140,7 +1140,7 @@ if ((exists $arg{label}) && !ref $arg{label}) { $arg{label} = new CFPlus::UI::Label align => 1, - valign => 1, + valign => 0, text => $arg{label}, fontsize => ($arg{border} || 0.8) * 0.75; } @@ -1968,6 +1968,9 @@ $self->{cursor} = 0; } elsif ($sym == CFPlus::SDLK_END) { $self->{cursor} = length $text; + } elsif ($uni == 21) { # ctrl-u + $text = ""; + $self->{cursor} = 0; } elsif ($uni == 27) { $self->emit ('escape'); } elsif ($uni) { @@ -2855,18 +2858,16 @@ sub current_paragraph { my ($self) = @_; - $self->force_uptodate; $self->{top_paragraph} - 1 } sub scroll_to { my ($self, $para) = @_; - $self->force_uptodate; - $para = List::Util::max 0, List::Util::min $#{$self->{par}}, $para; - $self->{children}[1]->set_value ($self->{par}[$para]{y}); + $self->{scroll_to} = $para; + $self->update; } sub clear { @@ -2905,7 +2906,7 @@ sub scroll_to_bottom { my ($self) = @_; - $self->{scroll_to_bottom} = 1; + $self->{scroll_to} = $#{$self->{par}}; $self->update; } @@ -2916,9 +2917,6 @@ my ($W, $H) = @{$self->{children}[0]}{qw(w h)}; my $height = 0; - my $paridx; - my $top_paragraph; - my $top = int $self->{children}[1]{range}[0]; for my $para (@{$self->{par}}) { if ($para->{w} != $W && ($para->{wrapped} || $para->{w} > $W)) { @@ -2931,23 +2929,17 @@ } $para->{y} = $height; - - $paridx++; - $top_paragraph ||= $paridx if $height >= $top; - $height += $para->{h}; } - $self->{top_paragraph} = $top_paragraph; $self->{height} = $height; - $self->{children}[1]->set_range ([$self->{children}[1]{range}[0], 0, $height, $H, 1]); delete $self->{texture}; } - if (delete $self->{scroll_to_bottom}) { - $self->{children}[1]->set_value (1e10); + if (my $paridx = delete $self->{scroll_to}) { + $self->{children}[1]->set_value ($self->{par}[$paridx]{y}); } } @@ -2969,6 +2961,17 @@ glClearColor 0, 0, 0, 0; glClear GL_COLOR_BUFFER_BIT; + { + package CFPlus::UI::Base; + + local ($draw_x, $draw_y, $draw_w, $draw_h) = + (0, 0, $self->{w}, $self->{h}); + } + + my $top = int $self->{children}[1]{range}[0]; + + my $paridx = 0; + my $top_paragraph; my $top = int $self->{children}[1]{range}[0]; my $y0 = $top; @@ -2996,7 +2999,12 @@ } } } + + $paridx++; + $top_paragraph ||= $paridx if $y >= $top; } + + $self->{top_paragraph} = $top_paragraph; }; }); } @@ -3837,7 +3845,7 @@ 1 }; - my $tooltip = "$spell->{message}$TOOLTIP_ALL"; + my $tooltip = (CFPlus::asxml $spell->{message}) . $TOOLTIP_ALL; #TODO: add path info to tooltip #$self->add (6, $row, new CFPlus::UI::Label text => $spell->{path}); @@ -4125,7 +4133,7 @@ { package CFPlus::UI::Base; - ($draw_x, $draw_y, $draw_w, $draw_h) = + local ($draw_x, $draw_y, $draw_w, $draw_h) = (0, 0, $self->{w}, $self->{h}); }