From 6d3ec9cf9886aac728f47b3d5f5932cae6b378ee Mon Sep 17 00:00:00 2001 From: etienne Date: Fri, 6 Oct 2006 12:20:37 +0000 Subject: Simplification du mécanisme de régulation. Amélioration du feedback lors d'un changement de T0 en mode rejeu. --- src/ivymon | 46 ++++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index d01b712..848c23c 100755 --- a/src/ivymon +++ b/src/ivymon @@ -183,8 +183,6 @@ my $replay_current_t0; my $replay_current_t; my $replay_data_t0; my $replay_data_t; -my $replay_pause_t; -my $replay_pause_duration = 0; my $replay_maxgap = 0.2; # sec my $replay_regulpct = [50, 20]; # % my $replay_factor = 1000; # msec @@ -2337,14 +2335,7 @@ sub loadfileForReplay { -command => sub { return if $realspeedrate == 1; $realspeedrate = 1; - $replay_data_t0 = $replay_time; - $replay_current_t0 = gettimeofday(); - if ($replay_running == 0) { - $replay_pause_t = $replay_current_t0; - } else { - $replay_pause_t = undef; - } - $replay_pause_duration = 0; + ®ulationReset(); }, -selectcolor => 'white')->pack(-side => 'left'); $ctrl_fm1->Radiobutton(-text => "x2", -indicatoron => 0, @@ -2442,7 +2433,7 @@ sub loadfileForReplay { $message =~ s/\"$//; push(@{$replay_msg{$time}}, $message); $replay_text->insert('end', &replayTime($time)." ".$message."\n", $time); - # when user click on a message, the begin time changes. + # when user click on a message the begin time changes. $replay_text->tagBind($time, '<1>', [sub { my $ti = $_[1]; my $replay_was_running; @@ -2450,17 +2441,17 @@ sub loadfileForReplay { $replay_was_running = 1; &replayStop; } - my $fg = $replay_text->tagCget($ti, -foreground); - my $bg = $replay_text->tagCget($ti, -background); - $replay_text->tagConfigure($_[1], -foreground => 'white', - -background => 'gray50'); + $replay_text->tagConfigure($replay_last_time, + -foreground => $replay_fg_orig, + -background => $replay_bg_orig) + if defined $replay_last_time; + $replay_text->tagConfigure($ti, + -foreground => $replay_fg, + -background => $replay_bg); + $replay_last_time = $ti; $replay_hour = &replayTime($ti); $replay_time = $ti; - $replay_text->after(100, [sub { - $replay_text->tagConfigure($_[0], - -foreground => $fg, - -background => $bg); - }, $ti]); + ®ulationReset(); &replayStart if $replay_was_running; }, $time]); &setProgressbar($line, $step); @@ -2657,10 +2648,6 @@ sub replayStart { my $t = $replay_text; return if $replay_running and not $loopflag; return if $loopflag and not $replay_running; - if (defined $replay_pause_t and $replay_speed == 1) { - $replay_pause_duration += gettimeofday() - $replay_pause_t; - } - $replay_pause_t = undef; $replay_runnable = 0; $replay_running = 1; if ($replay_time > $replay_max_time) { @@ -2709,7 +2696,7 @@ sub replayStart { # continuous mode } else { - my $dt = gettimeofday() - $replay_current_t0 - $replay_pause_duration; + my $dt = gettimeofday() - $replay_current_t0; my $dt2 = sprintf("%.2f", $dt); my $d = sprintf("%.3f", $dt-$data_dt); @@ -2751,7 +2738,7 @@ sub replayStop { $replay_running = 0; $replay_runnable = 1; $replay_text->afterCancel($replay_timer) if defined $replay_timer; - $replay_pause_t = gettimeofday(); + ®ulationReset(); } # end replayStop @@ -2791,6 +2778,13 @@ sub replayTime { #---------------------------------------------------------------------------------- # General functions #---------------------------------------------------------------------------------- +sub regulationReset { + + $replay_data_t0 = undef; + $replay_current_t0 = undef; + +} # end regulationReset + sub enlarge { @packinfo = (); -- cgit v1.1