ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/kgsueme/bin/kgsueme
(Generate patch)

Comparing kgsueme/bin/kgsueme (file contents):
Revision 1.14 by pcg, Fri May 30 03:49:27 2003 UTC vs.
Revision 1.23 by pcg, Fri May 30 11:53:24 2003 UTC

1#!/usr/bin/perl -I../lib/ 1#!/usr/bin/perl -I../lib/
2
3#use PApp::Util qw(dumpval); # debug only
4 2
5use Gtk; 3use Gtk;
6use Gtk::Gdk; 4use Gtk::Gdk;
7use Gtk::Gdk::Pixbuf; 5use Gtk::Gdk::Pixbuf;
8#use Gtk::Gdk::ImlibImage; 6#use Gtk::Gdk::ImlibImage;
9 7
10use KGS::Protocol; 8use KGS::Protocol;
11use KGS::Listener::Debug; 9use KGS::Listener::Debug;
12 10
11use Audio::Data;
12use Audio::Play;
13
13use IO::Socket::INET; 14use IO::Socket::INET;
14 15
15use Errno; 16use Errno;
16 17
17init Gtk; 18init Gtk;
18 19
19$HACK = 1; # do NEVER enable. ;) 20$HACK = 1; # do NEVER enable. ;)
20 21
21our $config; 22our $config;
23our $LIBDIR = ".";
22our $IMGDIR = "images"; 24our $IMGDIR = "$LIBDIR/images";
25our $SNDDIR = "$LIBDIR/sounds";
23 26
24sub load_img { 27sub load_img {
25 new_from_file Gtk::Gdk::Pixbuf "$IMGDIR/$_[0]" 28 new_from_file Gtk::Gdk::Pixbuf "$IMGDIR/$_[0]"
26# load_image Gtk::Gdk::ImlibImage "$IMGDIR/$_[0]" 29# load_image Gtk::Gdk::ImlibImage "$IMGDIR/$_[0]"
27 or die "$IMGDIR/$_[0]: $!"; 30 or die "$IMGDIR/$_[0]: $!";
28} 31}
32
33my @fontchars = ('A' .. 'Z', 0 .. 9);
29 34
30our @black_img = load_img "b-01.png"; 35our @black_img = load_img "b-01.png";
31our @white_img = map +(load_img "w-0$_.png"), 1,2,3,4,5; 36our @white_img = map +(load_img "w-0$_.png"), 1,2,3,4,5;
32our @triangle_img = map +(load_img "triangle-$_.png"), qw(b w); 37our @triangle_img = map +(load_img "triangle-$_.png"), qw(b w);
33our @square_img = map +(load_img "square-$_.png"), qw(b w); 38our @square_img = map +(load_img "square-$_.png"), qw(b w);
34our @circle_img = map +(load_img "circle-$_.png"), qw(b w); 39our @circle_img = map +(load_img "circle-$_.png"), qw(b w);
35our $board_img = load_img "woodgrain-01.jpg"; 40our $board_img = load_img "woodgrain-01.jpg";
36 41
42our @font = (
43 [map +(load_img "font/$_-black.png"), @fontchars],
44 [map +(load_img "font/$_-white.png"), @fontchars],
45 );
46our %fontmap;
47@fontmap{@fontchars} = (0..25 + 10);
48@fontmap{'a' .. 'z'} = (0..25);
49
50{
51 #my $audioserver = new Audio::Play(0);
52 my %sound;
53 $SIG{CHLD} = 'IGNORE';
54
55 for (qw(alarm warning move)) {
56 local $/;
57 open my $snd, "<", "$SNDDIR/$_"
58 or die "$SNDDIR: $!";
59 binmode $snd;
60
61 $sound{$_} = new Audio::Data;
62 $sound{$_}->Load($snd);
63 }
64
65 sub play_sound {
66 if (fork == 0) {
67 if (my $audioserver = new Audio::Play(1)) {
68 $audioserver->play ($sound{$_[0]});
69 }
70 Gtk->_exit(0);
71 }
72 }
73}
74
37{ 75{
38 use Storable (); 76 use Storable ();
39 use Scalar::Util (); 77 use Scalar::Util ();
40 78
41 my $staterc = "$ENV{HOME}/.kgsueme"; 79 my $staterc = "$ENV{HOME}/.kgsueme";
42 80
43 my $state = -r $staterc ? Storable::retrieve($staterc) : {}; 81 my $state = -r $staterc ? Storable::retrieve($staterc) : {};
44 my @widgets; 82 my @widgets;
45 83
46 $config = $state->{config} ||= {}; 84 $config = $state->{config} ||= {};
85
86 $config{speed} = 1;#d# optimize for speed or memory?
87 $config{conserve_memory} = 0;
47 88
48 # grr... more gtk+ brokenness 89 # grr... more gtk+ brokenness
49 my %get = ( 90 my %get = (
50 hpane_position => sub { ($_[0]->children)[0]->allocation->[2] }, 91 hpane_position => sub { ($_[0]->children)[0]->allocation->[2] },
51 vpane_position => sub { ($_[0]->children)[0]->allocation->[3] }, 92 vpane_position => sub { ($_[0]->children)[0]->allocation->[3] },
52 window_size => sub { [ @{$_[0]->allocation}[2,3] ] }, 93 window_size => sub { [ @{$_[0]->allocation}[2,3] ] },
53 #window_pos => sub { die PApp::Util::dumpval [ $_[0]->get_root_origin ] }, 94 #window_pos => sub { die KGS::Listener::Debug::dumpval [ $_[0]->get_root_origin ] },
54 clist_column_widths => sub { 95 clist_column_widths => sub {
55 $_[0]{column_widths}; 96 $_[0]{column_widths};
56 }, 97 },
57 ); 98 );
58 99
139 $main->{status}->push($context_id{$type} ||= $main->{status}->get_context_id($type), $text) if $text; 180 $main->{status}->push($context_id{$type} ||= $main->{status}->get_context_id($type), $text) if $text;
140 } 181 }
141} 182}
142 183
143if (0) { 184if (0) {
185 use KGS::Constants;
186
144 my $board = new game size => 5; 187 my $board = new game size => 5;
188 $board->{board} = new KGS::Game::Board;
189 $board->{board}{board}[0][0] = MARK_B;
190 $board->{board}{board}[1][1] = MARK_GRAY_B | MARK_SMALL_W;
191 $board->{board}{board}[2][2] = MARK_W | MARK_TRIANGLE;
145 $board->{window}->show_all; 192 $board->{window}->show_all;
146} 193}
147 194
148main Gtk; 195main Gtk;
149 196
246 if ($msg->{success}) { 293 if ($msg->{success}) {
247 for (keys %{$::config->{rooms}}) { 294 for (keys %{$::config->{rooms}}) {
248 $self->{roomlist}->join_room($_); 295 $self->{roomlist}->join_room($_);
249 } 296 }
250 } 297 }
251
252 warn PApp::Util::dumpval($::config);
253} 298}
254 299
255sub event_disconnect { } 300sub event_disconnect { }
256 301
257############################################################################# 302#############################################################################
560} 605}
561 606
562sub configure_event { 607sub configure_event {
563 my ($widget, $self, $event) = @_; 608 my ($widget, $self, $event) = @_;
564 delete $self->{stack}; 609 delete $self->{stack};
610 delete $self->{background};
565 $self->repaint_board; 611 $self->repaint_board;
566 1; 612 1;
567} 613}
568 614
569sub expose_event { 615sub INTERP_NEAREST (){ 1 }
570 my ($widget, $self, $event) = @_;
571
572 $self->{pixmap} or return;
573
574 my ($ox, $oy, $s) = @{$self->{offsets}};
575
576 my ($x, $y, $w, $h) =
577 @{Gtk::Gdk::Rectangle->intersect(
578 $event->{area},
579 [$ox, $oy, $s, $s]
580 )};
581
582 $self->{canvas}->window->draw_pixmap (
583 $self->{canvas}->style->white_gc,
584 $self->{pixmap},
585 $x - $ox, $y - $oy, $x, $y, $w, $h,
586 );
587 1;
588}
589
590# create new, _transparent_ pixbuf
591sub new_pixbuf {
592 my ($w, $h) = @_;
593
594 $pixbuf;
595}
596
597sub INTERP_TILES (){ 1 } 616sub INTERP_TILES (){ 1 }
598sub INTERP_BILINEAR (){ 2 } 617sub INTERP_BILINEAR (){ 2 }
599sub INTERP_HYPER (){ 3 } 618sub INTERP_HYPER (){ 3 }
600 619
601sub new_pixbuf { 620sub new_pixbuf {
602 my ($w, $h, $clear) = @_; 621 my ($w, $h, $alpha, $clear) = @_;
603 622
604 my $pixbuf = new Gtk::Gdk::Pixbuf 'rgb', 1, 8, $w, $h; 623 my $pixbuf = new Gtk::Gdk::Pixbuf 'rgb', $alpha, 8, $w, $h;
605 624
606 if ($clear) { # damn, need to clear it ourselves 625 if ($clear) { # damn, need to clear it ourselves
607 my $row = "\x00\x00\x00\x00" x $w; 626 my $row = "\x00\x00\x00\x00" x $w;
608 $pixbuf->put_pixels ($row, $_, 0) for 0 .. $h - 1; 627 $pixbuf->put_pixels ($row, $_, 0) for 0 .. $h - 1;
609 } 628 }
612} 631}
613 632
614sub scale_pixbuf { 633sub scale_pixbuf {
615 my ($src, $w, $h, $mode) = @_; 634 my ($src, $w, $h, $mode) = @_;
616 635
617 my $dst = new_pixbuf $w, $h; 636 my $dst = new_pixbuf $w, $h, 1;
618 637
619 $src->scale( 638 $src->scale(
620 $dst, 0, 0, $w, $h, 0, 0, 639 $dst, 0, 0, $w, $h, 0, 0,
621 $w / $src->get_width, $h / $src->get_height, 640 $w / $src->get_width, $h / $src->get_height,
622 $mode, 641 $mode,
623 ); 642 );
624 643
625 $dst; 644 $dst;
626} 645}
627 646
628sub label_font {
629 my ($size) = @_;
630
631 $size = int $size;
632 $size = 34 if $size > 34;
633
634 # I am soo incapable
635 for (8, 10, 11, 12, 14, 17, 18, 20, 24, 25, 34) {
636 next unless $size <= $_;
637 my $font = Gtk::Gdk::Font->fontset_load ("-*-helvetica-bold-r-*--$_-*");
638 return $font if $font;
639 }
640
641 return Gtk::Gdk::Font->fontset_load ("-*-helvetica-bold-r-*--8-*");
642}
643
644sub center_text {
645 my ($drawable, $font, $gc, $x, $y, $t) = @_;
646 my $w = $font->string_width ($t);
647 my $h = $font->string_height($t) - $font->descent;
648 $drawable->draw_text ($font, $gc, $x - $w*0.5, $y + $h * 0.5, $t, length $t);
649}
650
651# create a stack of stones 647# create a stack of stones
652sub create_stack { 648sub create_stack {
653 my ($self, $gc, $mark, $size) = @_; 649 my ($self, $mark, $size, $rand) = @_;
650
651 my $shadow = $size * 0.06;
654 652
655 my $c = \$self->{stack}{$mark}; 653 my $c = \$self->{stack}{$mark};
656 unless ($$c) { 654 unless ($$c) {
657 for my $stone ($mark & (MARK_W | MARK_GRAY_W) ? @::white_img : @::black_img) { 655 for my $stone ($mark & (MARK_W | MARK_GRAY_W) ? @::white_img : @::black_img) {
658 my $base = 656 my $base = new_pixbuf $size + $shadow, $size + $shadow, 1, 1;
659 $mark & (MARK_B | MARK_GRAY_B | MARK_W | MARK_GRAY_W)
660 ? scale_pixbuf $stone, $size, $size, INTERP_HYPER
661 : new_pixbuf $size, $size, 1;
662 657
663 if ($mark & (MARK_GRAY_B | MARK_GRAY_W)) { 658 # zeroeth the shadow
664 # make transparent by stippling :( 659 $::black_img[0]->composite (
665 # fix this to use compositing if/when we have full compositing support 660 $base, $shadow, $shadow, $size, $size, $shadow-0.5, $shadow-0.5,
666 # in kgsueme 661 $size / $stone->get_width, $size / $stone->get_height,
667 my @row = ( 662 $::config{speed} ? INTERP_NEAREST : INTERP_TILES, 128
668 "\xff\xff\xff\xff\x00\x00\x00\x00" x ($size / 2 + 1), 663 );
669 "\x00\x00\x00\x00\xff\xff\xff\xff" x ($size / 2 + 1), 664
665 # first the big stones
666 for ([MARK_B, 255],
667 [MARK_W, 255],
668 [MARK_GRAY_B, 128],
669 [MARK_GRAY_W, 128]) {
670 my ($mask, $alpha) = @$_;
671 if ($mark & $mask) {
672 $stone->composite (
673 $base, 0, 0, $size, $size, -0.5, -0.5,
674 $size / $stone->get_width, $size / $stone->get_height,
675 $::config{speed} ? INTERP_NEAREST : INTERP_HYPER, $alpha
670 ); 676 );
671 $base->put_pixels ($base->get_pixels ($_) & $row[$_ & 1], $_, 0) 677 }
672 for 0 .. $size - 1;
673 } 678 }
674 679
680 # then the samll stones
675 for ([MARK_SMALL_B, $::black_img[int rand @::black_img]], 681 for ([MARK_SMALL_B, $::black_img[$rand % @::black_img]],
676 [MARK_SMALL_W, $::white_img[int rand @::white_img]]) { 682 [MARK_SMALL_W, $::white_img[$rand % @::white_img]]) {
677 my ($mask, $img) = @$_; 683 my ($mask, $img) = @$_;
678 if ($mark & $mask) { 684 if ($mark & $mask) {
679 $img->composite ( 685 $img->composite (
680 $base, ($size / 4) x2, (int ($size / 2 + 0.5)) x2, ($size / 4) x 2, 686 $base, ($size / 4) x2, (int ($size / 2 + 0.5)) x2, ($size / 4 - 0.5) x 2,
681 $size / $img->get_width / 2, $size / $img->get_height / 2, 687 $size / $img->get_width / 2, $size / $img->get_height / 2,
682 INTERP_HYPER, 192 688 $::config{speed} ? INTERP_NEAREST : INTERP_HYPER, 192
683 ); 689 );
684 } 690 }
685 } 691 }
686 692
693 # and lastly any markers (labels NYI)
687 my $dark_bg = ! ! ($mark & (MARK_B | MARK_GRAY_B)); 694 my $dark_bg = ! ! ($mark & (MARK_B | MARK_GRAY_B));
688 695
689 for ([MARK_CIRCLE, $::circle_img[$dark_bg]], 696 for ([MARK_CIRCLE, $::circle_img[$dark_bg]],
690 [MARK_TRIANGLE, $::triangle_img[$dark_bg]], 697 [MARK_TRIANGLE, $::triangle_img[$dark_bg]],
691 [MARK_SQUARE, $::square_img[$dark_bg]]) { 698 [MARK_SQUARE, $::square_img[$dark_bg]]) {
692 my ($mask, $img) = @$_; 699 my ($mask, $img) = @$_;
693 if ($mark & $mask) { 700 if ($mark & $mask) {
694 $img->composite ( 701 $img->composite (
695 $base, 0, 0, $size, $size, 0, 0, 702 $base, 0, 0, $size, $size, -0.5, -0.5,
696 ($size - 1) / ($img->get_width - 1), ($size - 1) / ($img->get_height - 1), 703 $size / $img->get_width, $size / $img->get_height,
697 INTERP_HYPER, 255 704 $::config{speed} ? INTERP_NEAREST : INTERP_HYPER, 255
698 ); 705 );
699 } 706 }
700 } 707 }
701 708
702 push @$$c, [$base->render_pixmap_and_mask (128)]; 709 push @$$c, $base;
703 } 710 }
704 } 711 }
705 712
706 @{$$c->[int rand @$$c]}; 713 $$c->[$rand % @$$c];
714}
715
716sub pixbuf_text {
717 my ($pixbuf, $colour, $x, $y, $height, $text) = @_;
718
719 my $c = $::font[$colour][$::fontmap{substr $text, 0, 1}];
720
721 if ($c) {
722 my ($w, $h) = ($c->get_width, $c->get_height);
723 my $s = ($height-1) / ($h-1);
724
725 $x -= $w * $s * 0.5;
726 $y -= $height * 0.5;
727
728 $c->composite ($pixbuf,
729 $x, $y, $w*$s+0.5, $height+0.5, $x-0.5, $y-0.5, $s, $s,
730 $::config{speed} ? INTERP_NEAREST : INTERP_BILINEAR, 192);
731
732 } else {
733 warn "unable to render character '$text'";
734 }
735}
736
737my $black_pb;
738
739sub pixbuf_rect {
740 my ($pb, $x1, $y1, $x2, $y2) = @_;
741 # we fake lines by... an unspeakable method :/
742 unless ($black_pb) {
743 $black_pb = new_pixbuf 1, 1, 0, 0;
744 $black_pb->put_pixels ("\x44\x11\x11", 0, 0);
745 }
746
747 $black_pb->composite ($pb, $x1, $y1, $x2 - $x1 + 1, $y2 - $y1 + 1, $x1, $y1, 1, 1, INTERP_NEAREST, 192);
707} 748}
708 749
709sub repaint_board { 750sub repaint_board {
710 my ($self) = @_; 751 my ($self) = @_;
711 my $canvas = $self->{canvas}; 752 my $canvas = $self->{canvas};
712 753
713 %cache = (); 754 return unless $self->{board};
714 755
715 my ($w, $h) = @{$canvas->allocation}[2,3]; 756 my ($w, $h) = @{$canvas->allocation}[2,3];
716 757
717 my $s = $w > $h ? $h : $w; 758 my $s = $w > $h ? $h : $w;
718 759
719 $self->{offsets} = [int (($w - $s) / 2), int (($h - $s) / 2), $s]; 760 $self->{offsets} = [int (($w - $s) / 2), int (($h - $s) / 2), $s];
720 761
721 my $pixmap = $self->{pixmap} = new Gtk::Gdk::Pixmap $self->{canvas}->window, $s, $s; 762 my $size = $self->{size};
722 763
723 { 764 my $border = int ($s / $size);
765 my $s2 = $s - $border * 2;
766 my $edge = int ($s2 / $size * 0.97);
767 my $ofs = int ($edge / 2);
768
769 my @k = map int ($s2 * $_ / $size - $ofs + $border + 0.5), 0 .. $size;
770
771 my $pixbuf;
772
773 if ($self->{background}) {
774 $pixbuf = $self->{background}->copy;
775 } else {
724 my ($bw, $bh) = ($::board_img->get_width, $::board_img->get_height); 776 my ($bw, $bh) = ($::board_img->get_width, $::board_img->get_height);
725 777
726 my $bg = $s < $bw && $s < $bh ? $::board_img : scale_pixbuf $::board_img, $s, $s, INTERP_TILES; 778 if ($s < $bw && $s < $bh) {
727 $bg->render_to_drawable( 779 $pixbuf = new_pixbuf $s, $s, $::config{conserve_memory} ? 0 : 1, 0;
728 $pixmap, $self->{canvas}->style->white_gc, 780 $::board_img->copy_area (0, 0, $s, $s, $pixbuf, 0, 0);
729 0, 0, 0, 0, $s, $s, 781 } else {
730 0, 0, 0 782 $pixbuf = scale_pixbuf $::board_img, $s, $s, $::config{speed} ? INTERP_NEAREST : INTERP_TILES;
731 ); 783 }
732 }
733 784
734 my $gc = Gtk::Gdk::GC->new ($pixmap); 785 my $linew = int ($s / 500);
735 786
736 $gc->rgb_gc_set_foreground($line_colour);
737 $gc->set_line_attributes (int ($s / 300) + 1, 'solid', 'projecting', 'miter');
738
739 my $size = $self->{size};
740 my $border = int ($s / $size * 0.75);
741 my $s2 = $s - $border * 2;
742 my $edge = int ($s2 / $size);
743 my $ofs = int ($s2 / $size * 0.5);
744
745 my $font = label_font $ofs;
746
747 my @k = map int ($s2 * $_ / $size - $ofs + $border + 0.5), 0 .. $size;
748
749 my $a = "A"; 787 my $a = "A";
750 for my $i (1 .. $size) { 788 for my $i (1 .. $size) {
751 $pixmap->draw_line ($gc, $k[$i], $k[1], $k[$i], $k[$size]); 789 pixbuf_rect $pixbuf, $k[$i] - $linew, $k[1] - $linew, $k[$i] + $linew, $k[$size] + $linew;
752 $pixmap->draw_line ($gc, $k[1], $k[$i], $k[$size], $k[$i]); 790 pixbuf_rect $pixbuf, $k[1] - $linew, $k[$i] - $linew, $k[$size] + $linew, $k[$i] + $linew;
753 791
754 center_text $pixmap, $font, $gc, $k[$i], ($ofs +$border) / 2, $a; 792 pixbuf_text $pixbuf, 0, $k[$i], ($ofs +$border) / 2, $ofs, $a;
755 center_text $pixmap, $font, $gc, $k[$i], $s2 + $border + $ofs / 2, $a; 793 pixbuf_text $pixbuf, 0, $k[$i], $s2 + $border + $ofs / 2, $ofs, $a;
756 center_text $pixmap, $font, $gc, ($ofs + $border) / 2, $k[$i], $i; 794 pixbuf_text $pixbuf, 0, ($ofs + $border) / 2, $k[$i], $ofs, $size - $i + 1;
757 center_text $pixmap, $font, $gc, $s2 + $border + $ofs / 2, $k[$i], $i; 795 pixbuf_text $pixbuf, 0, $s2 + $border + $ofs / 2, $k[$i], $ofs, $size - $i + 1;
758 796
759 $a++; 797 $a++;
760 $a++ if $a eq "I"; # not correct, instead of AA AB, we should get HH JJ KK... 798 $a++ if $a eq "I"; # not correct, instead of AA AB, we should get HH JJ KK...
799 }
800
801 unless ($::config->{conserve_memory}) {
802 $self->{background} = $pixbuf;
803 $pixbuf = $pixbuf->copy;
804 }
761 } 805 }
806
807 $self->{pixbuf} = $pixbuf;
762 808
763 # hoshi-points(!)#d# 809 # hoshi-points(!)#d#
764 # caching of empty board gfx(!)#d# 810 # caching of empty board gfx(!)#d#
765 811
766 if ($self->{board}) { 812 for my $x (1 .. $size) {
767 for my $x (1 .. $size) { 813 for my $y (1 .. $size) {
768 for my $y (1 .. $size) {
769 my $yk = $s2 * $x / $size - $ofs + $border;
770 my $mark = $self->{board}{board}[$x-1][$y-1]; 814 my $mark = $self->{board}{board}[$x-1][$y-1];
771 815
772 if ($mark) { 816 if ($mark) {
773 my ($dx, $dy) = ($k[$x] - $ofs, $k[$y] - $ofs); 817 my ($dx, $dy) = ($k[$x] - $ofs, $k[$y] - $ofs);
818 my $pb = $self->create_stack($mark, $edge, $x * 17 + $y * 11 );
819
820 $pb->composite ($pixbuf, $dx, $dy, $pb->get_width, $pb->get_height,
821 $dx, $dy, 1, 1, $::config{speed} ? INTERP_NEAREST : INTERP_NEAREST, 255);
822
774 my ($pm, $bm) = $self->create_stack($gc, $mark, $edge); 823 #my ($pm, $bm) = $self->create_stack($gc, $mark, $edge, $x * 17 + $y * 11 );
775 824
776 $gc->set_clip_mask ($bm); 825 #$gc->set_clip_mask ($bm);
777 $gc->set_clip_origin ($dx, $dy); 826 #$gc->set_clip_origin ($dx, $dy);
778 $pixmap->draw_pixmap ($gc, $pm, 0, 0, $dx, $dy, $edge, $edge); 827 #$pixmap->draw_pixmap ($gc, $pm, 0, 0, $dx, $dy, $edge, $edge);
779 }
780 } 828 }
781 } 829 }
782 } 830 }
831}
832
833sub expose_event {
834 my ($widget, $self, $event) = @_;
835
836 $self->{pixbuf} or return;
837
838 my ($ox, $oy, $s) = @{$self->{offsets}};
839
840 my ($x, $y, $w, $h) =
841 @{Gtk::Gdk::Rectangle->intersect(
842 $event->{area},
843 [$ox, $oy, $s, $s]
844 )};
845
846 if (defined $x) {
847 $self->{pixbuf}->render_to_drawable ($self->{canvas}->window, $self->{canvas}->style->white_gc,
848 $x - $ox, $y - $oy, $x, $y, $w, $h);
849 #$self->{canvas}->window->draw_pixmap (
850 # $self->{canvas}->style->white_gc,
851 # $self->{pixmap},
852 # $x - $ox, $y - $oy, $x, $y, $w, $h,
853 #);
854 }
855 1;
783} 856}
784 857
785sub event_update_tree { 858sub event_update_tree {
786 my ($self) = @_; 859 my ($self) = @_;
787 860
792 865
793 # force a redraw (not perfect(?)) 866 # force a redraw (not perfect(?))
794 expose_event $self->{canvas}, $self, { area => $self->{canvas}->allocation }; 867 expose_event $self->{canvas}, $self, { area => $self->{canvas}->allocation };
795 868
796 $self->{text}->backward_delete($self->{text}->get_length); 869 $self->{text}->backward_delete($self->{text}->get_length);
797 $self->{text}->insert(undef, undef, undef, $self->{board}{comment}.PApp::Util::dumpval([$self->{board}{time},$self->{board}{captures}])); 870 $self->{text}->insert(undef, undef, undef, KGS::Listener::Debug::dumpval([$self->{board}{time},$self->{board}{captures}]). $self->{board}{comment});
871}
872
873sub event_move {
874 ::play_sound "move";
798} 875}
799 876
8001; 8771;
801 878
802 879

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines