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

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.98 by root, Wed Jul 12 17:20:04 2006 UTC vs.
Revision 1.101 by elmex, Sat Jul 22 12:18:01 2006 UTC

285} 285}
286 286
287sub do_n_dialog { 287sub do_n_dialog {
288 my ($cb) = @_; 288 my ($cb) = @_;
289 289
290 my $w = new CFClient::UI::FancyFrame; 290 my $w = new CFClient::UI::FancyFrame
291 on_delete => sub { $_[0]->destroy; 1 },
292 has_close_button => 1,
293 ;
294
291 $w->add (my $vb = new CFClient::UI::VBox x => "center", y => "center"); 295 $w->add (my $vb = new CFClient::UI::VBox x => "center", y => "center");
292 $vb->add (new CFClient::UI::Label text => "Enter item count:"); 296 $vb->add (new CFClient::UI::Label text => "Enter item count:");
293 $vb->add (my $entry = new CFClient::UI::Entry 297 $vb->add (my $entry = new CFClient::UI::Entry
294 text => $last_enter_count, 298 text => $last_enter_count,
295 on_activate => sub { 299 on_activate => sub {
296 my ($entry) = @_; 300 my ($entry) = @_;
297 $last_enter_count = $entry->get_text; 301 $last_enter_count = $entry->get_text;
298 $cb->($last_enter_count); 302 $cb->($last_enter_count);
299 $w->hide; 303 $w->hide;
300 $w = undef; 304 $w->destroy;
305
306 0
301 } 307 },
308 on_escape => sub { $w->destroy; 1 },
302 ); 309 );
303 $entry->grab_focus; 310 $entry->grab_focus;
304 $w->show; 311 $w->show;
305
306} 312}
307 313
308sub update_widgets { 314sub update_widgets {
309 my ($self) = @_; 315 my ($self) = @_;
310 316
330 } elsif ($ev->{button} == 1) { 336 } elsif ($ev->{button} == 1) {
331 $::CONN->send ("examine $self->{tag}"); 337 $::CONN->send ("examine $self->{tag}");
332 } elsif ($ev->{button} == 2) { 338 } elsif ($ev->{button} == 2) {
333 $::CONN->send ("apply $self->{tag}"); 339 $::CONN->send ("apply $self->{tag}");
334 } elsif ($ev->{button} == 3) { 340 } elsif ($ev->{button} == 3) {
341 my $move_prefix = $::CONN->{open_container} ? 'put' : 'drop';
342 if ($self->{container} == $::CONN->{open_container}) {
343 $move_prefix = "take";
344 }
345
335 my @menu_items = ( 346 my @menu_items = (
336 ["examine", sub { $::CONN->send ("examine $self->{tag}") }], 347 ["examine", sub { $::CONN->send ("examine $self->{tag}") }],
337 ["mark", sub { $::CONN->send ("mark ". pack "N", $self->{tag}) }], 348 ["mark", sub { $::CONN->send ("mark ". pack "N", $self->{tag}) }],
349 ["ignite/thaw", # first try of an easier use of flint&steel
350 sub {
351 $::CONN->send ("mark ". pack "N", $self->{tag});
352 $::CONN->send ("command apply flint and steel");
353 }
354 ],
338 ["apply", sub { $::CONN->send ("apply $self->{tag}") }], 355 ["apply", sub { $::CONN->send ("apply $self->{tag}") }],
339 ( 356 (
340 $self->{flags} & F_LOCKED 357 $self->{flags} & F_LOCKED
341 ? ( 358 ? (
342 ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) }], 359 ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) }],
343 ) 360 )
344 : ( 361 : (
345 ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }], 362 ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }],
346 ["drop", sub { $::CONN->send ("move $::CONN->{open_container} $self->{tag} 0") }], 363 ["$move_prefix all", sub { $::CONN->send ("move $targ $self->{tag} 0") }],
347 ["move n", 364 ["$move_prefix n",
348 sub { 365 sub {
349 do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") }) 366 do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") })
350 } 367 }
351 ] 368 ]
352 ) 369 )

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines