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.203 by root, Sun May 14 21:13:11 2006 UTC vs.
Revision 1.205 by root, Mon May 15 00:15:08 2006 UTC

31 $TOOLTIP->set_tooltip_from ($widget); 31 $TOOLTIP->set_tooltip_from ($widget);
32 $TOOLTIP->show; 32 $TOOLTIP->show;
33 33
34 my ($x, $y) = $widget->coord2global ($widget->{w}, 0); 34 my ($x, $y) = $widget->coord2global ($widget->{w}, 0);
35 35
36 if ($x + $TOOLTIP->{w} > $::WIDTH) {
37 ($x, $y) = $widget->coord2global (-$TOOLTIP->{w}, 0); 36 ($x, $y) = $widget->coord2global (-$TOOLTIP->{w}, 0)
38 } 37 if $x + $TOOLTIP->{w} > $::WIDTH;
39 38
40 $TOOLTIP->move ($x, $y); 39 $TOOLTIP->move ($x, $y);
41 $TOOLTIP->check_size; 40 $TOOLTIP->check_size;
42 $TOOLTIP->update; 41 $TOOLTIP->update;
43 } 42 }
376 glVertex $self->{w}, 0; 375 glVertex $self->{w}, 0;
377 glVertex $self->{w}, $self->{h}; 376 glVertex $self->{w}, $self->{h};
378 glVertex 0 , $self->{h}; 377 glVertex 0 , $self->{h};
379 glEnd; 378 glEnd;
380 glPopMatrix; 379 glPopMatrix;
381 CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; 380 #CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw;
382 } 381 }
383} 382}
384 383
385sub _draw { 384sub _draw {
386 my ($self) = @_; 385 my ($self) = @_;
2690 ? "<b>$item->{count} ×</b> $item->{text}" 2689 ? "<b>$item->{count} ×</b> $item->{text}"
2691 : $item->{text}; 2690 : $item->{text};
2692 2691
2693 for ($short) { 2692 for ($short) {
2694 s/^\s+//; 2693 s/^\s+//;
2695 s/\012.*/…/s; 2694 s/\s+/ /g;
2696 my $len = int 40 / $item->{fontsize}; 2695 my $len = int 40 / $item->{fontsize};
2697 substr $_, $len, length, "…" if $len < length; 2696 substr $_, $len, length, "…" if $len < length;
2698 } 2697 }
2699 2698
2700 new CFClient::UI::Label 2699 new CFClient::UI::Label
2701 markup => $short, 2700 markup => $short,
2702 tooltip => $item->{tooltip}, 2701 tooltip => $item->{tooltip},
2703 tooltip_font => $::FONT_PROP, 2702 tooltip_font => $::FONT_PROP,
2704 tooltip_width => 0.67, 2703 tooltip_width => 0.67,
2705 fontsize => $item->{fontsize}, 2704 fontsize => $item->{fontsize},
2706 color => $item->{color}, 2705 fg => $item->{fg},
2707 can_events => 1, 2706 can_events => 1,
2708 can_hover => 1 2707 can_hover => 1
2709 }; 2708 };
2710 } 2709 }
2711 2710
2738 id => ++$self->{id}, 2737 id => ++$self->{id},
2739 text => $text, 2738 text => $text,
2740 timeout => $timeout, 2739 timeout => $timeout,
2741 tooltip => $text, 2740 tooltip => $text,
2742 fontsize => 0.8, 2741 fontsize => 0.8,
2743 color => [0.8, 0.8, 0.8, 0.8], 2742 fg => [0.8, 0.8, 0.8, 0.8],
2744 pri => 0, 2743 pri => 0,
2745 count => 1, 2744 count => 1,
2746 %arg, 2745 %arg,
2747 }; 2746 };
2748 } 2747 }
2796 if $old_w && $old_h && ($old_w != $w || $old_h != $h); 2795 if $old_w && $old_h && ($old_w != $w || $old_h != $h);
2797 2796
2798 for my $child ($self->children) { 2797 for my $child ($self->children) {
2799 my ($X, $Y, $W, $H) = @$child{qw(x y req_w req_h)}; 2798 my ($X, $Y, $W, $H) = @$child{qw(x y req_w req_h)};
2800 2799
2800 $X = $child->{req_x} > 0 ? $child->{req_x} : $w - $W - $child->{req_x} + 1
2801 if exists $child->{req_x};
2802
2803 $Y = $child->{req_y} > 0 ? $child->{req_y} : $h - $H - $child->{req_y} + 1
2804 if exists $child->{req_y};
2805
2801 $X = List::Util::max 0, List::Util::min $w - $W, $X; 2806 $X = List::Util::max 0, List::Util::min $w - $W, int $X + 0.5;
2802 $Y = List::Util::max 0, List::Util::min $h - $H, $Y; 2807 $Y = List::Util::max 0, List::Util::min $h - $H, int $Y + 0.5;
2808
2803 $child->configure ($X, $Y, $W, $H); 2809 $child->configure ($X, $Y, $W, $H);
2804 } 2810 }
2805} 2811}
2806 2812
2807sub coord2local { 2813sub coord2local {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines