Merge pull request #449 from OH1KH/squash_reverse_bandmap

Fix to Band Map
This commit is contained in:
Petr Hlozek 2021-10-13 13:22:23 +02:00 committed by GitHub
commit b1a40edffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 22 deletions

View File

@ -226,7 +226,9 @@ So any time you like you can make it larger and chat lines are there to check.</
QSO logging.<br><br>
If the entry becomes older than the set time, it is displayed in a lighter color. Very old
entries will disappear, also if you log the station, the corresponding entry disappears
from the band map. The entries are always sorted by frequency.
from the band map.
<br><br>The entries are always sorted by frequency. Default order is for lowest to higest. This can be reversed with checkbox <b>Reverese order</b>.
<br>With normal order and <b>Show active band</b> checked this shows CW spots first (CW is normally at band low edge). Cheking <b>Reverse order</b> will then show SBB spots first.
<br><br>When band map form is active new spots are not added. This helps to locate needed
line from all spot lines. Form name changes to <b>BM PAUSED!</b> to remind that nothing will be
added until focus is moved to any other form by a mouse click.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -118,7 +118,7 @@ type
FOnlyLoTW : Boolean;
FOnlyEQSL : Boolean;
procedure SortBandMapArray(l,r : Integer);
procedure SortBandMapArray(l,r : Integer; Rev:boolean);
procedure BandMapDbClick(where:longint;mb:TmouseButton;ms:TShiftState);
procedure EmitBandMapClick(Sender:TObject;Call,Mode : String; Freq : Currency);
procedure ClearAll;
@ -332,27 +332,37 @@ begin
end
end;
procedure TfrmBandMap.SortBandMapArray(l,r : integer);
procedure TfrmBandMap.SortBandMapArray(l,r : integer; Rev:boolean);
var
i,j : Integer;
w : TbandMapItem;
x : Double;
i,j,h : Integer;
w : TbandMapItem;
x : Double;
procedure SwapItems;
begin
BandMapItems[j] := BandMapItems[j-h];
j := j - h;
end;
begin
i:=l; j:=r;
x:=BandMapItems[(l+r) div 2].Freq;
h := l;
repeat
while BandMapItems[i].Freq < x do i:=i+1;
while x < BandMapItems[j].Freq do j:=j-1;
if i <= j then
begin
w := BandMapItems[i];
BandMapItems[i] := BandMapItems[j];
BandMapItems[j] := w;
i:=i+1; j:=j-1
end
until i > j;
if l < j then SortBandMapArray(l,j);
if i < r then SortBandMapArray(i,r)
h := 3*h + 1
until h > r;
repeat
h := h div 3;
for i := h + 1 to r do
begin
x := BandMapItems[i].Freq;
w := BandMapItems[i];
j := i;
if not Rev then
while (j > h) AND (BandMapItems[j-h].Freq > x) do SwapItems
else
while (j > h) AND (BandMapItems[j-h].Freq < x) do SwapItems;
BandMapItems[j] := w;
end
until h = 1;
end;
function TfrmBandMap.GetIndexFromPosition(ItemPos : Word) : Integer;
@ -555,7 +565,7 @@ begin
end;
if NewAdded then
begin
frmBandMap.SortBandMapArray(1,MAX_ITEMS);
frmBandMap.SortBandMapArray(1,MAX_ITEMS,cqrini.ReadBool('BandMap', 'ReverseOrder', False) );
NewAdded := False;
Changed := True
end;

View File

@ -10,7 +10,7 @@ object frmBandMapFilter: TfrmBandMapFilter
OnClose = FormClose
OnShow = FormShow
Position = poMainFormCenter
LCLVersion = '2.0.4.0'
LCLVersion = '2.0.12.0'
object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
@ -136,6 +136,17 @@ object frmBandMapFilter: TfrmBandMapFilter
Caption = 'Show only active band'
TabOrder = 6
end
object chkRevOrder: TCheckBox
AnchorSideLeft.Control = edtTime
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = rbShowAll
Left = 505
Height = 23
Top = 6
Width = 117
Caption = 'Reverse order'
TabOrder = 7
end
end
object GroupBox2: TGroupBox
AnchorSideLeft.Control = GroupBox1

View File

@ -15,6 +15,7 @@ type
TfrmBandMapFilter = class(TForm)
btnOK: TButton;
btnCancel: TButton;
chkRevOrder: TCheckBox;
chkOnlyeQSL: TCheckBox;
chkOnlyLoTW: TCheckBox;
chkShowActiveBandFil: TCheckBox;
@ -67,6 +68,7 @@ begin
seCallWidth.Value := cqrini.ReadInteger('BandMapFilter','CallWidth',12);
chkShowActiveBandFil.Checked := cqrini.ReadBool('BandMap', 'OnlyActiveBand', False);
chkRevOrder.Checked:=cqrini.ReadBool('BandMap', 'ReverseOrder', False);
end;
procedure TfrmBandMapFilter.FormClose(Sender: TObject;
@ -114,6 +116,7 @@ begin
cqrini.WriteBool('BandMapFilter','OnlyLoTW',chkOnlyLoTW.Checked);
cqrini.WriteBool('BandMap', 'OnlyActiveBand', chkShowActiveBandFil.Checked);
cqrini.WriteBool('BandMap', 'ReverseOrder', chkRevOrder.Checked);
cqrini.WriteInteger('BandMapFilter','FreqWidth',seFreqWidth.Value);
cqrini.WriteInteger('BandMapFilter','CallWidth',seCallWidth.Value);