… | |
… | |
25 | |
25 | |
26 | use Carp (); |
26 | use Carp (); |
27 | use AnyEvent (); |
27 | use AnyEvent (); |
28 | use BerkeleyDB; |
28 | use BerkeleyDB; |
29 | use Pod::POM (); |
29 | use Pod::POM (); |
|
|
30 | use Scalar::Util (); |
30 | use Storable (); # finally |
31 | use Storable (); # finally |
31 | |
32 | |
32 | package CFClient::PodToPango; |
33 | package CFClient::PodToPango; |
33 | |
34 | |
34 | use base Pod::POM::View::Text; |
35 | use base Pod::POM::View::Text; |
… | |
… | |
291 | $cb->($last_enter_count); |
292 | $cb->($last_enter_count); |
292 | $w->hide; |
293 | $w->hide; |
293 | $w = undef; |
294 | $w = undef; |
294 | } |
295 | } |
295 | ); |
296 | ); |
296 | $entry->focus_in; |
297 | $entry->grab_focus; |
297 | $w->show; |
298 | $w->show; |
298 | |
299 | |
299 | } |
300 | } |
300 | |
301 | |
301 | sub update_widgets { |
302 | sub update_widgets { |
302 | my ($self) = @_; |
303 | my ($self) = @_; |
|
|
304 | |
|
|
305 | # necessary to avoid cyclic references |
|
|
306 | Scalar::Util::weaken $self; |
303 | |
307 | |
304 | my $button_cb = sub { |
308 | my $button_cb = sub { |
305 | my (undef, $ev, $x, $y) = @_; |
309 | my (undef, $ev, $x, $y) = @_; |
306 | |
310 | |
307 | my $targ = $::CONN->{player}{tag}; |
311 | my $targ = $::CONN->{player}{tag}; |
… | |
… | |
452 | sub open_binding_dialog { |
456 | sub open_binding_dialog { |
453 | my ($cb) = @_; |
457 | my ($cb) = @_; |
454 | |
458 | |
455 | my $w = new CFClient::UI::FancyFrame |
459 | my $w = new CFClient::UI::FancyFrame |
456 | title => "Bind Action", |
460 | title => "Bind Action", |
457 | x => "center", |
461 | x => "center", |
458 | y => "center"; |
462 | y => "center", |
|
|
463 | z => 1000, |
|
|
464 | has_close_button => 1; |
459 | |
465 | |
460 | $w->add (my $vb = new CFClient::UI::VBox); |
466 | $w->add (my $vb = new CFClient::UI::VBox); |
461 | $vb->add (new CFClient::UI::Label |
467 | $vb->add (new CFClient::UI::Label |
462 | text => "Press a modifier (CTRL, ALT and/or SHIFT) and a key." |
468 | text => "Press a modifier (CTRL, ALT and/or SHIFT) and a key." |
463 | ."You can only bind 0-9 and F1-F15 without modifiers." |
469 | . "You can only bind 0-9 and F1-F15 without modifiers." |
464 | ); |
470 | ); |
465 | $vb->add (my $entry = new CFClient::UI::Entry |
471 | $vb->add (my $entry = new CFClient::UI::Entry |
466 | text => "", |
472 | text => "", |
467 | on_key_down => sub { |
473 | on_key_down => sub { |
468 | my ($entry, $ev) = @_; |
474 | my ($entry, $ev) = @_; |
… | |
… | |
484 | ." directly without modifier! It would damage the completer handling." |
490 | ." directly without modifier! It would damage the completer handling." |
485 | ); |
491 | ); |
486 | return; |
492 | return; |
487 | } |
493 | } |
488 | |
494 | |
489 | $entry->focus_out; |
495 | $entry->grab_focus; |
490 | |
496 | |
491 | $cb->($mod, $sym); |
497 | $cb->($mod, $sym); |
492 | |
498 | |
493 | $w->destroy |
499 | $w->destroy |
494 | }); |
500 | }); |
495 | |
501 | |
496 | $entry->focus_in; |
502 | $entry->grab_focus; |
497 | $w->show; |
503 | $w->show; |
498 | } |
504 | } |
499 | |
505 | |
500 | sub keycombo_to_name { |
506 | sub keycombo_to_name { |
501 | my ($mod, $sym) = @_; |
507 | my ($mod, $sym) = @_; |