ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.306 by root, Sun Jun 18 17:39:36 2006 UTC vs.
Revision 1.309 by elmex, Wed Jun 21 12:59:23 2006 UTC

470} 470}
471 471
472sub emit { 472sub 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
480sub find_widget { 481sub find_widget {
481 my ($self, $x, $y) = @_; 482 my ($self, $x, $y) = @_;
482 483
2410 2411
2411 $self->SUPER::invoke_button_down ($ev, $x, $y); 2412 $self->SUPER::invoke_button_down ($ev, $x, $y);
2412 2413
2413 $self->{click} = [$self->{range}[0], $self->{vertical} ? $y : $x]; 2414 $self->{click} = [$self->{range}[0], $self->{vertical} ? $y : $x];
2414 2415
2415 $self->mouse_motion ($ev, $x, $y) 2416 $self->invoke_mouse_motion ($ev, $x, $y)
2416} 2417}
2417 2418
2418sub invoke_mouse_motion { 2419sub invoke_mouse_motion {
2419 my ($self, $ev, $x, $y) = @_; 2420 my ($self, $ev, $x, $y) = @_;
2420 2421
3471 $self->update_binding_widgets; 3472 $self->update_binding_widgets;
3472 3473
3473 $self 3474 $self
3474} 3475}
3475 3476
3477sub cfg_bind {
3478 my ($self, $mod, $sym, $cmds) = @_;
3479 $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds;
3480 ::update_bindings ();
3481}
3482
3483sub cfg_unbind {
3484 my ($self, $mod, $sym, $cmds) = @_;
3485 delete $::CFG->{profile}{default}{bindings}{$mod}{$sym};
3486 ::update_bindings ();
3487}
3488
3476sub commit { 3489sub commit {
3477 my ($self) = @_; 3490 my ($self) = @_;
3478 my ($mod, $sym, $cmds) = $self->get_binding; 3491 my ($mod, $sym, $cmds) = $self->get_binding;
3479 if ($sym != 0 && @$cmds > 0) { 3492 if ($sym != 0 && @$cmds > 0) {
3480 $::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)
3550 3563
3551# this is a shortcut method that asks for a binding 3564# this is a shortcut method that asks for a binding
3552# and then just binds it. 3565# and then just binds it.
3553sub do_quick_binding { 3566sub do_quick_binding {
3554 my ($self, $cmds, $end_cb) = @_; 3567 my ($self, $cmds, $end_cb) = @_;
3555 $self->set_binding (undef, undef, $cmds, sub { 3568 $self->set_binding (undef, undef, $cmds, sub { $self->cfg_bind (@_) });
3556 $::CFG->{bindings}->{$_[0]}->{$_[1]} = $_[2];
3557 });
3558 $self->ask_for_bind (1, $end_cb); 3569 $self->ask_for_bind (1, $end_cb);
3559} 3570}
3560 3571
3561sub update_binding_widgets { 3572sub update_binding_widgets {
3562 my ($self) = @_; 3573 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines