--- deliantra/Deliantra-Client/DC/UI.pm 2006/06/07 06:28:30 1.297 +++ deliantra/Deliantra-Client/DC/UI.pm 2006/06/07 07:00:30 1.298 @@ -2755,6 +2755,9 @@ . "visible $widget->{visible}"; } + $tooltip =~ s/^\n+//; + $tooltip =~ s/\n+$//; + $self->add (new CFClient::UI::Label markup => $tooltip, max_w => ($widget->{tooltip_width} || 0.25) * $::WIDTH, @@ -2940,7 +2943,7 @@ $widget = new CFClient::UI::Label can_hover => 1, can_events => 1, - text => $widget, + markup => $widget, tooltip => $tooltip } @@ -3554,12 +3557,16 @@ ) } +my $TOOLTIP_ALL = "\n\nLeft click - ready spell\nMiddle click - invoke spell\nRight click - further options"; + +my @TOOLTIP_NAME = (align => 0, can_events => 1, can_hover => 1, tooltip => + "Name. The name of the spell.$TOOLTIP_ALL"); my @TOOLTIP_LVL = (align => 1, can_events => 1, can_hover => 1, tooltip => - "Level. Minimum level the caster needs in the associated skill to be able to attempt casting this spell."); + "Level. Minimum level the caster needs in the associated skill to be able to attempt casting this spell.$TOOLTIP_ALL"); my @TOOLTIP_SP = (align => 1, can_events => 1, can_hover => 1, tooltip => - "Spell points / Grace points. Amount of spell or grace points used by each invocation."); + "Spell points / Grace points. Amount of spell or grace points used by each invocation.$TOOLTIP_ALL"); my @TOOLTIP_DMG = (align => 1, can_events => 1, can_hover => 1, tooltip => - "Damage. The amount of damage the spell deals when it hits."); + "Damage. The amount of damage the spell deals when it hits.$TOOLTIP_ALL"); sub rebuild_spell_list { my ($self) = @_; @@ -3567,7 +3574,7 @@ $CFClient::UI::ROOT->on_refresh ($self => sub { $self->clear; - $self->add (1, 0, new CFClient::UI::Label text => "Spell Name"); + $self->add (1, 0, new CFClient::UI::Label text => "Spell Name", @TOOLTIP_NAME); $self->add (2, 0, new CFClient::UI::Label text => "Lvl" , @TOOLTIP_LVL); $self->add (3, 0, new CFClient::UI::Label text => "Sp/Gp", @TOOLTIP_SP); $self->add (4, 0, new CFClient::UI::Label text => "Dmg" , @TOOLTIP_DMG); @@ -3579,11 +3586,33 @@ $row++; + my $spell_cb = sub { + my ($widget, $ev) = @_; + + if ($ev->{button} == 1) { + $::CONN->user_send ("cast $spell->{name}"); + } elsif ($ev->{button} == 2) { + $::CONN->user_send ("invoke $spell->{name}"); + } elsif ($ev->{button} == 3) { + (new CFClient::UI::Menu + items => [ + ["bind cast $spell->{name} to a key" => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }], + ["bind invoke $spell->{name} to a key" => sub { $::BIND_EDITOR->do_quick_binding (["invoke $spell->{name}"]) }], + ], + )->popup ($ev); + } else { + return 0; + } + + 1 + }; + $self->add (0, $row, new CFClient::UI::Face face => $spell->{face}, can_hover => 1, can_events => 1, tooltip => $spell->{message}, + on_button_down => $spell_cb, ); $self->add (1, $row, new CFClient::UI::Label @@ -3591,19 +3620,13 @@ text => $spell->{name}, can_hover => 1, can_events => 1, - tooltip => $spell->{message}, + tooltip => "$spell->{message}$TOOLTIP_ALL", + on_button_down => $spell_cb, ); $self->add (2, $row, new CFClient::UI::Label text => $spell->{level}, @TOOLTIP_LVL); $self->add (3, $row, new CFClient::UI::Label text => $spell->{mana} || $spell->{grace}, @TOOLTIP_SP); $self->add (4, $row, new CFClient::UI::Label text => $spell->{damage}, @TOOLTIP_DMG); - - # TODO: should be done via popup - $self->add (5, $row, new CFClient::UI::Button - text => "bind", - tooltip => "bind spell readying (cast command) to key", - on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }, - ); } }); }