… | |
… | |
39 | my ($self, $command, $tooltip, $widget, $cb) = @_; |
39 | my ($self, $command, $tooltip, $widget, $cb) = @_; |
40 | |
40 | |
41 | (my $data = $command) =~ s/\\//g; |
41 | (my $data = $command) =~ s/\\//g; |
42 | |
42 | |
43 | $tooltip =~ s/^\s+//; |
43 | $tooltip =~ s/^\s+//; |
44 | |
|
|
45 | $tooltip = "<big>$data</big>\n\n$tooltip"; |
44 | $tooltip = "<big>$data</big>\n\n$tooltip"; |
46 | |
|
|
47 | $tooltip =~ s/\s+$//; |
45 | $tooltip =~ s/\s+$//; |
48 | |
46 | |
49 | $self->{completer}{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}]; |
47 | $self->{completer}{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}]; |
50 | } |
48 | } |
51 | |
49 | |
… | |
… | |
136 | $::CONN->user_send ("apply"); |
134 | $::CONN->user_send ("apply"); |
137 | } elsif ($uni == ord ".") { |
135 | } elsif ($uni == ord ".") { |
138 | $::CONN->user_send ($self->{completer}{last_command}) |
136 | $::CONN->user_send ($self->{completer}{last_command}) |
139 | if exists $self->{completer}{last_command}; |
137 | if exists $self->{completer}{last_command}; |
140 | } elsif ($uni == ord "\t") { |
138 | } elsif ($uni == ord "\t") { |
141 | # TODO: toggle inventory |
139 | $::INV_WINDOW->toggle_visibility; |
142 | } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { |
140 | } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { |
143 | $::CONN->user_send ("rotateshoottype +"); |
141 | $::CONN->user_send ("rotateshoottype +"); |
144 | } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { |
142 | } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { |
145 | $::CONN->user_send ("rotateshoottype -"); |
143 | $::CONN->user_send ("rotateshoottype -"); |
146 | } elsif ($uni == ord '"') { |
144 | } elsif ($uni == ord '"') { |
… | |
… | |
157 | $self->{ctrl}++; |
155 | $self->{ctrl}++; |
158 | $::CONN->user_send ("run $DIR{$sym}[0]"); |
156 | $::CONN->user_send ("run $DIR{$sym}[0]"); |
159 | } else { |
157 | } else { |
160 | $::CONN->user_send ("$DIR{$sym}[1]"); |
158 | $::CONN->user_send ("$DIR{$sym}[1]"); |
161 | } |
159 | } |
162 | } elsif ($ev->{unicode}) { |
160 | } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) { |
163 | $self->{completer}->key_down ($ev); |
161 | $self->{completer}->key_down ($ev); |
164 | $self->{completer}->show; |
162 | $self->{completer}->show; |
165 | } |
163 | } |
166 | } |
164 | } |
167 | |
165 | |