… | |
… | |
112 | $self |
112 | $self |
113 | } |
113 | } |
114 | |
114 | |
115 | sub move { |
115 | sub move { |
116 | my ($self, $x, $y, $z) = @_; |
116 | my ($self, $x, $y, $z) = @_; |
|
|
117 | |
117 | $self->{x} = int $x; |
118 | $self->{x} = int $x; |
118 | $self->{y} = int $y; |
119 | $self->{y} = int $y; |
119 | $self->{z} = $z if defined $z; |
120 | $self->{z} = $z if defined $z; |
|
|
121 | |
|
|
122 | $self->update; |
120 | } |
123 | } |
121 | |
124 | |
122 | sub needs_redraw { |
125 | sub needs_redraw { |
123 | 0 |
126 | 0 |
124 | } |
127 | } |
… | |
… | |
126 | sub size_request { |
129 | sub size_request { |
127 | require Carp; |
130 | require Carp; |
128 | Carp::confess "size_request is abtract"; |
131 | Carp::confess "size_request is abtract"; |
129 | } |
132 | } |
130 | |
133 | |
131 | sub _size_allocate { |
134 | sub configure { |
132 | my ($self, $x, $y, $w, $h) = @_; |
135 | my ($self, $x, $y, $w, $h) = @_; |
133 | |
136 | |
134 | $self->{x} = $x; |
137 | $self->{x} = $x; |
135 | $self->{y} = $y; |
138 | $self->{y} = $y; |
136 | |
139 | |
137 | return unless $self->{w} != $w || $self->{h} != $h; |
140 | return unless $self->{w} != $w || $self->{h} != $h; |
138 | |
141 | |
139 | $self->{w} = $w; |
142 | $self->{w} = $w; |
140 | $self->{h} = $h; |
143 | $self->{h} = $h; |
141 | |
144 | |
142 | 1 |
145 | $self->size_allocate ($w, $h); |
143 | } |
146 | } |
144 | |
147 | |
145 | sub size_allocate { |
148 | sub size_allocate { |
146 | my ($self, $x, $y, $w, $h) = @_; |
149 | # nothing to be done |
147 | |
|
|
148 | $self->_size_allocate ($x, $y, $w, $h); |
|
|
149 | } |
150 | } |
150 | |
151 | |
151 | # return top left coordinates |
152 | # return top left coordinates |
152 | sub _topleft { |
153 | sub _topleft { |
153 | my ($self, $x, $y) = @_; |
154 | my ($self, $x, $y) = @_; |
… | |
… | |
225 | glPopMatrix; |
226 | glPopMatrix; |
226 | |
227 | |
227 | if ($self == $HOVER && $self->{can_hover}) { |
228 | if ($self == $HOVER && $self->{can_hover}) { |
228 | my ($x, $y) = @$self{qw(x y)}; |
229 | my ($x, $y) = @$self{qw(x y)}; |
229 | |
230 | |
230 | glColor 0, 0, 1, 0.2; |
231 | glColor 1, 0.8, 0.5, 0.2; |
231 | glEnable GL_BLEND; |
232 | glEnable GL_BLEND; |
232 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
233 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
233 | glBegin GL_QUADS; |
234 | glBegin GL_QUADS; |
234 | glVertex $x , $y; |
235 | glVertex $x , $y; |
235 | glVertex $x + $self->{w}, $y; |
236 | glVertex $x + $self->{w}, $y; |
… | |
… | |
260 | my ($self, $parent) = @_; |
261 | my ($self, $parent) = @_; |
261 | |
262 | |
262 | Scalar::Util::weaken ($self->{parent} = $parent); |
263 | Scalar::Util::weaken ($self->{parent} = $parent); |
263 | } |
264 | } |
264 | |
265 | |
|
|
266 | sub check_size { |
|
|
267 | my ($self) = @_; |
|
|
268 | |
|
|
269 | my ($w, $h) = $self->size_request; |
|
|
270 | |
|
|
271 | if ($w != $self->{req_w} || $h != $self->{req_h}) { |
|
|
272 | $self->{req_w} = $w; |
|
|
273 | $self->{req_h} = $h; |
|
|
274 | |
|
|
275 | $self->{parent}->check_size |
|
|
276 | if $self->{parent}; |
|
|
277 | |
|
|
278 | $self->size_allocate ($w, $h); |
|
|
279 | $self->update; |
|
|
280 | } |
|
|
281 | } |
|
|
282 | |
265 | sub update { |
283 | sub update { |
266 | my ($self) = @_; |
284 | my ($self) = @_; |
267 | |
285 | |
268 | $self->{parent}->update |
286 | $self->{parent}->update |
269 | if $self->{parent}; |
287 | if $self->{parent}; |
270 | } |
288 | } |
271 | |
289 | |
272 | sub connect { |
290 | sub connect { |
273 | my ($self, $signal, $cb) = @_; |
291 | my ($self, $signal, $cb) = @_; |
274 | |
292 | |
275 | push @{ $self->{cb}{$signal} }, $cb; |
293 | push @{ $self->{signal_cb}{$signal} }, $cb; |
276 | } |
294 | } |
277 | |
295 | |
278 | sub emit { |
296 | sub emit { |
279 | my ($self, $signal, @args) = @_; |
297 | my ($self, $signal, @args) = @_; |
280 | |
298 | |
|
|
299 | for my $cb (@{$self->{signal_cb}{$signal} || []}) { |
281 | $_->($self, @args) |
300 | $cb->($self, @args); |
282 | for @{$self->{cb}{$signal} || []}; |
301 | } |
283 | } |
302 | } |
284 | |
303 | |
285 | sub DESTROY { |
304 | sub DESTROY { |
286 | my ($self) = @_; |
305 | my ($self) = @_; |
287 | |
306 | |
… | |
… | |
368 | sort { $a->{z} <=> $b->{z} } |
387 | sort { $a->{z} <=> $b->{z} } |
369 | @{$self->{children}}, $child |
388 | @{$self->{children}}, $child |
370 | ]; |
389 | ]; |
371 | |
390 | |
372 | $self->{w} = $self->{h} = -1; |
391 | $self->{w} = $self->{h} = -1; |
373 | $self->update; |
392 | |
|
|
393 | $child->check_size; |
374 | } |
394 | } |
375 | |
395 | |
376 | sub remove { |
396 | sub remove { |
377 | my ($self, $widget) = @_; |
397 | my ($self, $widget) = @_; |
378 | |
398 | |
379 | $self->{children} = [ grep $_ != $widget, @{ $self->{children} } ]; |
399 | $self->{children} = [ grep $_ != $widget, @{ $self->{children} } ]; |
380 | |
400 | |
381 | $self->size_allocate (0, 0, $self->{w}, $self->{h}); |
401 | $self->check_size; |
382 | } |
402 | } |
383 | |
403 | |
384 | sub find_widget { |
404 | sub find_widget { |
385 | my ($self, $x, $y) = @_; |
405 | my ($self, $x, $y) = @_; |
386 | |
406 | |
… | |
… | |
439 | sub size_request { |
459 | sub size_request { |
440 | $_[0]{children}[0]->size_request |
460 | $_[0]{children}[0]->size_request |
441 | } |
461 | } |
442 | |
462 | |
443 | sub size_allocate { |
463 | sub size_allocate { |
444 | my ($self, $x, $y, $w, $h) = @_; |
464 | my ($self, $w, $h) = @_; |
445 | |
465 | |
446 | $self->_size_allocate ($x, $y, $w, $h) or return; |
|
|
447 | |
|
|
448 | $self->{children}[0]->size_allocate (0, 0, $w, $h); |
466 | $self->{children}[0]->configure (0, 0, $w, $h); |
449 | } |
467 | } |
450 | |
468 | |
451 | ############################################################################# |
469 | ############################################################################# |
452 | |
470 | |
453 | package CFClient::UI::Window; |
471 | package CFClient::UI::Window; |
… | |
… | |
479 | $self->child->draw; |
497 | $self->child->draw; |
480 | }; |
498 | }; |
481 | } |
499 | } |
482 | |
500 | |
483 | sub size_allocate { |
501 | sub size_allocate { |
484 | my ($self, $x, $y, $w, $h) = @_; |
502 | my ($self, $w, $h) = @_; |
485 | |
503 | |
486 | $self->_size_allocate ($x, $y, $w, $h) or return; |
|
|
487 | |
|
|
488 | $self->child->size_allocate (0, 0, $w, $h); |
504 | $self->child->configure (0, 0, $w, $h); |
489 | |
505 | |
490 | $self->render_chld; |
506 | $self->render_chld; |
491 | } |
507 | } |
492 | |
508 | |
493 | sub _draw { |
509 | sub _draw { |
… | |
… | |
509 | glDisable GL_TEXTURE_2D; |
525 | glDisable GL_TEXTURE_2D; |
510 | } |
526 | } |
511 | |
527 | |
512 | ############################################################################# |
528 | ############################################################################# |
513 | |
529 | |
|
|
530 | package CFClient::UI::ViewPort; |
|
|
531 | |
|
|
532 | our @ISA = CFClient::UI::Window::; |
|
|
533 | |
|
|
534 | sub new { die } |
|
|
535 | |
|
|
536 | sub size_request { |
|
|
537 | my ($self) = @_; |
|
|
538 | |
|
|
539 | @$self{qw(child_w child_h)} = $self->child->size_request; |
|
|
540 | $self->child->size_allocate (0, 0, @$self{qw(child_w child_h)}); |
|
|
541 | |
|
|
542 | @$self{qw(child_w child_h)} |
|
|
543 | } |
|
|
544 | |
|
|
545 | sub _draw { |
|
|
546 | my ($self) = @_; |
|
|
547 | |
|
|
548 | $self->{children}[1]->draw; |
|
|
549 | } |
|
|
550 | |
|
|
551 | |
|
|
552 | ############################################################################# |
|
|
553 | |
514 | package CFClient::UI::Frame; |
554 | package CFClient::UI::Frame; |
515 | |
555 | |
516 | our @ISA = CFClient::UI::Bin::; |
556 | our @ISA = CFClient::UI::Bin::; |
517 | |
557 | |
518 | use SDL::OpenGL; |
558 | use SDL::OpenGL; |
… | |
… | |
528 | } |
568 | } |
529 | |
569 | |
530 | sub size_allocate { |
570 | sub size_allocate { |
531 | my ($self, $x, $y, $w, $h) = @_; |
571 | my ($self, $x, $y, $w, $h) = @_; |
532 | |
572 | |
533 | $self->_size_allocate ($x, $y, $w, $h) or return; |
|
|
534 | |
|
|
535 | $self->child->size_allocate (2, 2, $w - 4, $h - 4); |
573 | $self->child->configure (2, 2, $w - 4, $h - 4); |
536 | } |
574 | } |
537 | |
575 | |
538 | sub _draw { |
576 | sub _draw { |
539 | my ($self) = @_; |
577 | my ($self) = @_; |
540 | |
578 | |
… | |
… | |
590 | $h + $self->{border} * 2, |
628 | $h + $self->{border} * 2, |
591 | ) |
629 | ) |
592 | } |
630 | } |
593 | |
631 | |
594 | sub size_allocate { |
632 | sub size_allocate { |
595 | my ($self, $x, $y, $w, $h) = @_; |
633 | my ($self, $w, $h) = @_; |
596 | |
|
|
597 | $self->_size_allocate ($x, $y, $w, $h) or return; |
|
|
598 | |
634 | |
599 | $h -= List::Util::max 0, $self->{border} * 2; |
635 | $h -= List::Util::max 0, $self->{border} * 2; |
600 | $w -= List::Util::max 0, $self->{border} * 2; |
636 | $w -= List::Util::max 0, $self->{border} * 2; |
601 | |
637 | |
602 | $self->child->size_allocate ($self->{border}, $self->{border}, $w, $h); |
638 | $self->child->configure ($self->{border}, $self->{border}, $w, $h); |
603 | } |
639 | } |
604 | |
640 | |
605 | sub button_down { |
641 | sub button_down { |
606 | my ($self, $ev, $x, $y) = @_; |
642 | my ($self, $ev, $x, $y) = @_; |
607 | |
643 | |
… | |
… | |
616 | |
652 | |
617 | ($x, $y) = ($ev->motion_x, $ev->motion_y); |
653 | ($x, $y) = ($ev->motion_x, $ev->motion_y); |
618 | |
654 | |
619 | $self->{user_w} = $bw + $x - $ox; |
655 | $self->{user_w} = $bw + $x - $ox; |
620 | $self->{user_h} = $bh + $y - $oy; |
656 | $self->{user_h} = $bh + $y - $oy; |
621 | $self->update; |
657 | $self->check_size; |
622 | }; |
658 | }; |
623 | |
659 | |
624 | } elsif ($x >= 0 && $x < $self->{w} |
660 | } elsif ($x >= 0 && $x < $self->{w} |
625 | && $y >= 0 && $y < $self->{border}) { |
661 | && $y >= 0 && $y < $self->{border}) { |
626 | |
662 | |
… | |
… | |
710 | |
746 | |
711 | $child->set_parent ($self); |
747 | $child->set_parent ($self); |
712 | $self->{children}[$y][$x] = $child; |
748 | $self->{children}[$y][$x] = $child; |
713 | |
749 | |
714 | $self->{w} = $self->{h} = -1; |
750 | $self->{w} = $self->{h} = -1; |
715 | $self->update; |
751 | |
|
|
752 | $child->check_size; |
716 | } |
753 | } |
717 | |
754 | |
718 | # TODO: move to container class maybe? send childs a signal on removal? |
755 | # TODO: move to container class maybe? send childs a signal on removal? |
719 | sub clear { |
756 | sub clear { |
720 | my ($self) = @_; |
757 | my ($self) = @_; |
… | |
… | |
755 | (sum @$hs), |
792 | (sum @$hs), |
756 | ) |
793 | ) |
757 | } |
794 | } |
758 | |
795 | |
759 | sub size_allocate { |
796 | sub size_allocate { |
760 | my ($self, $x, $y, $w, $h) = @_; |
797 | my ($self, $w, $h) = @_; |
761 | |
|
|
762 | $self->_size_allocate ($x, $y, $w, $h) or return; |
|
|
763 | |
798 | |
764 | my ($ws, $hs) = $self->get_wh; |
799 | my ($ws, $hs) = $self->get_wh; |
765 | |
800 | |
766 | my $req_w = sum @$ws; |
801 | my $req_w = sum @$ws; |
767 | my $req_h = sum @$hs; |
802 | my $req_h = sum @$hs; |
… | |
… | |
789 | |
824 | |
790 | for my $c (0 .. $#$row) { |
825 | for my $c (0 .. $#$row) { |
791 | my $col_w = $ws->[$c]; |
826 | my $col_w = $ws->[$c]; |
792 | |
827 | |
793 | if (my $widget = $row->[$c]) { |
828 | if (my $widget = $row->[$c]) { |
794 | $widget->size_allocate ($x, $y, $col_w, $row_h); |
829 | $widget->configure ($x, $y, $col_w, $row_h); |
795 | } |
830 | } |
796 | |
831 | |
797 | $x += $col_w; |
832 | $x += $col_w; |
798 | } |
833 | } |
799 | |
834 | |
… | |
… | |
844 | (List::Util::max map $_->[1], @alloc), |
879 | (List::Util::max map $_->[1], @alloc), |
845 | ) |
880 | ) |
846 | } |
881 | } |
847 | |
882 | |
848 | sub size_allocate { |
883 | sub size_allocate { |
849 | my ($self, $x, $y, $w, $h) = @_; |
884 | my ($self, $w, $h) = @_; |
850 | |
|
|
851 | $self->_size_allocate ($x, $y, $w, $h); |
|
|
852 | |
885 | |
853 | ($h, $w) = ($w, $h); |
886 | ($h, $w) = ($w, $h); |
854 | |
887 | |
855 | my $children = $self->{children}; |
888 | my $children = $self->{children}; |
856 | |
889 | |
… | |
… | |
878 | |
911 | |
879 | my $y = 0; |
912 | my $y = 0; |
880 | for (0 .. $#$children) { |
913 | for (0 .. $#$children) { |
881 | my $child = $children->[$_]; |
914 | my $child = $children->[$_]; |
882 | my $h = $h[$_]; |
915 | my $h = $h[$_]; |
883 | $child->size_allocate ($y, 0, $h, $w); |
916 | $child->configure ($y, 0, $h, $w); |
884 | |
917 | |
885 | $y += $h; |
918 | $y += $h; |
886 | } |
919 | } |
|
|
920 | |
|
|
921 | 1 |
887 | } |
922 | } |
888 | |
923 | |
889 | ############################################################################# |
924 | ############################################################################# |
890 | |
925 | |
891 | package CFClient::UI::VBox; |
926 | package CFClient::UI::VBox; |
… | |
… | |
904 | (List::Util::sum map $_->[1], @alloc), |
939 | (List::Util::sum map $_->[1], @alloc), |
905 | ) |
940 | ) |
906 | } |
941 | } |
907 | |
942 | |
908 | sub size_allocate { |
943 | sub size_allocate { |
909 | my ($self, $x, $y, $w, $h) = @_; |
944 | my ($self, $w, $h) = @_; |
910 | |
|
|
911 | $self->_size_allocate ($x, $y, $w, $h); |
|
|
912 | |
945 | |
913 | my $children = $self->{children}; |
946 | my $children = $self->{children}; |
914 | |
947 | |
915 | my @h = map +($_->size_request)[1], @$children; |
948 | my @h = map +($_->size_request)[1], @$children; |
916 | |
949 | |
… | |
… | |
934 | |
967 | |
935 | my $y = 0; |
968 | my $y = 0; |
936 | for (0 .. $#$children) { |
969 | for (0 .. $#$children) { |
937 | my $child = $children->[$_]; |
970 | my $child = $children->[$_]; |
938 | my $h = $h[$_]; |
971 | my $h = $h[$_]; |
939 | $child->size_allocate (0, $y, $w, $h); |
972 | $child->configure (0, $y, $w, $h); |
940 | |
973 | |
941 | $y += $h; |
974 | $y += $h; |
942 | } |
975 | } |
|
|
976 | |
|
|
977 | 1 |
943 | } |
978 | } |
944 | |
979 | |
945 | ############################################################################# |
980 | ############################################################################# |
946 | |
981 | |
947 | package CFClient::UI::Label; |
982 | package CFClient::UI::Label; |
… | |
… | |
962 | padding => 2, |
997 | padding => 2, |
963 | layout => new CFClient::Layout, |
998 | layout => new CFClient::Layout, |
964 | %arg |
999 | %arg |
965 | ); |
1000 | ); |
966 | |
1001 | |
967 | $self->set_text ($self->{text}); |
1002 | $self->{xxx}++ if $self->{text} eq "Client Setup" && $self->{align};#d# |
|
|
1003 | |
|
|
1004 | $self->set_text (delete $self->{text}) if exists $self->{text}; |
|
|
1005 | $self->set_markup (delete $self->{markup}) if exists $self->{markup}; |
968 | |
1006 | |
969 | $self |
1007 | $self |
970 | } |
1008 | } |
971 | |
1009 | |
972 | sub escape_text { |
1010 | sub escape_text { |
… | |
… | |
980 | } |
1018 | } |
981 | |
1019 | |
982 | sub set_text { |
1020 | sub set_text { |
983 | my ($self, $text) = @_; |
1021 | my ($self, $text) = @_; |
984 | |
1022 | |
985 | $self->{text} = $text; |
|
|
986 | $self->{layout}->set_markup ($text); |
1023 | $self->{layout}->set_text ($text); |
987 | |
1024 | |
988 | delete $self->{texture}; |
1025 | delete $self->{texture}; |
989 | # $self->{w} = $self->{h} = -1; |
|
|
990 | $self->update; |
1026 | $self->update; |
991 | } |
1027 | } |
992 | |
1028 | |
993 | sub get_text { |
1029 | sub set_markup { |
994 | my ($self, $text) = @_; |
1030 | my ($self, $markup) = @_; |
995 | |
1031 | |
996 | $self->{text} |
1032 | $self->{layout}->set_markup ($markup); |
|
|
1033 | |
|
|
1034 | delete $self->{texture}; |
|
|
1035 | $self->update; |
997 | } |
1036 | } |
998 | |
1037 | |
999 | sub size_request { |
1038 | sub size_request { |
1000 | my ($self) = @_; |
1039 | my ($self) = @_; |
1001 | |
1040 | |
1002 | $self->{layout}->set_width; |
1041 | $self->{layout}->set_width; |
1003 | $self->{layout}->set_height ($self->{fontsize}); |
1042 | $self->{layout}->set_height ($self->{fontsize}); |
|
|
1043 | |
1004 | my ($w, $h) = $self->{layout}->size; |
1044 | my ($w, $h) = $self->{layout}->size; |
1005 | |
1045 | |
1006 | ( |
1046 | ( |
1007 | $w + $self->{padding} * 2, |
1047 | $w + $self->{padding} * 2, |
1008 | $h + $self->{padding} * 2, |
1048 | $h + $self->{padding} * 2, |
1009 | ) |
1049 | ) |
1010 | } |
1050 | } |
1011 | |
1051 | |
1012 | sub size_allocate { |
1052 | sub size_allocate { |
1013 | my ($self, $x, $y, $w, $h) = @_; |
1053 | my ($self, $w, $h) = @_; |
1014 | |
|
|
1015 | $self->_size_allocate ($x, $y, $w, $h) or return; |
|
|
1016 | |
1054 | |
1017 | delete $self->{texture}; |
1055 | delete $self->{texture}; |
1018 | } |
1056 | } |
1019 | |
1057 | |
1020 | sub update { |
1058 | sub update { |
… | |
… | |
1027 | sub _draw { |
1065 | sub _draw { |
1028 | my ($self) = @_; |
1066 | my ($self) = @_; |
1029 | |
1067 | |
1030 | my $tex = $self->{texture} ||= do { |
1068 | my $tex = $self->{texture} ||= do { |
1031 | $self->{layout}->set_width ($self->{w}); |
1069 | $self->{layout}->set_width ($self->{w}); |
1032 | $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{fontsize}); |
1070 | $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize}); |
1033 | new_from_layout CFClient::Texture $self->{layout} |
1071 | new_from_layout CFClient::Texture $self->{layout} |
1034 | }; |
1072 | }; |
1035 | |
1073 | |
1036 | glEnable GL_BLEND; |
1074 | glEnable GL_BLEND; |
1037 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1075 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
1038 | glEnable GL_TEXTURE_2D; |
1076 | glEnable GL_TEXTURE_2D; |
1039 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1077 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
1040 | |
1078 | |
1041 | glColor @{$self->{fg}}; |
1079 | glColor @{$self->{fg}}; |
1042 | |
1080 | |
1043 | my $x = |
1081 | $self->{ox} = int ( |
1044 | $self->{align} < 0 ? $self->{padding} |
1082 | $self->{align} < 0 ? $self->{padding} |
1045 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1083 | : $self->{align} > 0 ? $self->{w} - $tex->{w} - $self->{padding} |
1046 | : ($self->{w} - $tex->{w}) * 0.5; |
1084 | : ($self->{w} - $tex->{w}) * 0.5 |
|
|
1085 | ); |
1047 | |
1086 | |
1048 | my $y = |
1087 | $self->{oy} = int ( |
1049 | $self->{valign} < 0 ? $self->{padding} |
1088 | $self->{valign} < 0 ? $self->{padding} |
1050 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} |
1089 | : $self->{valign} > 0 ? $self->{h} - $tex->{h} - $self->{padding} |
1051 | : ($self->{h} - $tex->{h}) * 0.5; |
1090 | : ($self->{h} - $tex->{h}) * 0.5 |
|
|
1091 | ); |
1052 | |
1092 | |
1053 | $tex->draw_quad (int $x, int $y); |
1093 | $tex->draw_quad ($self->{ox}, $self->{oy}); |
1054 | |
1094 | |
1055 | glDisable GL_TEXTURE_2D; |
1095 | glDisable GL_TEXTURE_2D; |
1056 | glDisable GL_BLEND; |
1096 | glDisable GL_BLEND; |
1057 | } |
1097 | } |
1058 | |
1098 | |
1059 | ############################################################################# |
1099 | ############################################################################# |
1060 | |
1100 | |
1061 | package CFClient::UI::Entry; |
1101 | package CFClient::UI::EntryBase; |
1062 | |
1102 | |
1063 | our @ISA = CFClient::UI::Label::; |
1103 | our @ISA = CFClient::UI::Label::; |
1064 | |
1104 | |
1065 | use SDL; |
1105 | use SDL; |
1066 | use SDL::OpenGL; |
1106 | use SDL::OpenGL; |
… | |
… | |
1081 | } |
1121 | } |
1082 | |
1122 | |
1083 | sub _set_text { |
1123 | sub _set_text { |
1084 | my ($self, $text) = @_; |
1124 | my ($self, $text) = @_; |
1085 | |
1125 | |
1086 | my $old_text = $self->{text}; |
1126 | delete $self->{cur_h}; |
|
|
1127 | |
|
|
1128 | return if $self->{text} eq $text; |
1087 | |
1129 | |
1088 | $self->{last_activity} = $::NOW; |
1130 | $self->{last_activity} = $::NOW; |
1089 | |
|
|
1090 | $self->{text} = $text; |
1131 | $self->{text} = $text; |
1091 | $self->{layout}->set_width ($self->{w}); |
|
|
1092 | $self->{layout}->set_height (List::Util::min $self->{h} - $self->{padding} * 2, $self->{fontsize}); |
|
|
1093 | |
1132 | |
1094 | $text =~ s/./*/g if $self->{hidden}; |
1133 | $text =~ s/./*/g if $self->{hidden}; |
|
|
1134 | $self->{layout}->set_text ("$text "); |
1095 | |
1135 | |
1096 | $self->{layout}->set_markup ($self->escape_text ($text) . " "); |
1136 | $self->emit (changed => $self->{text}); |
|
|
1137 | } |
1097 | |
1138 | |
1098 | $text = substr $text, 0, $self->{cursor}; |
1139 | sub get_text { |
1099 | utf8::encode $text; |
1140 | $_[0]{text} |
1100 | |
|
|
1101 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text); |
|
|
1102 | |
|
|
1103 | $self->emit (changed => $self->{text}) # XXX: is this the right place to do this? |
|
|
1104 | if $old_text ne $self->{text}; |
|
|
1105 | } |
1141 | } |
1106 | |
1142 | |
1107 | sub size_request { |
1143 | sub size_request { |
1108 | my ($self) = @_; |
1144 | my ($self) = @_; |
1109 | |
1145 | |
… | |
… | |
1111 | |
1147 | |
1112 | ($w + 1, $h) # add 1 for cursor |
1148 | ($w + 1, $h) # add 1 for cursor |
1113 | } |
1149 | } |
1114 | |
1150 | |
1115 | sub size_allocate { |
1151 | sub size_allocate { |
1116 | my ($self, $x, $y, $w, $h) = @_; |
1152 | my ($self, $w, $h) = @_; |
1117 | |
|
|
1118 | $self->SUPER::size_allocate ($x, $y, $w, $h); |
|
|
1119 | |
1153 | |
1120 | $self->_set_text ($self->{text}); |
1154 | $self->_set_text ($self->{text}); |
1121 | } |
1155 | } |
1122 | |
1156 | |
1123 | sub set_text { |
1157 | sub set_text { |
… | |
… | |
1213 | |
1247 | |
1214 | $self->SUPER::_draw; |
1248 | $self->SUPER::_draw; |
1215 | |
1249 | |
1216 | #TODO: force update every cursor change :( |
1250 | #TODO: force update every cursor change :( |
1217 | if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) { |
1251 | if ($FOCUS == $self && (($::NOW - $self->{last_activity}) & 1023) < 600) { |
|
|
1252 | |
|
|
1253 | unless (exists $self->{cur_h}) { |
|
|
1254 | my $text = substr $self->{text}, 0, $self->{cursor}; |
|
|
1255 | utf8::encode $text; |
|
|
1256 | |
|
|
1257 | @$self{qw(cur_x cur_y cur_h)} = $self->{layout}->cursor_pos (length $text) |
|
|
1258 | } |
|
|
1259 | |
1218 | glColor @{$self->{fg}}; |
1260 | glColor @{$self->{fg}}; |
1219 | glBegin GL_LINES; |
1261 | glBegin GL_LINES; |
1220 | glVertex $self->{cur_x}, $self->{cur_y}; |
|
|
1221 | glVertex $self->{cur_x}, $self->{cur_y} + $self->{cur_h}; |
1262 | glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy}; |
|
|
1263 | glVertex $self->{cur_x} + $self->{ox}, $self->{cur_y} + $self->{oy} + $self->{cur_h}; |
1222 | glEnd; |
1264 | glEnd; |
1223 | } |
1265 | } |
1224 | } |
1266 | } |
1225 | |
1267 | |
1226 | package CFClient::UI::LineEntry; |
1268 | package CFClient::UI::Entry; |
1227 | |
1269 | |
1228 | our @ISA = CFClient::UI::Entry::; |
1270 | our @ISA = CFClient::UI::EntryBase::; |
1229 | |
1271 | |
1230 | use SDL; |
1272 | use SDL; |
1231 | use SDL::OpenGL; |
1273 | use SDL::OpenGL; |
1232 | |
1274 | |
1233 | sub key_down { |
1275 | sub key_down { |
… | |
… | |
1263 | |
1305 | |
1264 | $class->SUPER::new ( |
1306 | $class->SUPER::new ( |
1265 | padding => 4, |
1307 | padding => 4, |
1266 | fg => [1, 1, 1], |
1308 | fg => [1, 1, 1], |
1267 | bg => [1, 1, 1, 0.2], |
1309 | bg => [1, 1, 1, 0.2], |
1268 | active_fg => [1, 1, 0], |
1310 | active_fg => [0, 0, 1], |
1269 | can_hover => 1, |
1311 | can_hover => 1, |
|
|
1312 | align => 0, |
|
|
1313 | valign => 0, |
1270 | @_ |
1314 | @_ |
1271 | ) |
1315 | ) |
1272 | } |
1316 | } |
1273 | |
1317 | |
1274 | sub button_up { |
1318 | sub button_up { |
… | |
… | |
1333 | my ($self) = @_; |
1377 | my ($self) = @_; |
1334 | |
1378 | |
1335 | ($self->{padding} * 2 + 6) x 2 |
1379 | ($self->{padding} * 2 + 6) x 2 |
1336 | } |
1380 | } |
1337 | |
1381 | |
1338 | sub size_allocate { |
|
|
1339 | my ($self, $x, $y, $w, $h) = @_; |
|
|
1340 | |
|
|
1341 | $self->_size_allocate ($x, $y, $w, $h); |
|
|
1342 | } |
|
|
1343 | |
|
|
1344 | sub button_down { |
1382 | sub button_down { |
1345 | my ($self, $ev, $x, $y) = @_; |
1383 | my ($self, $ev, $x, $y) = @_; |
1346 | |
1384 | |
1347 | if ($x >= $self->{padding} && $x < $self->{w} - $self->{padding} |
1385 | if ($x >= $self->{padding} && $x < $self->{w} - $self->{padding} |
1348 | && $y >= $self->{padding} && $y < $self->{h} - $self->{padding}) { |
1386 | && $y >= $self->{padding} && $y < $self->{h} - $self->{padding}) { |
… | |
… | |
1370 | |
1408 | |
1371 | $tex->draw_quad (0, 0, $s, $s); |
1409 | $tex->draw_quad (0, 0, $s, $s); |
1372 | |
1410 | |
1373 | glDisable GL_TEXTURE_2D; |
1411 | glDisable GL_TEXTURE_2D; |
1374 | glDisable GL_BLEND; |
1412 | glDisable GL_BLEND; |
|
|
1413 | } |
|
|
1414 | |
|
|
1415 | ############################################################################# |
|
|
1416 | |
|
|
1417 | package CFClient::UI::VGauge; |
|
|
1418 | |
|
|
1419 | our @ISA = CFClient::UI::Base::; |
|
|
1420 | |
|
|
1421 | use SDL::OpenGL; |
|
|
1422 | |
|
|
1423 | my %tex = ( |
|
|
1424 | food => [ |
|
|
1425 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } |
|
|
1426 | qw/g1_food_gauge_empty.png g1_food_gauge_full.png/ |
|
|
1427 | ], |
|
|
1428 | grace => [ |
|
|
1429 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } |
|
|
1430 | qw/g1_grace_gauge_empty.png g1_grace_gauge_full.png/ |
|
|
1431 | ], |
|
|
1432 | hp => [ |
|
|
1433 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } |
|
|
1434 | qw/g1_hp_gauge_empty.png g1_hp_gauge_full.png/ |
|
|
1435 | ], |
|
|
1436 | mana => [ |
|
|
1437 | map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } |
|
|
1438 | qw/g1_mana_gauge_empty.png g1_mana_gauge_full.png/ |
|
|
1439 | ], |
|
|
1440 | ); |
|
|
1441 | |
|
|
1442 | # eg. VGauge->new (gauge => 'food'), default gauge: food |
|
|
1443 | sub new { |
|
|
1444 | my $class = shift; |
|
|
1445 | |
|
|
1446 | my $self = $class->SUPER::new (gauge => 'food', @_); |
|
|
1447 | |
|
|
1448 | $self |
|
|
1449 | } |
|
|
1450 | |
|
|
1451 | sub size_request { |
|
|
1452 | my ($self) = @_; |
|
|
1453 | |
|
|
1454 | my $tex = $tex{$self->{gauge}}[0]; |
|
|
1455 | |
|
|
1456 | @$tex{qw(w h)} |
|
|
1457 | } |
|
|
1458 | |
|
|
1459 | sub set_max { |
|
|
1460 | my ($self, $max) = @_; |
|
|
1461 | |
|
|
1462 | $self->{max_val} = $max; |
|
|
1463 | } |
|
|
1464 | |
|
|
1465 | sub set_value { |
|
|
1466 | my ($self, $val, $max) = @_; |
|
|
1467 | |
|
|
1468 | $self->set_max ($max) |
|
|
1469 | if defined $max; |
|
|
1470 | |
|
|
1471 | $max = $self->{max_val}; |
|
|
1472 | $self->{val} = $val; |
|
|
1473 | |
|
|
1474 | $self->update; |
|
|
1475 | } |
|
|
1476 | |
|
|
1477 | sub _draw { |
|
|
1478 | my ($self) = @_; |
|
|
1479 | |
|
|
1480 | my $tex = $tex{$self->{gauge}}; |
|
|
1481 | |
|
|
1482 | my ($w, $h) = ($self->{w}, $self->{h}); |
|
|
1483 | |
|
|
1484 | my $ycut = $self->{val} / ($self->{max_val} || 1); |
|
|
1485 | $ycut = 1 if $self->{val} > $self->{max_val}; |
|
|
1486 | |
|
|
1487 | my $t1 = $tex->[0]; |
|
|
1488 | my $t2 = $tex->[1]; |
|
|
1489 | |
|
|
1490 | glEnable GL_BLEND; |
|
|
1491 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
|
|
1492 | glEnable GL_TEXTURE_2D; |
|
|
1493 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; |
|
|
1494 | |
|
|
1495 | my $h1 = $self->{h} - $ycut * $self->{h}; |
|
|
1496 | my $h2 = $ycut * $self->{h}; |
|
|
1497 | |
|
|
1498 | my $yp = 0; |
|
|
1499 | |
|
|
1500 | glBindTexture GL_TEXTURE_2D, $t1->{name}; |
|
|
1501 | glBegin GL_QUADS; |
|
|
1502 | glTexCoord 0 , 0; glVertex 0 , $yp; |
|
|
1503 | glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $yp + $h1; |
|
|
1504 | glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex 0 + $w, $yp + $h1; |
|
|
1505 | glTexCoord $t1->{s}, 0; glVertex 0 + $w, $yp; |
|
|
1506 | glEnd; |
|
|
1507 | |
|
|
1508 | $yp += $h1; |
|
|
1509 | |
|
|
1510 | glBindTexture GL_TEXTURE_2D, $t2->{name}; |
|
|
1511 | glBegin GL_QUADS; |
|
|
1512 | glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $yp; |
|
|
1513 | glTexCoord 0 , $t2->{t}; glVertex 0 , $yp + $h2; |
|
|
1514 | glTexCoord $t2->{s}, $t2->{t}; glVertex 0 + $w, $yp + $h2; |
|
|
1515 | glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex 0 + $w, $yp; |
|
|
1516 | glEnd; |
|
|
1517 | |
|
|
1518 | glDisable GL_BLEND; |
|
|
1519 | glDisable GL_TEXTURE_2D; |
1375 | } |
1520 | } |
1376 | |
1521 | |
1377 | ############################################################################# |
1522 | ############################################################################# |
1378 | |
1523 | |
1379 | package CFClient::UI::Slider; |
1524 | package CFClient::UI::Slider; |
… | |
… | |
1573 | |
1718 | |
1574 | ($self->{req_w}, $self->{req_h}) |
1719 | ($self->{req_w}, $self->{req_h}) |
1575 | } |
1720 | } |
1576 | |
1721 | |
1577 | sub size_allocate { |
1722 | sub size_allocate { |
1578 | my ($self, $x, $y, $w, $h) = @_; |
1723 | my ($self, $w, $h) = @_; |
1579 | |
|
|
1580 | $self->SUPER::size_allocate ($x, $y, $w, $h); |
|
|
1581 | |
1724 | |
1582 | $self->{layout}->set_height ($self->{fontsize}); |
1725 | $self->{layout}->set_height ($self->{fontsize}); |
1583 | $self->{layout}->set_width ($self->{w}); |
1726 | $self->{layout}->set_width ($self->{w}); |
1584 | |
1727 | |
1585 | $self->reflow; |
1728 | $self->reflow; |
|
|
1729 | $self->update; |
1586 | } |
1730 | } |
1587 | |
1731 | |
1588 | sub add_paragraph { |
1732 | sub add_paragraph { |
1589 | my ($self, $color, $text) = @_; |
1733 | my ($self, $color, $text) = @_; |
1590 | |
1734 | |
… | |
… | |
1770 | glTranslate $sx0 - 32, $sy0 - 32, 0; |
1914 | glTranslate $sx0 - 32, $sy0 - 32, 0; |
1771 | |
1915 | |
1772 | my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); |
1916 | my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1); |
1773 | |
1917 | |
1774 | if ($::CFG->{fow_enable}) { |
1918 | if ($::CFG->{fow_enable}) { |
1775 | if ($::CFG->{fow_smooth}) { # smooth fog of war |
1919 | if ($::CFG->{fow_smooth} && $CFClient::GL_VERSION >= 1.2) { # smooth fog of war |
1776 | glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER; |
1920 | glConvolutionParameter (GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER); |
1777 | glConvolutionFilter2D |
1921 | glConvolutionFilter2D ( |
1778 | GL_CONVOLUTION_2D, |
1922 | GL_CONVOLUTION_2D, |
1779 | GL_ALPHA, |
1923 | GL_ALPHA, |
1780 | 3, 3, |
1924 | 3, 3, |
1781 | GL_ALPHA, GL_FLOAT, |
1925 | GL_ALPHA, GL_FLOAT, |
1782 | pack "f*", |
1926 | pack "f*", |
1783 | 0.1, 0.1, 0.1, |
1927 | 0.1, 0.1, 0.1, |
1784 | 0.1, 0.2, 0.1, |
1928 | 0.1, 0.2, 0.1, |
1785 | 0.1, 0.1, 0.1, |
1929 | 0.1, 0.1, 0.1, |
1786 | ; |
1930 | ); |
1787 | glEnable GL_CONVOLUTION_2D; |
1931 | glEnable GL_CONVOLUTION_2D; |
1788 | } |
1932 | } |
1789 | |
1933 | |
1790 | $self->{fow_texture} = new CFClient::Texture |
1934 | $self->{fow_texture} = new CFClient::Texture |
1791 | w => $w, |
1935 | w => $w, |
… | |
… | |
1821 | $self->{mapmap_texture} = |
1965 | $self->{mapmap_texture} = |
1822 | new CFClient::Texture |
1966 | new CFClient::Texture |
1823 | w => $w, |
1967 | w => $w, |
1824 | h => $h, |
1968 | h => $h, |
1825 | data => $::MAP->mapmap ($w, $h), |
1969 | data => $::MAP->mapmap ($w, $h), |
1826 | type => GL_UNSIGNED_INT_8_8_8_8_REV; |
1970 | type => $CFClient::GL_VERSION >= 1.2 ? GL_UNSIGNED_INT_8_8_8_8_REV : GL_UNSIGNED_BYTE; |
1827 | |
1971 | |
1828 | $self->{mapmap_texture}->draw_quad (100, 100); |
1972 | $self->{mapmap_texture}->draw_quad (100, 100); |
1829 | |
1973 | |
1830 | glDisable GL_TEXTURE_2D; |
1974 | glDisable GL_TEXTURE_2D; |
1831 | glDisable GL_BLEND; |
1975 | glDisable GL_BLEND; |
… | |
… | |
1875 | |
2019 | |
1876 | my $mod = $ev->key_mod; |
2020 | my $mod = $ev->key_mod; |
1877 | my $sym = $ev->key_sym; |
2021 | my $sym = $ev->key_sym; |
1878 | |
2022 | |
1879 | if ($sym == SDLK_KP5) { |
2023 | if ($sym == SDLK_KP5) { |
1880 | $::CONN->user_send ("command stay fire"); |
2024 | $::CONN->user_send ("stay fire"); |
1881 | } elsif ($sym == SDLK_a) { |
2025 | } elsif ($sym == SDLK_a) { |
1882 | $::CONN->user_send ("command apply"); |
2026 | $::CONN->user_send ("apply"); |
1883 | } elsif ($sym == SDLK_QUOTE) { |
2027 | } elsif ($sym == SDLK_QUOTE) { |
1884 | $self->emit ('activate_console'); |
2028 | $self->emit ('activate_console'); |
1885 | } elsif ($sym == SDLK_SLASH) { |
2029 | } elsif ($sym == SDLK_SLASH) { |
1886 | $self->emit ('activate_console' => '/'); |
2030 | $self->emit ('activate_console' => '/'); |
1887 | } elsif (exists $DIR{$sym}) { |
2031 | } elsif (exists $DIR{$sym}) { |
1888 | if ($mod & KMOD_SHIFT) { |
2032 | if ($mod & KMOD_SHIFT) { |
1889 | $self->{shft}++; |
2033 | $self->{shft}++; |
1890 | $::CONN->user_send ("command fire $DIR{$sym}[0]"); |
2034 | $::CONN->user_send ("fire $DIR{$sym}[0]"); |
1891 | } elsif ($mod & KMOD_CTRL) { |
2035 | } elsif ($mod & KMOD_CTRL) { |
1892 | $self->{ctrl}++; |
2036 | $self->{ctrl}++; |
1893 | $::CONN->user_send ("command run $DIR{$sym}[0]"); |
2037 | $::CONN->user_send ("run $DIR{$sym}[0]"); |
1894 | } else { |
2038 | } else { |
1895 | $::CONN->user_send ("command $DIR{$sym}[1]"); |
2039 | $::CONN->user_send ("$DIR{$sym}[1]"); |
1896 | } |
2040 | } |
1897 | } |
2041 | } |
1898 | } |
2042 | } |
1899 | |
2043 | |
1900 | sub key_up { |
2044 | sub key_up { |
… | |
… | |
1902 | |
2046 | |
1903 | my $mod = $ev->key_mod; |
2047 | my $mod = $ev->key_mod; |
1904 | my $sym = $ev->key_sym; |
2048 | my $sym = $ev->key_sym; |
1905 | |
2049 | |
1906 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
2050 | if (!($mod & KMOD_SHIFT) && delete $self->{shft}) { |
1907 | $::CONN->user_send ("command fire_stop"); |
2051 | $::CONN->user_send ("fire_stop"); |
1908 | } |
2052 | } |
1909 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
2053 | if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) { |
1910 | $::CONN->user_send ("command run_stop"); |
2054 | $::CONN->user_send ("run_stop"); |
1911 | } |
2055 | } |
1912 | } |
2056 | } |
1913 | |
2057 | |
1914 | ############################################################################# |
2058 | ############################################################################# |
1915 | |
2059 | |
… | |
… | |
1998 | |
2142 | |
1999 | our @ISA = CFClient::UI::Container::; |
2143 | our @ISA = CFClient::UI::Container::; |
2000 | |
2144 | |
2001 | use SDL::OpenGL; |
2145 | use SDL::OpenGL; |
2002 | |
2146 | |
|
|
2147 | sub check_size { |
|
|
2148 | my ($self) = @_; |
|
|
2149 | |
|
|
2150 | $self->configure (0, 0, $::WITH, $::HEIGHT); |
|
|
2151 | } |
|
|
2152 | |
2003 | sub size_request { |
2153 | sub size_request { |
2004 | ($::WIDTH, $::HEIGHT) |
2154 | ($::WIDTH, $::HEIGHT) |
2005 | } |
2155 | } |
2006 | |
2156 | |
2007 | sub size_allocate { |
2157 | sub configure { |
2008 | my ($self, $x, $y, $w, $h) = @_; |
2158 | my ($self, $x, $y, $w, $h) = @_; |
2009 | |
2159 | |
2010 | $self->_size_allocate ($x, $y, $w, $h); |
2160 | $self->SUPER::configure ($x, $y, $w, $h); |
2011 | |
2161 | |
2012 | $_->size_allocate ($_->{x}, $_->{y}, $_->size_request) |
2162 | $_->configure ($_->{x}, $_->{y}, $_->size_request) |
2013 | for @{$self->{children}}; |
2163 | for @{$self->{children}}; |
2014 | } |
2164 | } |
2015 | |
2165 | |
2016 | sub _topleft { |
2166 | sub _topleft { |
2017 | my ($self, $x, $y) = @_; |
2167 | my ($self, $x, $y) = @_; |
… | |
… | |
2020 | } |
2170 | } |
2021 | |
2171 | |
2022 | sub update { |
2172 | sub update { |
2023 | my ($self) = @_; |
2173 | my ($self) = @_; |
2024 | |
2174 | |
2025 | $self->size_allocate (0, 0, $::WIDTH, $::HEIGHT); |
2175 | $self->check_size; |
2026 | ::refresh (); |
2176 | ::refresh (); |
2027 | } |
2177 | } |
2028 | |
2178 | |
2029 | sub add { |
2179 | sub add { |
2030 | my ($self, $widget) = @_; |
2180 | my ($self, $child) = @_; |
2031 | |
2181 | |
2032 | $self->SUPER::add ($widget); |
2182 | $self->SUPER::add ($child); |
2033 | |
|
|
2034 | $widget->size_allocate (int $widget->{x}, int $widget->{y}, $widget->size_request); |
|
|
2035 | } |
2183 | } |
2036 | |
2184 | |
2037 | sub on_refresh { |
2185 | sub on_refresh { |
2038 | my ($self, $id, $cb) = @_; |
2186 | my ($self, $id, $cb) = @_; |
2039 | |
2187 | |