ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.73 by elmex, Mon May 29 19:30:27 2006 UTC vs.
Revision 1.80 by elmex, Tue May 30 08:12:50 2006 UTC

68 } 68 }
69 69
70 close CFG; 70 close CFG;
71} 71}
72 72
73mkdir "$Crossfire::VARDIR/pclient", 0777; 73mkdir "$Crossfire::VARDIR/cfplus", 0777;
74 74
75our $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
75our $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
84sub db_table($) { 95sub 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
99sub pod_to_pango($) { 110sub 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) {
379# (Bindings are stored in $::CFG->{bindings}->{$mod}->{$sym}) 391# (Bindings are stored in $::CFG->{bindings}->{$mod}->{$sym})
380sub open_binding_dialog { 392sub open_binding_dialog {
381 my ($cmd) = @_; 393 my ($cmd) = @_;
382 394
383 my $w = new CFClient::UI::FancyFrame 395 my $w = new CFClient::UI::FancyFrame
384 title => "Bind Action"; 396 title => "Bind Action",
397 x => "center",
398 y => "center";
385 399
386 $w->add (my $vb = new CFClient::UI::VBox); 400 $w->add (my $vb = new CFClient::UI::VBox);
387 $vb->add (new CFClient::UI::Label 401 $vb->add (new CFClient::UI::Label
388 text => "Press a modifier (CTRL, ALT and/or SHIFT) and a key." 402 text => "Press a modifier (CTRL, ALT and/or SHIFT) and a key."
389 ."You can only bind 0-9 and F1-F15 without modifiers." 403 ."You can only bind 0-9 and F1-F15 without modifiers."
413 } 427 }
414 428
415 $entry->focus_out; 429 $entry->focus_out;
416 430
417 $::CFG->{bindings}->{$mod}->{$sym} = $cmd; 431 $::CFG->{bindings}->{$mod}->{$sym} = $cmd;
418 $::STATUSBOX->add ("Bound actions to '".keycombo_to_name ($mod, $sym)."'. Don't forget Save Layout!"); 432 $::STATUSBOX->add ("Bound actions to '".keycombo_to_name ($mod, $sym)."'. Don't forget 'Save Config'!");
419 433
420 $w->destroy 434 $w->destroy
421 }); 435 });
422 436
423 $entry->focus_in; 437 $entry->focus_in;
424 $w->center;
425 $w->show; 438 $w->show;
426} 439}
427 440
428sub keycombo_to_name { 441sub keycombo_to_name {
429 my ($mod, $sym) = @_; 442 my ($mod, $sym) = @_;
454 for (@$list) { 467 for (@$list) {
455 $CMDBOX->add (my $hb = new CFClient::UI::HBox); 468 $CMDBOX->add (my $hb = new CFClient::UI::HBox);
456 469
457 my $i = $idx; 470 my $i = $idx;
458 $hb->add (new CFClient::UI::Button 471 $hb->add (new CFClient::UI::Button
459 text => "del", 472 text => "delete",
460 tooltip => "Deletes the action from the record", 473 tooltip => "Deletes the action from the record",
461 on_activate => sub { 474 on_activate => sub {
462 $CMDBOX->remove ($hb); 475 $CMDBOX->remove ($hb);
463 $list->[$i] = undef; 476 $list->[$i] = undef;
464 }); 477 });
507 520
508 $RECORD_WINDOW->add (my $vb = new CFClient::UI::VBox); 521 $RECORD_WINDOW->add (my $vb = new CFClient::UI::VBox);
509 $vb->add ($REC_BTN = new CFClient::UI::Button 522 $vb->add ($REC_BTN = new CFClient::UI::Button
510 text => "start recording", 523 text => "start recording",
511 tooltip => "Start/Stops recording of actions." 524 tooltip => "Start/Stops recording of actions."
512 ."(CTRL+INS Starts the recorder, INS Stops recorder and binds automatically)" 525 ."(CTRL+Insert Starts the recorder, Insert Stops recorder and binds automatically)"
513 ."All subsequent actions after the recording started will be captured." 526 ."All subsequent actions after the recording started will be captured."
514 ."The actions are displayed after the record was stopped." 527 ."The actions are displayed after the record was stopped."
515 ."To bind the action you have to click on the 'Bind' button", 528 ."To bind the action you have to click on the 'Bind' button",
516 on_activate => sub { 529 on_activate => sub {
517 my ($btn) = @_; 530 my ($btn) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines