mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Fix ruler not updating on sample rate change
Add FRulerLastSpan to ruler cache — previously only FCenterFreq and ActiveVfoFreq were tracked, so span changes left the ruler showing stale frequency step marks. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+8
-5
@@ -48,6 +48,7 @@ type
|
|||||||
FSmBitmap: TBitmap;
|
FSmBitmap: TBitmap;
|
||||||
FRulerLastFreq: Double;
|
FRulerLastFreq: Double;
|
||||||
FRulerLastVfo: Double;
|
FRulerLastVfo: Double;
|
||||||
|
FRulerLastSpan: Double;
|
||||||
|
|
||||||
// ── Radio state ───────────────────────────────────────────────────────────
|
// ── Radio state ───────────────────────────────────────────────────────────
|
||||||
FVfoA: Double;
|
FVfoA: Double;
|
||||||
@@ -513,7 +514,7 @@ procedure TSpectrumView.SetRulerSize(W, H: Integer);
|
|||||||
begin
|
begin
|
||||||
if (W <= 0) or (H <= 0) then Exit;
|
if (W <= 0) or (H <= 0) then Exit;
|
||||||
FRulerBitmap.SetSize(W, H);
|
FRulerBitmap.SetSize(W, H);
|
||||||
FRulerLastFreq := -1.0; FRulerLastVfo := -1.0;
|
FRulerLastFreq := -1.0; FRulerLastVfo := -1.0; FRulerLastSpan := -1.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpectrumView.SpectrumBitmapWidth: Integer;
|
function TSpectrumView.SpectrumBitmapWidth: Integer;
|
||||||
@@ -533,7 +534,7 @@ end;
|
|||||||
|
|
||||||
procedure TSpectrumView.InvalidateRulerCache;
|
procedure TSpectrumView.InvalidateRulerCache;
|
||||||
begin
|
begin
|
||||||
FRulerLastFreq := -1.0; FRulerLastVfo := -1.0;
|
FRulerLastFreq := -1.0; FRulerLastVfo := -1.0; FRulerLastSpan := -1.0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpectrumView.ResetSpectrumBuf;
|
procedure TSpectrumView.ResetSpectrumBuf;
|
||||||
@@ -570,7 +571,8 @@ end;
|
|||||||
function TSpectrumView.NeedsRulerRedraw: Boolean;
|
function TSpectrumView.NeedsRulerRedraw: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (Abs(FCenterFreq - FRulerLastFreq) >= 0.5) or
|
Result := (Abs(FCenterFreq - FRulerLastFreq) >= 0.5) or
|
||||||
(Abs(ActiveVfoFreq - FRulerLastVfo) >= 0.5);
|
(Abs(ActiveVfoFreq - FRulerLastVfo) >= 0.5) or
|
||||||
|
(Abs(FSpanHz - FRulerLastSpan) >= 1.0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ────────────────────────────────────────────────────────────────────────────
|
// ────────────────────────────────────────────────────────────────────────────
|
||||||
@@ -854,8 +856,9 @@ begin
|
|||||||
W := FPbRuler.Width; H := FPbRuler.Height;
|
W := FPbRuler.Width; H := FPbRuler.Height;
|
||||||
if (W <= 0) or (H <= 0) then Exit;
|
if (W <= 0) or (H <= 0) then Exit;
|
||||||
if (Abs(FCenterFreq - FRulerLastFreq) < 0.5) and
|
if (Abs(FCenterFreq - FRulerLastFreq) < 0.5) and
|
||||||
(Abs(ActiveVfoFreq - FRulerLastVfo) < 0.5) then Exit;
|
(Abs(ActiveVfoFreq - FRulerLastVfo) < 0.5) and
|
||||||
FRulerLastFreq := FCenterFreq; FRulerLastVfo := ActiveVfoFreq;
|
(Abs(FSpanHz - FRulerLastSpan) < 1.0) then Exit;
|
||||||
|
FRulerLastFreq := FCenterFreq; FRulerLastVfo := ActiveVfoFreq; FRulerLastSpan := FSpanHz;
|
||||||
if (FRulerBitmap.Width <> W) or (FRulerBitmap.Height <> H) then
|
if (FRulerBitmap.Width <> W) or (FRulerBitmap.Height <> H) then
|
||||||
FRulerBitmap.SetSize(W, H);
|
FRulerBitmap.SetSize(W, H);
|
||||||
C := FRulerBitmap.Canvas;
|
C := FRulerBitmap.Canvas;
|
||||||
|
|||||||
Reference in New Issue
Block a user