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.209 by root, Wed May 17 00:26:55 2006 UTC vs.
Revision 1.210 by root, Wed May 17 10:14:52 2006 UTC

2718 2718
2719package CFClient::UI::Statusbox; 2719package CFClient::UI::Statusbox;
2720 2720
2721our @ISA = CFClient::UI::VBox::; 2721our @ISA = CFClient::UI::VBox::;
2722 2722
2723sub new {
2724 my $class = shift;
2725
2726 $class->SUPER::new (
2727 fontsize => 0.8,
2728 @_,
2729 )
2730}
2731
2723sub reorder { 2732sub reorder {
2724 my ($self) = @_; 2733 my ($self) = @_;
2725 my $NOW = time; 2734 my $NOW = time;
2726 2735
2727 while (my ($k, $v) = each %{ $self->{item} }) { 2736 while (my ($k, $v) = each %{ $self->{item} }) {
2743 # TODO: doesn't handle markup well (read as: at all) 2752 # TODO: doesn't handle markup well (read as: at all)
2744 my $short = $item->{count} > 1 2753 my $short = $item->{count} > 1
2745 ? "<b>$item->{count} ×</b> $item->{text}" 2754 ? "<b>$item->{count} ×</b> $item->{text}"
2746 : $item->{text}; 2755 : $item->{text};
2747 2756
2757 my $fontsize = $item->{fontsize} || $self->{fontsize};
2758
2748 for ($short) { 2759 for ($short) {
2749 s/^\s+//; 2760 s/^\s+//;
2750 s/\s+/ /g; 2761 s/\s+/ /g;
2751 my $len = int 40 / $item->{fontsize}; 2762 my $len = int 40 / $fontsize;
2752 substr $_, $len, length, "…" if $len < length; 2763 substr $_, $len, length, "…" if $len < length;
2753 } 2764 }
2754 2765
2755 new CFClient::UI::Label 2766 new CFClient::UI::Label
2756 markup => $short, 2767 markup => $short,
2757 tooltip => $item->{tooltip}, 2768 tooltip => $item->{tooltip},
2758 tooltip_font => $::FONT_PROP, 2769 tooltip_font => $::FONT_PROP,
2759 tooltip_width => 0.67, 2770 tooltip_width => 0.67,
2760 fontsize => $item->{fontsize}, 2771 fontsize => $fontsize,
2761 fg => $item->{fg}, 2772 fg => $item->{fg},
2762 can_events => 1, 2773 can_events => 1,
2763 can_hover => 1 2774 can_hover => 1
2764 }; 2775 };
2765 } 2776 }
2792 $self->{item}{$group} = { 2803 $self->{item}{$group} = {
2793 id => ++$self->{id}, 2804 id => ++$self->{id},
2794 text => $text, 2805 text => $text,
2795 timeout => $timeout, 2806 timeout => $timeout,
2796 tooltip => $text, 2807 tooltip => $text,
2797 fontsize => 0.8,
2798 fg => [0.8, 0.8, 0.8, 0.8], 2808 fg => [0.8, 0.8, 0.8, 0.8],
2799 pri => 0, 2809 pri => 0,
2800 count => 1, 2810 count => 1,
2801 %arg, 2811 %arg,
2802 }; 2812 };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines