Browse Source

Taught Search&Edit to remember cursor position and to use home/end keys.

master
DF6FR 14 years ago
parent
commit
86c334abf5
  1. 7
      yfk
  2. 22
      yfksubs.pl

7
yfk

@ -1274,7 +1274,6 @@ if ($aw eq 'm') { # back to menu
last; # break out from while (1) loop
}
elsif ($aw == 0) { # back to QSO list
$editnr = 0;
$aw = 2;
}
@ -1293,8 +1292,9 @@ while ($aw == 2) {
# We have selected search criteria in the QSO-array. Now display a
# scrollable list with only the matching QSOs. The user selects one QSO,
# the number of the QSO (as in the NR field in the database) is returned.
# To remember the position of the last qso edited, we tell the editnr.
$editnr = &choseeditqso(\$weditlog, \@sqso);
$editnr = &choseeditqso(\$weditlog, \@sqso, $editnr);
if ($editnr eq 'm') { # back to MAIN MENU
$status = 2;
@ -1306,7 +1306,8 @@ while ($aw == 2) {
for (0 .. 25) { # clear the QSO and if no results also
$qso[$_] = ''; # sqso
}
@sqso = ();
@sqso = ();
$editnr = 0; # forget last edited qso
$aw = 1; # back to list
}
else {

22
yfksubs.pl

@ -3796,8 +3796,8 @@ sub choseeditqso {
my $ret; # return number
my $goon=1; # becomes 0 when we are done
my $count; # number of entries/QSOs matching
my $pos=1; # position in the QSOs from 1 .. $count
my $pos=$_[2]; # position in the QSOs from 1 .. $count
if ($pos == 0) {$pos = 1;} # last edited qso if not equal 0
my $win = ${$_[0]}; # Window where output goes. height = 17
my $sql; # SQL string with search criteria
my $sql2=' AND 1 ';
@ -3840,6 +3840,13 @@ sub choseeditqso {
$count = $eq->fetchrow_array();
if ($count == 0) { return 0 }; # no QSO to edit-> $editnr = 0.
# calculate offset and aline for possible last edited qso
if ($pos > 17) {
$offset = int(($pos-1) / 17) * 17;
$aline = $pos-1 - $offset;
}
else {$aline = $pos-1;}
do {
my $eq = $dbh->prepare($sql.$sql2." ORDER BY `DATE`, `T_ON` LIMIT $offset, 17;");
@ -3920,6 +3927,17 @@ do {
}
}
elsif ($ch eq KEY_HOME) { # go to first qso
$pos = 1;
$aline = 0;
$offset = 0;
}
elsif ($ch eq KEY_END) { # go to last qso
$pos = $count;
$offset = int(($count-1) / 17) * 17;
$aline = $count-1 - $offset;
}
elsif ($ch eq KEY_F(1)) { # F1 -> Back to main menu
return 'm';
}

Loading…
Cancel
Save