… | |
… | |
36 | |
36 | |
37 | use CFClient; |
37 | use CFClient; |
38 | use CFClient::OpenGL (); |
38 | use CFClient::OpenGL (); |
39 | use CFClient::Protocol; |
39 | use CFClient::Protocol; |
40 | use CFClient::UI; |
40 | use CFClient::UI; |
|
|
41 | use CFClient::BindingEditor; |
41 | use CFClient::MapWidget; |
42 | use CFClient::MapWidget; |
42 | |
43 | |
43 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
44 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
44 | |
45 | |
45 | $Event::DIED = sub { |
46 | $Event::DIED = sub { |
… | |
… | |
115 | our $INV; |
116 | our $INV; |
116 | our $INVR; |
117 | our $INVR; |
117 | our $INV_RIGHT_HB; |
118 | our $INV_RIGHT_HB; |
118 | |
119 | |
119 | our $BIND_EDITOR; |
120 | our $BIND_EDITOR; |
|
|
121 | our $BIND_UPD_CB; |
120 | |
122 | |
121 | our $PICKUP_CFG; |
123 | our $PICKUP_CFG; |
122 | |
124 | |
123 | sub status { |
125 | sub status { |
124 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
126 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
… | |
… | |
748 | ); |
750 | ); |
749 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
751 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
750 | font => $FONT_FIXED, |
752 | font => $FONT_FIXED, |
751 | can_hover => 1, |
753 | can_hover => 1, |
752 | can_events => 1, |
754 | can_events => 1, |
753 | image => "ui/resist/resist_$_.png", |
755 | path => "ui/resist/resist_$_.png", |
754 | tooltip => $resist_names{$_}, |
756 | tooltip => $resist_names{$_}, |
755 | ); |
757 | ); |
756 | |
758 | |
757 | $row++; |
759 | $row++; |
758 | if ($row % 6 == 0) { |
760 | if ($row % 6 == 0) { |
… | |
… | |
945 | x => 'center', |
947 | x => 'center', |
946 | y => 'center', |
948 | y => 'center', |
947 | z => 3, |
949 | z => 3, |
948 | force_h => $::HEIGHT * 0.4, |
950 | force_h => $::HEIGHT * 0.4, |
949 | child => (my $vbox = new CFClient::UI::VBox), |
951 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
952 | has_close_button => 1, |
950 | on_visibility_change => sub { |
953 | on_visibility_change => sub { |
951 | update_metaserver if $_[1]; |
954 | update_metaserver if $_[1]; |
952 | 0 |
955 | 0 |
953 | }, |
956 | }, |
954 | ; |
957 | ; |
… | |
… | |
1301 | |
1304 | |
1302 | sub spell_setup { |
1305 | sub spell_setup { |
1303 | new CFClient::UI::SpellList |
1306 | new CFClient::UI::SpellList |
1304 | } |
1307 | } |
1305 | |
1308 | |
|
|
1309 | sub update_bindings { |
|
|
1310 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
|
|
1311 | } |
|
|
1312 | |
1306 | sub keyboard_setup { |
1313 | sub keyboard_setup { |
1307 | my $binding_list = new CFClient::UI::VBox; |
1314 | my $binding_list = new CFClient::UI::VBox; |
1308 | |
1315 | |
1309 | my $refresh; |
1316 | my $refresh; |
1310 | $refresh = sub { |
1317 | $refresh = $BIND_UPD_CB = sub { |
1311 | $binding_list->clear (); |
1318 | $binding_list->clear (); |
1312 | |
1319 | |
1313 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1320 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1314 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1321 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1315 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1322 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
… | |
… | |
1333 | on_activate => sub { |
1340 | on_activate => sub { |
1334 | $::BIND_EDITOR->set_binding ( |
1341 | $::BIND_EDITOR->set_binding ( |
1335 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1342 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1336 | sub { |
1343 | sub { |
1337 | my ($nmod, $nsym, $ncmds) = @_; |
1344 | my ($nmod, $nsym, $ncmds) = @_; |
1338 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1345 | $::BIND_EDITOR->cfg_unbind ($mod, $sym); |
1339 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1346 | $::BIND_EDITOR->cfg_bind ($nmod, $nsym, $ncmds); |
1340 | $refresh->(); |
1347 | $refresh->(); |
1341 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1348 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1342 | $SETUP_DIALOG->show; |
1349 | $SETUP_DIALOG->show; |
1343 | }, |
1350 | }, |
1344 | sub { |
1351 | sub { |
… | |
… | |
1378 | tooltip => "This button opens the binding editor with an empty binding.", |
1385 | tooltip => "This button opens the binding editor with an empty binding.", |
1379 | on_activate => sub { |
1386 | on_activate => sub { |
1380 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1387 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1381 | sub { |
1388 | sub { |
1382 | my ($mod, $sym, $cmds) = @_; |
1389 | my ($mod, $sym, $cmds) = @_; |
1383 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1390 | $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds); |
1384 | $refresh->(); |
1391 | $refresh->(); |
1385 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1392 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1386 | $SETUP_DIALOG->show; |
1393 | $SETUP_DIALOG->show; |
1387 | }, |
1394 | }, |
1388 | sub { |
1395 | sub { |
… | |
… | |
1430 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1437 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1431 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1438 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1432 | value => undef, |
1439 | value => undef, |
1433 | options => [ |
1440 | options => [ |
1434 | [intro => "Introduction"], |
1441 | [intro => "Introduction"], |
1435 | [manual => "Manual"], |
1442 | [manual => "Main Manual"], |
1436 | [skill_help => "Skills"], |
1443 | [skill_help => "Skill Reference"], |
1437 | [command_help => "Commands"], |
1444 | [command_help => "Command Reference"], |
1438 | [dmcommand_help => "DM Commands"], |
1445 | [dmcommand_help => "DM Commands"], |
1439 | [COPYING => "License Terms"], |
1446 | [COPYING => "License Terms"], |
1440 | ], |
1447 | ], |
1441 | on_changed => sub { |
1448 | on_changed => sub { |
1442 | my ($self, $pod) = @_; |
1449 | my ($self, $pod) = @_; |
1443 | |
1450 | |
1444 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1451 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1445 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1452 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1446 | |
1453 | |
1447 | $viewer->clear; |
1454 | $viewer->clear; |
|
|
1455 | |
|
|
1456 | # $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n", |
|
|
1457 | # (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1), |
|
|
1458 | # (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"), |
|
|
1459 | # ]);#d# |
1448 | |
1460 | |
1449 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1461 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1450 | for @$pom; |
1462 | for @$pom; |
1451 | |
1463 | |
1452 | $viewer->set_offset (0); |
1464 | $viewer->set_offset (0); |
|
|
1465 | |
1453 | 0 |
1466 | 0 |
1454 | }, |
1467 | }, |
1455 | on_visibility_change => sub { |
1468 | on_visibility_change => sub { |
1456 | my ($self, $visible) = @_; |
1469 | my ($self, $visible) = @_; |
1457 | return unless $visible; |
1470 | return unless $visible; |
… | |
… | |
1504 | z => 100, |
1517 | z => 100, |
1505 | force_x => "max", |
1518 | force_x => "max", |
1506 | force_y => 0; |
1519 | force_y => 0; |
1507 | $DEBUG_STATUS->show; |
1520 | $DEBUG_STATUS->show; |
1508 | |
1521 | |
1509 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1522 | $BIND_EDITOR = new CFClient::BindingEditor (x => "max", y => 0); |
1510 | |
1523 | |
1511 | $STATUSBOX = new CFClient::UI::Statusbox; |
1524 | $STATUSBOX = new CFClient::UI::Statusbox; |
1512 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1525 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1513 | |
1526 | |
1514 | (new CFClient::UI::Frame |
1527 | (new CFClient::UI::Frame |