diff options
author | etienne | 2010-08-10 15:56:16 +0000 |
---|---|---|
committer | etienne | 2010-08-10 15:56:16 +0000 |
commit | 4ff70bb45789dc21d853f6539c4b000401cded03 (patch) | |
tree | baf6c66e576be0dd2dc387223d3dc97c442727b7 /src/ivyreplay | |
parent | a2400e16868829b587b015f8275f62dfd69dbce9 (diff) | |
download | ivymon-4ff70bb45789dc21d853f6539c4b000401cded03.zip ivymon-4ff70bb45789dc21d853f6539c4b000401cded03.tar.gz ivymon-4ff70bb45789dc21d853f6539c4b000401cded03.tar.bz2 ivymon-4ff70bb45789dc21d853f6539c4b000401cded03.tar.xz |
* ivyreplay :
. émission d'un message en double-cliquant dessus
. ajout d'une option -padding définissant la marge verticale
interne d'un message
. corrections :
. l'appli plantait lorsque il y avait moins de 10
lignes à rejouer
. la fenêtre est plus grande au démarrage
. le rejeu en boucle plantait
Diffstat (limited to 'src/ivyreplay')
-rwxr-xr-x | src/ivyreplay | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/src/ivyreplay b/src/ivyreplay index da71b6d..e1ab41b 100755 --- a/src/ivyreplay +++ b/src/ivyreplay @@ -20,10 +20,10 @@ use Getopt::Long; use Tk::CmdLine; use vars qw/$opt_help $opt_b $opt_bus $opt_light $opt_autostart - $opt_repeat $opt_startregexp + $opt_repeat $opt_startregexp $opt_padding $opt_stopregexp $opt_timegranularity $opt_debug/; -our $VERSION = '1.22'; +our $VERSION = '1.24'; # geometry @@ -64,23 +64,24 @@ my $replay_fg_orig; my $replay_hour; $opt_startregexp = '^ClockStart\$'; $opt_stopregexp = '^ClockStop\$'; +my $padding = 2; #---------------------------------------------------------------------------------- # command line options management #---------------------------------------------------------------------------------- -Tk::CmdLine::SetArguments(-font => '7x14'); +Tk::CmdLine::SetArguments(-font => '-Misc-Fixed-Medium-R-Normal--14-130-75-75-C-70-ISO8859-1'); Tk::CmdLine::SetArguments(); if (not GetOptions('-help', '-b=s', '-bus=s', '-light', '-repeat', '-startregexp=s', '-debug', '-timegranularity=s', - '-autostart', '-stopregexp=s') or $opt_help) { + '-autostart', '-stopregexp=s', '-padding=s') or $opt_help) { print "\n"; print "IvyReplay version $VERSION\n"; print "\n"; print "Usage: ivyreplay [-b[us] bus] [-help]\n"; - print " [-autostart] [-light]\n"; + print " [-autostart] [-light] [-padding int>0]\n"; print " [-repeat] [-timegranularity float>0]\n"; print " [-startregexp regexp] [-stopregexp regexp]\n"; print " [standard X11 options...]\n"; @@ -92,6 +93,8 @@ if (not GetOptions('-help', '-b=s', '-bus=s', '-light', print " -autostart If set, messages are replayed as soon as the\n"; print " input file is loaded\n"; print " -repeat If set, repeat infinitely the replay sequence\n"; + print " -padding Additionnal space in px above and below text lines\n"; + print " (2 by default)\n"; print " -timegranularity Time granularity (in second) for replaying\n"; print " messages (1 by default)\n"; print " -startregexp <regexp> Regexp to match for starting replay\n"; @@ -103,7 +106,7 @@ if (not GetOptions('-help', '-b=s', '-bus=s', '-light', exit ; } -my ($minW, $minH) = (defined $opt_light) ? (800, 50) : (800, 100); +my ($minW, $minH) = (defined $opt_light) ? (850, 50) : (850, 200); $replay_repeat = $opt_repeat; if ($opt_bus) { @@ -134,7 +137,8 @@ if ($replay_time_granularity >= 1) { $replay_time_decimalplaces = length($replay_time_decimalplaces); } $replay_hour = &replayTime(); - + +$padding = $opt_padding if $opt_padding > 0; #================================================================================= # @@ -144,7 +148,7 @@ $replay_hour = &replayTime(); my $mw = MainWindow->new(); $mw->title($title); - +$mw->geometry($minW."x".$minH); $mw->minsize($minW, $minH); #---------------------------------------------------------------------------------- @@ -273,9 +277,9 @@ sub build { # build replay window $replay_text = $mw->Scrolled('Text', -scrollbars => 'e', - -spacing1 => 2, + -spacing1 => $padding, -spacing2 => 0, - -spacing3 => 2, + -spacing3 => $padding, )->pack(-fill => 'both', -expand => 1, -side => 'bottom'); @@ -442,7 +446,9 @@ sub displayMessages { $replay_text->insert('end', &replayTime($time)." ".$message."\n", $time); $line++; - &setProgressbar($line/$steps) if $line % $steps == 0; + if ($steps != 0) { + &setProgressbar($line/$steps) if $line % $steps == 0; + } # when user click on a message the begin time changes. $replay_text->tagBind($time, '<1>', [sub { my $ti = $_[1]; @@ -464,6 +470,10 @@ sub displayMessages { ®ulationReset(); &replayStart if $replay_was_running; }, $time]); + # when user double-click on a message, he sends it. + $replay_text->tagBind($time, '<Double-1>', sub { + $ivy->sendMsgs($message); + }); } } $replay_text->configure(-state => 'disabled') if $replay_text; @@ -513,6 +523,8 @@ sub replayStart { if ($replay_time > $replay_max_time) { if ($replay_repeat == 1) { $replay_time = $replay_min_time; + $replay_data_t0 = $replay_time; + $replay_current_t0 = gettimeofday(); } else { $t->tagConfigure($replay_last_time, -foreground => $replay_fg_orig, |