summaryrefslogtreecommitdiff
path: root/src/ivymon
diff options
context:
space:
mode:
Diffstat (limited to 'src/ivymon')
-rwxr-xr-xsrc/ivymon127
1 files changed, 103 insertions, 24 deletions
diff --git a/src/ivymon b/src/ivymon
index e34450c..9af7002 100755
--- a/src/ivymon
+++ b/src/ivymon
@@ -14,11 +14,13 @@ use Carp;
use strict 'vars';
use Getopt::Long;
use Tk::CmdLine;
-use vars qw/$opt_help $opt_b $opt_bus $opt_history @opt_bind @opt_send/;
+use vars qw/$opt_help $opt_b $opt_bus $opt_history @opt_bind @opt_send $opt_size $opt_undersize/;
# geometry
my $minW = 1024;
my $minH = 768;
+my $smallsized = 0;
+my $coef = 1;
my $ivy_port; # undef:=> default value is treated by ivy-perl
my $history = 200000;
@@ -98,7 +100,7 @@ Tk::CmdLine::SetArguments(-font => '7x14');
Tk::CmdLine::SetArguments();
if (not GetOptions('-help', '-history=s', '-b=s', '-bus=s', '-bind=s@',
- '-send=s@') or $opt_help) {
+ '-send=s@', '-size=s', '-undersize') or $opt_help) {
print "Usage: ivymon [-b[us] bus] [-help] [-history length]\n";
print " [-bind regexp1] ... [-bind regexpN] \n";
print " [-send message1] ... [-send messageN] \n";
@@ -110,6 +112,8 @@ if (not GetOptions('-help', '-history=s', '-b=s', '-bus=s', '-bind=s@',
"(default $history messages)\n";
print " -bind <regexp> Ivy binding regular expression\n";
print " -send <string> Ivy message to send\n";
+ print " -size <VGA|SVGA|XGA...> Set the size of the IvyMon window, see man (default=XGA)\n";
+ print " -undersize Slightly reduce the IvyMon window.\n";
print "\n";
exit ;
@@ -132,6 +136,53 @@ push(@effectivebind, @opt_bind);
push(@bind_def, @opt_bind);
push(@send_def, @opt_send);
+#===================================
+#
+# Size options
+
+if($opt_size eq "UXGA" || $opt_size eq "1600") {
+ $minW = 1600;
+ $minH = 1200;
+ $smallsized = 0;
+ $coef = 1.2;
+ Tk::CmdLine::SetArguments(-font => '10x20');
+ Tk::CmdLine::SetArguments();
+}elsif($opt_size eq "SXGA" || $opt_size eq "1280") {
+ $minW = 1280;
+ $minH = 1024;
+ $smallsized = 0;
+ $coef = 1.1;
+ Tk::CmdLine::SetArguments(-font => '8x13');
+ Tk::CmdLine::SetArguments();
+}elsif($opt_size eq "XGA" || $opt_size eq "1024") {
+ $minW = 1024;
+ $minH = 768;
+ $smallsized = 1;
+ $coef = 1;
+ Tk::CmdLine::SetArguments(-font => '7x14');
+ Tk::CmdLine::SetArguments();
+}elsif($opt_size eq "SVGA" || $opt_size eq "800") {
+ $minW = 800;
+ $minH = 600;
+ $smallsized = 1;
+ $coef = 0.64;
+ Tk::CmdLine::SetArguments(-font => '6x10');
+ Tk::CmdLine::SetArguments();
+}elsif($opt_size eq "VGA" || $opt_size eq "640"){
+ $minW = 640;
+ $minH = 480;
+ $smallsized = 1;
+ $coef = 0.48;
+ Tk::CmdLine::SetArguments(-font => '5x7');
+ Tk::CmdLine::SetArguments();
+}
+
+if($opt_undersize)
+{
+ $minW -= 10;
+ $minH -= 30;
+}
+
#=================================================================================
#
# H M I
@@ -155,19 +206,19 @@ my $top_fm =
$mw->Frame()->pack(-fill => 'both',
-side => 'top',
-expand => 1,
- -padx => 5, -pady => 5);
+ -padx => 5*$coef, -pady => 5*$coef);
my $bottom_fm =
$mw->Frame()->pack(-fill => 'y',
-side => 'bottom',
- -padx => 5, -pady => 5,
+ -padx => 5*$coef, -pady => 5*$coef,
);
my $bindings_fm =
$bottom_fm->LabFrame(-label => 'Bindings : ',
-labelside => 'acrosstop',
-borderwidth => 3)->pack(-fill => 'both',
-side => 'left',
- -padx => 5,
+ -padx => 5*$coef,
-expand => 1,
);
my $clients_fm =
@@ -176,7 +227,7 @@ my $clients_fm =
-borderwidth => 3)->pack(-fill => 'both',
-side => 'left',
-expand => 1,
- -padx => 5,
+ -padx => 5*$coef,
);
my $send_fm =
$bottom_fm->LabFrame(-label => 'Messages to send : ',
@@ -184,7 +235,7 @@ my $send_fm =
-borderwidth => 3)->pack(-fill => 'both',
-side => 'left',
-expand => 1,
- -padx => 5,
+ -padx => 5*$coef,
);
my $searchandcontrol_fm = $bottom_fm->Frame()->pack(-side => 'right');
my $search_fm =
@@ -192,14 +243,14 @@ my $search_fm =
-labelside => 'acrosstop',
-borderwidth => 3)->pack(-fill => 'none',
-side => 'top',
- -padx => 5,
+ -padx => 5*$coef,
-expand => 1);
my $control_fm =
$searchandcontrol_fm->LabFrame(-label => 'Control : ',
-labelside => 'acrosstop',
-borderwidth => 3)->pack(-fill => 'none',
-side => 'bottom',
- -padx => 5,
+ -padx => 5*$coef,
-expand => 1);
my $progressbar =
@@ -213,7 +264,7 @@ my $progressbar =
)->pack(#-fill => 'both',
-side => 'right',
#-expand => 1,
- -padx => 5,
+ -padx => 5*$coef,
);
#----------------------------------------------------------------------------------
@@ -263,7 +314,7 @@ my $messagesMaxLabel =
my $messagesText =
$top_fm->Scrolled(Text,
-scrollbars => 'e',
- -height => 18,
+ -height => 18*$coef,
-spacing1 => 2,
-spacing2 => 0,
-spacing3 => 2,
@@ -322,12 +373,12 @@ $messagesCounterValue->repeat(1000, sub {
# Bindings area
#----------------------------------------------------------------------------------
my $bindingsEntry =
- $bindings_fm->Entry(-width => 30)->pack(-fill => 'x',
+ $bindings_fm->Entry(-width => 30*$coef)->pack(-fill => 'x',
-side => 'top',
-anchor => 'w',
-ipady => 3,
-expand => 0,
- -pady => 5);
+ -pady => 5*$coef);
$bindingsEntry->bind('<Escape>' => [\&addBindingExpression]);
$bindingsEntry->bind('<Return>' => [\&addBinding]);
@@ -342,7 +393,7 @@ my $bindingsList =
$bindings_fm->Scrolled(Listbox,
-scrollbars => 'osoe',
-height => 4,
- -width => 30)->pack(-fill => 'y',
+ -width => 30*$coef)->pack(-fill => 'y',
-side => 'top',
-anchor => 'w',
-expand => 1);
@@ -354,7 +405,7 @@ my $effectivebindingsList =
$bindings_fm->Scrolled(Listbox,
-scrollbars => 'osoe',
-height => 4,
- -width => 30)->pack(-fill => 'y',
+ -width => 30*$coef)->pack(-fill => 'y',
-side => 'bottom',
-anchor => 'w',
-expand => 1);
@@ -376,10 +427,17 @@ $clientsListbox->bind('<Double-1>', [\&showClientBindings]);
my $clientsButtons_fm = $clients_fm->Frame(
)->pack(-fill => 'both', -expand => 1, -side => 'bottom');
+
+my $clientsSeeBindings_btnmsg = "See bindings";
+
+if($smallsized){
+ $clientsSeeBindings_btnmsg = "Bindings";
+}
+
my $clientsSeeBindings_btn =
$clientsButtons_fm->Button(-command => [\&showClientBindings],
-state => 'disabled',
- -text => "See bindings")->pack(-side => 'left');
+ -text => $clientsSeeBindings_btnmsg)->pack(-side => 'left');
my $clientsKill_btn =
$clientsButtons_fm->Button(-command => [\&killClient],
-state => 'disabled',
@@ -391,38 +449,50 @@ my $clientsKill_btn =
#----------------------------------------------------------------------------------
my $sendEntry =
- $send_fm->Entry(-width => 40)->pack(-fill => 'x',
+ $send_fm->Entry(-width => 40*$coef)->pack(-fill => 'x',
-side => 'top',
-anchor => 'w',
-ipady => 3,
-expand => 0,
- -pady => 5);
+ -pady => 5*$coef);
my $send2_fm = $send_fm->Frame()->pack(-side => 'top',
-expand => 1,
-fill => 'both');
+
+my $clockstartButtonmsg = "Clock Start";
+my $clockstopButtonmsg = "Clock Stop";
+my $clockbackCheckButtonmsg = "Backward";
+
+if($smallsized){
+# $clockstartButtonmsg = "Start";
+ $clockstartButtonmsg = "Go";
+ $clockstopButtonmsg = "Stop";
+ $clockbackCheckButtonmsg = "Back";
+}
+
my $clockstartButton =
$send2_fm->Button(-height => 1,
-command => [\&clockstart],
- -text => "Clock Start")->grid(-column => 1,
+ -text => $clockstartButtonmsg)->grid(-column => 1,
-row => 1);
my $clockstopButton =
$send2_fm->Button(-height => 1,
-command => [\&clockstop],
- -text => "Clock Stop")->grid(-column => 2,
+ -text => $clockstopButtonmsg)->grid(-column => 2,
-row => 1);
my $clockbackCheckbutton =
$send2_fm->Checkbutton(-selectcolor => undef,
-indicatoron => 0,
-command => [\&clockswitch],
-variable => \$clockbackwardflag,
- -text => "Backward")->grid(-column => 3,
+ -text => $clockbackCheckButtonmsg)->grid(-column => 3,
-row => 1,
- -ipadx => 10,
+ -ipadx => 10*$coef,
-sticky => 'nsew');
my $sendList =
$send_fm->Scrolled(Listbox,
-scrollbars => 'osoe',
- -width => 40)->pack(-fill => 'y',
+ -width => 40*$coef)->pack(-fill => 'y',
-anchor => 'w',
-side => 'bottom',
-expand => 1);
@@ -2059,6 +2129,7 @@ ivymon - a graphical application for monitoring Ivy
=head1 SYNOPSIS
B<ivymon> [B<-b> ivybus] [B<-help>] [B<-history> size]
+ [B<-size> window size] [B<-undersize|noundersize>]
[B<-bind> messageB<1>] ... [B<-bind> messageB<N>]
[B<-send> regexpB<1>] ... [B<-send> regexpB<N>] ...
[standard X11 options...]
@@ -2096,6 +2167,14 @@ Gets some help
Sets the history size of messages window (default: 200000). If ivymon receives more messages, they won't be displayed neither stored.
+=item B<-size> window size
+
+Sets the size of the IvyMon window. Can be VGA or 640, SVGA or 800, XGA or 1024, SXGA or 1280, UXGA or 1600. Default is XGA (1024x768).
+
+=item B<-undersize|noundersiez>
+
+Slightly reduce the IvyMon window to fit it in screen with borders of the window manager. Default: noundersize.
+
=item B<-bind> regular_expression
Subscribes to ivy messages, by using regular expression. This option may be used several times.
@@ -2109,7 +2188,7 @@ Adds an ivy message in the list of potential messages to send. This option may b
=head1 EXAMPLE
-ivymon -b 10.192.36.255:3456 -history 20000 -bind 'PLN:(.*) SectorActivation sector=(.*)' -bind 'CLOCK start' -send 'TRAFFIC RadarEnd' -send 'AIRCRAFT: Activated'
+ivymon -b 10.192.36.255:3456 -history 20000 -bind 'PLN:(.*) SectorActivation sector=(.*)' -bind 'CLOCK start' -send 'TRAFFIC RadarEnd' -send 'AIRCRAFT: Activated' -size SVGA -undersize
=head1 AUTHORS