From: Dirk Koopman Date: Fri, 19 Nov 2021 16:58:36 +0000 (+0000) Subject: add width changing dx display in console X-Git-Url: http://dxcluster.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=4746cf71bae031c57c24600713d7cfc281d71e20;p=spider.git add width changing dx display in console --- diff --git a/Changes b/Changes index 840dd943..38ea4896 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,11 @@ +19Nov21======================================================================= +1. Add the ability of console.pl to resize and have dx spots also resize so + that the comment field's size will increase accordingly. Sh/dx amd sh/mydx + also work similarly. If you make the console width smaller or wider then + spots already on the screen will not resize. +2. For client programs that parse the output (why? use set/ve7cc to get more + easily machine parsed output), a new command "set/columns " is + available. 18Nov21======================================================================= 1. Add a dx spot cache which will store 2 days worth (configurable) of spots. This is then used by the vast majority of simple sh/dx queries without diff --git a/cmd/set/columns.pl b/cmd/set/columns.pl new file mode 100644 index 00000000..5575fe3b --- /dev/null +++ b/cmd/set/columns.pl @@ -0,0 +1,12 @@ +# +# set the page width for this invocation of the client +# +# Copyright (c) 2021 - Dirk Koopman G1TLH +# +# +# +my $self = shift; +my $l = shift; +$l = 80 if $l < 80; +$self->width($l); +return (1, $self->msg('pagewidth', $l)); diff --git a/cmd/show/dx.pl b/cmd/show/dx.pl index bad8ffde..a2c81a17 100644 --- a/cmd/show/dx.pl +++ b/cmd/show/dx.pl @@ -175,7 +175,7 @@ sub handle push @out, DXCommandmode::format_dx_spot($self, @$ref); } else { - push @out, Spot::formatl(@$ref); + push @out, Spot::formatl($self->{width}, @$ref); } } } @@ -197,7 +197,7 @@ sub handle push @out, DXCommandmode::format_dx_spot($self, @$ref); } else { - push @out, Spot::formatl(@$ref); + push @out, Spot::formatl($self->{width}, @$ref); } } } diff --git a/perl/DXChannel.pm b/perl/DXChannel.pm index c35d21ca..cbb5477a 100644 --- a/perl/DXChannel.pm +++ b/perl/DXChannel.pm @@ -718,6 +718,8 @@ sub process_one $self->enhanced($line); } elsif ($sort eq 'A' || $sort eq 'O' || $sort eq 'W') { $self->start($line, $sort); + } elsif ($sort eq 'C') { + $self->width($line); # change number of columns } elsif ($sort eq 'Z') { $self->disconnect; } elsif ($sort eq 'D') { diff --git a/perl/DXCommandmode.pm b/perl/DXCommandmode.pm index bcf1bf07..cd37c5e9 100644 --- a/perl/DXCommandmode.pm +++ b/perl/DXCommandmode.pm @@ -996,7 +996,7 @@ sub format_dx_spot my $t = ztime($_[2]); my $loc = ''; - my $clth = 30; + my $clth = 30 + $self->{width} - 80; # allow comment to grow according the screen width # --$clth if $self->{consort} eq 'local'; my $comment = substr (($_[3] || ''), 0, $clth); diff --git a/perl/Messages b/perl/Messages index 18df6279..c8381dfc 100644 --- a/perl/Messages +++ b/perl/Messages @@ -248,7 +248,8 @@ package DXM; ok => 'Operation successful', outconn => 'Outstanding connect to $_[0]', page => 'Press Enter to continue, A to abort ($_[0] lines) >', - pagelth => 'Page Length is now $_[0]', + pagelth => 'Page Length is now $_[0] lines', + pagewidth => 'Page width is now $_[0] columns', passerr => 'Please use: SET/PASS ', passphrase => 'Passphrase set or changed for $_[0]', passphraseu => 'Passphrase removed for $_[0]', diff --git a/perl/Spot.pm b/perl/Spot.pm index e9dd2790..515c4626 100644 --- a/perl/Spot.pm +++ b/perl/Spot.pm @@ -458,9 +458,15 @@ sub ftor # format a spot for user output in list mode sub formatl { - my $t = ztime($_[2]); - my $d = cldate($_[2]); - return sprintf "%8.1f %-11s %s %s %-28.28s%7s>", $_[0], $_[1], $d, $t, ($_[3]||''), "<$_[4]" ; + my $t = ztime($_[3]); + my $d = cldate($_[3]); + my $width = ($_[0] ? $_[0] : 80) - 80 + 28; + my $comment = $_[4] || ''; + $comment = substr $comment, 0, $width if length $comment > $width; + $comment .= ' ' x ($width - length($comment)) if $comment < $width; + +# return sprintf "%8.1f %-11s %s %s %-28.28s%7s>", $_[0], $_[1], $d, $t, ($_[3]||''), "<$_[4]" ; + return sprintf "%8.1f %-11s %s %s ${comment}%7s>", $_[1], $_[2], $d, $t, "<$_[5]" ; } # enter the spot for dup checking and return true if it is already a dup diff --git a/perl/console.pl b/perl/console.pl index d01cd539..14c95bac 100755 --- a/perl/console.pl +++ b/perl/console.pl @@ -134,6 +134,7 @@ sub doresize $inscroll = 0; $spos = @sh < $pagel ? 0 : @sh - $pagel; show_screen(); + $conn->send_later("C$call|$cols") if $conn; } # cease communications