--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/07/05 02:15:47 1.73 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/07/24 12:25:09 1.79 @@ -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,18 +104,28 @@ } elsif ($ev->{button} == 3) { (new CFClient::UI::Menu items => [ - ["Help Browser…\tF1", sub { $::HELP_WINDOW->toggle_visibility }], - ["Stats & Skills…\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }], - ["Inventory…\tF3", sub { ::toggle_player_page ($::INVENTORY_PAGE) }], - ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }], - ["Setup… \tF5", 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" : "Enable automatic pickup", sub { $::PICKUP_ENABLE->toggle } ], + ["Quit", + sub { + if ($::CONN) { + &::open_quit_dialog; + } else { + exit; + } + } + ], ], )->popup ($ev); } @@ -185,10 +199,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 +256,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 +538,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 +631,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 {