--- deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/25 02:23:14 1.38 +++ deliantra/Deliantra-Client/DC/MapWidget.pm 2006/05/30 14:35:09 1.45 @@ -41,9 +41,7 @@ (my $data = $command) =~ s/\\//g; $tooltip =~ s/^\s+//; - $tooltip = "$data\n\n$tooltip"; - $tooltip =~ s/\s+$//; $self->{completer}{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}]; @@ -138,7 +136,7 @@ $::CONN->user_send ($self->{completer}{last_command}) if exists $self->{completer}{last_command}; } elsif ($uni == ord "\t") { - # TODO: toggle inventory + $::INV_WINDOW->toggle_visibility; } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { $::CONN->user_send ("rotateshoottype +"); } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { @@ -159,7 +157,21 @@ } else { $::CONN->user_send ("$DIR{$sym}[1]"); } - } elsif ($ev->{unicode}) { + } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) { + $::BIND_EDITOR->set_binding (undef, undef, [], + sub { + my ($mod, $sym, $cmds) = @_; + $::CFG->{bindings}->{$mod}->{$sym} = $cmds; + }); + $::BIND_EDITOR->start; + $::BIND_EDITOR->show; + } elsif ($sym == CFClient::SDLK_INSERT && not ($mod & CFClient::KMOD_CTRL)) { + $::BIND_EDITOR->stop; + $::BIND_EDITOR->ask_for_bind (1); + $::BIND_EDITOR->hide; + } elsif (my $bind_cmd = $::CFG->{bindings}->{$mod}->{$sym}) { + $::CONN->user_send ($_) for @$bind_cmd; + } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) { $self->{completer}->key_down ($ev); $self->{completer}->show; } @@ -206,7 +218,7 @@ my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); if ($::CFG->{fow_enable}) { - if ($::CFG->{fow_smooth} && $CFClient::GL_VERSION >= 1.2) { # smooth fog of war + if ($::CFG->{fow_smooth} && $CFClient::OpenGL::GL_VERSION >= 1.2) { # smooth fog of war glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); glConvolutionFilter2D ( GL_CONVOLUTION_2D, @@ -281,7 +293,7 @@ # $label->update; # # $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { -# $label->move ( +# $label->move_abs ( # ($::WIDTH - $label->{w}) * 0.5, # ($::HEIGHT - $label->{h}) * 0.5, # ); @@ -408,10 +420,10 @@ ]; $self->{entry} = new CFClient::UI::Entry - connect_changed => sub { + on_changed => sub { $self->update_labels; }, - connect_key_down => sub { + on_key_down => sub { my ($entry, $ev) = @_; my $self = $entry->{parent}{parent}; @@ -460,7 +472,7 @@ my ($self, $w, $h) = @_; $self->SUPER::size_allocate ($w, $h); - $self->move (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10); + $self->move_abs (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10); } sub show { @@ -523,11 +535,11 @@ sort { $a->[1] <=> $b->[1] or $self->{command}{$a->[0]}[4] <=> $self->{command}{$b->[0]}[4] - or (length $a->[0]) <=> (length $b->[0]) + or (length $b->[0]) <=> (length $a->[0]) } @match; } - $self->{last_search} = $cmd; + $self->{last_search} = $text; $self->{last_match} = \@match; $self->{select_offset} = 0;