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.73 by root, Wed Jul 5 02:15:47 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
98 $self->update; 100 $self->update;
99 }; 101 };
100 } elsif ($ev->{button} == 3) { 102 } elsif ($ev->{button} == 3) {
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 ["Stats &amp; Skills\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }], 106 ["Statistics\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }],
107 ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }],
108 ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }],
105 ["Inventory…\tF3", sub { ::toggle_player_page ($::INVENTORY_PAGE) }], 109 ["Inventory…\tF5", sub { ::toggle_player_page ($::INVENTORY_PAGE) }],
106 ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }],
107 ["Setup… \tF5", sub { $::SETUP_DIALOG->toggle_visibility }], 110 ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }],
108 ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }], 111 ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }],
109 [ 112 [
110 $::PICKUP_ENABLE->{state} 113 $::PICKUP_ENABLE->{state}
111 ? "Disable automatic pickup" 114 ? "Disable automatic pickup"
112 : "Enable automatic pickup", 115 : "Enable automatic pickup",
113 sub { $::PICKUP_ENABLE->toggle } 116 sub { $::PICKUP_ENABLE->toggle }
183 } elsif ($sym == CFClient::SDLK_F1 && !$mod) { 186 } elsif ($sym == CFClient::SDLK_F1 && !$mod) {
184 $::HELP_WINDOW->toggle_visibility; 187 $::HELP_WINDOW->toggle_visibility;
185 } elsif ($sym == CFClient::SDLK_F2 && !$mod) { 188 } elsif ($sym == CFClient::SDLK_F2 && !$mod) {
186 ::toggle_player_page ($::STATS_PAGE); 189 ::toggle_player_page ($::STATS_PAGE);
187 } elsif ($sym == CFClient::SDLK_F3 && !$mod) { 190 } elsif ($sym == CFClient::SDLK_F3 && !$mod) {
188 ::toggle_player_page ($::INVENTORY_PAGE); 191 ::toggle_player_page ($::SKILL_PAGE);
189 } elsif ($sym == CFClient::SDLK_F4 && !$mod) { 192 } elsif ($sym == CFClient::SDLK_F4 && !$mod) {
190 ::toggle_player_page ($::SPELL_PAGE); 193 ::toggle_player_page ($::SPELL_PAGE);
191 } elsif ($sym == CFClient::SDLK_F5 && !$mod) { 194 } elsif ($sym == CFClient::SDLK_F5 && !$mod) {
195 ::toggle_player_page ($::INVENTORY_PAGE);
196 } elsif ($sym == CFClient::SDLK_F9 && !$mod) {
192 $::SETUP_DIALOG->toggle_visibility; 197 $::SETUP_DIALOG->toggle_visibility;
193 } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) { 198 } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) {
194 $::BIND_EDITOR->set_binding (undef, undef, [], 199 $::BIND_EDITOR->set_binding (undef, undef, [],
195 sub { 200 sub {
196 my ($mod, $sym, $cmds) = @_; 201 my ($mod, $sym, $cmds) = @_;
238 $::CONN->user_send ("run $DIR{$sym}[0]"); 243 $::CONN->user_send ("run $DIR{$sym}[0]");
239 } else { 244 } else {
240 $::CONN->user_send ("$DIR{$sym}[1]"); 245 $::CONN->user_send ("$DIR{$sym}[1]");
241 } 246 }
242 } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) { 247 } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) {
243 $self->{completer}->invoke_key_down ($ev); 248 $self->{completer}->inject_key_down ($ev);
244 $self->{completer}->show; 249 $self->{completer}->show;
245 } else { 250 } else {
246 return 0; 251 return 0;
247 } 252 }
248 253
613} 618}
614 619
615sub hide { 620sub hide {
616 my ($self) = @_; 621 my ($self) = @_;
617 622
623 $self->{hist_ptr} = 0;
624
618 $self->SUPER::hide; 625 $self->SUPER::hide;
619 $self->{entry}->set_text (""); 626 $self->{entry}->set_text ("");
620} 627}
621 628
622sub invoke_key_down { 629sub inject_key_down {
623 my ($self, $ev) = @_; 630 my ($self, $ev) = @_;
624 631
632 $self->{entry}->grab_focus;
625 $self->{entry}->emit (key_down => $ev) 633 $self->{entry}->emit (key_down => $ev);
626} 634}
627 635
628sub update_labels { 636sub update_labels {
629 my ($self) = @_; 637 my ($self) = @_;
630 638

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines