]> scm.dxcluster.org Git - spider.git/commitdiff
add width changing dx display in console
authorDirk Koopman <djk@tobit.co.uk>
Fri, 19 Nov 2021 16:58:36 +0000 (16:58 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Fri, 19 Nov 2021 16:58:36 +0000 (16:58 +0000)
Changes
cmd/set/columns.pl [new file with mode: 0644]
cmd/show/dx.pl
perl/DXChannel.pm
perl/DXCommandmode.pm
perl/Messages
perl/Spot.pm
perl/console.pl

diff --git a/Changes b/Changes
index 840dd943e459b5a0d66a4dbcfe909d35806e5e94..38ea489651b43ed28ae8f623f64ea7d2300a96bb 100644 (file)
--- 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 <width>" 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 (file)
index 0000000..5575fe3
--- /dev/null
@@ -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));
index bad8ffde0894634b51009a74a63ad903e23e7e17..a2c81a17055174b7bf952bce35f744d5859c4269 100644 (file)
@@ -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);
                                                                                                }
                                                                                        }
                                                                                }
index c35d21ca1517d7d286185fbb1d1426d685793397..cbb5477ab50cdba073201d46e08e3597b734454c 100644 (file)
@@ -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') {
index bcf1bf075b9beda9f40279bb70b59fbcf4f5e008..cd37c5e93c5833638491871427f7f92bba832941 100644 (file)
@@ -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);
index 18df627918ecd962829ce5d3f27c8c7de7b9ab40..c8381dfc570bb55595f217d3fd2e411ca67ed618 100644 (file)
@@ -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 <password> <callsign>',
                                passphrase => 'Passphrase set or changed for $_[0]',
                                passphraseu => 'Passphrase removed for $_[0]',
index e9dd27901364080c84d982a0b29f1c5e1cb01eca..515c462624eefcd7228ca32fe5b05e708bc95500 100644 (file)
@@ -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
index d01cd5390e8a88af39b8324dfe67c76ecd66a999..14c95bac6b14505493d4891098c1a8b117187b7c 100755 (executable)
@@ -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