Add Spectrum gradient fill toggle in settings

Mirror the existing Wideband gradient fill option for the main spectrum:
a "Spectrum gradient fill" checkbox on the Display settings tab gates the
under-curve gradient in TSpectrumView.DrawSpectrum. The curve, grid,
filter band and VFO markers always draw; only the gradient is optional.

Persisted as spectrum_fill in settings JSON (default True, preserving
current appearance). Wired through Settings -> SettingsForm visibility
event -> MainForm -> TSpectrumView.FillSpectrum, same path as
WidebandFill.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Uladzimir Karpenka
2026-05-29 15:24:33 +03:00
co-authored by Claude Opus 4.8
parent 2a7bf8528a
commit 655d242d02
4 changed files with 48 additions and 10 deletions
+17 -3
View File
@@ -39,6 +39,7 @@ type
FFMGridLastSpan: Double;
FSpPts: array of TPoint;
FSpPtsLen: Integer;
FFillSpectrum: Boolean;
// ── Тема ─────────────────────────────────────────────────────────────────
FTheme: TAppTheme;
FLightTheme: Boolean;
@@ -95,6 +96,7 @@ type
procedure SetTXSpanHz(V: Double);
procedure SetMarkerActive(V: Boolean);
procedure SetMarkerX(V: Integer);
procedure SetFillSpectrum(V: Boolean);
procedure DrawSpectrumGradient(const SpPts: array of TPoint; W, H: Integer);
procedure DrawMarkerLine(C: TCanvas; W, H: Integer);
procedure BlendBand(X1, X2, H: Integer; R, G, B, Alpha: Byte);
@@ -191,6 +193,7 @@ type
// ── Флаги обновления ──────────────────────────────────────────────────────
property SpectrumDirty: Boolean read FSpectrumDirty write FSpectrumDirty;
property FillSpectrum: Boolean read FFillSpectrum write SetFillSpectrum;
property WaterfallDirty: Boolean read GetWaterfallDirty write SetWaterfallDirty;
property WfFrameInterval: Integer read GetWfFrameInterval write SetWfFrameInterval;
@@ -304,6 +307,7 @@ begin
FSpectrumBufCount := 1024;
FSpectrumDirty := True;
FLightTheme := False;
FFillSpectrum := True;
FTheme := DarkTheme;
// Sub-views
FWaterfall := TWaterfallView.Create;
@@ -388,6 +392,13 @@ begin
FWaterfall.MarkerX := V;
end;
procedure TSpectrumView.SetFillSpectrum(V: Boolean);
begin
if FFillSpectrum = V then Exit;
FFillSpectrum := V;
FSpectrumDirty := True;
end;
function TSpectrumView.GetWaterfallDirty: Boolean;
begin
Result := FWaterfall.WaterfallDirty;
@@ -898,9 +909,12 @@ begin
end;
FSpPts[W] := Point(W-1, H); FSpPts[W+1] := Point(0, H);
// ── 5. Градиент ───────────────────────────────────────────────────────────
C.Brush.Style := bsSolid; C.Pen.Style := psClear;
DrawSpectrumGradient(FSpPts, W, H);
// ── 5. Градиент (заливка под кривой) ──────────────────────────────────────
if FFillSpectrum then
begin
C.Brush.Style := bsSolid; C.Pen.Style := psClear;
DrawSpectrumGradient(FSpPts, W, H);
end;
// ── 6. Линия спектра ──────────────────────────────────────────────────────
C.Pen.Style := psSolid; C.Pen.Color := FTheme.SpecLine; C.Pen.Width := 1;