--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/07/05 01:53:24 1.72
+++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/07/23 16:11:12 1.78
@@ -5,7 +5,9 @@
use List::Util qw(min max);
+use CFClient;
use CFClient::OpenGL;
+use CFClient::UI;
our @ISA = CFClient::UI::Base::;
@@ -32,7 +34,6 @@
$self->{completer} = new CFClient::MapWidget::Command::
command => $self->{command},
- can_focus => 1,
tooltip => "The Command Completer\n\n"
. "This is your central interface to send text commands to the server. "
. "To enter a verbatim command to send to the server, just type the command, "
@@ -62,6 +63,9 @@
my ($self) = @_;
%{$self->{completer}{command}} = ();
+
+ $self->{completer}->hide
+ if $self->{completer};
}
sub invoke_button_down {
@@ -100,12 +104,13 @@
} elsif ($ev->{button} == 3) {
(new CFClient::UI::Menu
items => [
- ["Help Browser…\t(F1)", sub { $::HELP_WINDOW->toggle_visibility }],
- ["Stats & Skills…\t(F2)", sub { ::toggle_player_page ($::STATS_PAGE) }],
- ["Inventory…\t(F3)", sub { ::toggle_player_page ($::INVENTORY_PAGE) }],
- ["Spells…\t(F4)", sub { ::toggle_player_page ($::SPELL_PAGE) }],
- ["Setup… \t(F5)", sub { $::SETUP_DIALOG->toggle_visibility }],
- ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }],
+ ["Help Browser…\tF1", sub { $::HELP_WINDOW->toggle_visibility }],
+ ["Statistics\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }],
+ ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }],
+ ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }],
+ ["Inventory…\tF5", sub { ::toggle_player_page ($::INVENTORY_PAGE) }],
+ ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }],
+ ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }],
[
$::PICKUP_ENABLE->{state}
? "Disable automatic pickup"
@@ -185,10 +190,12 @@
} elsif ($sym == CFClient::SDLK_F2 && !$mod) {
::toggle_player_page ($::STATS_PAGE);
} elsif ($sym == CFClient::SDLK_F3 && !$mod) {
- ::toggle_player_page ($::INVENTORY_PAGE);
+ ::toggle_player_page ($::SKILL_PAGE);
} elsif ($sym == CFClient::SDLK_F4 && !$mod) {
::toggle_player_page ($::SPELL_PAGE);
} elsif ($sym == CFClient::SDLK_F5 && !$mod) {
+ ::toggle_player_page ($::INVENTORY_PAGE);
+ } elsif ($sym == CFClient::SDLK_F9 && !$mod) {
$::SETUP_DIALOG->toggle_visibility;
} elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) {
$::BIND_EDITOR->set_binding (undef, undef, [],
@@ -240,7 +247,7 @@
$::CONN->user_send ("$DIR{$sym}[1]");
}
} elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) {
- $self->{completer}->invoke_key_down ($ev);
+ $self->{completer}->inject_key_down ($ev);
$self->{completer}->show;
} else {
return 0;
@@ -522,7 +529,7 @@
if ($ev->{button} == 3) {
(new CFClient::UI::Menu
items => [
- ["bind " . (CFClient::UI::Label::escape $self->{select}) . " to a key"
+ ["bind " . (CFClient::asxml $self->{select}) . " to a key"
=> sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->grab_focus }) }]
],
)->popup ($ev);
@@ -615,14 +622,17 @@
sub hide {
my ($self) = @_;
+ $self->{hist_ptr} = 0;
+
$self->SUPER::hide;
$self->{entry}->set_text ("");
}
-sub invoke_key_down {
+sub inject_key_down {
my ($self, $ev) = @_;
- $self->{entry}->emit (key_down => $ev)
+ $self->{entry}->grab_focus;
+ $self->{entry}->emit (key_down => $ev);
}
sub update_labels {