--- deliantra/Deliantra-Client/bin/cfplus 2006/12/04 15:17:14 1.134 +++ deliantra/Deliantra-Client/bin/cfplus 2006/12/05 16:53:29 1.135 @@ -1929,14 +1929,32 @@ $win->add ($r); - $vb->add (my $chk = new CFPlus::UI::Button text => "Disable build mode", on_activate => sub { $::IN_BUILD_MODE = undef }); - $vb->add (my $chk = new CFPlus::UI::Button text => "ERASE", on_activate => sub { $::IN_BUILD_MODE = { do_erase => 1 } }); + $vb->add ( + new CFPlus::UI::Button + text => "Disable build mode", + on_activate => sub { $::IN_BUILD_MODE = undef } + ); + $vb->add ( + new CFPlus::UI::Button + text => "ERASE", + on_activate => sub { $::IN_BUILD_MODE = { do_erase => 1 } } + ); - for my $itemarchname (keys %{$msg->{items}}) { + for my $itemarchname ( + sort { + $msg->{items}->{$a}->{build_arch_name} + cmp $msg->{items}->{$b}->{build_arch_name} + } keys %{$msg->{items}} + ) { + my $info = $msg->{items}->{$itemarchname}; $vb->add ( - new CFPlus::UI::Button text => "$itemarchname", + new CFPlus::UI::Button text => $info->{build_arch_name}, on_activate => sub { - $::IN_BUILD_MODE = $itemarchname; + $::IN_BUILD_MODE = { item => $itemarchname, info => $info }; + + if (grep { $msg->{items}->{$itemarchname}->{$_} } qw/has_connection has_name has_text/) { + build_mode_query_arch_info (); + } } ); } @@ -1944,6 +1962,50 @@ $win->show; } +sub build_mode_query_arch_info { + my ($iteminfo) = $::IN_BUILD_MODE; + my $itemarchname = $iteminfo->{item}; + my $info = $iteminfo->{info}; + + my $dialog = new CFPlus::UI::Toplevel + x => "center", + y => "center", + z => 50, + force_w => int $WIDTH * 1/2, + title => "Enter information for placement of '$itemarchname'", + has_close_button => 1; + + $dialog->add (my $vb = new CFPlus::UI::VBox expand => 1); + + $vb->add (my $table = new CFPlus::UI::Table expand => 1); + my $row = 0; + if ($info->{has_name}) { + $table->add (0, $row, new CFPlus::UI::Label text => "Name:"); + $table->add (1, $row++, new CFPlus::UI::Entry expand => 1, on_changed => sub { $::IN_BUILD_MODE->{name} = $_[1]; 0 }); + } + if ($info->{has_text}) { + $table->add (0, $row, new CFPlus::UI::Label text => "Text:"); + $table->add (1, $row++, new CFPlus::UI::Entry expand => 1, on_changed => sub { $::IN_BUILD_MODE->{text} = $_[1]; 0 }); + } + if ($info->{has_connection}) { + $table->add (0, $row, new CFPlus::UI::Label text => "Connection ID:"); + $table->add (1, $row++, + new CFPlus::UI::Entry + expand => 1, + on_changed => sub { $::IN_BUILD_MODE->{connection} = $_[1]; 0 }, + tooltip => "Enter the connection ID here. The connection ID connects actors like a lever to a gate or a magic ear to a gate" + ); + } + + $vb->add (my $hb = new CFPlus::UI::HBox expand => 1); + $hb->add (new CFPlus::UI::Button + text => "Close", + expand => 1, + on_activate => sub { $dialog->hide; 0 }, + ); + $dialog->show; +} + sub video_shutdown { CFPlus::OpenGL::shutdown;