summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Agent.pm17
-rwxr-xr-xsrc/ivycontrolpanel216
2 files changed, 120 insertions, 113 deletions
diff --git a/src/Agent.pm b/src/Agent.pm
index d1a6fc1..9e2e6c8 100644
--- a/src/Agent.pm
+++ b/src/Agent.pm
@@ -6,7 +6,6 @@ use FugueConfig;
use strict;
-
#----------------------------------------------------------------------
#
# class variables and methods
@@ -24,6 +23,7 @@ sub configure {
($mw, $bg, $fg, $selcolor, $pbcolor, $hlbg, $darkbg,
$fontspec, $x0, $y0, $wmax, $dy, $cmin, $rmax, $bus, $coef, $pingThreshold) = @_;
@fontspec = @$fontspec if $fontspec;
+
$off_img = $mw->Bitmap('off', -file => Tk::findINC('led.bmp'),
-foreground => $bg);
$pb_img = $mw->Bitmap('pb', -file => Tk::findINC('led.bmp'),
@@ -242,12 +242,12 @@ sub setposition {
if ($self->{command}) {
$self->{led}->configure(-highlightthickness => 6*$coef);
- $self->{led}->place(-x => $x+3*$coef, -y => $y+3*$coef);
+ $self->{led}->place(-x => $x+3*$coef, '-y' => $y+3*$coef);
} else {
$self->{led}->configure(-highlightthickness => 2*$coef);
- $self->{led}->place(-x => $x+6*$coef, -y => $y+6*$coef);
+ $self->{led}->place(-x => $x+6*$coef, '-y' => $y+6*$coef);
}
- $self->{label}->place(-x => $x + 38, -y => $y2);
+ $self->{label}->place(-x => $x + 38, '-y' => $y2);
} # end setposition
@@ -257,8 +257,8 @@ sub createlabel {
my ($self) = @_;
$self->{led} =
$mw->Label(-image => $off_img,
- -highlightbackground => $hlbg,
- -borderwidth => 0,
+ -highlightbackground => $hlbg,
+ -borderwidth => 0,
);
$self->{label} =
$mw->Label(-text => $self->formatlabel,
@@ -370,8 +370,9 @@ sub _cbOnPress {
my $host = &_hostsmenu($x, $y, $self->{host});
$self->{label}->configure(-foreground => $fg);
return unless $host;
- FugueConfig::launchAgent($self->{appname}, $host,
- $self->{command}, $self->{params}, $bus);
+ FugueConfig::execAgentBackground($self->{appname}, $host,
+ $self->{command}, $self->{params},
+ $bus);
print "$self->{appname} launched\n";
} else {
$mw->bell;
diff --git a/src/ivycontrolpanel b/src/ivycontrolpanel
index e8f1b47..fd2dbc6 100755
--- a/src/ivycontrolpanel
+++ b/src/ivycontrolpanel
@@ -49,13 +49,13 @@ my $coef = 1;
# fonts spec
my @fontspec34 = (-font =>
- '-b&h-lucida-bold-r-normal-sans-34-240-100-100-p-216-iso8859-1');
+ '-b&h-lucida-bold-r-normal-sans-34-240-100-100-p-216-iso8859-1');
my @fontspec24 = (-font =>
- '-b&h-lucida-bold-i-normal-sans-24-240-100-100-p-216-iso8859-1');
+ '-b&h-lucida-bold-i-normal-sans-24-240-100-100-p-216-iso8859-1');
my @fontspec20 = (-font =>
- '-b&h-lucida-bold-r-normal-sans-20-140-100-100-p-127-iso8859-1');
+ '-b&h-lucida-bold-r-normal-sans-20-140-100-100-p-127-iso8859-1');
my @fontspec17 = (-font =>
- '-adobe-helvetica-bold-r-normal--17-120-100-100-p-92-iso10646-1');
+ '-adobe-helvetica-bold-r-normal--17-120-100-100-p-92-iso10646-1');
# colors spec
my $darkbg = '#1E161B';
@@ -88,13 +88,13 @@ my $ivy_version = $Ivy::VERSION;
my $ivy_versionstring = "v$ivy_version";
my $ivy_cvsrevision = 0;
if ($ivy_version =~ s/Revision: (.*)//) {
- $ivy_version = $1;
- $ivy_cvsrevision = 1;
- $ivy_versionstring = "v$ivy_version (cvs revision)";
+ $ivy_version = $1;
+ $ivy_cvsrevision = 1;
+ $ivy_versionstring = "v$ivy_version (cvs revision)";
}
-my $newapi4_18 = 1 if (($ivy_cvsrevision == 1 and $ivy_version ge 1.40) or
- ($ivy_cvsrevision == 0 and $ivy_version ge 4.18));
-
+my $newapi4_18 = 1
+ if (($ivy_cvsrevision == 1 and $ivy_version ge 1.40) or
+ ($ivy_cvsrevision == 0 and $ivy_version ge 4.18));
#---------------------------------------------------------------------------------
#
# parse and test options
@@ -102,8 +102,10 @@ my $newapi4_18 = 1 if (($ivy_cvsrevision == 1 and $ivy_version ge 1.40) or
#---------------------------------------------------------------------------------
Getopt::Long::Configure('pass_through');
-&usage unless Getopt::Long::GetOptions(\%opt, 'b=s', 'nocursor', 'help', 'smallsize',
- 'position=s','pingthreshold=s');
+&usage
+ unless Getopt::Long::GetOptions(\%opt, 'b=s', 'nocursor',
+ 'help', 'smallsize',
+ 'position=s','pingthreshold=s');
&usage(1) if $opt{help};
my ($fuguefile) = @ARGV;
@@ -114,21 +116,20 @@ my ($fuguefile) = @ARGV;
# build the mainwindow
#
#---------------------------------------------------------------------------------
-if ($opt{smallsize})
-{
+if ($opt{smallsize}) {
$width = 640;
$height = 480;
$smallsized = 1;
$coef = 0.620;
@fontspec34 = (-font =>
- '-b&h-lucida-bold-r-normal-sans-20-140-100-100-p-127-iso8859-1');
+ '-b&h-lucida-bold-r-normal-sans-20-140-100-100-p-127-iso8859-1');
@fontspec20 = (-font =>
- '-b&h-lucida-bold-r-normal-sans-12-120-75-75-p-79-iso8859-1');
+ '-b&h-lucida-bold-r-normal-sans-12-120-75-75-p-79-iso8859-1');
@fontspec24 = (-font =>
- '-b&h-lucida-bold-i-normal-sans-15-150-100-100-p-216-iso8859-1');
+ '-b&h-lucida-bold-i-normal-sans-15-150-100-100-p-216-iso8859-1');
@fontspec17 = (-font =>
- '-adobe-helvetica-medium-r-normal--11-80-100-100-p-60-iso10646-1');
+ '-adobe-helvetica-medium-r-normal--11-80-100-100-p-60-iso10646-1');
}
if ($opt{pingthreshold}) {
@@ -144,25 +145,27 @@ my $mw = MainWindow->new (-bg => 'black');
#---------------------------------------------------------------------------------
if ($newapi4_18) {
- IvyIO::init("ivycontrolpanel", $opt{b}, \&connected, \&disconnected, \&pingcb, $mw);
+ IvyIO::init("ivycontrolpanel", $opt{b},
+ \&connected, \&disconnected, \&pingcb, $mw);
} else {
- IvyIO::init("ivycontrolpanel", $opt{b}, \&connected, \&disconnected, undef, $mw);
+ IvyIO::init("ivycontrolpanel", $opt{b},
+ \&connected, \&disconnected, undef, $mw);
}
if ($opt{nocursor}) {
- open(CURSOR, ">/tmp/cursor-ivybanner");
- print CURSOR "#define cursor_width 1\n";
- print CURSOR "#define cursor_height 1\n";
- print CURSOR "#define cursor_x_hot 0\n";
- print CURSOR "#define cursor_y_hot 0 \n";
- print CURSOR "static char cursor_bits[] = { 0x20};\n";
- close(CURSOR);
- $mw->configure(-cursor => ['@'.'/tmp/cursor-ivybanner',
- '/tmp/cursor-ivybanner',
- 'black', 'black']);
- unlink("/tmp/cursor-ivybanner");
+ open(CURSOR, ">/tmp/cursor-ivybanner");
+ print CURSOR "#define cursor_width 1\n";
+ print CURSOR "#define cursor_height 1\n";
+ print CURSOR "#define cursor_x_hot 0\n";
+ print CURSOR "#define cursor_y_hot 0 \n";
+ print CURSOR "static char cursor_bits[] = { 0x20};\n";
+ close(CURSOR);
+ $mw->configure(-cursor => ['@'.'/tmp/cursor-ivybanner',
+ '/tmp/cursor-ivybanner',
+ 'black', 'black']);
+ unlink("/tmp/cursor-ivybanner");
} else {
- $mw->configure(-cursor => 'circle');
+ $mw->configure(-cursor => 'circle');
}
$mw->geometry ($width."x".$height.$opt{position});
$mw->title ('ivycontrolpanel - Ivy '.$ivy_versionstring);
@@ -184,36 +187,37 @@ my $fm_h = $btn_h + 10*$coef;
# widgets attributes
my @frameattr = (-relief => 'flat',
- -highlightthickness => 3*$coef,
- -highlightbackground => $hlbg,
- -highlightcolor => $hlbg,
- -height => $height - $dytop - $dybot,
- -width => $width - $dxleft - $dxright,
- -background => $bg);
+ -highlightthickness => 3*$coef,
+ -highlightbackground => $hlbg,
+ -highlightcolor => $hlbg,
+ -height => $height - $dytop - $dybot,
+ -width => $width - $dxleft - $dxright,
+ -background => $bg);
my @labelattr = (-width => 2, -height => 1,
- @fontspec34,
- -relief => 'flat',
- -highlightthickness => 0,
- -background => $bg,
- -foreground => $fg);
+ @fontspec34,
+ -relief => 'flat',
+ -highlightthickness => 0,
+ -background => $bg,
+ -foreground => $fg);
my @buttonattr = (@labelattr,
- -borderwidth => 1,
- -highlightbackground => $hlbg,
- -highlightthickness => 3*$coef,
- -width => $btn_w, -height => $btn_h,
- -activebackground => $bg,
- -activeforeground => $fg);
+ -borderwidth => 1,
+ -highlightbackground => $hlbg,
+ -highlightthickness => 3*$coef,
+ -width => $btn_w, -height => $btn_h,
+ -activebackground => $bg,
+ -activeforeground => $fg);
my @cbuttonattr = (-relief => 'flat',
- -highlightthickness => 0,
- -background => $darkbg,
- -foreground => $fg,
- @fontspec20,
- -activeforeground => $fg,
- -activebackground => $bg,
- -selectcolor => $selcolor);
+ -highlightthickness => 0,
+ -background => $darkbg,
+ -foreground => $fg,
+ @fontspec20,
+ -activeforeground => $fg,
+ -activebackground => $bg,
+ -selectcolor => $selcolor);
-my $fm1 = $mw->Frame(-background => $darkbg)->pack(-expand => 1, -fill => 'both');
+my $fm1 = $mw->Frame(-background => $darkbg)->pack(-expand => 1,
+ -fill => 'both');
$x = $dxleft;
@@ -222,44 +226,45 @@ $y = $height - $dybot + $ddy;
# build information fields
#---------------------------------------------------------------------------------
my $fm2 = $fm1->Frame(@frameattr,
- -background => $darkbg)->place(-x => $dxleft, -y => $dytop);
+ -background => $darkbg)->place(-x => $dxleft,
+ '-y' => $dytop);
$fm1->Label(-borderwidth => 0,
- -relief => 'flat',
- -highlightthickness => 0,
- -background => $darkbg,
- -foreground => $bg,
- -text => ' [ Bus ] '.(($opt{b}) ? $opt{b} : 'default').' '.
- '[ File ] '.(($fuguefile) ? $fuguefile : 'none').' ',
- @fontspec17,
- -foreground => $hlbg)->place(-x => $dxleft+20*$coef, -y => $dytop-10);
+ -relief => 'flat',
+ -highlightthickness => 0,
+ -background => $darkbg,
+ -foreground => $bg,
+ -text => ' [ Bus ] '.(($opt{b}) ? $opt{b} : 'default').' '.
+ '[ File ] '.(($fuguefile) ? $fuguefile : 'none').' ',
+ @fontspec17,
+ -foreground => $hlbg)->place(-x => $dxleft+20*$coef, '-y' => $dytop-10);
# build traffic rate frame
#---------------------------------------------------------------------------------
my $prevbmp = $mw->Bitmap('prev', -file => Tk::findINC('prev.bmp'),
- -background => $bg,
- -foreground => $hlbg);
+ -background => $bg,
+ -foreground => $hlbg);
my $nextbmp = $mw->Bitmap('next', -file => Tk::findINC('next.bmp'),
- -background => $bg,
- -foreground => $hlbg);
+ -background => $bg,
+ -foreground => $hlbg);
my $btn_prev = $fm1->Button(@buttonattr,
- -image => $prevbmp,
- )->place(-x => $x, -y => $y );
+ -image => $prevbmp,
+ )->place(-x => $x, '-y' => $y );
$x += $btn_w + 15*$coef;
my $fm_lab = $fm1->Frame(@frameattr,
- -width => $fm_w,
- -height => $fm_h)->place(-x => $x, -y => $y);
+ -width => $fm_w,
+ -height => $fm_h)->place(-x => $x, '-y' => $y);
my $lab_rate = $fm_lab->Label(@labelattr,
- -anchor => 'center',
- -text => 1)->place(-x => 7*$coef, -y => 10*$coef);
+ -anchor => 'center',
+ -text => 1)->place(-x => 7*$coef, '-y' => 10*$coef);
$x += $fm_w + 5*$coef;
my $btn_next = $fm1->Button(@buttonattr,
- -image => $nextbmp,
- )->place(-x => $x, -y => $y);
+ -image => $nextbmp,
+ )->place(-x => $x, '-y' => $y);
$x += $btn_w + 15*$coef;
&setloopcommand($btn_prev, \&decrease_rate);
@@ -279,13 +284,14 @@ $x += 90*$coef;
my $xi;
# next/prev buttons
-my $btn_tprev = $fm1->Button(@buttonattr,
- -image => $prevbmp,
- )->place(-x => $x-$fm_w-5, -y => $y + 80*$coef);
+my $btn_tprev =
+ $fm1->Button(@buttonattr,
+ -image => $prevbmp,
+ )->place(-x => $x-$fm_w-5, '-y' => $y + 80*$coef);
my $fm_lab = $fm1->Frame(@frameattr,
- -width => 3*$fm_w,
- -height => $fm_h)->place(-x => $x, -y => $y);
+ -width => 3*$fm_w,
+ -height => $fm_h)->place(-x => $x, '-y' => $y);
# separators
$xi = -13*$coef ;
for (my $i=0; $i<2; $i++) {
@@ -293,21 +299,21 @@ for (my $i=0; $i<2; $i++) {
$fm_lab->Label(@labelattr,
-width => 0,
-anchor => 'center',
- -text => ':')->place(-x => $xi, -y => $ddy);
+ -text => ':')->place(-x => $xi, '-y' => $ddy);
}
# hour, minutes, seconds
$xi = 5*$coef;
my $lab_hour = $fm_lab->Label(@labelattr,
-anchor => 'center',
- -text => '00')->place(-x => $xi, -y => $ddy);
+ -text => '00')->place(-x => $xi, '-y' => $ddy);
$xi += $fm_w;
my $lab_min = $fm_lab->Label(@labelattr,
-anchor => 'center',
- -text => '00')->place(-x => $xi, -y => 10*$coef);
+ -text => '00')->place(-x => $xi, '-y' => 10*$coef);
$xi += $fm_w;
my $lab_sec = $fm_lab->Label(@labelattr,
-anchor => 'center',
- -text => '00')->place(-x => $xi, -y => 10*$coef);
+ -text => '00')->place(-x => $xi, '-y' => 10*$coef);
$lab_hour->bind('<1>', [\&settime, 0]);
$lab_min->bind('<1>', [\&settime, 1]);
@@ -317,7 +323,7 @@ $x += 3*$fm_w + 10*$coef;
my $btn_tnext = $fm1->Button(@buttonattr,
-image => $nextbmp,
- )->place(-x => $x-5, -y => $y + 80*$coef);
+ )->place(-x => $x-5, '-y' => $y + 80*$coef);
@@ -348,12 +354,12 @@ my @pushedbuttonattr = (@buttonattr,
my $playbtn = $fm1->Button(@buttonattr,
-image => $playbmp,
- )->place(-x => $x, -y => $y);
+ )->place(-x => $x, '-y' => $y);
$x += $btn_w + 20*$coef;
my $pausebtn = $fm1->Button(@buttonattr,
-image => $pausebmp,
- )->place(-x => $x, -y => $y );
+ )->place(-x => $x, '-y' => $y );
$x += $btn_w + 20*$coef;
$playbtn->configure(-command => \&play);
@@ -375,7 +381,7 @@ $x = $width - $dxright/2 - $fm_w - 90*$coef;
my $button_lower = $fm1->Button(
@buttonattr,
-image => $lowerbmp,
- )->place(-x => $x, -y => $y );
+ )->place(-x => $x, '-y' => $y );
$button_lower->configure( -command => sub { $mw->lower();});
@@ -390,7 +396,7 @@ my $quitbmp = $mw->Bitmap('quit', -file => Tk::findINC('quit.bmp'),
$fm1->Button(@buttonattr,
-image => $quitbmp,
-command => \&quitdialogbox,
- )->place(-x => $x, -y => $y);
+ )->place(-x => $x, '-y' => $y);
$x -= $fm_w + 10*$coef;
IvyIO::bind_for_kill_all(\&killandquit);
@@ -569,12 +575,12 @@ sub connected {
# called when an ivy agent disconnects.
sub disconnected {
- my ($agent, $host) = @_;
- if ($agent eq 'ivylaunch') {
- $ivylaunch_agent--;
- } elsif ($agent ne 'ivycontrolpanel') {
- Agent->disconnect($agent);
- }
+ my ($agent, $host) = @_;
+ if ($agent eq 'ivylaunch') {
+ $ivylaunch_agent--;
+ } elsif ($agent ne 'ivycontrolpanel') {
+ Agent->disconnect($agent);
+ }
} # end disconnected
@@ -731,10 +737,10 @@ sub display_rate {
$rate =~ s/\.0+$//;
if (length($rate) > 2) {
$lab_rate->configure(-width => 3, @fontspec24);
- $lab_rate->place(-x => 5*$coef, -y => 15*$coef);
+ $lab_rate->place(-x => 5*$coef, '-y' => 15*$coef);
} else {
$lab_rate->configure(-width => 2, @fontspec34);
- $lab_rate->place(-x => 7*$coef, -y => 10*$coef);
+ $lab_rate->place(-x => 7*$coef, '-y' => 10*$coef);
}
$lab_rate->configure(-text => $rate);
if ($rate == 0 and $isplaying) {
@@ -758,7 +764,7 @@ sub display_rate {
sub settime {
my ($lab, $field, $x, $y) = @_;
my %placeinfo = $btn_tprev->placeInfo;
- my $y = $placeinfo{-y};
+ my $y = $placeinfo{'-y'};
if ($isplaying) {
&pause;
$wasplayingBeforeSettingTime = 1;
@@ -766,8 +772,8 @@ sub settime {
if ($selectedtimelabel eq $lab) {
$selectedtimelabel = undef;
$lab->configure(-background => $bg, -foreground => $fg);
- $btn_tprev->place(-y => $y + 80*$coef);
- $btn_tnext->place(-y => $y + 80*$coef);
+ $btn_tprev->place('-y' => $y + 80*$coef);
+ $btn_tnext->place('-y' => $y + 80*$coef);
&unsetloopcommand($btn_tprev);
&unsetloopcommand($btn_tnext);
my $time = $lab_hour->cget(-text).':'.$lab_min->cget(-text).':'.
@@ -785,8 +791,8 @@ sub settime {
}
$lab->configure(-background => $fg, -foreground => $bg);
unless (defined $selectedtimelabel) {
- $btn_tprev->place(-y => $y - 80*$coef);
- $btn_tnext->place(-y => $y - 80*$coef);
+ $btn_tprev->place('-y' => $y - 80*$coef);
+ $btn_tnext->place('-y' => $y - 80*$coef);
}
$selectedtimelabel = $lab;
&setloopcommand($btn_tprev, sub {&decrease_time($lab, $field)});