From 9a1c632f4ef8efc72e862619e3e4ac7a1352289d Mon Sep 17 00:00:00 2001 From: etienne Date: Wed, 14 Nov 2001 14:35:09 +0000 Subject: Les champs de statistique disparaissent. Utilisation de la molette souris. La fonctionnalite d'edition des messages disparait. Alarme sonore quand une recherche recommence au debut. --- src/ivymon | 288 +++++++++++++++++++++++-------------------------------------- 1 file changed, 107 insertions(+), 181 deletions(-) (limited to 'src') diff --git a/src/ivymon b/src/ivymon index be20aa7..e520ea7 100755 --- a/src/ivymon +++ b/src/ivymon @@ -8,7 +8,7 @@ use Getopt::Long; use vars qw/$opt_help $opt_b $opt_history @opt_bind @opt_send/; # geometrie -my $minW = 860; +my $minW = 950; my $minH = 768; my $ivy_port; # undef:=> default value is treated by ivy-perl @@ -217,63 +217,65 @@ $mw->title("IvyMon ($ivy_port)"); push(@bind, @opt_bind); push(@send, @opt_send); #---------------------------------------------------------------------------------- -# La Frame de gauche prend toute la hauteur de l'appli et est composee d'une frame -# ou sont affiches les Messages et une frame ou sont saisis les Abonnements, les -# instructions de Recherche, et les messages a emettre +# La frame du haut $frame1top prend toute la largeur de l'appli et contient un w +# idget Text ou sont affiches les messages #---------------------------------------------------------------------------------- -my $frame1left = + +my $frame1top = $mw->Frame()->pack(-fill => 'both', + -side => 'top', -expand => 1, - -side => 'left'); - -my $frame11messages = - $frame1left->Frame()->pack(-fill => 'both', - -expand => 1, - -padx => 5, -pady => 5); -my $frame12 = - $frame1left->Frame()->pack(-fill => 'both', - -side => 'top', - -expand => 0); -my $frame121bindings = - $frame12->Frame()->pack(-fill => 'y', - -anchor => 'w', - -padx => 5, -pady => 5, - -side => 'left', - -expand => 0); -my $frame122search = - $frame12->Frame()->pack(-fill => 'y', - -anchor => 'w', - -padx => 5, -pady => 5, - -side => 'left', - -expand => 0); - -my $frame13send = - $frame1left->Frame()->pack(-fill => 'y', - -anchor => 'w', - -padx => 5, -pady => 5, - -side => 'bottom', - -expand => 0); + -padx => 5, -pady => 5); + +my $frame11messages = $frame1top; + #---------------------------------------------------------------------------------- -# La Frame de droite prend toute la hauteur de l'appli et est composee d'une frame -# ou sont affiches les Applications connectees et une frame contenant les boutons -# de commande +# La frame du bas $frame2bottom est composee d'une frame Commandes a droite, d'une +# frame Clients au centre et d'une frame regroupant Abonnements, Messages a emettre +# et Recherche #---------------------------------------------------------------------------------- -my $frame2right = - $mw->Frame()->pack(-fill => 'both', - -expand => 0, - -side => 'right'); -my $frame21appli = - $frame2right->Frame()->pack(-fill => 'both', - -expand => 1, - -padx => 5, -pady => 5); +my $frame2bottom = + $mw->Frame()->pack(-fill => 'y', + -side => 'bottom', + -padx => 5, -pady => 5, + -ipadx => 3, -ipady => 3); +my $frame21left = + $frame2bottom->Frame()->pack(-fill => 'both', + -side => 'left', + -expand => 1, + ); +my $frame22center = + $frame2bottom->Frame()->pack(-fill => 'both', + -side => 'left', + -expand => 1, + ); +my $frame23right = + $frame2bottom->Frame()->pack(-fill => 'both', + -side => 'right', + -expand => 1, + ); + +my $frame21appli = $frame22center; -my $frame21control = - $frame2right->Frame(-borderwidth => 3, - -relief => 'groove')->pack(-fill => 'both', - -anchor => 's', - -expand => 0, - -padx => 5, -pady => 5); +my $frame21control = $frame23right; + +my $frame212bottom = $frame21left->Frame()->pack(-fill => 'both', + -side => 'bottom', + ); +my $frame13send = $frame212bottom; + +my $frame2111left = $frame21left->Frame()->pack(-fill => 'both', + -side => 'left', + ); +my $frame2112right = $frame21left->Frame()->pack(-fill => 'both', + -side => 'right', + ); + +my $frame121bindings = $frame2111left; +my $frame122search = $frame2112right; + + #---------------------------------------------------------------------------------- # Description de la zone Messages #---------------------------------------------------------------------------------- @@ -310,12 +312,7 @@ my $messagesBg = $messagesText->cget(-background); $messagesText->tagConfigure('sender', -background => 'gray50', -foreground => 'gray90'); -$messagesText->tagConfigure('info', -foreground => 'sienna'); $messagesText->tagConfigure($appname, -foreground => 'gray40'); -$messagesText->bind('', sub { - my $index = $messagesText->index('insert'); - $messagesText->tagAdd('info', "$index - 1 chars", $index); -}); #---------------------------------------------------------------------------------- # Description de la zone Clients @@ -571,107 +568,68 @@ my $sendRemove = #---------------------------------------------------------------------------------- # Description de a la zone Commande #---------------------------------------------------------------------------------- -# les champs de statistiques -my $frame211control = - $frame21control->Frame()->pack(-side => 'top', - -pady => 3, - -fill => 'both', - -expand => 1); -my $frame2111control = - $frame211control->Frame()->pack(-side => 'left', - -padx => 5, - -fill => 'both', - -expand => 1); -my $frame2112control = - $frame211control->Frame()->pack(-side => 'right', - -fill => 'both', - -expand => 1); - - -$frame2111control->Label(-text => "Duration :")->pack(-side => 'top', - -pady => 3, - -anchor => 'w', - ); -$frame2111control->Label(-text => "Messages :")->pack(-side => 'top', - -pady => 2, - -anchor => 'w'); -$frame2111control->Label(-text => "Bytes :")->pack(-side => 'top', - -pady => 3, - -anchor => 'w'); -$frame2112control->Label(-textvariable => \$fmtduration)->pack(-side => 'top', - -pady => 3, - -anchor => 'w'); -$frame2112control->Label(-textvariable => \$messagesNumber)->pack(-side => 'top', - -pady => 3, - -anchor => 'w'); -$frame2112control->Label(-textvariable => \$bytes)->pack(-side => 'top', - -pady => 3, +# le label titre +my $controlLabel = + $frame21control->Label(-text => "Control :")->pack(-side => 'top', -anchor => 'w'); - -# les boutons -my $frame212control = - $frame21control->Frame()->pack(-side => 'bottom', - -fill => 'both', - -padx => 10, - -expand => 1); -my $frame2121control = - $frame212control->Frame()->pack(-side => 'left', - -fill => 'both', - -pady => 5, - -expand => 1); -my $frame2122control = - $frame212control->Frame()->pack(-side => 'right', - -pady => 5, - -fill => 'both', - -expand => 1); +# la frame de commandes generale +my $frame211control = + $frame21control->Frame(-relief => 'groove', + -borderwidth => 3)->pack(-fill => 'none', + -ipadx => 10, + -ipady => 10, + -side => 'left', + -expand => 1); +# utilisation d'un grid +$frame211control->gridBbox(2, 3); +my $helpButton = + $frame211control->Button(-height => 3, + -width => 5, + -command => [\&loadfile, 1], + -state => 'disabled', + -text => 'Help')->grid(-column => 1, + -row => 1); my $loadButton = - $frame2121control->Button(-height => 3, - -width => 6, - -command => [\&loadfile, 1], + $frame211control->Button(-height => 3, + -width => 5, + -command => [\&loadfile, 1], + -state => 'disabled', + -text => 'Load')->grid(-column => 1, + -row => 2); +my $saveButton = + $frame211control->Button(-height => 3, + -width => 5, + -command => [\&savefile, 1], -state => 'disabled', - -text => 'Load')->pack(-fill => 'both', - -pady => 20, - -side => 'top', - -expand => 0); + -text => 'Save')->grid(-column => 2, + -row => 2); + my $startButton = - $frame2121control->Button(-height => 3, - -width => 6, + $frame211control->Button(-height => 3, + -width => 5, -command => [\&start, 1], -state => 'disabled', - -text => 'Continue')->pack(-fill => 'both', - -side => 'top', - -expand => 0); + -text => 'Continue')->grid(-column => 1, + -row => 3); +my $stopButton = + $frame211control->Button(-height => 3, + -width => 5, + -command => [\&stop, 1], + -text => "Pause")->grid(-column => 2, + -row => 3); my $clearButton = - $frame2121control->Button(-height => 3, - -width => 6, - -command => [\&clearMessages], - -text => "Clear")->pack(-fill => 'both', - -side => 'bottom', - -expand => 0); + $frame211control->Button(-height => 3, + -width => 5, + -command => [\&clearMessages], + -text => "Clear")->grid(-column => 1, + -row => 4); -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/\nEdit")->pack(-fill => 'both', - -side => 'top', - -expand => 0); my $exitButton = - $frame2122control->Button(-height => 3, - -width => 6, - -command => [\&bye], - -text => 'Exit')->pack(-fill => 'both', - -side => 'bottom', - -expand => 0); + $frame211control->Button(-height => 3, + -width => 5, + -command => [\&bye], + -text => 'Exit')->grid(-column => 2, + -row => 4); @@ -686,7 +644,6 @@ Ivy->init(-loopMode => 'TK', ); my $ivy = Ivy->new(-statusFunc => \&checkClientsStatus); $ivy->start; -$mw->repeat(1000, \&updateDuration); # par defaut on cree les abonnements suivants : for my $bind (sort(@bind)) { @@ -832,18 +789,6 @@ sub updateMessages { $messagesText->update; } -sub printInfo { - my $info = shift; - $messagesText->insert('end', "<< $info >>\n"); - my $index = $messagesText->index('end'); - my $len = length($info) + 7; - my $index1 = "$index - 1 lines"; - my $index0 = "$index1 - $len chars"; - $messagesText->tagAdd('info', $index0, $index1); - $messagesText->see('end'); - $messagesText->markSet('insert', 'end'); -} - sub addBindingExpression { $bindingsEntry->insert('insert', '(.*)'); $bindingsEntry->xview('end'); @@ -862,6 +807,7 @@ sub flashMessages { $messagesText->after(100, sub {$messagesText->configure(-background => $messagesBg); }); + $messagesText->bell; } #---------------------------------------------------------------------------------- @@ -1266,11 +1212,6 @@ sub stop { $stopFlag = 1; $startButton->configure(-state => 'normal'); $stopButton->configure(-state => 'disabled'); - if ($flag) { - &setEditMode; - my $fmttime = &formattime($time); - &printInfo("Stopped at $fmttime"); - } } @@ -1283,30 +1224,15 @@ sub start { $messagesText->insert('insert', "\n"); } # puis, on affiche les messages bufferises - &unsetEditMode; for (@messagesbuffer) { &updateMessages(@$_, 1); } - # on affiche le message de reprise - if ($flag) { - &setEditMode; - my $fmttime = &formattime($time); - &printInfo("Restarted at $fmttime"); - &unsetEditMode; - } # puis on re-active l'affichage des messages recus $stopFlag = 0; $stopButton->configure(-state => 'normal'); $startButton->configure(-state => 'disabled'); } -sub updateDuration { - return unless $bindingsFlag; - $time++; - return if $stopFlag; - $duration++; - $fmtduration = &formattime($duration); -} sub formattime { my $duration = shift; -- cgit v1.1