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

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.124 by elmex, Mon Apr 17 20:29:37 2006 UTC vs.
Revision 1.137 by root, Wed Apr 19 21:38:05 2006 UTC

21 $FOCUS->key_up ($_[0]) if $FOCUS; 21 $FOCUS->key_up ($_[0]) if $FOCUS;
22} 22}
23 23
24sub feed_sdl_button_down_event { 24sub feed_sdl_button_down_event {
25 my ($ev) = @_; 25 my ($ev) = @_;
26 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 26 my ($x, $y) = ($ev->{x}, $ev->{y});
27 27
28 if (!$BUTTON_STATE) { 28 if (!$BUTTON_STATE) {
29 my $widget = $ROOT->find_widget ($x, $y); 29 my $widget = $ROOT->find_widget ($x, $y);
30 30
31 $GRAB = $widget; 31 $GRAB = $widget;
32 $GRAB->update if $GRAB; 32 $GRAB->update if $GRAB;
33 } 33 }
34 34
35 $BUTTON_STATE |= 1 << ($ev->button - 1); 35 $BUTTON_STATE |= 1 << ($ev->{button} - 1);
36 36
37 $GRAB->button_down ($ev, $GRAB->coord2local ($x, $y)) if $GRAB; 37 $GRAB->button_down ($ev, $GRAB->coord2local ($x, $y)) if $GRAB;
38} 38}
39 39
40sub feed_sdl_button_up_event { 40sub feed_sdl_button_up_event {
41 my ($ev) = @_; 41 my ($ev) = @_;
42 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 42 my ($x, $y) = ($ev->{x}, $ev->{y});
43 43
44 my $widget = $GRAB || $ROOT->find_widget ($x, $y); 44 my $widget = $GRAB || $ROOT->find_widget ($x, $y);
45 45
46 $BUTTON_STATE &= ~(1 << ($ev->button - 1)); 46 $BUTTON_STATE &= ~(1 << ($ev->{button} - 1));
47 47
48 $GRAB->button_up ($ev, $GRAB->coord2local ($x, $y)) if $GRAB; 48 $GRAB->button_up ($ev, $GRAB->coord2local ($x, $y)) if $GRAB;
49 49
50 if (!$BUTTON_STATE) { 50 if (!$BUTTON_STATE) {
51 my $grab = $GRAB; undef $GRAB; 51 my $grab = $GRAB; undef $GRAB;
54 } 54 }
55} 55}
56 56
57sub feed_sdl_motion_event { 57sub feed_sdl_motion_event {
58 my ($ev) = @_; 58 my ($ev) = @_;
59 my ($x, $y) = ($ev->motion_x, $ev->motion_y); 59 my ($x, $y) = ($ev->{x}, $ev->{y});
60 60
61 my $widget = $GRAB || $ROOT->find_widget ($x, $y); 61 my $widget = $GRAB || $ROOT->find_widget ($x, $y);
62 62
63 if ($widget != $HOVER) { 63 if ($widget != $HOVER) {
64 my $hover = $HOVER; $HOVER = $widget; 64 my $hover = $HOVER; $HOVER = $widget;
96 96
97 my $self = bless { 97 my $self = bless {
98 x => 0, 98 x => 0,
99 y => 0, 99 y => 0,
100 z => 0, 100 z => 0,
101 w => -1,
102 h => -1,
103 @_ 101 @_
104 }, $class; 102 }, $class;
105 103
106 for (keys %$self) { 104 for (keys %$self) {
107 if (/^connect_(.*)$/) { 105 if (/^connect_(.*)$/) {
110 } 108 }
111 109
112 $self 110 $self
113} 111}
114 112
113sub show {
114 my ($self) = @_;
115
116 return if $self->{parent};
117
118 $CFClient::UI::ROOT->add ($self);
119}
120
121sub hide {
122 my ($self) = @_;
123
124 return unless $self->{parent};
125
126 $self->{parent}->remove ($self);
127}
128
115sub move { 129sub move {
116 my ($self, $x, $y, $z) = @_; 130 my ($self, $x, $y, $z) = @_;
131
117 $self->{x} = int $x; 132 $self->{x} = int $x;
118 $self->{y} = int $y; 133 $self->{y} = int $y;
119 $self->{z} = $z if defined $z; 134 $self->{z} = $z if defined $z;
135
136 $self->update;
120} 137}
121 138
122sub needs_redraw { 139sub needs_redraw {
123 0 140 0
124} 141}
126sub size_request { 143sub size_request {
127 require Carp; 144 require Carp;
128 Carp::confess "size_request is abtract"; 145 Carp::confess "size_request is abtract";
129} 146}
130 147
131sub _size_allocate { 148sub configure {
132 my ($self, $x, $y, $w, $h) = @_; 149 my ($self, $x, $y, $w, $h) = @_;
133 150
134 $self->{x} = $x; 151 $self->{x} = $x;
135 $self->{y} = $y; 152 $self->{y} = $y;
136 153
137 return unless $self->{w} != $w || $self->{h} != $h; 154 return unless $self->{w} != $w || $self->{h} != $h;
138 155
139 $self->{w} = $w; 156 $self->{w} = $w;
140 $self->{h} = $h; 157 $self->{h} = $h;
141 158
142 1 159 $self->size_allocate ($w, $h);
160 $self->update;
143} 161}
144 162
145sub size_allocate { 163sub size_allocate {
146 my ($self, $x, $y, $w, $h) = @_; 164 # nothing to be done
147
148 $self->_size_allocate ($x, $y, $w, $h);
149} 165}
150 166
151# return top left coordinates 167# return top left coordinates
152sub _topleft { 168sub _topleft {
153 my ($self, $x, $y) = @_; 169 my ($self, $x, $y) = @_;
260 my ($self, $parent) = @_; 276 my ($self, $parent) = @_;
261 277
262 Scalar::Util::weaken ($self->{parent} = $parent); 278 Scalar::Util::weaken ($self->{parent} = $parent);
263} 279}
264 280
281sub check_size {
282 my ($self) = @_;
283
284 my ($w, $h) = $self->size_request;
285
286 if ($w != $self->{req_w} || $h != $self->{req_h}) {
287 $self->{req_w} = $w;
288 $self->{req_h} = $h;
289
290 $self->{parent}->check_size
291 if $self->{parent};
292 }
293}
294
265sub update { 295sub update {
266 my ($self) = @_; 296 my ($self) = @_;
267 297
268 $self->{parent}->update 298 $self->{parent}->update
269 if $self->{parent}; 299 if $self->{parent};
270} 300}
271 301
272sub connect { 302sub connect {
273 my ($self, $signal, $cb) = @_; 303 my ($self, $signal, $cb) = @_;
274 304
275 push @{ $self->{cb}{$signal} }, $cb; 305 push @{ $self->{signal_cb}{$signal} }, $cb;
276} 306}
277 307
278sub emit { 308sub emit {
279 my ($self, $signal, @args) = @_; 309 my ($self, $signal, @args) = @_;
280 310
311 for my $cb (@{$self->{signal_cb}{$signal} || []}) {
281 $_->($self, @args) 312 $cb->($self, @args);
282 for @{$self->{cb}{$signal} || []}; 313 }
283} 314}
284 315
285sub DESTROY { 316sub DESTROY {
286 my ($self) = @_; 317 my ($self) = @_;
287 318
367 $self->{children} = [ 398 $self->{children} = [
368 sort { $a->{z} <=> $b->{z} } 399 sort { $a->{z} <=> $b->{z} }
369 @{$self->{children}}, $child 400 @{$self->{children}}, $child
370 ]; 401 ];
371 402
372 $self->{w} = $self->{h} = -1; 403 $child->check_size;
373 $self->update;
374} 404}
375 405
376sub remove { 406sub remove {
377 my ($self, $widget) = @_; 407 my ($self, $child) = @_;
378 408
409 delete $child->{parent};
410
379 $self->{children} = [ grep $_ != $widget, @{ $self->{children} } ]; 411 $self->{children} = [ grep $_ != $child, @{ $self->{children} } ];
380 412
381 $self->size_allocate (0, 0, $self->{w}, $self->{h}); 413 $self->check_size;
382} 414}
383 415
384sub find_widget { 416sub find_widget {
385 my ($self, $x, $y) = @_; 417 my ($self, $x, $y) = @_;
386 418
416 448
417 $class->SUPER::new (children => [$child], %arg) 449 $class->SUPER::new (children => [$child], %arg)
418} 450}
419 451
420sub add { 452sub add {
421 my ($self, $widget) = @_; 453 my ($self, $child) = @_;
422 454
423 $self->{children} = []; 455 $self->{children} = [];
424 456
425 $self->SUPER::add ($widget); 457 $self->SUPER::add ($child);
426} 458}
427 459
428sub remove { 460sub remove {
429 my ($self, $widget) = @_; 461 my ($self, $widget) = @_;
430 462
439sub size_request { 471sub size_request {
440 $_[0]{children}[0]->size_request 472 $_[0]{children}[0]->size_request
441} 473}
442 474
443sub size_allocate { 475sub size_allocate {
444 my ($self, $x, $y, $w, $h) = @_; 476 my ($self, $w, $h) = @_;
445 477
446 $self->_size_allocate ($x, $y, $w, $h) or return;
447
448 $self->{children}[0]->size_allocate (0, 0, $w, $h); 478 $self->{children}[0]->configure (0, 0, $w, $h);
449} 479}
450 480
451############################################################################# 481#############################################################################
452 482
453package CFClient::UI::Window; 483package CFClient::UI::Window;
479 $self->child->draw; 509 $self->child->draw;
480 }; 510 };
481} 511}
482 512
483sub size_allocate { 513sub size_allocate {
484 my ($self, $x, $y, $w, $h) = @_; 514 my ($self, $w, $h) = @_;
485 515
486 $self->_size_allocate ($x, $y, $w, $h) or return;
487
488 $self->child->size_allocate (0, 0, $w, $h); 516 $self->child->configure (0, 0, $w, $h);
489 517
490 $self->render_chld; 518 $self->render_chld;
491} 519}
492 520
493sub _draw { 521sub _draw {
509 glDisable GL_TEXTURE_2D; 537 glDisable GL_TEXTURE_2D;
510} 538}
511 539
512############################################################################# 540#############################################################################
513 541
542package CFClient::UI::ViewPort;
543
544our @ISA = CFClient::UI::Window::;
545
546sub new { die }
547
548sub size_request {
549 my ($self) = @_;
550
551 @$self{qw(child_w child_h)} = $self->child->size_request;
552 $self->child->size_allocate (0, 0, @$self{qw(child_w child_h)});
553
554 @$self{qw(child_w child_h)}
555}
556
557sub _draw {
558 my ($self) = @_;
559
560 $self->{children}[1]->draw;
561}
562
563
564#############################################################################
565
514package CFClient::UI::Frame; 566package CFClient::UI::Frame;
515 567
516our @ISA = CFClient::UI::Bin::; 568our @ISA = CFClient::UI::Bin::;
517 569
518use SDL::OpenGL; 570use SDL::OpenGL;
528} 580}
529 581
530sub size_allocate { 582sub size_allocate {
531 my ($self, $x, $y, $w, $h) = @_; 583 my ($self, $x, $y, $w, $h) = @_;
532 584
533 $self->_size_allocate ($x, $y, $w, $h) or return;
534
535 $self->child->size_allocate (2, 2, $w - 4, $h - 4); 585 $self->child->configure (2, 2, $w - 4, $h - 4);
536} 586}
537 587
538sub _draw { 588sub _draw {
539 my ($self) = @_; 589 my ($self) = @_;
540 590
571 # TODO: user_x, user_y, overwrite moveto? 621 # TODO: user_x, user_y, overwrite moveto?
572 622
573 $class->SUPER::new ( 623 $class->SUPER::new (
574 bg => [1, 1, 1, 1], 624 bg => [1, 1, 1, 1],
575 border_bg => [1, 1, 1, 1], 625 border_bg => [1, 1, 1, 1],
576 border => int $::FONTSIZE * 0.8, 626 border => 0.8,
577 @_ 627 @_
578 ) 628 )
579} 629}
580 630
631sub border {
632 int $_[0]{border} * $::FONTSIZE
633}
634
581sub size_request { 635sub size_request {
582 my ($self) = @_; 636 my ($self) = @_;
583 637
584 return ($self->{user_w}, $self->{user_h}) if $self->{user_w} && $self->{user_h}; 638 return ($self->{user_w}, $self->{user_h}) if $self->{user_w} && $self->{user_h};
585 639
586 my ($w, $h) = $self->SUPER::size_request; 640 my ($w, $h) = $self->SUPER::size_request;
587 641
588 ( 642 (
589 $w + $self->{border} * 2, 643 $w + $self->border * 2,
590 $h + $self->{border} * 2, 644 $h + $self->border * 2,
591 ) 645 )
592} 646}
593 647
594sub size_allocate { 648sub size_allocate {
595 my ($self, $x, $y, $w, $h) = @_; 649 my ($self, $w, $h) = @_;
596 650
597 $self->_size_allocate ($x, $y, $w, $h) or return;
598
599 $h -= List::Util::max 0, $self->{border} * 2; 651 $h -= List::Util::max 0, $self->border * 2;
600 $w -= List::Util::max 0, $self->{border} * 2; 652 $w -= List::Util::max 0, $self->border * 2;
601 653
602 $self->child->size_allocate ($self->{border}, $self->{border}, $w, $h); 654 $self->child->configure ($self->border, $self->border, $w, $h);
603} 655}
604 656
605sub button_down { 657sub button_down {
606 my ($self, $ev, $x, $y) = @_; 658 my ($self, $ev, $x, $y) = @_;
607 659
660 my $border = $self->border;
661
608 if ($x < $self->{w} && $x >= $self->{w} - $self->{border} 662 if ($x < $self->{w} && $x >= $self->{w} - $border
609 && $y < $self->{h} && $y >= $self->{h} - $self->{border}) { 663 && $y < $self->{h} && $y >= $self->{h} - $border) {
610 664
611 my ($ox, $oy) = ($ev->button_x, $ev->button_y); 665 my ($ox, $oy) = ($ev->button_x, $ev->button_y);
612 my ($bw, $bh) = ($self->{w}, $self->{h}); 666 my ($bw, $bh) = ($self->{w}, $self->{h});
613 667
614 $self->{motion} = sub { 668 $self->{motion} = sub {
616 670
617 ($x, $y) = ($ev->motion_x, $ev->motion_y); 671 ($x, $y) = ($ev->motion_x, $ev->motion_y);
618 672
619 $self->{user_w} = $bw + $x - $ox; 673 $self->{user_w} = $bw + $x - $ox;
620 $self->{user_h} = $bh + $y - $oy; 674 $self->{user_h} = $bh + $y - $oy;
621 $self->update; 675 $self->check_size;
622 }; 676 };
623 677
624 } elsif ($x >= 0 && $x < $self->{w} 678 } elsif ($x >= 0 && $x < $self->{w}
625 && $y >= 0 && $y < $self->{border}) { 679 && $y >= 0 && $y < $border) {
626 680
627 my ($ox, $oy) = ($ev->button_x, $ev->button_y); 681 my ($ox, $oy) = ($ev->button_x, $ev->button_y);
628 my ($bx, $by) = ($self->{x}, $self->{y}); 682 my ($bx, $by) = ($self->{x}, $self->{y});
629 683
630 $self->{motion} = sub { 684 $self->{motion} = sub {
659 glEnable GL_BLEND; 713 glEnable GL_BLEND;
660 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 714 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
661 glEnable GL_TEXTURE_2D; 715 glEnable GL_TEXTURE_2D;
662 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 716 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
663 717
718 my $border = $self->border;
719
664 glColor @{ $self->{border_bg} }; 720 glColor @{ $self->{border_bg} };
665 $tex[1]->draw_quad (0, 0, $w, $self->{border}); 721 $tex[1]->draw_quad (0, 0, $w, $border);
666 $tex[3]->draw_quad (0, $self->{border}, $self->{border}, $ch); 722 $tex[3]->draw_quad (0, $border, $border, $ch);
667 $tex[2]->draw_quad ($w - $self->{border}, $self->{border}, $self->{border}, $ch); 723 $tex[2]->draw_quad ($w - $border, $border, $border, $ch);
668 $tex[4]->draw_quad (0, $h - $self->{border}, $w, $self->{border}); 724 $tex[4]->draw_quad (0, $h - $border, $w, $border);
669 725
670 my $bg = $tex[0]; 726 my $bg = $tex[0];
671 727
672 # TODO: repeat texture not scale 728 # TODO: repeat texture not scale
673 my $rep_x = $cw / $bg->{w}; 729 my $rep_x = $cw / $bg->{w};
676 glColor @{ $self->{bg} }; 732 glColor @{ $self->{bg} };
677 733
678 $bg->{s} = $rep_x; 734 $bg->{s} = $rep_x;
679 $bg->{t} = $rep_y; 735 $bg->{t} = $rep_y;
680 $bg->{wrap_mode} = 1; 736 $bg->{wrap_mode} = 1;
681 $bg->draw_quad ($self->{border}, $self->{border}, $cw, $ch); 737 $bg->draw_quad ($border, $border, $cw, $ch);
682 738
683 glDisable GL_TEXTURE_2D; 739 glDisable GL_TEXTURE_2D;
684 glDisable GL_BLEND; 740 glDisable GL_BLEND;
685 741
686 $self->child->draw; 742 $self->child->draw;
709 my ($self, $x, $y, $child) = @_; 765 my ($self, $x, $y, $child) = @_;
710 766
711 $child->set_parent ($self); 767 $child->set_parent ($self);
712 $self->{children}[$y][$x] = $child; 768 $self->{children}[$y][$x] = $child;
713 769
714 $self->{w} = $self->{h} = -1; 770 $child->check_size;
715 $self->update;
716} 771}
717 772
718# TODO: move to container class maybe? send childs a signal on removal? 773# TODO: move to container class maybe? send childs a signal on removal?
719sub clear { 774sub clear {
720 my ($self) = @_; 775 my ($self) = @_;
755 (sum @$hs), 810 (sum @$hs),
756 ) 811 )
757} 812}
758 813
759sub size_allocate { 814sub size_allocate {
760 my ($self, $x, $y, $w, $h) = @_; 815 my ($self, $w, $h) = @_;
761
762 $self->_size_allocate ($x, $y, $w, $h) or return;
763 816
764 my ($ws, $hs) = $self->get_wh; 817 my ($ws, $hs) = $self->get_wh;
765 818
766 my $req_w = sum @$ws; 819 my $req_w = sum @$ws;
767 my $req_h = sum @$hs; 820 my $req_h = sum @$hs;
789 842
790 for my $c (0 .. $#$row) { 843 for my $c (0 .. $#$row) {
791 my $col_w = $ws->[$c]; 844 my $col_w = $ws->[$c];
792 845
793 if (my $widget = $row->[$c]) { 846 if (my $widget = $row->[$c]) {
794 $widget->size_allocate ($x, $y, $col_w, $row_h); 847 $widget->configure ($x, $y, $col_w, $row_h);
795 } 848 }
796 849
797 $x += $col_w; 850 $x += $col_w;
798 } 851 }
799 852
844 (List::Util::max map $_->[1], @alloc), 897 (List::Util::max map $_->[1], @alloc),
845 ) 898 )
846} 899}
847 900
848sub size_allocate { 901sub size_allocate {
849 my ($self, $x, $y, $w, $h) = @_; 902 my ($self, $w, $h) = @_;
850
851 $self->_size_allocate ($x, $y, $w, $h);
852 903
853 ($h, $w) = ($w, $h); 904 ($h, $w) = ($w, $h);
854 905
855 my $children = $self->{children}; 906 my $children = $self->{children};
856 907
878 929
879 my $y = 0; 930 my $y = 0;
880 for (0 .. $#$children) { 931 for (0 .. $#$children) {
881 my $child = $children->[$_]; 932 my $child = $children->[$_];
882 my $h = $h[$_]; 933 my $h = $h[$_];
883 $child->size_allocate ($y, 0, $h, $w); 934 $child->configure ($y, 0, $h, $w);
884 935
885 $y += $h; 936 $y += $h;
886 } 937 }
938
939 1
887} 940}
888 941
889############################################################################# 942#############################################################################
890 943
891package CFClient::UI::VBox; 944package CFClient::UI::VBox;
904 (List::Util::sum map $_->[1], @alloc), 957 (List::Util::sum map $_->[1], @alloc),
905 ) 958 )
906} 959}
907 960
908sub size_allocate { 961sub size_allocate {
909 my ($self, $x, $y, $w, $h) = @_; 962 my ($self, $w, $h) = @_;
910
911 $self->_size_allocate ($x, $y, $w, $h);
912 963
913 my $children = $self->{children}; 964 my $children = $self->{children};
914 965
915 my @h = map +($_->size_request)[1], @$children; 966 my @h = map +($_->size_request)[1], @$children;
916 967
934 985
935 my $y = 0; 986 my $y = 0;
936 for (0 .. $#$children) { 987 for (0 .. $#$children) {
937 my $child = $children->[$_]; 988 my $child = $children->[$_];
938 my $h = $h[$_]; 989 my $h = $h[$_];
939 $child->size_allocate (0, $y, $w, $h); 990 $child->configure (0, $y, $w, $h);
940 991
941 $y += $h; 992 $y += $h;
942 } 993 }
994
995 1
943} 996}
944 997
945############################################################################# 998#############################################################################
946 999
947package CFClient::UI::Label; 1000package CFClient::UI::Label;
953sub new { 1006sub new {
954 my ($class, %arg) = @_; 1007 my ($class, %arg) = @_;
955 1008
956 my $self = $class->SUPER::new ( 1009 my $self = $class->SUPER::new (
957 fg => [1, 1, 1], 1010 fg => [1, 1, 1],
958 fontsize => $::FONTSIZE, 1011 fontsize => 1,
959 text => "", 1012 text => "",
960 align => -1, 1013 align => -1,
961 valign => -1, 1014 valign => -1,
962 padding => 2, 1015 padding => 2,
963 layout => new CFClient::Layout, 1016 layout => new CFClient::Layout,
1002 1055
1003sub size_request { 1056sub size_request {
1004 my ($self) = @_; 1057 my ($self) = @_;
1005 1058
1006 $self->{layout}->set_width; 1059 $self->{layout}->set_width;
1007 $self->{layout}->set_height ($self->{fontsize}); 1060 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE);
1008 1061
1009 my ($w, $h) = $self->{layout}->size; 1062 my ($w, $h) = $self->{layout}->size;
1010 1063
1011 ( 1064 (
1012 $w + $self->{padding} * 2, 1065 $w + $self->{padding} * 2,
1013 $h + $self->{padding} * 2, 1066 $h + $self->{padding} * 2,
1014 ) 1067 )
1015} 1068}
1016 1069
1017sub size_allocate { 1070sub size_allocate {
1018 my ($self, $x, $y, $w, $h) = @_; 1071 my ($self, $w, $h) = @_;
1019
1020 $self->_size_allocate ($x, $y, $w, $h) or return;
1021 1072
1022 delete $self->{texture}; 1073 delete $self->{texture};
1023}
1024
1025sub update {
1026 my ($self) = @_;
1027
1028 delete $self->{texture};
1029 $self->SUPER::update;
1030} 1074}
1031 1075
1032sub _draw { 1076sub _draw {
1033 my ($self) = @_; 1077 my ($self) = @_;
1034 1078
1035 my $tex = $self->{texture} ||= do { 1079 my $tex = $self->{texture} ||= do {
1036 $self->{layout}->set_width ($self->{w}); 1080 $self->{layout}->set_width ($self->{w});
1037 $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize}); 1081 $self->{layout}->set_height (List::Util::min $self->{h}, $self->{fontsize} * $::FONTSIZE);
1038 new_from_layout CFClient::Texture $self->{layout} 1082 new_from_layout CFClient::Texture $self->{layout}
1039 }; 1083 };
1040 1084
1041 glEnable GL_BLEND; 1085 glEnable GL_BLEND;
1042 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1086 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1067 1111
1068package CFClient::UI::EntryBase; 1112package CFClient::UI::EntryBase;
1069 1113
1070our @ISA = CFClient::UI::Label::; 1114our @ISA = CFClient::UI::Label::;
1071 1115
1072use SDL;
1073use SDL::OpenGL; 1116use SDL::OpenGL;
1074 1117
1075sub new { 1118sub new {
1076 my $class = shift; 1119 my $class = shift;
1077 1120
1092 1135
1093 delete $self->{cur_h}; 1136 delete $self->{cur_h};
1094 1137
1095 return if $self->{text} eq $text; 1138 return if $self->{text} eq $text;
1096 1139
1140 delete $self->{texture};
1141
1097 $self->{last_activity} = $::NOW; 1142 $self->{last_activity} = $::NOW;
1098 $self->{text} = $text; 1143 $self->{text} = $text;
1099 1144
1100 $text =~ s/./*/g if $self->{hidden}; 1145 $text =~ s/./*/g if $self->{hidden};
1101 $self->{layout}->set_text ("$text "); 1146 $self->{layout}->set_text ("$text ");
1114 1159
1115 ($w + 1, $h) # add 1 for cursor 1160 ($w + 1, $h) # add 1 for cursor
1116} 1161}
1117 1162
1118sub size_allocate { 1163sub size_allocate {
1119 my ($self, $x, $y, $w, $h) = @_; 1164 my ($self, $w, $h) = @_;
1120
1121 $self->SUPER::size_allocate ($x, $y, $w, $h);
1122 1165
1123 $self->_set_text ($self->{text}); 1166 $self->_set_text ($self->{text});
1124} 1167}
1125 1168
1126sub set_text { 1169sub set_text {
1132} 1175}
1133 1176
1134sub key_down { 1177sub key_down {
1135 my ($self, $ev) = @_; 1178 my ($self, $ev) = @_;
1136 1179
1137 my $mod = $ev->key_mod; 1180 my $mod = $ev->{mod};
1138 my $sym = $ev->key_sym; 1181 my $sym = $ev->{sym};
1139
1140 my $uni = $ev->key_unicode; 1182 my $uni = $ev->{unicode};
1141 1183
1142 my $text = $self->get_text; 1184 my $text = $self->get_text;
1143 1185
1144 if ($sym == SDLK_BACKSPACE) { 1186 if ($sym == 8) {
1145 substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; 1187 substr $text, --$self->{cursor}, 1, "" if $self->{cursor};
1146 } elsif ($sym == SDLK_DELETE) { 1188 } elsif ($sym == 127) {
1147 substr $text, $self->{cursor}, 1, ""; 1189 substr $text, $self->{cursor}, 1, "";
1148 } elsif ($sym == SDLK_LEFT) { 1190 } elsif ($sym == CFClient::SDLK_LEFT) {
1149 --$self->{cursor} if $self->{cursor}; 1191 --$self->{cursor} if $self->{cursor};
1150 } elsif ($sym == SDLK_RIGHT) { 1192 } elsif ($sym == CFClient::SDLK_RIGHT) {
1151 ++$self->{cursor} if $self->{cursor} < length $self->{text}; 1193 ++$self->{cursor} if $self->{cursor} < length $self->{text};
1152 } elsif ($sym == SDLK_HOME) { 1194 } elsif ($sym == CFClient::SDLK_HOME) {
1153 $self->{cursor} = 0; 1195 $self->{cursor} = 0;
1154 } elsif ($sym == SDLK_END) { 1196 } elsif ($sym == CFClient::SDLK_END) {
1155 $self->{cursor} = length $text; 1197 $self->{cursor} = length $text;
1156 } elsif ($sym == SDLK_ESCAPE) { 1198 } elsif ($sym == 27) {
1157 $self->emit ('escape'); 1199 $self->emit ('escape');
1158 } elsif ($uni) { 1200 } elsif ($uni) {
1159 substr $text, $self->{cursor}++, 0, chr $uni; 1201 substr $text, $self->{cursor}++, 0, chr $uni;
1160 } 1202 }
1161 1203
1236 1278
1237package CFClient::UI::Entry; 1279package CFClient::UI::Entry;
1238 1280
1239our @ISA = CFClient::UI::EntryBase::; 1281our @ISA = CFClient::UI::EntryBase::;
1240 1282
1241use SDL;
1242use SDL::OpenGL; 1283use SDL::OpenGL;
1243 1284
1244sub key_down { 1285sub key_down {
1245 my ($self, $ev) = @_; 1286 my ($self, $ev) = @_;
1246 1287
1247 my $sym = $ev->key_sym; 1288 my $sym = $ev->{sym};
1248 1289
1249 if ($sym == SDLK_RETURN) { 1290 if ($sym == 13) {
1250 $self->emit (activate => $self->get_text); 1291 $self->emit (activate => $self->get_text);
1251 $self->update; 1292 $self->update;
1252 1293
1253 } else { 1294 } else {
1254 $self->SUPER::key_down ($ev); 1295 $self->SUPER::key_down ($ev);
1260 1301
1261package CFClient::UI::Button; 1302package CFClient::UI::Button;
1262 1303
1263our @ISA = CFClient::UI::Label::; 1304our @ISA = CFClient::UI::Label::;
1264 1305
1265use SDL;
1266use SDL::OpenGL; 1306use SDL::OpenGL;
1267 1307
1268my @tex = 1308my @tex =
1269 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1309 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1270 qw(b1_button_active.png); 1310 qw(b1_button_active.png);
1276 padding => 4, 1316 padding => 4,
1277 fg => [1, 1, 1], 1317 fg => [1, 1, 1],
1278 bg => [1, 1, 1, 0.2], 1318 bg => [1, 1, 1, 0.2],
1279 active_fg => [0, 0, 1], 1319 active_fg => [0, 0, 1],
1280 can_hover => 1, 1320 can_hover => 1,
1321 align => 0,
1322 valign => 0,
1281 @_ 1323 @_
1282 ) 1324 )
1283} 1325}
1284 1326
1285sub button_up { 1327sub button_up {
1322 1364
1323my @tex = 1365my @tex =
1324 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ } 1366 map { new_from_file CFClient::Texture CFClient::find_rcfile $_ }
1325 qw(c1_checkbox_bg.png c1_checkbox_active.png); 1367 qw(c1_checkbox_bg.png c1_checkbox_active.png);
1326 1368
1327use SDL;
1328use SDL::OpenGL; 1369use SDL::OpenGL;
1329 1370
1330sub new { 1371sub new {
1331 my $class = shift; 1372 my $class = shift;
1332 1373
1342 1383
1343sub size_request { 1384sub size_request {
1344 my ($self) = @_; 1385 my ($self) = @_;
1345 1386
1346 ($self->{padding} * 2 + 6) x 2 1387 ($self->{padding} * 2 + 6) x 2
1347}
1348
1349sub size_allocate {
1350 my ($self, $x, $y, $w, $h) = @_;
1351
1352 $self->_size_allocate ($x, $y, $w, $h);
1353} 1388}
1354 1389
1355sub button_down { 1390sub button_down {
1356 my ($self, $ev, $x, $y) = @_; 1391 my ($self, $ev, $x, $y) = @_;
1357 1392
1422} 1457}
1423 1458
1424sub size_request { 1459sub size_request {
1425 my ($self) = @_; 1460 my ($self) = @_;
1426 1461
1427 ($self->{w}, $self->{h}) 1462 my $tex = $tex{$self->{gauge}}[0];
1463
1464 @$tex{qw(w h)}
1428} 1465}
1429 1466
1430sub set_max { 1467sub set_max {
1431 my ($self, $max) = @_; 1468 my ($self, $max) = @_;
1469
1432 $self->{max_val} = $max; 1470 $self->{max_val} = $max;
1433} 1471}
1434 1472
1435sub set_value { 1473sub set_value {
1436 my ($self, $val, $max) = @_; 1474 my ($self, $val, $max) = @_;
1465 my $h1 = $self->{h} - $ycut * $self->{h}; 1503 my $h1 = $self->{h} - $ycut * $self->{h};
1466 my $h2 = $ycut * $self->{h}; 1504 my $h2 = $ycut * $self->{h};
1467 1505
1468 my $yp = 0; 1506 my $yp = 0;
1469 1507
1470 glBindTexture (GL_TEXTURE_2D, $t1->{name}); 1508 glBindTexture GL_TEXTURE_2D, $t1->{name};
1471 glBegin (GL_QUADS); 1509 glBegin GL_QUADS;
1472 glTexCoord (0, 0); glVertex (0 , $yp); 1510 glTexCoord 0 , 0; glVertex 0 , $yp;
1473 glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp + $h1); 1511 glTexCoord 0 , $t1->{t} * (1 - $ycut); glVertex 0 , $yp + $h1;
1474 glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp + $h1); 1512 glTexCoord $t1->{s}, $t1->{t} * (1 - $ycut); glVertex 0 + $w, $yp + $h1;
1475 glTexCoord (1, 0); glVertex (0 + $w, $yp); 1513 glTexCoord $t1->{s}, 0; glVertex 0 + $w, $yp;
1476 glEnd (); 1514 glEnd;
1477 1515
1478 $yp += $h1; 1516 $yp += $h1;
1479 1517
1480 glBindTexture (GL_TEXTURE_2D, $t2->{name}); 1518 glBindTexture GL_TEXTURE_2D, $t2->{name};
1481 glBegin (GL_QUADS); 1519 glBegin GL_QUADS;
1482 glTexCoord (0, (1 - $ycut)); glVertex (0 , $yp); 1520 glTexCoord 0 , $t2->{t} * (1 - $ycut); glVertex 0 , $yp;
1483 glTexCoord (0, 1); glVertex (0 , $yp + $h2); 1521 glTexCoord 0 , $t2->{t}; glVertex 0 , $yp + $h2;
1484 glTexCoord (1, 1); glVertex (0 + $w, $yp + $h2); 1522 glTexCoord $t2->{s}, $t2->{t}; glVertex 0 + $w, $yp + $h2;
1485 glTexCoord (1, (1 - $ycut)); glVertex (0 + $w, $yp); 1523 glTexCoord $t2->{s}, $t2->{t} * (1 - $ycut); glVertex 0 + $w, $yp;
1486 glEnd (); 1524 glEnd;
1487 1525
1488 glDisable GL_BLEND; 1526 glDisable GL_BLEND;
1489 glDisable GL_TEXTURE_2D; 1527 glDisable GL_TEXTURE_2D;
1490} 1528}
1491 1529
1513 # TODO: calculations are off 1551 # TODO: calculations are off
1514 my $self = $class->SUPER::new ( 1552 my $self = $class->SUPER::new (
1515 fg => [1, 1, 1], 1553 fg => [1, 1, 1],
1516 active_fg => [0, 0, 0], 1554 active_fg => [0, 0, 0],
1517 range => [0, 0, 100, 10], 1555 range => [0, 0, 100, 10],
1518 req_w => 40, 1556 req_w => 20,
1519 req_h => 13, 1557 req_h => 20,
1520 vertical => 0, 1558 vertical => 0,
1521 can_hover => 1, 1559 can_hover => 1,
1522 inner_pad => 5, 1560 inner_pad => 5,
1523 @_ 1561 @_
1524 ); 1562 );
1634 1672
1635sub new { 1673sub new {
1636 my $class = shift; 1674 my $class = shift;
1637 1675
1638 my $self = $class->SUPER::new ( 1676 my $self = $class->SUPER::new (
1639 req_w => $::WIDTH / 6,
1640 req_h => $::HEIGHT / 6,
1641 fontsize => $::FONTSIZE, 1677 fontsize => 1,
1642 @_, 1678 @_,
1643 1679
1644 layout => (new CFClient::Layout), 1680 layout => (new CFClient::Layout),
1645 par => [], 1681 par => [],
1646 height => 0, 1682 height => 0,
1667sub text_height { 1703sub text_height {
1668 my ($self, $text) = @_; 1704 my ($self, $text) = @_;
1669 1705
1670 my $layout = $self->{layout}; 1706 my $layout = $self->{layout};
1671 1707
1672 $layout->set_height ($self->{fontsize}); 1708 $layout->set_height ($self->{fontsize} * $::FONTSIZE);
1673 $layout->set_width ($self->{w}); 1709 $layout->set_width ($self->{w});
1674 $layout->set_text ($text); 1710 $layout->set_text ($text);
1675 1711
1676 ($layout->size)[1] 1712 ($layout->size)[1]
1677} 1713}
1681 1717
1682 $self->{need_reflow}++; 1718 $self->{need_reflow}++;
1683 $self->update; 1719 $self->update;
1684} 1720}
1685 1721
1686sub size_request {
1687 my ($self) = @_;
1688
1689 ($self->{req_w}, $self->{req_h})
1690}
1691
1692sub size_allocate { 1722sub size_allocate {
1693 my ($self, $x, $y, $w, $h) = @_; 1723 my ($self, $w, $h) = @_;
1694 1724
1695 $self->SUPER::size_allocate ($x, $y, $w, $h); 1725 $self->SUPER::size_allocate ($w, $h);
1696 1726
1697 $self->{layout}->set_height ($self->{fontsize}); 1727 $self->{layout}->set_height ($self->{fontsize} * $::FONTSIZE);
1698 $self->{layout}->set_width ($self->{w}); 1728 $self->{layout}->set_width ($self->{children}[0]{w});
1699 1729
1700 $self->reflow; 1730 $self->reflow;
1701} 1731}
1702 1732
1703sub add_paragraph { 1733sub add_paragraph {
1786 glDisable GL_TEXTURE_2D; 1816 glDisable GL_TEXTURE_2D;
1787 } 1817 }
1788 1818
1789 $self->{children}[1]->draw; 1819 $self->{children}[1]->draw;
1790 1820
1791}
1792
1793#############################################################################
1794
1795package CFClient::UI::MapWidget;
1796
1797use strict;
1798
1799use List::Util qw(min max);
1800
1801use SDL;
1802use SDL::OpenGL;
1803
1804our @ISA = CFClient::UI::Base::;
1805
1806sub new {
1807 my $class = shift;
1808
1809 $class->SUPER::new (
1810 z => -1,
1811 can_focus => 1,
1812 list => (glGenLists 1),
1813 @_
1814 )
1815}
1816
1817sub key_down {
1818 print "MAPKEYDOWN\n";
1819}
1820
1821sub key_up {
1822}
1823
1824sub button_down {
1825 my ($self, $ev, $x, $y) = @_;
1826
1827 $self->focus_in;
1828
1829 if ($ev->button == 2) {
1830 my ($ox, $oy) = ($ev->button_x, $ev->button_y);
1831 my ($bw, $bh) = ($::CFG->{map_shift_x}, $::CFG->{map_shift_y});
1832
1833 $self->{motion} = sub {
1834 my ($ev, $x, $y) = @_;
1835
1836 ($x, $y) = ($ev->motion_x, $ev->motion_y);
1837
1838 $::CFG->{map_shift_x} = $bw + $x - $ox;
1839 $::CFG->{map_shift_y} = $bh + $y - $oy;
1840
1841 $self->update;
1842 };
1843 }
1844}
1845
1846sub button_up {
1847 my ($self, $ev, $x, $y) = @_;
1848
1849 delete $self->{motion};
1850}
1851
1852sub mouse_motion {
1853 my ($self, $ev, $x, $y) = @_;
1854
1855 $self->{motion}->($ev, $x, $y) if $self->{motion};
1856}
1857
1858sub size_request {
1859 (
1860 1 + 32 * int $::WIDTH / 32,
1861 1 + 32 * int $::HEIGHT / 32,
1862 )
1863}
1864
1865sub update {
1866 my ($self) = @_;
1867
1868 $self->{need_update} = 1;
1869 $self->SUPER::update;
1870}
1871
1872sub draw {
1873 my ($self) = @_;
1874
1875 if (delete $self->{need_update}) {
1876 glNewList $self->{list}, GL_COMPILE;
1877
1878 if ($::MAP) {
1879 my $sw = int $::WIDTH / 32;
1880 my $sh = int $::HEIGHT / 32;
1881
1882 my $sx = $::CFG->{map_shift_x}; my $sx0 = $sx & 31; $sx = ($sx - $sx0) / 32;
1883 my $sy = $::CFG->{map_shift_y}; my $sy0 = $sy & 31; $sy = ($sy - $sy0) / 32;
1884
1885 glTranslate $sx0 - 32, $sy0 - 32, 0;
1886
1887 my ($w, $h, $data) = $::MAP->draw ($sx, $sy, 0, 0, $sw + 1, $sh + 1);
1888
1889 if ($::CFG->{fow_enable}) {
1890 if ($::CFG->{fow_smooth}) { # smooth fog of war
1891 glConvolutionParameter GL_CONVOLUTION_2D, GL_CONVOLUTION_BORDER_MODE, GL_CONSTANT_BORDER;
1892 glConvolutionFilter2D
1893 GL_CONVOLUTION_2D,
1894 GL_ALPHA,
1895 3, 3,
1896 GL_ALPHA, GL_FLOAT,
1897 pack "f*",
1898 0.1, 0.1, 0.1,
1899 0.1, 0.2, 0.1,
1900 0.1, 0.1, 0.1,
1901 ;
1902 glEnable GL_CONVOLUTION_2D;
1903 }
1904
1905 $self->{fow_texture} = new CFClient::Texture
1906 w => $w,
1907 h => $h,
1908 data => $data,
1909 internalformat => GL_ALPHA,
1910 format => GL_ALPHA;
1911
1912 glDisable GL_CONVOLUTION_2D if $::CFG->{fow_smooth};
1913
1914 glEnable GL_BLEND;
1915 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1916 glEnable GL_TEXTURE_2D;
1917 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
1918
1919 glColor +($::CFG->{fow_intensity}) x 3, 1;
1920 $self->{fow_texture}->draw_quad (0, 0, $w * 32, $h * 32);
1921
1922 glDisable GL_TEXTURE_2D;
1923 glDisable GL_BLEND;
1924 }
1925
1926 # HACK BEGIN
1927 {
1928 glTranslate -($sx0 - 32), -($sy0 - 32), 0;#remove
1929 my ($w, $h) = (250, 250);
1930
1931 glEnable GL_BLEND;
1932 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
1933 glEnable GL_TEXTURE_2D;
1934 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1935
1936 $self->{mapmap_texture} =
1937 new CFClient::Texture
1938 w => $w,
1939 h => $h,
1940 data => $::MAP->mapmap ($w, $h),
1941 type => GL_UNSIGNED_INT_8_8_8_8_REV;
1942
1943 $self->{mapmap_texture}->draw_quad (100, 100);
1944
1945 glDisable GL_TEXTURE_2D;
1946 glDisable GL_BLEND;
1947 }
1948 # HACK END
1949 }
1950
1951 glEndList;
1952 }
1953
1954 glPushMatrix;
1955 glCallList $self->{list};
1956 glPopMatrix;
1957
1958 if ($FOCUS != $self) {
1959 glColor 64/255, 64/255, 64/255;
1960 glLogicOp GL_AND;
1961 glEnable GL_COLOR_LOGIC_OP;
1962 glBegin GL_QUADS;
1963 glVertex 0, 0;
1964 glVertex 0, $::HEIGHT;
1965 glVertex $::WIDTH, $::HEIGHT;
1966 glVertex $::WIDTH, 0;
1967 glEnd;
1968 glDisable GL_COLOR_LOGIC_OP;
1969 }
1970}
1971
1972my %DIR = (
1973 SDLK_KP8, [1, "north"],
1974 SDLK_KP9, [2, "northeast"],
1975 SDLK_KP6, [3, "east"],
1976 SDLK_KP3, [4, "southeast"],
1977 SDLK_KP2, [5, "south"],
1978 SDLK_KP1, [6, "southwest"],
1979 SDLK_KP4, [7, "west"],
1980 SDLK_KP7, [8, "northwest"],
1981
1982 SDLK_UP, [1, "north"],
1983 SDLK_RIGHT, [3, "east"],
1984 SDLK_DOWN, [5, "south"],
1985 SDLK_LEFT, [7, "west"],
1986);
1987
1988sub key_down {
1989 my ($self, $ev) = @_;
1990
1991 my $mod = $ev->key_mod;
1992 my $sym = $ev->key_sym;
1993
1994 if ($sym == SDLK_KP5) {
1995 $::CONN->user_send ("stay fire");
1996 } elsif ($sym == SDLK_a) {
1997 $::CONN->user_send ("apply");
1998 } elsif ($sym == SDLK_QUOTE) {
1999 $self->emit ('activate_console');
2000 } elsif ($sym == SDLK_SLASH) {
2001 $self->emit ('activate_console' => '/');
2002 } elsif (exists $DIR{$sym}) {
2003 if ($mod & KMOD_SHIFT) {
2004 $self->{shft}++;
2005 $::CONN->user_send ("fire $DIR{$sym}[0]");
2006 } elsif ($mod & KMOD_CTRL) {
2007 $self->{ctrl}++;
2008 $::CONN->user_send ("run $DIR{$sym}[0]");
2009 } else {
2010 $::CONN->user_send ("$DIR{$sym}[1]");
2011 }
2012 }
2013}
2014
2015sub key_up {
2016 my ($self, $ev) = @_;
2017
2018 my $mod = $ev->key_mod;
2019 my $sym = $ev->key_sym;
2020
2021 if (!($mod & KMOD_SHIFT) && delete $self->{shft}) {
2022 $::CONN->user_send ("fire_stop");
2023 }
2024 if (!($mod & KMOD_CTRL ) && delete $self->{ctrl}) {
2025 $::CONN->user_send ("run_stop");
2026 }
2027} 1821}
2028 1822
2029############################################################################# 1823#############################################################################
2030 1824
2031package CFClient::UI::Animator; 1825package CFClient::UI::Animator;
2113 1907
2114our @ISA = CFClient::UI::Container::; 1908our @ISA = CFClient::UI::Container::;
2115 1909
2116use SDL::OpenGL; 1910use SDL::OpenGL;
2117 1911
1912sub check_size {
1913 my ($self) = @_;
1914
1915 $self->configure (0, 0, $::WITH, $::HEIGHT);
1916}
1917
2118sub size_request { 1918sub size_request {
2119 ($::WIDTH, $::HEIGHT) 1919 ($::WIDTH, $::HEIGHT)
2120} 1920}
2121 1921
2122sub size_allocate { 1922sub configure {
2123 my ($self, $x, $y, $w, $h) = @_; 1923 my ($self, $x, $y, $w, $h) = @_;
2124 1924
2125 $self->_size_allocate ($x, $y, $w, $h); 1925 $self->SUPER::configure ($x, $y, $w, $h);
2126 1926
2127 $_->size_allocate ($_->{x}, $_->{y}, $_->size_request) 1927 $_->configure ($_->{x}, $_->{y}, $_->size_request)
2128 for @{$self->{children}}; 1928 for @{$self->{children}};
2129} 1929}
2130 1930
2131sub _topleft { 1931sub _topleft {
2132 my ($self, $x, $y) = @_; 1932 my ($self, $x, $y) = @_;
2135} 1935}
2136 1936
2137sub update { 1937sub update {
2138 my ($self) = @_; 1938 my ($self) = @_;
2139 1939
2140 $self->size_allocate (0, 0, $::WIDTH, $::HEIGHT); 1940 $self->check_size;
2141 ::refresh (); 1941 ::refresh ();
2142} 1942}
2143 1943
2144sub add { 1944sub add {
2145 my ($self, $widget) = @_; 1945 my ($self, $child) = @_;
2146 1946
2147 $self->SUPER::add ($widget); 1947 $self->SUPER::add ($child);
2148
2149 $widget->size_allocate (int $widget->{x}, int $widget->{y}, $widget->size_request);
2150} 1948}
2151 1949
2152sub on_refresh { 1950sub on_refresh {
2153 my ($self, $id, $cb) = @_; 1951 my ($self, $id, $cb) = @_;
2154 1952

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines