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.435 by root, Wed Aug 22 21:40:43 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
2901<<<<<<< UI.pm
2902 $self->{lvl} = $lvl;
2903 $self->{exp} = $exp;
2904
2905=======
2904 $self->{lvl} = $exp; 2906 $self->{lvl} = $exp;
2905 $self->{exp} = $exp; 2907 $self->{exp} = $exp;
2906 2908
2909>>>>>>> 1.434
2907 my $v = -1; 2910 my $v = -1;
2908 2911
2909 if ($::CONN && (my $table = $::CONN->{exp_table})) { 2912 if ($::CONN && (my $table = $::CONN->{exp_table})) {
2910 my $l0 = $table->[$lvl - 1]; 2913 my $l0 = $table->[$lvl - 1];
2911 my $l1 = $table->[$lvl]; 2914 my $l1 = $table->[$lvl];
3556} 3559}
3557 3560
3558sub set_tooltip_from { 3561sub set_tooltip_from {
3559 my ($self, $widget) = @_; 3562 my ($self, $widget) = @_;
3560 3563
3561 $widget->{tooltip} = CFPlus::Pod::section_label tooltip => $1
3562 if $widget->{tooltip} =~ /^#(.*)$/;
3563
3564 my $tooltip = $widget->{tooltip}; 3564 my $tip = $widget->{tooltip};
3565 $tip = $tip->($widget) if "CODE" eq ref $tip;
3566
3567 $tip = CFPlus::Pod::section_label tooltip => $1
3568 if $tip =~ /^#(.*)$/;
3565 3569
3566 if ($ENV{CFPLUS_DEBUG} & 2) { 3570 if ($ENV{CFPLUS_DEBUG} & 2) {
3567 $tooltip .= "\n\n" . (ref $widget) . "\n" 3571 $tip .= "\n\n" . (ref $widget) . "\n"
3568 . "$widget->{x} $widget->{y} $widget->{w} $widget->{h}\n" 3572 . "$widget->{x} $widget->{y} $widget->{w} $widget->{h}\n"
3569 . "req $widget->{req_w} $widget->{req_h}\n" 3573 . "req $widget->{req_w} $widget->{req_h}\n"
3570 . "visible $widget->{visible}"; 3574 . "visible $widget->{visible}";
3571 } 3575 }
3572 3576
3573 $tooltip =~ s/^\n+//; 3577 $tip =~ s/^\n+//;
3574 $tooltip =~ s/\n+$//; 3578 $tip =~ s/\n+$//;
3575 3579
3576 $self->add (new CFPlus::UI::Label 3580 $self->add (new CFPlus::UI::Label
3577 markup => $tooltip, 3581 markup => $tip,
3578 max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH, 3582 max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH,
3579 fontsize => 0.8, 3583 fontsize => 0.8,
3580 style => 1, # FLAG_INVERSE 3584 style => 1, # FLAG_INVERSE
3581 ellipsise => 0, 3585 ellipsise => 0,
3582 font => ($widget->{tooltip_font} || $::FONT_PROP), 3586 font => ($widget->{tooltip_font} || $::FONT_PROP),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines