… | |
… | |
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]); |
… | |
… | |
1301 | |
1302 | |
1302 | sub spell_setup { |
1303 | sub spell_setup { |
1303 | new CFClient::UI::SpellList |
1304 | new CFClient::UI::SpellList |
1304 | } |
1305 | } |
1305 | |
1306 | |
|
|
1307 | sub update_bindings { |
|
|
1308 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
|
|
1309 | } |
|
|
1310 | |
1306 | sub keyboard_setup { |
1311 | sub keyboard_setup { |
1307 | my $binding_list = new CFClient::UI::VBox; |
1312 | my $binding_list = new CFClient::UI::VBox; |
1308 | |
1313 | |
1309 | my $refresh; |
1314 | my $refresh; |
1310 | $refresh = sub { |
1315 | $refresh = $BIND_UPD_CB = sub { |
1311 | $binding_list->clear (); |
1316 | $binding_list->clear (); |
1312 | |
1317 | |
1313 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1318 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1314 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1319 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1315 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1320 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
… | |
… | |
1333 | on_activate => sub { |
1338 | on_activate => sub { |
1334 | $::BIND_EDITOR->set_binding ( |
1339 | $::BIND_EDITOR->set_binding ( |
1335 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1340 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1336 | sub { |
1341 | sub { |
1337 | my ($nmod, $nsym, $ncmds) = @_; |
1342 | my ($nmod, $nsym, $ncmds) = @_; |
1338 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1343 | $::BIND_EDITOR->cfg_unbind ($mod, $sym); |
1339 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1344 | $::BIND_EDITOR->cfg_bind ($nmod, $nsym, $ncmds); |
1340 | $refresh->(); |
1345 | $refresh->(); |
1341 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1346 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1342 | $SETUP_DIALOG->show; |
1347 | $SETUP_DIALOG->show; |
1343 | }, |
1348 | }, |
1344 | sub { |
1349 | sub { |
… | |
… | |
1378 | tooltip => "This button opens the binding editor with an empty binding.", |
1383 | tooltip => "This button opens the binding editor with an empty binding.", |
1379 | on_activate => sub { |
1384 | on_activate => sub { |
1380 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1385 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1381 | sub { |
1386 | sub { |
1382 | my ($mod, $sym, $cmds) = @_; |
1387 | my ($mod, $sym, $cmds) = @_; |
1383 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1388 | $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds); |
1384 | $refresh->(); |
1389 | $refresh->(); |
1385 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1390 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1386 | $SETUP_DIALOG->show; |
1391 | $SETUP_DIALOG->show; |
1387 | }, |
1392 | }, |
1388 | sub { |
1393 | sub { |