… | |
… | |
68 | } |
68 | } |
69 | |
69 | |
70 | close CFG; |
70 | close CFG; |
71 | } |
71 | } |
72 | |
72 | |
73 | mkdir "$Crossfire::VARDIR/pclient", 0777; |
73 | mkdir "$Crossfire::VARDIR/cfplus", 0777; |
74 | |
74 | |
|
|
75 | our $DB_ENV; |
|
|
76 | |
|
|
77 | { |
|
|
78 | use strict; |
|
|
79 | |
|
|
80 | my $recover = $BerkeleyDB::db_version >= 4.4 |
|
|
81 | ? eval "DB_REGISTER | DB_RECOVER" |
|
|
82 | : 0; |
|
|
83 | |
75 | our $DB_ENV = new BerkeleyDB::Env |
84 | $DB_ENV = new BerkeleyDB::Env |
76 | -Home => "$Crossfire::VARDIR/pclient", |
85 | -Home => "$Crossfire::VARDIR/cfplus", |
77 | -Cachesize => 1_000_000, |
86 | -Cachesize => 1_000_000, |
78 | -ErrFile => "$Crossfire::VARDIR/pclient/errorlog.txt", |
87 | -ErrFile => "$Crossfire::VARDIR/cfplus/errorlog.txt", |
79 | # -ErrPrefix => "DATABASE", |
88 | # -ErrPrefix => "DATABASE", |
80 | -Verbose => 1, |
89 | -Verbose => 1, |
81 | -Flags => DB_CREATE | DB_RECOVER | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN, |
90 | -Flags => DB_CREATE | DB_RECOVER | DB_INIT_MPOOL | DB_INIT_LOCK | DB_INIT_TXN | $recover, |
|
|
91 | -SetFlags => DB_AUTO_COMMIT | DB_LOG_AUTOREMOVE, |
82 | or die "unable to create/open database home $Crossfire::VARDIR/pclient: $BerkeleyDB::Error"; |
92 | or die "unable to create/open database home $Crossfire::VARDIR/cfplus: $BerkeleyDB::Error"; |
|
|
93 | } |
83 | |
94 | |
84 | sub db_table($) { |
95 | sub db_table($) { |
85 | my ($table) = @_; |
96 | my ($table) = @_; |
86 | |
97 | |
87 | $table =~ s/([^a-zA-Z0-9_\-])/sprintf "=%x=", ord $1/ge; |
98 | $table =~ s/([^a-zA-Z0-9_\-])/sprintf "=%x=", ord $1/ge; |
88 | |
99 | |
89 | new CFClient::Database |
100 | new CFClient::Database |
90 | -Env => $DB_ENV, |
101 | -Env => $DB_ENV, |
91 | -Filename => $table, |
102 | -Filename => $table, |
92 | # -Filename => "database", |
103 | # -Filename => "database", |
93 | # -Subname => $table, |
104 | # -Subname => $table, |
94 | -Property => DB_CHKSUM, |
105 | -Property => DB_CHKSUM, |
95 | -Flags => DB_CREATE | DB_UPGRADE, |
106 | -Flags => DB_CREATE | DB_UPGRADE, |
96 | or die "unable to create/open database table $_[0]: $BerkeleyDB::Error"; |
107 | or die "unable to create/open database table $_[0]: $BerkeleyDB::Error" |
97 | } |
108 | } |
98 | |
109 | |
99 | sub pod_to_pango($) { |
110 | sub pod_to_pango($) { |
100 | my ($pom) = @_; |
111 | my ($pom) = @_; |
101 | |
112 | |
… | |
… | |
240 | |
251 | |
241 | if ($self->{container} == $::CONN->{player}{tag}) { |
252 | if ($self->{container} == $::CONN->{player}{tag}) { |
242 | $targ = $::CONN->{open_container}; |
253 | $targ = $::CONN->{open_container}; |
243 | } |
254 | } |
244 | |
255 | |
245 | $::CONN->send ("move $targ $self->{tag} 0"); |
256 | $::CONN->send ("move $targ $self->{tag} 0") |
|
|
257 | if $targ || !($self->{flags} & F_LOCKED); |
246 | } elsif ($ev->{button} == 1) { |
258 | } elsif ($ev->{button} == 1) { |
247 | $::CONN->send ("examine $self->{tag}"); |
259 | $::CONN->send ("examine $self->{tag}"); |
248 | } elsif ($ev->{button} == 2) { |
260 | } elsif ($ev->{button} == 2) { |
249 | $::CONN->send ("apply $self->{tag}"); |
261 | $::CONN->send ("apply $self->{tag}"); |
250 | } elsif ($ev->{button} == 3) { |
262 | } elsif ($ev->{button} == 3) { |
… | |
… | |
413 | } |
425 | } |
414 | |
426 | |
415 | $entry->focus_out; |
427 | $entry->focus_out; |
416 | |
428 | |
417 | $::CFG->{bindings}->{$mod}->{$sym} = $cmd; |
429 | $::CFG->{bindings}->{$mod}->{$sym} = $cmd; |
418 | $::STATUSBOX->add ("Bound actions to '".keycombo_to_name ($mod, $sym)."'. Don't forget Save Layout!"); |
430 | $::STATUSBOX->add ("Bound actions to '".keycombo_to_name ($mod, $sym)."'. Don't forget 'Save Config'!"); |
419 | |
431 | |
420 | $w->destroy |
432 | $w->destroy |
421 | }); |
433 | }); |
422 | |
434 | |
423 | $entry->focus_in; |
435 | $entry->focus_in; |
… | |
… | |
454 | for (@$list) { |
466 | for (@$list) { |
455 | $CMDBOX->add (my $hb = new CFClient::UI::HBox); |
467 | $CMDBOX->add (my $hb = new CFClient::UI::HBox); |
456 | |
468 | |
457 | my $i = $idx; |
469 | my $i = $idx; |
458 | $hb->add (new CFClient::UI::Button |
470 | $hb->add (new CFClient::UI::Button |
459 | text => "del", |
471 | text => "delete", |
460 | tooltip => "Deletes the action from the record", |
472 | tooltip => "Deletes the action from the record", |
461 | on_activate => sub { |
473 | on_activate => sub { |
462 | $CMDBOX->remove ($hb); |
474 | $CMDBOX->remove ($hb); |
463 | $list->[$i] = undef; |
475 | $list->[$i] = undef; |
464 | }); |
476 | }); |
… | |
… | |
507 | |
519 | |
508 | $RECORD_WINDOW->add (my $vb = new CFClient::UI::VBox); |
520 | $RECORD_WINDOW->add (my $vb = new CFClient::UI::VBox); |
509 | $vb->add ($REC_BTN = new CFClient::UI::Button |
521 | $vb->add ($REC_BTN = new CFClient::UI::Button |
510 | text => "start recording", |
522 | text => "start recording", |
511 | tooltip => "Start/Stops recording of actions." |
523 | tooltip => "Start/Stops recording of actions." |
512 | ."(CTRL+INS Starts the recorder, INS Stops recorder and binds automatically)" |
524 | ."(CTRL+Insert Starts the recorder, Insert Stops recorder and binds automatically)" |
513 | ."All subsequent actions after the recording started will be captured." |
525 | ."All subsequent actions after the recording started will be captured." |
514 | ."The actions are displayed after the record was stopped." |
526 | ."The actions are displayed after the record was stopped." |
515 | ."To bind the action you have to click on the 'Bind' button", |
527 | ."To bind the action you have to click on the 'Bind' button", |
516 | on_activate => sub { |
528 | on_activate => sub { |
517 | my ($btn) = @_; |
529 | my ($btn) = @_; |