diff options
-rwxr-xr-x | src/ivymon | 207 |
1 files changed, 181 insertions, 26 deletions
@@ -11,7 +11,7 @@ use vars qw/$opt_help $opt_b $opt_history @opt_bind @opt_send/; my $minW = 860; my $minH = 768; -my $ivy_port = "127.255.255.255:2010"; +my $ivy_port; # undef:=> default value is treated by ivy-perl my $history = 10000; # divers @@ -50,15 +50,133 @@ my $stopFlag = 0; my $appname = 'IvyMon'; my @send_def = - ('CLOCK Pause', - 'CLOCK Start', - 'CLOCK Start time=', - 'CLOCK Stop', - 'CLOCK rate=', - 'CLOCK Tick time=', + ('ClockStop', + 'ClockStart', + 'ClockBackward', + 'ClockForward', + 'SetClock Time=[]:[]:[]', + 'SetClock Rate=[]', + 'GetClockDatas', + 'GetRadarRefresh', + 'GetTrajectory MsgName=[] Flight=[] From=[]', + 'GetPln MsgName=[] Flight=[] From=[]', + 'GetSectorsInfos MsgName=[] Flight=[]', + 'GetPosition MsgName=[] Flight=[] Time=[]:[]:[]', + 'GetOldPositions MsgName=[] Flight=[] Nb=[] ', + 'GetStrip MsgName=[] Flight=[] Sector=[]', + 'GetRange MsgName=[] Flight=[]', + 'GetDuplicate MsgName=[] Flight=[]', + 'GetDataBaseInfos MsgName=[] Cond=[]', + 'GetFlightsWithStrip MsgName=[] Sector=[]', + 'SetStripTime Flight=[] Sector=[] Time=[]:[]', + 'SetSectorIn Flight=[] Sector=[] Time=[]:[]', + 'SetSectorOut Flight=[] Sector=[] Time=[]:[]', + 'SetSectorsInfos Flight=[] List=[]', + 'SetCallSign Flight=[] CallSign=[]', + 'SetTfl Flight=[] Sector=[] Tfl=[]', + 'SetBeforeTrack Flight=[] List=[]', + 'SetAfterTrack Flight=[] List=[]', + 'TranslateTime Flight=[] Shift=[]:[]:[]', + 'TranslateFl Flight=[] Delta=[]', + 'AircraftDirect Flight=[] Beacon=[]', + 'AircraftHeading Flight=[] To=[]', + 'AircraftTurn Flight=[] Angle=[]', + 'AircraftLevel Flight=[] Fl=[]', + 'SetUserEventList Flight=[] EventName=[] List=[]', + 'MergeUserEventList Flight=[] EventName=[] List=[]', + 'GetUserEventList Flight=[] Name=[]', + 'GetUserEventNames MsgName=[] Flight=[]', + 'CancelLastOrder Flight=[]', + 'Discard Flight=[]', + 'Enable Flight=[]', + 'Dump Flight=[]', + 'StripsOnOff Print=yes', + 'StripsOnOff Print=no', + 'TagStrip Flight=[] Sector=[]', + 'PrintTaggedStrips', + 'Debug Flight=[]', + 'FileRead Type=rejeu Name=[]', + 'FileRead Type=simu Name=[]', + 'FileWrite Type=rejeu Name=[]', + 'FileWrite Type=simu Name=[]', + 'FileWrite Type=dump Name=[]', ); -my @bind_def = ('(.*)'); +my @bind_def = ('(.*)', + '(^ClockEvent .*)', + '(^RadarEndEvent)', + '(^TrackMovedEvent .*)', + '(^TrackDiedEvent .*)', + '(^SectorEvent .*)', + '(^BeaconEvent .*)', + '(^LayerEvent .*)', + '(^StripEvent .*)', + '(^PlnEvent .*)', + '(^StcaAlertEvent .*)', + '(^MsawAlertEvent .*)', + '(^ClockStop)', + '(^ClockStart)', + '(^ClockBackward)', + '(^ClockForward)', + '(^SetClock .*)', + '(^GetClockDatas)', + '(^ClockDatas .*)', + '(^GetRadarRefresh)', + '(^RadarRefresh .*)', + '(^GetTrajectory .*)', + '(^Trajectory .*)', + '(^GetPln .*)', + '(^Pln .*)', + '(^GetSectorsInfos .*)', + '(^SectorsInfos .*)', + '(^GetPosition .*)', + '(^Position .*)', + '(^GetOldPositions .*)', + '(^OldPositions .*)', + '(^GetStrip .*)', + '(^Strip .*)', + '(^GetRange .*)', + '(^Range .*)', + '(^GetDuplicate .*)', + '(^Duplicate .*)', + '(^GetDataBaseInfos .*)', + '(^DataBaseInfo .*)', + '(^GetFlightsWithStrip .*)', + '(^FlightsWithStrip .*)', + '(^SetStripTime .*)', + '(^SetSectorIn .*)', + '(^SetSectorOut .*)', + '(^SetSectorsInfos .*)', + '(^SetCallSign .*)', + '(^SetTfl .*)', + '(^SetBeforeTrack .*)', + '(^SetAfterTrack .*)', + '(^TranslateTime .*)', + '(^TranslateFl .*)', + '(^AircraftDirect .*)', + '(^AircraftTurn .*)', + '(^AircraftLevel .*)', + '(^SetUserEventList .*)', + '(^UserEvent .*)', + '(^MergeUserEventList .*)', + '(^SetUserEventList .*)', + '(^MergeUserEventList .*)', + '(^GetUserEventList .*)', + '(^UserEventList .*)', + '(^etUserEventNames .*)', + '(^SetUserEventList .*)', + '(^UserEventNames .*)', + '(^CancelLastOrder .*)', + '(^Discard .*)', + '(^Enable .*)', + '(^Dump .*)', + '(^StripsOnOff .*)', + '(^TagStrip .*)', + '(^PrintTaggedStrips)', + '(^Debug .*)', + '(^FileRead .*)', + '(^FileWrite .*)', + ); my @send = @send_def; my @bind = @bind_def; @@ -74,7 +192,7 @@ if (not GetOptions('-help', '-history=s', '-b=s', '-bind=s@', '-send=s@') or $op print " [-send message1] ... [-send messageN] \n"; print "\n"; print "Options :\n"; - print " -b <[addr]:port> Ivy bus (default is $ivy_port)\n"; + print " -b <[addr]:port> Ivy bus (default is \$IVYBUS or $ivy_port)\n"; print " -history <lenght> Messages list history length (default is $history)\n"; print " -bind <regexp> Ivy binding regular expression\n"; print " -send <string> Ivy message to send\n"; @@ -165,14 +283,14 @@ my $messagesLabel = my $textFont = $mw->fontCreate('H_Normal', -family => 'Helvetica', - -size => 10); + -size => 11); my $textItalicFont = $mw->fontCreate('H_Italic', -family => 'Helvetica', - -size => 10, + -size => 11, -slant => 'italic'); my $textBoldFont = $mw->fontCreate('H_Bold', -family => 'Helvetica', - -size => 10, + -size => 11, -weight => 'bold'); my $messagesText = @@ -186,6 +304,8 @@ my $messagesText = -state => 'disabled')->pack(-fill => 'both', -expand => 1, -side => 'bottom'); +&wheelmousebindings($messagesText); + my $messagesBg = $messagesText->cget(-background); $messagesText->tagConfigure('sender', -background => 'gray50', @@ -209,7 +329,7 @@ my $clientsListbox = -expand => 1, -side => 'top'); $clientsListbox->bind('<1>', [\&selectClient]); - +&wheelmousebindings($clientsListbox); #---------------------------------------------------------------------------------- # Description de la zone Abonnements @@ -266,6 +386,7 @@ my $bindingsList = -anchor => 'w', -expand => 1); $bindingsList->bind('<1>', [\&selectBinding]); +&wheelmousebindings($bindingsList); # creation des boutons my $bindingsClear = @@ -424,6 +545,8 @@ my $sendList = -expand => 1); $sendList->bind('<1>', [\&selectMsgToSend]); $sendList->bind('<Double-1>', [\&addMsgToSend, 1]); +&wheelmousebindings($sendList); + # creation des boutons my $sendClear = $frame132->Button(-text => 'Clear', @@ -451,7 +574,7 @@ my $sendRemove = # les champs de statistiques my $frame211control = $frame21control->Frame()->pack(-side => 'top', - -pady => 47, + -pady => 3, -fill => 'both', -expand => 1); my $frame2111control = @@ -489,27 +612,35 @@ $frame2112control->Label(-textvariable => \$bytes)->pack(-side => 'top', my $frame212control = $frame21control->Frame()->pack(-side => 'bottom', -fill => 'both', + -padx => 10, -expand => 1); my $frame2121control = $frame212control->Frame()->pack(-side => 'left', -fill => 'both', - -ipady => 5, - -padx => 5, -pady => 5, + -pady => 5, -expand => 1); my $frame2122control = $frame212control->Frame()->pack(-side => 'right', - -padx => 5, -pady => 5, - -ipady => 5, + -pady => 5, -fill => 'both', -expand => 1); +my $loadButton = + $frame2121control->Button(-height => 3, + -width => 6, + -command => [\&loadfile, 1], + -state => 'disabled', + -text => 'Load')->pack(-fill => 'both', + -pady => 20, + -side => 'top', + -expand => 0); my $startButton = $frame2121control->Button(-height => 3, -width => 6, -command => [\&start, 1], -state => 'disabled', - -text => 'Start')->pack(-fill => 'both', - -side => 'top', - -expand => 0); + -text => 'Continue')->pack(-fill => 'both', + -side => 'top', + -expand => 0); my $clearButton = $frame2121control->Button(-height => 3, -width => 6, @@ -518,11 +649,20 @@ my $clearButton = -side => 'bottom', -expand => 0); +my $saveButton = + $frame2122control->Button(-height => 3, + -width => 6, + -command => [\&savefile, 1], + -state => 'disabled', + -text => 'Save')->pack(-fill => 'both', + -pady => 20, + -side => 'top', + -expand => 0); my $stopButton = $frame2122control->Button(-height => 3, -width => 6, -command => [\&stop, 1], - -text => 'Pause')->pack(-fill => 'both', + -text => "Pause/\nEdit")->pack(-fill => 'both', -side => 'top', -expand => 0); my $exitButton = @@ -546,7 +686,6 @@ Ivy->init(-loopMode => 'TK', ); my $ivy = Ivy->new(-statusFunc => \&checkClientsStatus); $ivy->start; - $mw->repeat(1000, \&updateDuration); # par defaut on cree les abonnements suivants : @@ -652,12 +791,12 @@ sub selectClient { # Fonctions associees a la gestion de l'affichage des messages #---------------------------------------------------------------------------------- sub updateMessages { - my ($sender, $message, $force) = @_; - return unless $message; + my ($sender, @messages) = @_; + my $message = '"' . join ( '" "', @messages) . '"' ; chomp($message); # cas ou l'on se trouve dans le mode pause, et ou l'on ne force pas l'affichage # des messages => on bufferise - if ($stopFlag and not $force) { + if ($stopFlag) { push(@messagesbuffer, [$sender, $message]); splice(@messagesbuffer, 0, 1) if @messagesbuffer > $history; return; @@ -1195,6 +1334,22 @@ sub unsetEditMode { $bindingsEntry->focus; } +#---------------------------------------------------------------------------------- +# Fonctionsgenerales +#---------------------------------------------------------------------------------- +sub wheelmousebindings { + my $w = shift; + my $count = shift; + my $count = 3 unless $count > 0; + $w->bind('<Control-ButtonPress-4>', sub {$w->yview('scroll', -1, 'page')}); + $w->bind('<Shift-ButtonPress-4>', sub {$w->yview('scroll', -1, 'unit')}); + $w->bind('<ButtonPress-4>', sub {$w->yview('scroll', -$count, 'unit')}); + + $w->bind('<Control-ButtonPress-5>', sub {$w->yview('scroll', 1, 'page')}); + $w->bind('<Shift-ButtonPress-5>', sub {$w->yview('scroll', 1, 'unit')}); + $w->bind('<ButtonPress-5>', sub {$w->yview('scroll', $count, 'unit')}); +} + __END__ =head1 NAME |