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.96 by root, Sun Jul 2 18:52:04 2006 UTC vs.
Revision 1.101 by elmex, Sat Jul 22 12:18:01 2006 UTC

234 [ 234 [
235 map s/^(\s*)// && [40 * length $1, length $_ ? $_ : " "], 235 map s/^(\s*)// && [40 * length $1, length $_ ? $_ : " "],
236 split /\n/, $pom->present ("CFClient::PodToPango") 236 split /\n/, $pom->present ("CFClient::PodToPango")
237 ] 237 ]
238} 238}
239
240package CFClient::Layout;
241
242$CFClient::OpenGL::SHUTDOWN_HOOK{"CFClient::Layout"} = sub {
243 reset_glyph_cache;
244};
239 245
240package CFClient::Item; 246package CFClient::Item;
241 247
242use strict; 248use strict;
243use Crossfire::Protocol::Constants; 249use Crossfire::Protocol::Constants;
279} 285}
280 286
281sub do_n_dialog { 287sub do_n_dialog {
282 my ($cb) = @_; 288 my ($cb) = @_;
283 289
284 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
285 $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");
286 $vb->add (new CFClient::UI::Label text => "Enter item count:"); 296 $vb->add (new CFClient::UI::Label text => "Enter item count:");
287 $vb->add (my $entry = new CFClient::UI::Entry 297 $vb->add (my $entry = new CFClient::UI::Entry
288 text => $last_enter_count, 298 text => $last_enter_count,
289 on_activate => sub { 299 on_activate => sub {
290 my ($entry) = @_; 300 my ($entry) = @_;
291 $last_enter_count = $entry->get_text; 301 $last_enter_count = $entry->get_text;
292 $cb->($last_enter_count); 302 $cb->($last_enter_count);
293 $w->hide; 303 $w->hide;
294 $w = undef; 304 $w->destroy;
305
306 0
295 } 307 },
308 on_escape => sub { $w->destroy; 1 },
296 ); 309 );
297 $entry->grab_focus; 310 $entry->grab_focus;
298 $w->show; 311 $w->show;
299
300} 312}
301 313
302sub update_widgets { 314sub update_widgets {
303 my ($self) = @_; 315 my ($self) = @_;
304 316
324 } elsif ($ev->{button} == 1) { 336 } elsif ($ev->{button} == 1) {
325 $::CONN->send ("examine $self->{tag}"); 337 $::CONN->send ("examine $self->{tag}");
326 } elsif ($ev->{button} == 2) { 338 } elsif ($ev->{button} == 2) {
327 $::CONN->send ("apply $self->{tag}"); 339 $::CONN->send ("apply $self->{tag}");
328 } 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
329 my @menu_items = ( 346 my @menu_items = (
330 ["examine", sub { $::CONN->send ("examine $self->{tag}") }], 347 ["examine", sub { $::CONN->send ("examine $self->{tag}") }],
331 ["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 ],
332 ["apply", sub { $::CONN->send ("apply $self->{tag}") }], 355 ["apply", sub { $::CONN->send ("apply $self->{tag}") }],
333 ( 356 (
334 $self->{flags} & F_LOCKED 357 $self->{flags} & F_LOCKED
335 ? ( 358 ? (
336 ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) }], 359 ["unlock", sub { $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) }],
337 ) 360 )
338 : ( 361 : (
339 ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }], 362 ["lock", sub { $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) }],
340 ["drop", sub { $::CONN->send ("move $::CONN->{open_container} $self->{tag} 0") }], 363 ["$move_prefix all", sub { $::CONN->send ("move $targ $self->{tag} 0") }],
341 ["move n", 364 ["$move_prefix n",
342 sub { 365 sub {
343 do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") }) 366 do_n_dialog (sub { $::CONN->send ("move $targ $self->{tag} $_[0]") })
344 } 367 }
345 ] 368 ]
346 ) 369 )

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines