From 8b79cc9889919c92cd6d8253c2dbcf9062a9dd92 Mon Sep 17 00:00:00 2001 From: jquelin Date: Tue, 6 Nov 2007 23:22:06 +0000 Subject: [PATCH] [project @ 144] r7602@merlin: jquelin | 2007-11-07 00:15:42 +0100 allocating one different color per ip --- lib/Language/Befunge/Debugger.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Language/Befunge/Debugger.pm b/lib/Language/Befunge/Debugger.pm index 97abcc4..93dba9c 100644 --- a/lib/Language/Befunge/Debugger.pm +++ b/lib/Language/Befunge/Debugger.pm @@ -129,21 +129,24 @@ sub _on_b_next { if ( ! exists $ips->[$id] ) { # newly created ip - initializing data structure. - # - summary label - $ips->[$id]{label} = $w->{f_ips}->Label( - -text => _ip_to_label($ip,$bef), - -justify => 'left', - -anchor => 'w' - )->pack(-fill=>'x', -expand=>1); - # - decay colors my ($r,$g,$b) = exists $COLORS[$id] ? @{$COLORS[$id]} : (rand(100), rand(100), rand(100)); + my $bgcolor; foreach my $i ( 0 .. $DECAY-1 ) { my $ri = sprintf "%02x", $r + (255-$r) / $DECAY * ($i+1); my $gi = sprintf "%02x", $g + (255-$g) / $DECAY * ($i+1); my $bi = sprintf "%02x", $b + (255-$b) / $DECAY * ($i+1); $tm->tagConfigure( "decay-$id-$i", -bg => "#$ri$gi$bi" ); + $bgcolor = "#$ri$gi$bi" if $i == int($DECAY/2); } + + # - summary label + $ips->[$id]{label} = $w->{f_ips}->Label( + -text => _ip_to_label($ip,$bef), + -justify => 'left', + -anchor => 'w', + -bg => $bgcolor, + )->pack(-fill=>'x', -expand=>1); } # do some color decay. -- 2.11.4.GIT