summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-06-30 08:09:55 +0000
committerOlivier Blin <oblin@mandriva.org>2004-06-30 08:09:55 +0000
commitd0719f26870476db09b7f659995a964b38cba41b (patch)
tree05981968ad0ccf7e98dc93699ad9339fa4532f5a /perl-install
parent08a947dfc2164e1ec95a6428898fb154e6e6b970 (diff)
downloaddrakx-d0719f26870476db09b7f659995a964b38cba41b.tar
drakx-d0719f26870476db09b7f659995a964b38cba41b.tar.gz
drakx-d0719f26870476db09b7f659995a964b38cba41b.tar.bz2
drakx-d0719f26870476db09b7f659995a964b38cba41b.tar.xz
drakx-d0719f26870476db09b7f659995a964b38cba41b.zip
allow the user to use different scales for received and transmitted
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/net_monitor15
1 files changed, 13 insertions, 2 deletions
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index f5f35746a..faa86f811 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -86,6 +86,8 @@ my ($width, $height) = (300, 150);
my $left_border = 50;
my $grid_interval = 30;
+my $use_same_scale = 1;
+
network::netconnect::load_conf($netcnx, $netc, $intf);
network::netconnect::read_net_conf('', $netcnx, $netc);
MDK::Common::Globals::init(in => $in);
@@ -120,6 +122,7 @@ gtkadd($window1->{window},
)
)
),
+ 0, gtksignal_connect(gtkset_active(new Gtk2::CheckButton(N("Use same scale for received and transmitted")), $use_same_scale), clicked => sub { $use_same_scale = !$use_same_scale }),
0, my $statusbar = Gtk2::Statusbar->new
),
);
@@ -464,7 +467,15 @@ sub draw_monitor {
my $maxt = 0;
foreach (@{$o->{stack_t}}) { $maxt = $_ if $_ > $maxt }
- $echr = $echt = $height / max($maxr + $maxt, 1);
+ my ($graph_maxr, $graph_maxt);
+ if ($use_same_scale) {
+ $graph_maxr = $graph_maxt = ($maxr + $maxt)/2;
+ } else {
+ $graph_maxr = $maxr;
+ $graph_maxt = $maxt;
+ }
+ $echr = ($height/2) / max($graph_maxr, 1);
+ $echt = ($height/2) / max($graph_maxt, 1);
my $step = $left_border - 1;
foreach (@{$o->{stack_t}}) {
@@ -521,7 +532,7 @@ sub draw_monitor {
for (my $i = $grid_interval; $i <= $height - $grid_interval; $i += $grid_interval) {
$pixmap->draw_line($gcl, $left_border, $i, $width, $i);
my ($gc2, $text);
- if ($i > $pix_maxt) {
+ if ($i > ($use_same_scale ? $pix_maxt : $height/2)) {
$text = formatXiB(($height-$i)/$echr);
$gc2 = $gcr;
} else {