--- deliantra/Deliantra-Client/DC/Item.pm 2006/12/09 21:26:46 1.2 +++ deliantra/Deliantra-Client/DC/Item.pm 2007/08/14 12:02:14 1.7 @@ -1,6 +1,9 @@ package CFPlus::Item; use strict; +use utf8; +use Encode; + use Crossfire::Protocol::Constants; my $last_enter_count = 1; @@ -114,7 +117,7 @@ &::open_string_query ("Text to inscribe", sub { my ($entry, $txt) = @_; $::CONN->send ("mark ". pack "N", $self->{tag}); - $::CONN->send ("command use_skill inscription $txt"); + $::CONN->send_utf8 ("command use_skill inscription $txt"); }); } ], @@ -123,7 +126,7 @@ &::open_string_query ("Rename item to:", sub { my ($entry, $txt) = @_; $::CONN->send ("mark ". pack "N", $self->{tag}); - $::CONN->send ("command rename to <$txt>"); + $::CONN->send_utf8 ("command rename to <$txt>"); }, $self->{name}, "If you input no name or erase the current custom name, the custom name will be unset"); } @@ -153,13 +156,14 @@ 1 }; - my $tooltip_std = "" - . "Left click - examine item\n" - . "Shift-Left click - " . ($self->{container} ? "move or drop" : "take") . " item\n" - . "Middle click - apply\n" - . "Shift-Middle click - lock/unlock\n" - . "Right click - further options" - . "\n"; + my $tooltip_std = + "" + . "Left click - examine item\n" + . "Shift-Left click - " . ($self->{container} ? "move or drop" : "take") . " item\n" + . "Middle click - apply\n" + . "Shift-Middle click - lock/unlock\n" + . "Right click - further options" + . "\n"; my $bg = $self->{flags} & F_CURSED ? [1 , 0 , 0, 0.5] : $self->{flags} & F_MAGIC ? [0.2, 0.2, 1, 0.5] @@ -188,12 +192,28 @@ can_hover => 1, ellipsise => 2, align => -1, - on_button_down => $button_cb, + + on_button_down => $button_cb, + on_tooltip_show => sub { + my ($widget) = @_; + + $::CONN && $::CONN->ex ($self->{tag}, sub { + my ($long_desc) = @_; + + $long_desc =~ s/\s+$//; + + $self->{long_desc} = $long_desc; + $widget->set_tooltip ("$long_desc\n\n$tooltip_std"); + }); + }, ; + my $desc = CFPlus::Item::desc_string $self; $self->{desc_widget}{bg} = $bg; $self->{desc_widget}->set_text ($desc); - $self->{desc_widget}->set_tooltip ("$desc.\n$tooltip_std"); + + my $long_desc = $self->{long_desc} || $desc; + $self->{desc_widget}->set_tooltip ("$long_desc\n\n$tooltip_std"); $self->{weight_widget} ||= new CFPlus::UI::Label can_events => 1, @@ -211,3 +231,4 @@ . "\n\n$tooltip_std" ); } +