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

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.39 by root, Sat May 27 19:49:07 2006 UTC vs.
Revision 1.45 by elmex, Tue May 30 14:35:09 2006 UTC

39 my ($self, $command, $tooltip, $widget, $cb) = @_; 39 my ($self, $command, $tooltip, $widget, $cb) = @_;
40 40
41 (my $data = $command) =~ s/\\//g; 41 (my $data = $command) =~ s/\\//g;
42 42
43 $tooltip =~ s/^\s+//; 43 $tooltip =~ s/^\s+//;
44
45 $tooltip = "<big>$data</big>\n\n$tooltip"; 44 $tooltip = "<big>$data</big>\n\n$tooltip";
46
47 $tooltip =~ s/\s+$//; 45 $tooltip =~ s/\s+$//;
48 46
49 $self->{completer}{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}]; 47 $self->{completer}{command}{$command} = [$data, $tooltip, $widget, $cb, ++$self->{command_id}];
50} 48}
51 49
136 $::CONN->user_send ("apply"); 134 $::CONN->user_send ("apply");
137 } elsif ($uni == ord ".") { 135 } elsif ($uni == ord ".") {
138 $::CONN->user_send ($self->{completer}{last_command}) 136 $::CONN->user_send ($self->{completer}{last_command})
139 if exists $self->{completer}{last_command}; 137 if exists $self->{completer}{last_command};
140 } elsif ($uni == ord "\t") { 138 } elsif ($uni == ord "\t") {
141 # TODO: toggle inventory 139 $::INV_WINDOW->toggle_visibility;
142 } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") { 140 } elsif ($sym == CFClient::SDLK_KP_PLUS || $uni == ord "+") {
143 $::CONN->user_send ("rotateshoottype +"); 141 $::CONN->user_send ("rotateshoottype +");
144 } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") { 142 } elsif ($sym == CFClient::SDLK_KP_MINUS || $uni == ord "-") {
145 $::CONN->user_send ("rotateshoottype -"); 143 $::CONN->user_send ("rotateshoottype -");
146 } elsif ($uni == ord '"') { 144 } elsif ($uni == ord '"') {
157 $self->{ctrl}++; 155 $self->{ctrl}++;
158 $::CONN->user_send ("run $DIR{$sym}[0]"); 156 $::CONN->user_send ("run $DIR{$sym}[0]");
159 } else { 157 } else {
160 $::CONN->user_send ("$DIR{$sym}[1]"); 158 $::CONN->user_send ("$DIR{$sym}[1]");
161 } 159 }
162 } elsif ($ev->{unicode}) { 160 } elsif ($sym == CFClient::SDLK_INSERT && $mod & CFClient::KMOD_CTRL) {
161 $::BIND_EDITOR->set_binding (undef, undef, [],
162 sub {
163 my ($mod, $sym, $cmds) = @_;
164 $::CFG->{bindings}->{$mod}->{$sym} = $cmds;
165 });
166 $::BIND_EDITOR->start;
167 $::BIND_EDITOR->show;
168 } elsif ($sym == CFClient::SDLK_INSERT && not ($mod & CFClient::KMOD_CTRL)) {
169 $::BIND_EDITOR->stop;
170 $::BIND_EDITOR->ask_for_bind (1);
171 $::BIND_EDITOR->hide;
172 } elsif (my $bind_cmd = $::CFG->{bindings}->{$mod}->{$sym}) {
173 $::CONN->user_send ($_) for @$bind_cmd;
174 } elsif ((ord 'a') <= $uni && $uni <= (ord 'z')) {
163 $self->{completer}->key_down ($ev); 175 $self->{completer}->key_down ($ev);
164 $self->{completer}->show; 176 $self->{completer}->show;
165 } 177 }
166} 178}
167 179
279# 291#
280# $label->show; 292# $label->show;
281# $label->update; 293# $label->update;
282# 294#
283# $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub { 295# $CFClient::UI::ROOT->on_post_alloc ("$self$label" => sub {
284# $label->move ( 296# $label->move_abs (
285# ($::WIDTH - $label->{w}) * 0.5, 297# ($::WIDTH - $label->{w}) * 0.5,
286# ($::HEIGHT - $label->{h}) * 0.5, 298# ($::HEIGHT - $label->{h}) * 0.5,
287# ); 299# );
288# }); 300# });
289# 301#
406 fontsize => $_, 418 fontsize => $_,
407 ), (0.8) x 16 419 ), (0.8) x 16
408 ]; 420 ];
409 421
410 $self->{entry} = new CFClient::UI::Entry 422 $self->{entry} = new CFClient::UI::Entry
411 connect_changed => sub { 423 on_changed => sub {
412 $self->update_labels; 424 $self->update_labels;
413 }, 425 },
414 connect_key_down => sub { 426 on_key_down => sub {
415 my ($entry, $ev) = @_; 427 my ($entry, $ev) = @_;
416 428
417 my $self = $entry->{parent}{parent}; 429 my $self = $entry->{parent}{parent};
418 430
419 if ($ev->{sym} == 13) { 431 if ($ev->{sym} == 13) {
458 470
459sub size_allocate { 471sub size_allocate {
460 my ($self, $w, $h) = @_; 472 my ($self, $w, $h) = @_;
461 473
462 $self->SUPER::size_allocate ($w, $h); 474 $self->SUPER::size_allocate ($w, $h);
463 $self->move (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10); 475 $self->move_abs (($::WIDTH - $w) * 0.5, ($::HEIGHT - $h) * 0.6, 10);
464} 476}
465 477
466sub show { 478sub show {
467 my ($self) = @_; 479 my ($self) = @_;
468 480

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines