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> QSO logging.<br><br>
If the entry becomes older than the set time, it is displayed in a lighter color. Very old 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 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 <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 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. 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; FOnlyLoTW : Boolean;
FOnlyEQSL : Boolean; FOnlyEQSL : Boolean;
procedure SortBandMapArray(l,r : Integer); procedure SortBandMapArray(l,r : Integer; Rev:boolean);
procedure BandMapDbClick(where:longint;mb:TmouseButton;ms:TShiftState); procedure BandMapDbClick(where:longint;mb:TmouseButton;ms:TShiftState);
procedure EmitBandMapClick(Sender:TObject;Call,Mode : String; Freq : Currency); procedure EmitBandMapClick(Sender:TObject;Call,Mode : String; Freq : Currency);
procedure ClearAll; procedure ClearAll;
@ -332,27 +332,37 @@ begin
end end
end; end;
procedure TfrmBandMap.SortBandMapArray(l,r : integer); procedure TfrmBandMap.SortBandMapArray(l,r : integer; Rev:boolean);
var var
i,j : Integer; i,j,h : Integer;
w : TbandMapItem; w : TbandMapItem;
x : Double; x : Double;
procedure SwapItems;
begin
BandMapItems[j] := BandMapItems[j-h];
j := j - h;
end;
begin begin
i:=l; j:=r; h := l;
x:=BandMapItems[(l+r) div 2].Freq;
repeat repeat
while BandMapItems[i].Freq < x do i:=i+1; h := 3*h + 1
while x < BandMapItems[j].Freq do j:=j-1; until h > r;
if i <= j then repeat
begin h := h div 3;
w := BandMapItems[i]; for i := h + 1 to r do
BandMapItems[i] := BandMapItems[j]; begin
BandMapItems[j] := w; x := BandMapItems[i].Freq;
i:=i+1; j:=j-1 w := BandMapItems[i];
end j := i;
until i > j; if not Rev then
if l < j then SortBandMapArray(l,j); while (j > h) AND (BandMapItems[j-h].Freq > x) do SwapItems
if i < r then SortBandMapArray(i,r) else
while (j > h) AND (BandMapItems[j-h].Freq < x) do SwapItems;
BandMapItems[j] := w;
end
until h = 1;
end; end;
function TfrmBandMap.GetIndexFromPosition(ItemPos : Word) : Integer; function TfrmBandMap.GetIndexFromPosition(ItemPos : Word) : Integer;
@ -555,7 +565,7 @@ begin
end; end;
if NewAdded then if NewAdded then
begin begin
frmBandMap.SortBandMapArray(1,MAX_ITEMS); frmBandMap.SortBandMapArray(1,MAX_ITEMS,cqrini.ReadBool('BandMap', 'ReverseOrder', False) );
NewAdded := False; NewAdded := False;
Changed := True Changed := True
end; end;

View File

@ -10,7 +10,7 @@ object frmBandMapFilter: TfrmBandMapFilter
OnClose = FormClose OnClose = FormClose
OnShow = FormShow OnShow = FormShow
Position = poMainFormCenter Position = poMainFormCenter
LCLVersion = '2.0.4.0' LCLVersion = '2.0.12.0'
object GroupBox1: TGroupBox object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
@ -136,6 +136,17 @@ object frmBandMapFilter: TfrmBandMapFilter
Caption = 'Show only active band' Caption = 'Show only active band'
TabOrder = 6 TabOrder = 6
end 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 end
object GroupBox2: TGroupBox object GroupBox2: TGroupBox
AnchorSideLeft.Control = GroupBox1 AnchorSideLeft.Control = GroupBox1

View File

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