ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.74 by root, Sun Jul 16 23:30:08 2006 UTC vs.
Revision 1.77 by root, Sun Jul 23 02:44:05 2006 UTC

30 @_ 30 @_
31 ); 31 );
32 32
33 $self->{completer} = new CFClient::MapWidget::Command:: 33 $self->{completer} = new CFClient::MapWidget::Command::
34 command => $self->{command}, 34 command => $self->{command},
35 can_focus => 1,
36 tooltip => "<b>The Command Completer</b>\n\n" 35 tooltip => "<b>The Command Completer</b>\n\n"
37 . "This is your central interface to send text commands to the server. " 36 . "This is your central interface to send text commands to the server. "
38 . "To enter a verbatim command to send to the server, just type the command, " 37 . "To enter a verbatim command to send to the server, just type the command, "
39 . "followed by a space, and press return. " 38 . "followed by a space, and press return. "
40 . "Typing the initial letters of words (or just any letters) displays guesses " 39 . "Typing the initial letters of words (or just any letters) displays guesses "
60 59
61sub clr_commands { 60sub clr_commands {
62 my ($self) = @_; 61 my ($self) = @_;
63 62
64 %{$self->{completer}{command}} = (); 63 %{$self->{completer}{command}} = ();
64
65 $self->{completer}->hide
66 if $self->{completer};
65} 67}
66 68
67sub invoke_button_down { 69sub invoke_button_down {
68 my ($self, $ev, $x, $y) = @_; 70 my ($self, $ev, $x, $y) = @_;
69 71
101 (new CFClient::UI::Menu 103 (new CFClient::UI::Menu
102 items => [ 104 items => [
103 ["Help Browser…\tF1", sub { $::HELP_WINDOW->toggle_visibility }], 105 ["Help Browser…\tF1", sub { $::HELP_WINDOW->toggle_visibility }],
104 ["Statistics\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }], 106 ["Statistics\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }],
105 ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }], 107 ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }],
108 ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }],
106 ["Inventory…\tF4", sub { ::toggle_player_page ($::INVENTORY_PAGE) }], 109 ["Inventory…\tF5", sub { ::toggle_player_page ($::INVENTORY_PAGE) }],
107 ["Spells…\tF5", sub { ::toggle_player_page ($::SPELL_PAGE) }],
108 ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }], 110 ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }],
109 ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }], 111 ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }],
110 [ 112 [
111 $::PICKUP_ENABLE->{state} 113 $::PICKUP_ENABLE->{state}
112 ? "Disable automatic pickup" 114 ? "Disable automatic pickup"
186 } elsif ($sym == CFClient::SDLK_F2 && !$mod) { 188 } elsif ($sym == CFClient::SDLK_F2 && !$mod) {
187 ::toggle_player_page ($::STATS_PAGE); 189 ::toggle_player_page ($::STATS_PAGE);
188 } elsif ($sym == CFClient::SDLK_F3 && !$mod) { 190 } elsif ($sym == CFClient::SDLK_F3 && !$mod) {
189 ::toggle_player_page ($::SKILL_PAGE); 191 ::toggle_player_page ($::SKILL_PAGE);
190 } elsif ($sym == CFClient::SDLK_F4 && !$mod) { 192 } elsif ($sym == CFClient::SDLK_F4 && !$mod) {
193 ::toggle_player_page ($::SPELL_PAGE);
194 } elsif ($sym == CFClient::SDLK_F5 && !$mod) {
191 ::toggle_player_page ($::INVENTORY_PAGE); 195 ::toggle_player_page ($::INVENTORY_PAGE);
192 } elsif ($sym == CFClient::SDLK_F5 && !$mod) {
193 ::toggle_player_page ($::SPELL_PAGE);
194 } elsif ($sym == CFClient::SDLK_F9 && !$mod) { 196 } elsif ($sym == CFClient::SDLK_F9 && !$mod) {
195 $::SETUP_DIALOG->toggle_visibility; 197 $::SETUP_DIALOG->toggle_visibility;
196 } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) { 198 } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) {
197 $::BIND_EDITOR->set_binding (undef, undef, [], 199 $::BIND_EDITOR->set_binding (undef, undef, [],
198 sub { 200 sub {
241 $::CONN->user_send ("run $DIR{$sym}[0]"); 243 $::CONN->user_send ("run $DIR{$sym}[0]");
242 } else { 244 } else {
243 $::CONN->user_send ("$DIR{$sym}[1]"); 245 $::CONN->user_send ("$DIR{$sym}[1]");
244 } 246 }
245 } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) { 247 } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) {
246 $self->{completer}->invoke_key_down ($ev); 248 $self->{completer}->inject_key_down ($ev);
247 $self->{completer}->show; 249 $self->{completer}->show;
248 } else { 250 } else {
249 return 0; 251 return 0;
250 } 252 }
251 253
616} 618}
617 619
618sub hide { 620sub hide {
619 my ($self) = @_; 621 my ($self) = @_;
620 622
623 $self->{hist_ptr} = 0;
624
621 $self->SUPER::hide; 625 $self->SUPER::hide;
622 $self->{entry}->set_text (""); 626 $self->{entry}->set_text ("");
623} 627}
624 628
625sub invoke_key_down { 629sub inject_key_down {
626 my ($self, $ev) = @_; 630 my ($self, $ev) = @_;
627 631
632 $self->{entry}->grab_focus;
628 $self->{entry}->emit (key_down => $ev) 633 $self->{entry}->emit (key_down => $ev);
629} 634}
630 635
631sub update_labels { 636sub update_labels {
632 my ($self) = @_; 637 my ($self) = @_;
633 638

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines