… | |
… | |
3 | use strict; |
3 | use strict; |
4 | use utf8; |
4 | use utf8; |
5 | |
5 | |
6 | use List::Util qw(min max); |
6 | use List::Util qw(min max); |
7 | |
7 | |
|
|
8 | use CFClient; |
8 | use CFClient::OpenGL; |
9 | use CFClient::OpenGL; |
|
|
10 | use CFClient::UI; |
9 | |
11 | |
10 | our @ISA = CFClient::UI::Base::; |
12 | our @ISA = CFClient::UI::Base::; |
11 | |
13 | |
12 | my $magicmap_tex = |
14 | my $magicmap_tex = |
13 | new_from_file CFClient::Texture CFClient::find_rcfile "magicmap.png", |
15 | new_from_file CFClient::Texture CFClient::find_rcfile "magicmap.png", |
… | |
… | |
30 | @_ |
32 | @_ |
31 | ); |
33 | ); |
32 | |
34 | |
33 | $self->{completer} = new CFClient::MapWidget::Command:: |
35 | $self->{completer} = new CFClient::MapWidget::Command:: |
34 | command => $self->{command}, |
36 | command => $self->{command}, |
35 | can_focus => 1, |
|
|
36 | tooltip => "<b>The Command Completer</b>\n\n" |
37 | tooltip => "<b>The Command Completer</b>\n\n" |
37 | . "This is your central interface to send text commands to the server. " |
38 | . "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, " |
39 | . "To enter a verbatim command to send to the server, just type the command, " |
39 | . "followed by a space, and press return. " |
40 | . "followed by a space, and press return. " |
40 | . "Typing the initial letters of words (or just any letters) displays guesses " |
41 | . "Typing the initial letters of words (or just any letters) displays guesses " |
41 | . "for commands you might want to use.\n" |
42 | . "for commands you might want to use.\n" |
42 | . "You can use the cursor-up and cursor-down keys to select between those guesses.\n" |
43 | . "You can use the cursor-up and cursor-down keys to select between those guesses.\n" |
43 | . "<b>Right-Click</b> opens a menu where you cna select further options, sich as redefining keybindings.", |
44 | . "<b>Right-Click</b> opens a menu where you cna select further options, sich as redefining key bindings.", |
44 | ; |
45 | ; |
45 | |
46 | |
46 | $self |
47 | $self |
47 | } |
48 | } |
48 | |
49 | |
… | |
… | |
60 | |
61 | |
61 | sub clr_commands { |
62 | sub clr_commands { |
62 | my ($self) = @_; |
63 | my ($self) = @_; |
63 | |
64 | |
64 | %{$self->{completer}{command}} = (); |
65 | %{$self->{completer}{command}} = (); |
65 | } |
|
|
66 | |
66 | |
|
|
67 | $self->{completer}->hide |
|
|
68 | if $self->{completer}; |
|
|
69 | } |
|
|
70 | |
67 | sub button_down { |
71 | sub invoke_button_down { |
68 | my ($self, $ev, $x, $y) = @_; |
72 | my ($self, $ev, $x, $y) = @_; |
69 | |
73 | |
70 | return unless $::CONN; |
|
|
71 | |
|
|
72 | $self->focus_in; |
|
|
73 | |
|
|
74 | if ($ev->{button} == 1) { |
74 | if ($ev->{button} == 1) { |
|
|
75 | $self->grab_focus; |
|
|
76 | return unless $::CONN; |
|
|
77 | |
75 | my $x = CFClient::floor +($ev->{x} - $self->{sx0}) / $self->{tilesize} - $self->{sx}; |
78 | my $x = 1 + CFClient::floor +($ev->{x} - $self->{sx0}) / $self->{tilesize} - $self->{sx}; |
76 | my $y = CFClient::floor +($ev->{y} - $self->{sy0}) / $self->{tilesize} - $self->{sy}; |
79 | my $y = 1 + CFClient::floor +($ev->{y} - $self->{sy0}) / $self->{tilesize} - $self->{sy}; |
77 | |
80 | |
78 | $x -= int 0.5 * $self->{sw}; |
81 | $x -= int 0.5 * $self->{sw}; |
79 | $y -= int 0.5 * $self->{sh}; |
82 | $y -= int 0.5 * $self->{sh}; |
80 | |
83 | |
81 | $::CONN->lookat ($x, $y) |
84 | $::CONN->lookat ($x, $y) |
82 | if $::CONN; |
85 | if $::CONN; |
83 | |
86 | |
84 | } elsif ($ev->{button} == 2) { |
87 | } elsif ($ev->{button} == 2) { |
|
|
88 | $self->grab_focus; |
|
|
89 | return unless $::CONN; |
|
|
90 | |
85 | my ($ox, $oy) = ($ev->{x}, $ev->{y}); |
91 | my ($ox, $oy) = ($ev->{x}, $ev->{y}); |
86 | my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y}); |
92 | my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y}); |
87 | |
93 | |
88 | $self->{motion} = sub { |
94 | $self->{motion} = sub { |
89 | my ($ev, $x, $y) = @_; |
95 | my ($ev, $x, $y) = @_; |
… | |
… | |
93 | $::CFG->{map_shift_x} = $bw + $x - $ox; |
99 | $::CFG->{map_shift_x} = $bw + $x - $ox; |
94 | $::CFG->{map_shift_y} = $bh + $y - $oy; |
100 | $::CFG->{map_shift_y} = $bh + $y - $oy; |
95 | |
101 | |
96 | $self->update; |
102 | $self->update; |
97 | }; |
103 | }; |
|
|
104 | } elsif ($ev->{button} == 3) { |
|
|
105 | (new CFClient::UI::Menu |
|
|
106 | items => [ |
|
|
107 | ["Help Browser…\tF1", sub { $::HELP_WINDOW->toggle_visibility }], |
|
|
108 | ["Statistics\tF2", sub { ::toggle_player_page ($::STATS_PAGE) }], |
|
|
109 | ["Skills\tF3", sub { ::toggle_player_page ($::SKILL_PAGE) }], |
|
|
110 | ["Spells…\tF4", sub { ::toggle_player_page ($::SPELL_PAGE) }], |
|
|
111 | ["Inventory…\tF5", sub { ::toggle_player_page ($::INVENTORY_PAGE) }], |
|
|
112 | ["Setup… \tF9", sub { $::SETUP_DIALOG->toggle_visibility }], |
|
|
113 | ["Server Messages…", sub { $::MESSAGE_WINDOW->toggle_visibility }], |
|
|
114 | [ |
|
|
115 | $::PICKUP_ENABLE->{state} |
|
|
116 | ? "Disable automatic pickup" |
|
|
117 | : "Enable automatic pickup", |
|
|
118 | sub { $::PICKUP_ENABLE->toggle } |
|
|
119 | ], |
|
|
120 | ], |
|
|
121 | )->popup ($ev); |
98 | } |
122 | } |
99 | |
123 | |
100 | 1 |
124 | 1 |
101 | } |
125 | } |
102 | |
126 | |
103 | sub button_up { |
127 | sub invoke_button_up { |
104 | my ($self, $ev, $x, $y) = @_; |
128 | my ($self, $ev, $x, $y) = @_; |
105 | |
129 | |
106 | delete $self->{motion}; |
130 | delete $self->{motion}; |
107 | |
131 | |
108 | 1 |
132 | 1 |
109 | } |
133 | } |
110 | |
134 | |
111 | sub mouse_motion { |
135 | sub invoke_mouse_motion { |
112 | my ($self, $ev, $x, $y) = @_; |
136 | my ($self, $ev, $x, $y) = @_; |
113 | |
137 | |
114 | if ($self->{motion}) { |
138 | if ($self->{motion}) { |
115 | $self->{motion}->($ev, $x, $y); |
139 | $self->{motion}->($ev, $x, $y); |
116 | } else { |
140 | } else { |
… | |
… | |
120 | 1 |
144 | 1 |
121 | } |
145 | } |
122 | |
146 | |
123 | sub size_request { |
147 | sub size_request { |
124 | ( |
148 | ( |
125 | 1 + 32 * int $::WIDTH / 32, |
149 | 32 * CFClient::ceil $::WIDTH / 32, |
126 | 1 + 32 * int $::HEIGHT / 32, |
150 | 32 * CFClient::ceil $::HEIGHT / 32, |
127 | ) |
151 | ) |
128 | } |
152 | } |
129 | |
153 | |
130 | sub update { |
154 | sub update { |
131 | my ($self) = @_; |
155 | my ($self) = @_; |
… | |
… | |
148 | CFClient::SDLK_RIGHT, [3, "east"], |
172 | CFClient::SDLK_RIGHT, [3, "east"], |
149 | CFClient::SDLK_DOWN, [5, "south"], |
173 | CFClient::SDLK_DOWN, [5, "south"], |
150 | CFClient::SDLK_LEFT, [7, "west"], |
174 | CFClient::SDLK_LEFT, [7, "west"], |
151 | ); |
175 | ); |
152 | |
176 | |
153 | sub key_down { |
177 | sub invoke_key_down { |
154 | my ($self, $ev) = @_; |
178 | my ($self, $ev) = @_; |
155 | |
|
|
156 | return 0 unless $::CONN; |
|
|
157 | |
179 | |
158 | my $mod = $ev->{mod}; |
180 | my $mod = $ev->{mod}; |
159 | my $sym = $ev->{sym}; |
181 | my $sym = $ev->{sym}; |
160 | my $uni = $ev->{unicode}; |
182 | my $uni = $ev->{unicode}; |
161 | |
183 | |
|
|
184 | $mod &= CFClient::KMOD_CTRL | CFClient::KMOD_ALT | CFClient::KMOD_SHIFT; |
|
|
185 | |
|
|
186 | if ($uni == ord "\t") { |
|
|
187 | $::PL_WINDOW->toggle_visibility; |
|
|
188 | } elsif ($sym == CFClient::SDLK_F1 && !$mod) { |
|
|
189 | $::HELP_WINDOW->toggle_visibility; |
|
|
190 | } elsif ($sym == CFClient::SDLK_F2 && !$mod) { |
|
|
191 | ::toggle_player_page ($::STATS_PAGE); |
|
|
192 | } elsif ($sym == CFClient::SDLK_F3 && !$mod) { |
|
|
193 | ::toggle_player_page ($::SKILL_PAGE); |
|
|
194 | } elsif ($sym == CFClient::SDLK_F4 && !$mod) { |
|
|
195 | ::toggle_player_page ($::SPELL_PAGE); |
|
|
196 | } elsif ($sym == CFClient::SDLK_F5 && !$mod) { |
|
|
197 | ::toggle_player_page ($::INVENTORY_PAGE); |
|
|
198 | } elsif ($sym == CFClient::SDLK_F9 && !$mod) { |
|
|
199 | $::SETUP_DIALOG->toggle_visibility; |
|
|
200 | } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) { |
|
|
201 | $::BIND_EDITOR->set_binding (undef, undef, [], |
|
|
202 | sub { |
|
|
203 | my ($mod, $sym, $cmds) = @_; |
|
|
204 | $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds); |
|
|
205 | }); |
|
|
206 | $::BIND_EDITOR->start; |
|
|
207 | $::BIND_EDITOR->show; |
|
|
208 | } elsif ($sym == CFClient::SDLK_INSERT && not ($mod & CFClient::KMOD_CTRL)) { |
|
|
209 | $::BIND_EDITOR->stop; |
|
|
210 | $::BIND_EDITOR->ask_for_bind_and_commit; |
|
|
211 | $::BIND_EDITOR->hide; |
|
|
212 | } elsif (!$::CONN) { |
|
|
213 | return 0; # bindings further down need a valid connection |
|
|
214 | |
162 | if ($sym == CFClient::SDLK_KP5) { |
215 | } elsif ($sym == CFClient::SDLK_KP5 && !$mod) { |
163 | $::CONN->user_send ("stay fire"); |
216 | $::CONN->user_send ("stay fire"); |
164 | } elsif ($uni == ord ",") { |
217 | } elsif ($uni == ord ",") { |
165 | $::CONN->user_send ("take"); |
218 | $::CONN->user_send ("take"); |
166 | } elsif ($uni == ord " ") { |
219 | } elsif ($uni == ord " ") { |
167 | $::CONN->user_send ("apply"); |
220 | $::CONN->user_send ("apply"); |
168 | } elsif ($uni == ord ".") { |
221 | } elsif ($uni == ord ".") { |
169 | $::CONN->user_send ($self->{completer}{last_command}) |
222 | $::CONN->user_send ($self->{completer}{last_command}) |
170 | if exists $self->{completer}{last_command}; |
223 | if exists $self->{completer}{last_command}; |
171 | } elsif ($uni == ord "\t") { |
224 | } elsif (my $bind_cmd = $::CFG->{profile}{default}{bindings}{$mod}{$sym}) { |
172 | $::INV_WINDOW->toggle_visibility; |
225 | $::CONN->user_send ($_) for @$bind_cmd; |
173 | } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { |
226 | } elsif (($sym == CFClient::SDLK_KP_PLUS && !$mod) || $uni == ord "+") { |
174 | $::CONN->user_send ("rotateshoottype +"); |
227 | $::CONN->user_send ("rotateshoottype +"); |
175 | } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { |
228 | } elsif (($sym == CFClient::SDLK_KP_MINUS && !$mod) || $uni == ord "-") { |
176 | $::CONN->user_send ("rotateshoottype -"); |
229 | $::CONN->user_send ("rotateshoottype -"); |
177 | } elsif ($uni == ord '"') { |
230 | } elsif ($uni == ord '"') { |
178 | $self->{completer}->set_prefix ("$::CFG->{say_command} "); |
231 | $self->{completer}->set_prefix ("$::CFG->{say_command} "); |
179 | $self->{completer}->show; |
232 | $self->{completer}->show; |
180 | } elsif ($uni == ord "'") { |
233 | } elsif ($uni == ord "'") { |
… | |
… | |
191 | $self->{ctrl}++; |
244 | $self->{ctrl}++; |
192 | $::CONN->user_send ("run $DIR{$sym}[0]"); |
245 | $::CONN->user_send ("run $DIR{$sym}[0]"); |
193 | } else { |
246 | } else { |
194 | $::CONN->user_send ("$DIR{$sym}[1]"); |
247 | $::CONN->user_send ("$DIR{$sym}[1]"); |
195 | } |
248 | } |
196 | } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) { |
|
|
197 | $::BIND_EDITOR->set_binding (undef, undef, [], |
|
|
198 | sub { |
|
|
199 | my ($mod, $sym, $cmds) = @_; |
|
|
200 | $::CFG->{bindings}->{$mod}->{$sym} = $cmds; |
|
|
201 | }); |
|
|
202 | $::BIND_EDITOR->start; |
|
|
203 | $::BIND_EDITOR->show; |
|
|
204 | } elsif ($sym == CFClient::SDLK_INSERT && not ($mod & CFClient::KMOD_CTRL)) { |
|
|
205 | $::BIND_EDITOR->stop; |
|
|
206 | $::BIND_EDITOR->ask_for_bind_and_commit; |
|
|
207 | $::BIND_EDITOR->hide; |
|
|
208 | } elsif (my $bind_cmd = $::CFG->{bindings}->{$mod}->{$sym}) { |
|
|
209 | $::CONN->user_send ($_) for @$bind_cmd; |
|
|
210 | } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) { |
249 | } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) { |
211 | $self->{completer}->key_down ($ev); |
250 | $self->{completer}->inject_key_down ($ev); |
212 | $self->{completer}->show; |
251 | $self->{completer}->show; |
213 | } else { |
252 | } else { |
214 | return 0; |
253 | return 0; |
215 | } |
254 | } |
216 | |
255 | |
217 | 1 |
256 | 1 |
218 | } |
257 | } |
219 | |
258 | |
220 | sub key_up { |
259 | sub invoke_key_up { |
221 | my ($self, $ev) = @_; |
260 | my ($self, $ev) = @_; |
222 | |
261 | |
223 | my $res = 0; |
262 | my $res = 0; |
224 | my $mod = $ev->{mod}; |
263 | my $mod = $ev->{mod}; |
225 | my $sym = $ev->{sym}; |
264 | my $sym = $ev->{sym}; |
… | |
… | |
251 | } |
290 | } |
252 | |
291 | |
253 | sub set_magicmap { |
292 | sub set_magicmap { |
254 | my ($self, $w, $h, $x, $y, $data) = @_; |
293 | my ($self, $w, $h, $x, $y, $data) = @_; |
255 | |
294 | |
256 | $x += - $::MAP->x - int 0.5 * $::MAP->w; |
295 | $x -= $::MAP->ox + int 0.5 * $::MAP->w; |
257 | $y += - $::MAP->y - int 0.5 * $::MAP->h; |
296 | $y -= $::MAP->oy + int 0.5 * $::MAP->h; |
258 | |
297 | |
259 | $self->{magicmap} = [$x, $y, $w, $h, $data]; |
298 | $self->{magicmap} = [$x, $y, $w, $h, $data]; |
260 | |
299 | |
261 | $self->update; |
300 | $self->update; |
262 | } |
301 | } |
… | |
… | |
332 | } |
371 | } |
333 | |
372 | |
334 | if ($self->{magicmap}) { |
373 | if ($self->{magicmap}) { |
335 | my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; |
374 | my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; |
336 | |
375 | |
337 | $x += $::MAP->x - $sx + int 0.5 * ($::MAP->w - $sw + 1); |
376 | $x += $::MAP->ox - $sx + int 0.5 * ($::MAP->w - $sw + 1); |
338 | $y += $::MAP->y - $sy + int 0.5 * ($::MAP->h - $sh + 1); |
377 | $y += $::MAP->oy - $sy + int 0.5 * ($::MAP->h - $sh + 1); |
339 | |
378 | |
340 | glTranslate - $x - 1, - $y - 1; |
379 | glTranslate - $x - 1, - $y - 1; |
341 | glBindTexture GL_TEXTURE_2D, $magicmap_tex->{name}; |
380 | glBindTexture GL_TEXTURE_2D, $magicmap_tex->{name}; |
342 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
381 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
343 | } |
382 | } |
… | |
… | |
380 | |
419 | |
381 | sub size_request { |
420 | sub size_request { |
382 | ($::HEIGHT * 0.25, $::HEIGHT * 0.25) |
421 | ($::HEIGHT * 0.25, $::HEIGHT * 0.25) |
383 | } |
422 | } |
384 | |
423 | |
385 | sub size_allocate { |
424 | sub invoke_size_allocate { |
386 | my ($self, $w, $h) = @_; |
425 | my ($self, $w, $h) = @_; |
387 | |
426 | |
388 | $self->SUPER::size_allocate ($w, $h); |
|
|
389 | $self->update; |
427 | $self->update; |
|
|
428 | |
|
|
429 | 1 |
390 | } |
430 | } |
391 | |
431 | |
392 | sub update { |
432 | sub update { |
393 | my ($self) = @_; |
433 | my ($self) = @_; |
394 | |
434 | |
… | |
… | |
479 | ]; |
519 | ]; |
480 | |
520 | |
481 | $self->{entry} = new CFClient::UI::Entry |
521 | $self->{entry} = new CFClient::UI::Entry |
482 | on_changed => sub { |
522 | on_changed => sub { |
483 | $self->update_labels; |
523 | $self->update_labels; |
|
|
524 | 0 |
484 | }, |
525 | }, |
485 | on_button_down => sub { |
526 | on_button_down => sub { |
486 | my ($entry, $ev, $x, $y) = @_; |
527 | my ($entry, $ev, $x, $y) = @_; |
487 | |
528 | |
488 | if ($ev->{button} == 3) { |
529 | if ($ev->{button} == 3) { |
489 | (new CFClient::UI::Menu |
530 | (new CFClient::UI::Menu |
490 | items => [ |
531 | items => [ |
|
|
532 | ["bind <i>" . (CFClient::asxml $self->{select}) . "</i> to a key" |
491 | ["bind to a key" => sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->focus_in }) }] |
533 | => sub { $::BIND_EDITOR->do_quick_binding ([$self->{select}], sub { $entry->grab_focus }) }] |
492 | ], |
534 | ], |
493 | )->popup ($ev); |
535 | )->popup ($ev); |
494 | return 1; |
536 | return 1; |
495 | } |
537 | } |
496 | 0 |
538 | 0 |
… | |
… | |
503 | if ($ev->{sym} == 13) { |
545 | if ($ev->{sym} == 13) { |
504 | if (exists $self->{select}) { |
546 | if (exists $self->{select}) { |
505 | $self->{last_command} = $self->{select}; |
547 | $self->{last_command} = $self->{select}; |
506 | $::CONN->user_send ($self->{select}); |
548 | $::CONN->user_send ($self->{select}); |
507 | |
549 | |
508 | unshift @{$self->{history}}, $self->{select}; |
550 | unshift @{$self->{history}}, $self->{entry}->get_text; |
509 | $self->{hist_ptr} = 0; |
551 | $self->{hist_ptr} = 0; |
510 | |
552 | |
511 | $self->hide; |
553 | $self->hide; |
512 | } |
554 | } |
513 | } elsif ($ev->{sym} == 27) { |
555 | } elsif ($ev->{sym} == 27) { |
514 | $self->{hist_ptr} = 0; |
556 | $self->{hist_ptr} = 0; |
515 | $self->hide; |
557 | $self->hide; |
516 | return; |
|
|
517 | } elsif ($ev->{sym} == CFClient::SDLK_DOWN) { |
558 | } elsif ($ev->{sym} == CFClient::SDLK_DOWN) { |
518 | if ($self->{hist_ptr} > 1) { |
559 | if ($self->{hist_ptr} > 1) { |
519 | $self->{hist_ptr}--; |
560 | $self->{hist_ptr}--; |
520 | $self->{entry}->set_text ($self->{history}->[$self->{hist_ptr} - 1]); |
561 | $self->{entry}->set_text ($self->{history}->[$self->{hist_ptr} - 1]); |
521 | } elsif ($self->{hist_ptr} > 0) { |
562 | } elsif ($self->{hist_ptr} > 0) { |
… | |
… | |
561 | |
602 | |
562 | $self->{entry}->set_text ($prefix); |
603 | $self->{entry}->set_text ($prefix); |
563 | $self->show; |
604 | $self->show; |
564 | } |
605 | } |
565 | |
606 | |
566 | sub size_allocate { |
607 | sub invoke_size_allocate { |
567 | my ($self, $w, $h) = @_; |
608 | my ($self, $w, $h) = @_; |
568 | |
609 | |
569 | $self->SUPER::size_allocate ($w, $h); |
|
|
570 | $self->move_abs (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10); |
610 | $self->move_abs (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10); |
|
|
611 | |
|
|
612 | $self->SUPER::invoke_size_allocate ($w, $h) |
571 | } |
613 | } |
572 | |
614 | |
573 | sub show { |
615 | sub show { |
574 | my ($self) = @_; |
616 | my ($self) = @_; |
575 | |
617 | |
576 | $self->SUPER::show; |
618 | $self->SUPER::show; |
577 | $self->{entry}->focus_in; |
619 | $self->{entry}->grab_focus; |
578 | } |
620 | } |
579 | |
621 | |
580 | sub hide { |
622 | sub hide { |
581 | my ($self) = @_; |
623 | my ($self) = @_; |
|
|
624 | |
|
|
625 | $self->{hist_ptr} = 0; |
582 | |
626 | |
583 | $self->SUPER::hide; |
627 | $self->SUPER::hide; |
584 | $self->{entry}->set_text (""); |
628 | $self->{entry}->set_text (""); |
585 | } |
629 | } |
586 | |
630 | |
587 | sub key_down { |
631 | sub inject_key_down { |
588 | my ($self, $ev) = @_; |
632 | my ($self, $ev) = @_; |
589 | |
633 | |
|
|
634 | $self->{entry}->grab_focus; |
590 | $self->{entry}->key_down ($ev) |
635 | $self->{entry}->emit (key_down => $ev); |
591 | } |
636 | } |
592 | |
637 | |
593 | sub update_labels { |
638 | sub update_labels { |
594 | my ($self) = @_; |
639 | my ($self) = @_; |
595 | |
640 | |
… | |
… | |
682 | $label->set_text (""); |
727 | $label->set_text (""); |
683 | $label->set_tooltip (""); |
728 | $label->set_tooltip (""); |
684 | } |
729 | } |
685 | |
730 | |
686 | $self->update; |
731 | $self->update; |
687 | ### |
|
|
688 | } |
732 | } |
689 | |
733 | |
690 | sub _draw { |
734 | sub _draw { |
691 | my ($self) = @_; |
735 | my ($self) = @_; |
692 | |
736 | |