… | |
… | |
115 | our $INV; |
115 | our $INV; |
116 | our $INVR; |
116 | our $INVR; |
117 | our $INV_RIGHT_HB; |
117 | our $INV_RIGHT_HB; |
118 | |
118 | |
119 | our $BIND_EDITOR; |
119 | our $BIND_EDITOR; |
|
|
120 | our $BIND_UPD_CB; |
120 | |
121 | |
121 | our $PICKUP_CFG; |
122 | our $PICKUP_CFG; |
122 | |
123 | |
123 | sub status { |
124 | sub status { |
124 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
125 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
… | |
… | |
381 | status "connection closed"; |
382 | status "connection closed"; |
382 | |
383 | |
383 | destroy_query_dialog $CONN; |
384 | destroy_query_dialog $CONN; |
384 | $CONN->destroy; |
385 | $CONN->destroy; |
385 | $CONN = 0; # false, does not autovivify |
386 | $CONN = 0; # false, does not autovivify |
|
|
387 | |
|
|
388 | undef $MAP; |
386 | } |
389 | } |
387 | |
390 | |
388 | sub graphics_setup { |
391 | sub graphics_setup { |
389 | my $vbox = new CFClient::UI::VBox; |
392 | my $vbox = new CFClient::UI::VBox; |
390 | |
393 | |
… | |
… | |
1299 | |
1302 | |
1300 | sub spell_setup { |
1303 | sub spell_setup { |
1301 | new CFClient::UI::SpellList |
1304 | new CFClient::UI::SpellList |
1302 | } |
1305 | } |
1303 | |
1306 | |
|
|
1307 | sub update_bindings { |
|
|
1308 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
|
|
1309 | } |
|
|
1310 | |
1304 | sub keyboard_setup { |
1311 | sub keyboard_setup { |
1305 | my $binding_list = new CFClient::UI::VBox; |
1312 | my $binding_list = new CFClient::UI::VBox; |
1306 | |
1313 | |
1307 | my $refresh; |
1314 | my $refresh; |
1308 | $refresh = sub { |
1315 | $refresh = $BIND_UPD_CB = sub { |
1309 | $binding_list->clear (); |
1316 | $binding_list->clear (); |
1310 | |
1317 | |
1311 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1318 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1312 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1319 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1313 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1320 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
… | |
… | |
1331 | on_activate => sub { |
1338 | on_activate => sub { |
1332 | $::BIND_EDITOR->set_binding ( |
1339 | $::BIND_EDITOR->set_binding ( |
1333 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1340 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1334 | sub { |
1341 | sub { |
1335 | my ($nmod, $nsym, $ncmds) = @_; |
1342 | my ($nmod, $nsym, $ncmds) = @_; |
1336 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1343 | $::BIND_EDITOR->cfg_unbind ($mod, $sym); |
1337 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1344 | $::BIND_EDITOR->cfg_bind ($nmod, $nsym, $ncmds); |
1338 | $refresh->(); |
1345 | $refresh->(); |
1339 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1346 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1340 | $SETUP_DIALOG->show; |
1347 | $SETUP_DIALOG->show; |
1341 | }, |
1348 | }, |
1342 | sub { |
1349 | sub { |
… | |
… | |
1376 | tooltip => "This button opens the binding editor with an empty binding.", |
1383 | tooltip => "This button opens the binding editor with an empty binding.", |
1377 | on_activate => sub { |
1384 | on_activate => sub { |
1378 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1385 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1379 | sub { |
1386 | sub { |
1380 | my ($mod, $sym, $cmds) = @_; |
1387 | my ($mod, $sym, $cmds) = @_; |
1381 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1388 | $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds); |
1382 | $refresh->(); |
1389 | $refresh->(); |
1383 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1390 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1384 | $SETUP_DIALOG->show; |
1391 | $SETUP_DIALOG->show; |
1385 | }, |
1392 | }, |
1386 | sub { |
1393 | sub { |