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.347 by root, Mon Aug 14 03:41:28 2006 UTC vs.
Revision 1.354 by root, Sat Nov 18 23:31:23 2006 UTC

514); 514);
515 515
516sub emit { 516sub emit {
517 my ($self, $signal, @args) = @_; 517 my ($self, $signal, @args) = @_;
518 518
519 # I do not really like this solution, but I dislike duplication 519 # I do not really like this solution, but I do not like duplication
520 # and needlessly verbose code, too. 520 # and needlessly verbose code, either.
521 my @append 521 my @append
522 = $has_coords{$signal} 522 = $has_coords{$signal}
523 ? $args[0]->xy ($self) 523 ? $args[0]->xy ($self)
524 : (); 524 : ();
525 525
526 #warn +(caller(1))[3] . "emit $signal on $self (parent $self->{parent})\n";#d# 526 #warn +(caller(1))[3] . "emit $signal on $self (parent $self->{parent})\n";#d#
527 527
528 if ($self->{tooltip} =~ /Apply.*audio/) {
529 warn "2 ", join ":", @{ $self->{signal_cb}{$signal} || []}, "\n";#d#
530 warn "3 $self->{parent}\n";#d#
531 }
532
528 #d##TODO# stop propagating at first true, do not use sum 533 #d##TODO# stop propagating at first true, do not use sum
534 my $res =
529 (List::Util::sum map $_->($self, @args, @append), @{$self->{signal_cb}{$signal} || []}) # before 535 (List::Util::sum map $_->($self, @args, @append), @{$self->{signal_cb}{$signal} || []}) # before
530 || ($self->can ("invoke_$signal") || sub { 1 })->($self, @args, @append) # closure 536 || ($self->can ("invoke_$signal") || sub { 1 })->($self, @args, @append) # closure
531 || ($self->{parent} && $self->{parent}->emit ($signal, @args)) # parent 537 || ($self->{parent} && $self->{parent}->emit ($signal, @args)) # parent
538 ;
539 if ($self->{tooltip} =~ /Apply.*audio/) {
540 warn "4 ", join ":", @{ $self->{signal_cb}{$signal} || []}, "\n";#d#
541 warn "5 $self->{parent}\n";#d#
542 }
543
544 $res
532} 545}
533 546
534sub find_widget { 547sub find_widget {
535 my ($self, $x, $y) = @_; 548 my ($self, $x, $y) = @_;
536 549
898 glClear GL_COLOR_BUFFER_BIT; 911 glClear GL_COLOR_BUFFER_BIT;
899 912
900 { 913 {
901 package CFPlus::UI::Base; 914 package CFPlus::UI::Base;
902 915
903 ($draw_x, $draw_y, $draw_w, $draw_h) = 916 local ($draw_x, $draw_y, $draw_w, $draw_h) =
904 (0, 0, $self->{w}, $self->{h}); 917 (0, 0, $self->{w}, $self->{h});
918
919 $self->_render;
905 } 920 }
906
907 $self->_render;
908 }; 921 };
909} 922}
910 923
911sub _draw { 924sub _draw {
912 my ($self) = @_; 925 my ($self) = @_;
1966 ++$self->{cursor} if $self->{cursor} < length $self->{text}; 1979 ++$self->{cursor} if $self->{cursor} < length $self->{text};
1967 } elsif ($sym == CFPlus::SDLK_HOME) { 1980 } elsif ($sym == CFPlus::SDLK_HOME) {
1968 $self->{cursor} = 0; 1981 $self->{cursor} = 0;
1969 } elsif ($sym == CFPlus::SDLK_END) { 1982 } elsif ($sym == CFPlus::SDLK_END) {
1970 $self->{cursor} = length $text; 1983 $self->{cursor} = length $text;
1984 } elsif ($uni == 21) { # ctrl-u
1985 $text = "";
1986 $self->{cursor} = 0;
1971 } elsif ($uni == 27) { 1987 } elsif ($uni == 27) {
1972 $self->emit ('escape'); 1988 $self->emit ('escape');
1973 } elsif ($uni) { 1989 } elsif ($uni) {
1974 substr $text, $self->{cursor}++, 0, chr $uni; 1990 substr $text, $self->{cursor}++, 0, chr $uni;
1975 } else { 1991 } else {
2956 2972
2957 $self->{texture} ||= new_from_opengl CFPlus::Texture $W, $H, sub { 2973 $self->{texture} ||= new_from_opengl CFPlus::Texture $W, $H, sub {
2958 glClearColor 0, 0, 0, 0; 2974 glClearColor 0, 0, 0, 0;
2959 glClear GL_COLOR_BUFFER_BIT; 2975 glClear GL_COLOR_BUFFER_BIT;
2960 2976
2977 package CFPlus::UI::Base;
2978 local ($draw_x, $draw_y, $draw_w, $draw_h) =
2979 (0, 0, $self->{w}, $self->{h});
2980
2961 my $top = int $self->{children}[1]{range}[0]; 2981 my $top = int $self->{children}[1]{range}[0];
2962 2982
2963 my $paridx = 0; 2983 my $paridx = 0;
2964 my $top_paragraph; 2984 my $top_paragraph;
2965 my $top = int $self->{children}[1]{range}[0]; 2985 my $top = int $self->{children}[1]{range}[0];
3281 3301
3282package CFPlus::UI::Buttonbar; 3302package CFPlus::UI::Buttonbar;
3283 3303
3284our @ISA = CFPlus::UI::HBox::; 3304our @ISA = CFPlus::UI::HBox::;
3285 3305
3286# TODO: should actualyl wrap buttons and other goodies. 3306# TODO: should actually wrap buttons and other goodies.
3287 3307
3288############################################################################# 3308#############################################################################
3289 3309
3290package CFPlus::UI::Menu; 3310package CFPlus::UI::Menu;
3291 3311
3833 } 3853 }
3834 3854
3835 1 3855 1
3836 }; 3856 };
3837 3857
3838 my $tooltip = "$spell->{message}$TOOLTIP_ALL"; 3858 my $tooltip = (CFPlus::asxml $spell->{message}) . $TOOLTIP_ALL;
3839 3859
3840 #TODO: add path info to tooltip 3860 #TODO: add path info to tooltip
3841 #$self->add (6, $row, new CFPlus::UI::Label text => $spell->{path}); 3861 #$self->add (6, $row, new CFPlus::UI::Label text => $spell->{path});
3842 3862
3843 $self->add (0, $row, new CFPlus::UI::Face 3863 $self->add (0, $row, new CFPlus::UI::Face
4121 glLoadIdentity; 4141 glLoadIdentity;
4122 4142
4123 { 4143 {
4124 package CFPlus::UI::Base; 4144 package CFPlus::UI::Base;
4125 4145
4126 ($draw_x, $draw_y, $draw_w, $draw_h) = 4146 local ($draw_x, $draw_y, $draw_w, $draw_h) =
4127 (0, 0, $self->{w}, $self->{h}); 4147 (0, 0, $self->{w}, $self->{h});
4128 }
4129 4148
4130 $self->_draw; 4149 $self->_draw;
4150 }
4131} 4151}
4132 4152
4133############################################################################# 4153#############################################################################
4134 4154
4135package CFPlus::UI; 4155package CFPlus::UI;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines