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.434 by root, Wed Aug 22 21:32:09 2007 UTC vs.
Revision 1.436 by root, Wed Aug 22 21:40:57 2007 UTC

30 $TOOLTIP->{owner} = $widget; 30 $TOOLTIP->{owner} = $widget;
31 $TOOLTIP->{owner}->emit ("tooltip_show") if $TOOLTIP->{owner}; 31 $TOOLTIP->{owner}->emit ("tooltip_show") if $TOOLTIP->{owner};
32 32
33 return if $ENV{CFPLUS_DEBUG} & 8; 33 return if $ENV{CFPLUS_DEBUG} & 8;
34 34
35 my $tip = $widget->{tooltip};
36
37 $tip = $tip->($widget) if CODE:: eq ref $tip;
38
39 $TOOLTIP->set_tooltip_from ($widget); 35 $TOOLTIP->set_tooltip_from ($widget);
40 $TOOLTIP->show; 36 $TOOLTIP->show;
41 } 37 }
42 38
43 return; 39 return;
2873 2869
2874 my $self = $class->SUPER::new ( 2870 my $self = $class->SUPER::new (
2875 tooltip => sub { 2871 tooltip => sub {
2876 my ($self) = @_; 2872 my ($self) = @_;
2877 2873
2878 sprintf "%s points experience (level %d).\n%s points to next level %s.", 2874 sprintf "level %d\n%s points\n%s next level\n%s to go",
2879 ::formsep $self->{exp},
2880 $self->{lvl}, 2875 $self->{lvl},
2876 ::formsep ($self->{exp}),
2881 ::formsep $self->{nxt} 2877 ::formsep ($self->{nxt}),
2878 ::formsep ($self->{nxt} - $self->{exp}),
2882 }, 2879 },
2883 %arg 2880 %arg
2884 ); 2881 );
2885 2882
2886 $::CONN->{on_exp_update}{$self+0} = sub { $self->set_value ($self->{value}) } 2883 $::CONN->{on_exp_update}{$self+0} = sub { $self->set_value ($self->{value}) }
2899} 2896}
2900 2897
2901sub set_value { 2898sub set_value {
2902 my ($self, $lvl, $exp) = @_; 2899 my ($self, $lvl, $exp) = @_;
2903 2900
2904 $self->{lvl} = $exp; 2901 $self->{lvl} = $lvl;
2905 $self->{exp} = $exp; 2902 $self->{exp} = $exp;
2906 2903
2907 my $v = -1; 2904 my $v = -1;
2908 2905
2909 if ($::CONN && (my $table = $::CONN->{exp_table})) { 2906 if ($::CONN && (my $table = $::CONN->{exp_table})) {
3556} 3553}
3557 3554
3558sub set_tooltip_from { 3555sub set_tooltip_from {
3559 my ($self, $widget) = @_; 3556 my ($self, $widget) = @_;
3560 3557
3561 $widget->{tooltip} = CFPlus::Pod::section_label tooltip => $1
3562 if $widget->{tooltip} =~ /^#(.*)$/;
3563
3564 my $tooltip = $widget->{tooltip}; 3558 my $tip = $widget->{tooltip};
3559 $tip = $tip->($widget) if "CODE" eq ref $tip;
3560
3561 $tip = CFPlus::Pod::section_label tooltip => $1
3562 if $tip =~ /^#(.*)$/;
3565 3563
3566 if ($ENV{CFPLUS_DEBUG} & 2) { 3564 if ($ENV{CFPLUS_DEBUG} & 2) {
3567 $tooltip .= "\n\n" . (ref $widget) . "\n" 3565 $tip .= "\n\n" . (ref $widget) . "\n"
3568 . "$widget->{x} $widget->{y} $widget->{w} $widget->{h}\n" 3566 . "$widget->{x} $widget->{y} $widget->{w} $widget->{h}\n"
3569 . "req $widget->{req_w} $widget->{req_h}\n" 3567 . "req $widget->{req_w} $widget->{req_h}\n"
3570 . "visible $widget->{visible}"; 3568 . "visible $widget->{visible}";
3571 } 3569 }
3572 3570
3573 $tooltip =~ s/^\n+//; 3571 $tip =~ s/^\n+//;
3574 $tooltip =~ s/\n+$//; 3572 $tip =~ s/\n+$//;
3575 3573
3576 $self->add (new CFPlus::UI::Label 3574 $self->add (new CFPlus::UI::Label
3577 markup => $tooltip, 3575 markup => $tip,
3578 max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH, 3576 max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH,
3579 fontsize => 0.8, 3577 fontsize => 0.8,
3580 style => 1, # FLAG_INVERSE 3578 style => 1, # FLAG_INVERSE
3581 ellipsise => 0, 3579 ellipsise => 0,
3582 font => ($widget->{tooltip_font} || $::FONT_PROP), 3580 font => ($widget->{tooltip_font} || $::FONT_PROP),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines