… | |
… | |
470 | } |
470 | } |
471 | |
471 | |
472 | sub emit { |
472 | sub emit { |
473 | my ($self, $signal, @args) = @_; |
473 | my ($self, $signal, @args) = @_; |
474 | |
474 | |
|
|
475 | #d##TODO# stop propagating at first true, do not use sum |
475 | (List::Util::sum +(map $_->($self, @args), @{$self->{signal_cb}{$signal} || []}), # before |
476 | (List::Util::sum map $_->($self, @args), @{$self->{signal_cb}{$signal} || []}) # before |
476 | ($self->can ("invoke_$signal") || sub { 1 })->($self, @args)) # closure |
477 | || ($self->can ("invoke_$signal") || sub { 1 })->($self, @args) # closure |
477 | || ($self->{parent} && $self->{parent}->emit ($signal, @args)) # parent |
478 | || ($self->{parent} && $self->{parent}->emit ($signal, @args)) # parent |
478 | } |
479 | } |
479 | |
480 | |
480 | sub find_widget { |
481 | sub find_widget { |
481 | my ($self, $x, $y) = @_; |
482 | my ($self, $x, $y) = @_; |
482 | |
483 | |
… | |
… | |
1891 | my $sym = $ev->{sym}; |
1892 | my $sym = $ev->{sym}; |
1892 | |
1893 | |
1893 | if ($sym == 13) { |
1894 | if ($sym == 13) { |
1894 | unshift @{$self->{history}}, |
1895 | unshift @{$self->{history}}, |
1895 | my $txt = $self->get_text; |
1896 | my $txt = $self->get_text; |
|
|
1897 | |
1896 | $self->{history_pointer} = -1; |
1898 | $self->{history_pointer} = -1; |
1897 | $self->{history_saveback} = ''; |
1899 | $self->{history_saveback} = ''; |
1898 | $self->emit (activate => $txt); |
1900 | $self->emit (activate => $txt); |
1899 | $self->update; |
1901 | $self->update; |
1900 | |
1902 | |
… | |
… | |
2409 | |
2411 | |
2410 | $self->SUPER::invoke_button_down ($ev, $x, $y); |
2412 | $self->SUPER::invoke_button_down ($ev, $x, $y); |
2411 | |
2413 | |
2412 | $self->{click} = [$self->{range}[0], $self->{vertical} ? $y : $x]; |
2414 | $self->{click} = [$self->{range}[0], $self->{vertical} ? $y : $x]; |
2413 | |
2415 | |
2414 | $self->mouse_motion ($ev, $x, $y) |
2416 | $self->invoke_mouse_motion ($ev, $x, $y) |
2415 | } |
2417 | } |
2416 | |
2418 | |
2417 | sub invoke_mouse_motion { |
2419 | sub invoke_mouse_motion { |
2418 | my ($self, $ev, $x, $y) = @_; |
2420 | my ($self, $ev, $x, $y) = @_; |
2419 | |
2421 | |
… | |
… | |
3470 | $self->update_binding_widgets; |
3472 | $self->update_binding_widgets; |
3471 | |
3473 | |
3472 | $self |
3474 | $self |
3473 | } |
3475 | } |
3474 | |
3476 | |
|
|
3477 | sub cfg_bind { |
|
|
3478 | my ($self, $mod, $sym, $cmds) = @_; |
|
|
3479 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
|
|
3480 | ::update_bindings (); |
|
|
3481 | } |
|
|
3482 | |
|
|
3483 | sub cfg_unbind { |
|
|
3484 | my ($self, $mod, $sym, $cmds) = @_; |
|
|
3485 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
|
|
3486 | ::update_bindings (); |
|
|
3487 | } |
|
|
3488 | |
3475 | sub commit { |
3489 | sub commit { |
3476 | my ($self) = @_; |
3490 | my ($self) = @_; |
3477 | my ($mod, $sym, $cmds) = $self->get_binding; |
3491 | my ($mod, $sym, $cmds) = $self->get_binding; |
3478 | if ($sym != 0 && @$cmds > 0) { |
3492 | if ($sym != 0 && @$cmds > 0) { |
3479 | $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym) |
3493 | $::STATUSBOX->add ("Bound actions to '".CFClient::Binder::keycombo_to_name ($mod, $sym) |
… | |
… | |
3549 | |
3563 | |
3550 | # this is a shortcut method that asks for a binding |
3564 | # this is a shortcut method that asks for a binding |
3551 | # and then just binds it. |
3565 | # and then just binds it. |
3552 | sub do_quick_binding { |
3566 | sub do_quick_binding { |
3553 | my ($self, $cmds, $end_cb) = @_; |
3567 | my ($self, $cmds, $end_cb) = @_; |
3554 | $self->set_binding (undef, undef, $cmds, sub { |
3568 | $self->set_binding (undef, undef, $cmds, sub { $self->cfg_bind (@_) }); |
3555 | $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2]; |
|
|
3556 | }); |
|
|
3557 | $self->ask_for_bind (1, $end_cb); |
3569 | $self->ask_for_bind (1, $end_cb); |
3558 | } |
3570 | } |
3559 | |
3571 | |
3560 | sub update_binding_widgets { |
3572 | sub update_binding_widgets { |
3561 | my ($self) = @_; |
3573 | my ($self) = @_; |