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.364 by root, Sat Dec 23 10:18:27 2006 UTC vs.
Revision 1.367 by root, Fri Apr 27 00:59:14 2007 UTC

22our $TOOLTIP_WATCHER = Event->idle (min => 1/60, cb => sub { 22our $TOOLTIP_WATCHER = Event->idle (min => 1/60, cb => sub {
23 if (!$GRAB) { 23 if (!$GRAB) {
24 for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) { 24 for (my $widget = $HOVER; $widget; $widget = $widget->{parent}) {
25 if (length $widget->{tooltip}) { 25 if (length $widget->{tooltip}) {
26 if ($TOOLTIP->{owner} != $widget) { 26 if ($TOOLTIP->{owner} != $widget) {
27 $TOOLTIP->{owner}->emit ("tooltip_hide") if $TOOLTIP->{owner};
27 $TOOLTIP->hide; 28 $TOOLTIP->hide;
28 29
29 $TOOLTIP->{owner} = $widget; 30 $TOOLTIP->{owner} = $widget;
31 $TOOLTIP->{owner}->emit ("tooltip_show") if $TOOLTIP->{owner};
30 32
31 return if $ENV{CFPLUS_DEBUG} & 8; 33 return if $ENV{CFPLUS_DEBUG} & 8;
32 34
33 my $tip = $widget->{tooltip}; 35 my $tip = $widget->{tooltip};
34 36
42 } 44 }
43 } 45 }
44 } 46 }
45 47
46 $TOOLTIP->hide; 48 $TOOLTIP->hide;
49 $TOOLTIP->{owner}->emit ("tooltip_hide") if $TOOLTIP->{owner};
47 delete $TOOLTIP->{owner}; 50 delete $TOOLTIP->{owner};
48}); 51});
49 52
50sub get_layout { 53sub get_layout {
51 my $layout; 54 my $layout;
1966 my $mod = $ev->{mod}; 1969 my $mod = $ev->{mod};
1967 my $sym = $ev->{sym}; 1970 my $sym = $ev->{sym};
1968 my $uni = $ev->{unicode}; 1971 my $uni = $ev->{unicode};
1969 1972
1970 my $text = $self->get_text; 1973 my $text = $self->get_text;
1974
1975 $self->{cursor} = List::Util::max 0, List::Util::min $self->{cursor}, length $text;
1971 1976
1972 if ($uni == 8) { 1977 if ($uni == 8) {
1973 substr $text, --$self->{cursor}, 1, "" if $self->{cursor}; 1978 substr $text, --$self->{cursor}, 1, "" if $self->{cursor};
1974 } elsif ($uni == 127) { 1979 } elsif ($uni == 127) {
1975 substr $text, $self->{cursor}, 1, ""; 1980 substr $text, $self->{cursor}, 1, "";
2830 #font => default_font 2835 #font => default_font
2831 @_, 2836 @_,
2832 2837
2833 layout => (new CFPlus::Layout), 2838 layout => (new CFPlus::Layout),
2834 par => [], 2839 par => [],
2840 max_par => 0,
2835 height => 0, 2841 height => 0,
2836 children => [ 2842 children => [
2837 (new CFPlus::UI::Empty expand => 1), 2843 (new CFPlus::UI::Empty expand => 1),
2838 (new CFPlus::UI::Slider vertical => 1), 2844 (new CFPlus::UI::Slider vertical => 1),
2839 ], 2845 ],
2962 wrapped => 1, 2968 wrapped => 1,
2963 }; 2969 };
2964 2970
2965 $self->add (@{ $para->{widget} }) if @{ $para->{widget} }; 2971 $self->add (@{ $para->{widget} }) if @{ $para->{widget} };
2966 push @{$self->{par}}, $para; 2972 push @{$self->{par}}, $para;
2973 }
2974
2975 if (my $max = $self->{max_par}) {
2976 shift @{$self->{par}} while @{$self->{par}} > $max;
2967 } 2977 }
2968 2978
2969 $self->{need_reflow}++; 2979 $self->{need_reflow}++;
2970 $self->update; 2980 $self->update;
2971} 2981}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines