--- deliantra/Deliantra-Client/DC/Protocol.pm 2006/05/27 19:49:07 1.6 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2006/05/30 14:59:26 1.12 @@ -68,10 +68,25 @@ sub user_send { my ($self, $command) = @_; + if ($self->{record}) { + push @{$self->{record}}, $command; + } + $self->send_command ($command); ::status $command; } +sub start_record { + my ($self) = @_; + + $self->{record} = []; +} + +sub stop_record { + my ($self) = @_; + return delete $self->{record}; +} + sub map_scroll { my ($self, $dx, $dy) = @_; @@ -326,8 +341,11 @@ $LAST_QUERY = $prompt; my $dialog = new CFClient::UI::FancyFrame + x => "center", + y => "center", title => "Query", - child => my $vbox = new CFClient::UI::VBox; + child => my $vbox = new CFClient::UI::VBox, + ; $vbox->add (new CFClient::UI::Label max_w => $::WIDTH * 0.4, @@ -338,7 +356,7 @@ $vbox->add (my $hbox = new CFClient::UI::HBox); $hbox->add (new CFClient::UI::Button text => "No", - connect_activate => sub { + on_activate => sub { $self->send ("reply n"); $dialog->destroy; $self->{map_widget}->focus_in; @@ -346,7 +364,7 @@ ); $hbox->add (new CFClient::UI::Button text => "Yes", - connect_activate => sub { + on_activate => sub { $self->send ("reply y"); $dialog->destroy; }, @@ -357,7 +375,7 @@ } elsif ($flags & CS_QUERY_SINGLECHAR) { $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; $vbox->add (my $entry = new CFClient::UI::Entry - connect_changed => sub { + on_changed => sub { $self->send ("reply $_[1]"); $dialog->destroy; }, @@ -370,7 +388,7 @@ $vbox->add (my $entry = new CFClient::UI::Entry $flags & CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), - connect_activate => sub { + on_activate => sub { $self->send ("reply $_[1]"); $dialog->destroy; }, @@ -379,7 +397,7 @@ $entry->focus_in; } - $dialog->show_centered; + $dialog->show; } sub drawinfo { @@ -534,7 +552,22 @@ sub set_opencont { my ($conn, $tag, $name) = @_; $conn->{open_container} = $tag; - $::INVR_LBL->set_text ($name); + + $::INV_RIGHT_HB->clear (); + $::INV_RIGHT_HB->add (new CFClient::UI::Label align => 0, expand => 1, text => $name); + + if ($tag != 0) { # Floor isn't closable, is it? + $::INV_RIGHT_HB->add (new CFClient::UI::Button + text => "Close container", + tooltip => "Close the currently open container (if one is open)", + on_activate => sub { + $::CONN->send ("apply $tag") # $::CONN->{open_container}") + if $tag != 0; + #if $CONN->{open_container} != 0; + }, + ); + } + $::INVR->set_items ($conn->{container}{$tag}); } @@ -573,6 +606,8 @@ update_container (0); } elsif ($tag == $self->{player}{tag}) { $::INV->set_items ($self->{container}{$tag}) + } else { + update_container ($tag); } # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; @@ -590,7 +625,7 @@ } elsif ($_->{container} == $self->{player}{tag}) { $::INV->set_items ($self->{container}{$self->{player}{tag}}) } else { - update_container ($_->{tag}); + update_container ($_->{container}); } } }