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.348 by root, Thu Aug 17 01:27: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) = @_;
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;
1971 } elsif ($uni == 21) { # ctrl-u 1984 } elsif ($uni == 21) { # ctrl-u
1972 $text = ""; 1985 $text = "";
1986 $self->{cursor} = 0;
1973 } elsif ($uni == 27) { 1987 } elsif ($uni == 27) {
1974 $self->emit ('escape'); 1988 $self->emit ('escape');
1975 } elsif ($uni) { 1989 } elsif ($uni) {
1976 substr $text, $self->{cursor}++, 0, chr $uni; 1990 substr $text, $self->{cursor}++, 0, chr $uni;
1977 } else { 1991 } else {
2958 2972
2959 $self->{texture} ||= new_from_opengl CFPlus::Texture $W, $H, sub { 2973 $self->{texture} ||= new_from_opengl CFPlus::Texture $W, $H, sub {
2960 glClearColor 0, 0, 0, 0; 2974 glClearColor 0, 0, 0, 0;
2961 glClear GL_COLOR_BUFFER_BIT; 2975 glClear GL_COLOR_BUFFER_BIT;
2962 2976
2977 package CFPlus::UI::Base;
2978 local ($draw_x, $draw_y, $draw_w, $draw_h) =
2979 (0, 0, $self->{w}, $self->{h});
2980
2963 my $top = int $self->{children}[1]{range}[0]; 2981 my $top = int $self->{children}[1]{range}[0];
2964 2982
2965 my $paridx = 0; 2983 my $paridx = 0;
2966 my $top_paragraph; 2984 my $top_paragraph;
2967 my $top = int $self->{children}[1]{range}[0]; 2985 my $top = int $self->{children}[1]{range}[0];
3283 3301
3284package CFPlus::UI::Buttonbar; 3302package CFPlus::UI::Buttonbar;
3285 3303
3286our @ISA = CFPlus::UI::HBox::; 3304our @ISA = CFPlus::UI::HBox::;
3287 3305
3288# TODO: should actualyl wrap buttons and other goodies. 3306# TODO: should actually wrap buttons and other goodies.
3289 3307
3290############################################################################# 3308#############################################################################
3291 3309
3292package CFPlus::UI::Menu; 3310package CFPlus::UI::Menu;
3293 3311
3835 } 3853 }
3836 3854
3837 1 3855 1
3838 }; 3856 };
3839 3857
3840 my $tooltip = "$spell->{message}$TOOLTIP_ALL"; 3858 my $tooltip = (CFPlus::asxml $spell->{message}) . $TOOLTIP_ALL;
3841 3859
3842 #TODO: add path info to tooltip 3860 #TODO: add path info to tooltip
3843 #$self->add (6, $row, new CFPlus::UI::Label text => $spell->{path}); 3861 #$self->add (6, $row, new CFPlus::UI::Label text => $spell->{path});
3844 3862
3845 $self->add (0, $row, new CFPlus::UI::Face 3863 $self->add (0, $row, new CFPlus::UI::Face
4123 glLoadIdentity; 4141 glLoadIdentity;
4124 4142
4125 { 4143 {
4126 package CFPlus::UI::Base; 4144 package CFPlus::UI::Base;
4127 4145
4128 ($draw_x, $draw_y, $draw_w, $draw_h) = 4146 local ($draw_x, $draw_y, $draw_w, $draw_h) =
4129 (0, 0, $self->{w}, $self->{h}); 4147 (0, 0, $self->{w}, $self->{h});
4130 }
4131 4148
4132 $self->_draw; 4149 $self->_draw;
4150 }
4133} 4151}
4134 4152
4135############################################################################# 4153#############################################################################
4136 4154
4137package CFPlus::UI; 4155package CFPlus::UI;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines