mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
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:
co-authored by
Claude Opus 4.8
parent
2a7bf8528a
commit
655d242d02
+11
-3
@@ -241,6 +241,7 @@ type
|
|||||||
FShowWaterfall: Boolean;
|
FShowWaterfall: Boolean;
|
||||||
FShowWideband: Boolean;
|
FShowWideband: Boolean;
|
||||||
FWidebandFill: Boolean;
|
FWidebandFill: Boolean;
|
||||||
|
FSpectrumFill: Boolean;
|
||||||
FDisplayFPS: Integer;
|
FDisplayFPS: Integer;
|
||||||
FWaterfallDirty: Boolean;
|
FWaterfallDirty: Boolean;
|
||||||
FWidebandDirty: Boolean;
|
FWidebandDirty: Boolean;
|
||||||
@@ -729,7 +730,7 @@ type
|
|||||||
function PullSoundCardMic(MaxN: Integer): Integer;
|
function PullSoundCardMic(MaxN: Integer): Integer;
|
||||||
function BuildMicLineSelectByte: Byte;
|
function BuildMicLineSelectByte: Byte;
|
||||||
procedure ApplyVisibility(ShowSpectrum, ShowWaterfall, ShowWideband,
|
procedure ApplyVisibility(ShowSpectrum, ShowWaterfall, ShowWideband,
|
||||||
WidebandFill: Boolean);
|
WidebandFill, SpectrumFill: Boolean);
|
||||||
procedure ApplyFPS(FPS: Integer);
|
procedure ApplyFPS(FPS: Integer);
|
||||||
procedure ApplyFreqMhzDigits(Digits: Integer);
|
procedure ApplyFreqMhzDigits(Digits: Integer);
|
||||||
|
|
||||||
@@ -951,6 +952,7 @@ begin
|
|||||||
Result.ShowWaterfall := FShowWaterfall;
|
Result.ShowWaterfall := FShowWaterfall;
|
||||||
Result.ShowWideband := FShowWideband;
|
Result.ShowWideband := FShowWideband;
|
||||||
Result.WidebandFill := FWidebandFill;
|
Result.WidebandFill := FWidebandFill;
|
||||||
|
Result.SpectrumFill := FSpectrumFill;
|
||||||
Result.DisplayDuplex := FDisplayDuplex;
|
Result.DisplayDuplex := FDisplayDuplex;
|
||||||
Result.DisplayFPS := FDisplayFPS;
|
Result.DisplayFPS := FDisplayFPS;
|
||||||
Result.LightTheme := FLightTheme;
|
Result.LightTheme := FLightTheme;
|
||||||
@@ -1295,6 +1297,7 @@ begin
|
|||||||
FShowWaterfall := True;
|
FShowWaterfall := True;
|
||||||
FShowWideband := False;
|
FShowWideband := False;
|
||||||
FWidebandFill := False;
|
FWidebandFill := False;
|
||||||
|
FSpectrumFill := True;
|
||||||
FDisplayFPS := 60;
|
FDisplayFPS := 60;
|
||||||
FFreqMhzDigits := 3;
|
FFreqMhzDigits := 3;
|
||||||
FSplitterRatio := 0.40;
|
FSplitterRatio := 0.40;
|
||||||
@@ -4098,6 +4101,8 @@ begin
|
|||||||
FWidebandFill := G_Settings.WidebandFill;
|
FWidebandFill := G_Settings.WidebandFill;
|
||||||
if Assigned(FWidebandView) then
|
if Assigned(FWidebandView) then
|
||||||
FWidebandView.SetFillSpectrum(FWidebandFill);
|
FWidebandView.SetFillSpectrum(FWidebandFill);
|
||||||
|
FSpectrumFill := G_Settings.SpectrumFill;
|
||||||
|
FSpecView.FillSpectrum := FSpectrumFill;
|
||||||
FDisplayDuplex := G_Settings.DisplayDuplex;
|
FDisplayDuplex := G_Settings.DisplayDuplex;
|
||||||
if BtnDUP <> nil then StyleButton(BtnDUP, FDisplayDuplex);
|
if BtnDUP <> nil then StyleButton(BtnDUP, FDisplayDuplex);
|
||||||
if G_Settings.DisplayFPS > 0 then
|
if G_Settings.DisplayFPS > 0 then
|
||||||
@@ -7503,14 +7508,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ApplyVisibility(ShowSpectrum, ShowWaterfall,
|
procedure TMainForm.ApplyVisibility(ShowSpectrum, ShowWaterfall,
|
||||||
ShowWideband, WidebandFill: Boolean);
|
ShowWideband, WidebandFill, SpectrumFill: Boolean);
|
||||||
begin
|
begin
|
||||||
FShowSpectrum := ShowSpectrum;
|
FShowSpectrum := ShowSpectrum;
|
||||||
FShowWaterfall := ShowWaterfall;
|
FShowWaterfall := ShowWaterfall;
|
||||||
FShowWideband := ShowWideband;
|
FShowWideband := ShowWideband;
|
||||||
FWidebandFill := WidebandFill;
|
FWidebandFill := WidebandFill;
|
||||||
|
FSpectrumFill := SpectrumFill;
|
||||||
if Assigned(FWidebandView) then
|
if Assigned(FWidebandView) then
|
||||||
FWidebandView.SetFillSpectrum(FWidebandFill);
|
FWidebandView.SetFillSpectrum(FWidebandFill);
|
||||||
|
FSpecView.FillSpectrum := FSpectrumFill;
|
||||||
if Assigned(FNetwork) and FNetwork.Connected then
|
if Assigned(FNetwork) and FNetwork.Connected then
|
||||||
FNetwork.ConfigureWideband(0, FShowWideband, 512, 16, 70, 32);
|
FNetwork.ConfigureWideband(0, FShowWideband, 512, 16, 70, 32);
|
||||||
ResizeSpectrumPanels;
|
ResizeSpectrumPanels;
|
||||||
@@ -7597,7 +7604,8 @@ begin
|
|||||||
FCATLastGlobal.CATTcpPort);
|
FCATLastGlobal.CATTcpPort);
|
||||||
// Перечисляем PA устройства
|
// Перечисляем PA устройства
|
||||||
SF.RefreshAudioDevices(FAudioOut, FAudioIn);
|
SF.RefreshAudioDevices(FAudioOut, FAudioIn);
|
||||||
SF.LoadVisibility(FShowSpectrum, FShowWaterfall, FShowWideband, FWidebandFill);
|
SF.LoadVisibility(FShowSpectrum, FShowWaterfall, FShowWideband, FWidebandFill,
|
||||||
|
FSpectrumFill);
|
||||||
SF.LoadWfAGCNF(FWfAGCEnabled, FWfNFEnabled);
|
SF.LoadWfAGCNF(FWfAGCEnabled, FWfNFEnabled);
|
||||||
SF.LoadADCSettings(FDitherEnabled, FRandomEnabled);
|
SF.LoadADCSettings(FDitherEnabled, FRandomEnabled);
|
||||||
SF.LoadWebSettings(FWebEnabled, FWebPort, FWebBindAddr, FWebUser, FWebPass);
|
SF.LoadWebSettings(FWebEnabled, FWebPort, FWebBindAddr, FWebUser, FWebPass);
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ type
|
|||||||
ShowWaterfall: Boolean; // True = draw waterfall on main form
|
ShowWaterfall: Boolean; // True = draw waterfall on main form
|
||||||
ShowWideband: Boolean; // True = draw raw ADC wideband pane on main form
|
ShowWideband: Boolean; // True = draw raw ADC wideband pane on main form
|
||||||
WidebandFill: Boolean; // True = fill wideband spectrum with gradient
|
WidebandFill: Boolean; // True = fill wideband spectrum with gradient
|
||||||
|
SpectrumFill: Boolean; // True = fill main spectrum under the curve with gradient
|
||||||
DisplayDuplex: Boolean; // DUP: при TX показывать RX-водопад, TX-фильтр overlay'ем
|
DisplayDuplex: Boolean; // DUP: при TX показывать RX-водопад, TX-фильтр overlay'ем
|
||||||
// --- Display FPS ---
|
// --- Display FPS ---
|
||||||
DisplayFPS: Integer; // spectrum/waterfall timer fps (1..100)
|
DisplayFPS: Integer; // spectrum/waterfall timer fps (1..100)
|
||||||
@@ -402,6 +403,7 @@ begin
|
|||||||
G.ShowWaterfall := True;
|
G.ShowWaterfall := True;
|
||||||
G.ShowWideband := False;
|
G.ShowWideband := False;
|
||||||
G.WidebandFill := False;
|
G.WidebandFill := False;
|
||||||
|
G.SpectrumFill := True;
|
||||||
G.DisplayDuplex := False;
|
G.DisplayDuplex := False;
|
||||||
G.DisplayFPS := 60;
|
G.DisplayFPS := 60;
|
||||||
G.FreqMhzDigits := 3;
|
G.FreqMhzDigits := 3;
|
||||||
@@ -621,6 +623,7 @@ begin
|
|||||||
G.ShowWaterfall := JB(GObj,'show_waterfall',True);
|
G.ShowWaterfall := JB(GObj,'show_waterfall',True);
|
||||||
G.ShowWideband := JB(GObj,'show_wideband',False);
|
G.ShowWideband := JB(GObj,'show_wideband',False);
|
||||||
G.WidebandFill := JB(GObj,'wideband_fill',False);
|
G.WidebandFill := JB(GObj,'wideband_fill',False);
|
||||||
|
G.SpectrumFill := JB(GObj,'spectrum_fill',True);
|
||||||
G.DisplayDuplex := JB(GObj,'display_duplex',False);
|
G.DisplayDuplex := JB(GObj,'display_duplex',False);
|
||||||
G.DisplayFPS := JI(GObj,'display_fps',60);
|
G.DisplayFPS := JI(GObj,'display_fps',60);
|
||||||
G.LightTheme := JB(GObj,'light_theme',False);
|
G.LightTheme := JB(GObj,'light_theme',False);
|
||||||
@@ -708,6 +711,7 @@ begin
|
|||||||
JW(O,'show_waterfall',G.ShowWaterfall);
|
JW(O,'show_waterfall',G.ShowWaterfall);
|
||||||
JW(O,'show_wideband',G.ShowWideband);
|
JW(O,'show_wideband',G.ShowWideband);
|
||||||
JW(O,'wideband_fill',G.WidebandFill);
|
JW(O,'wideband_fill',G.WidebandFill);
|
||||||
|
JW(O,'spectrum_fill',G.SpectrumFill);
|
||||||
JW(O,'display_duplex',G.DisplayDuplex);
|
JW(O,'display_duplex',G.DisplayDuplex);
|
||||||
JW(O,'display_fps',G.DisplayFPS);
|
JW(O,'display_fps',G.DisplayFPS);
|
||||||
JW(O,'light_theme',G.LightTheme);
|
JW(O,'light_theme',G.LightTheme);
|
||||||
|
|||||||
+16
-4
@@ -50,7 +50,7 @@ type
|
|||||||
TOnAudioInDevChange = procedure(DevIndex: Integer; const DevName: string) of object;
|
TOnAudioInDevChange = procedure(DevIndex: Integer; const DevName: string) of object;
|
||||||
TOnAudioBufferChange = procedure(BufferSize: Integer) of object;
|
TOnAudioBufferChange = procedure(BufferSize: Integer) of object;
|
||||||
TOnVisibilityChange = procedure(ShowSpectrum, ShowWaterfall, ShowWideband,
|
TOnVisibilityChange = procedure(ShowSpectrum, ShowWaterfall, ShowWideband,
|
||||||
WidebandFill: Boolean) of object;
|
WidebandFill, SpectrumFill: Boolean) of object;
|
||||||
TOnFPSChange = procedure(FPS: Integer) of object;
|
TOnFPSChange = procedure(FPS: Integer) of object;
|
||||||
TOnThemeChange = procedure(LightTheme: Boolean) of object;
|
TOnThemeChange = procedure(LightTheme: Boolean) of object;
|
||||||
TOnWfAGCNFChange = procedure(WfAGC, WfNF: Boolean) of object;
|
TOnWfAGCNFChange = procedure(WfAGC, WfNF: Boolean) of object;
|
||||||
@@ -123,6 +123,7 @@ type
|
|||||||
FChkShowWaterfall: TFlatCheckBox;
|
FChkShowWaterfall: TFlatCheckBox;
|
||||||
FChkShowWideband: TFlatCheckBox;
|
FChkShowWideband: TFlatCheckBox;
|
||||||
FChkWidebandFill: TFlatCheckBox;
|
FChkWidebandFill: TFlatCheckBox;
|
||||||
|
FChkSpectrumFill: TFlatCheckBox;
|
||||||
FCmbFPS: TFlatComboBox;
|
FCmbFPS: TFlatComboBox;
|
||||||
FChkLightTheme: TFlatCheckBox;
|
FChkLightTheme: TFlatCheckBox;
|
||||||
FCmbFreqMhzDigits: TFlatComboBox;
|
FCmbFreqMhzDigits: TFlatComboBox;
|
||||||
@@ -375,7 +376,7 @@ type
|
|||||||
procedure RefreshAudioDevices(AudioOut: TAudioOutput; AudioIn: TAudioInput);
|
procedure RefreshAudioDevices(AudioOut: TAudioOutput; AudioIn: TAudioInput);
|
||||||
procedure LoadAudioBufferSize(BufferSize: Integer);
|
procedure LoadAudioBufferSize(BufferSize: Integer);
|
||||||
procedure LoadVisibility(ShowSpectrum, ShowWaterfall, ShowWideband,
|
procedure LoadVisibility(ShowSpectrum, ShowWaterfall, ShowWideband,
|
||||||
WidebandFill: Boolean);
|
WidebandFill, SpectrumFill: Boolean);
|
||||||
procedure LoadFPS(FPS: Integer);
|
procedure LoadFPS(FPS: Integer);
|
||||||
procedure LoadLightTheme(ALight: Boolean);
|
procedure LoadLightTheme(ALight: Boolean);
|
||||||
procedure LoadFreqMhzDigits(Digits: Integer);
|
procedure LoadFreqMhzDigits(Digits: Integer);
|
||||||
@@ -846,6 +847,16 @@ begin
|
|||||||
FChkWidebandFill.Font.Size := 9;
|
FChkWidebandFill.Font.Size := 9;
|
||||||
FChkWidebandFill.OnChange := OnVisibilityChkChange;
|
FChkWidebandFill.OnChange := OnVisibilityChkChange;
|
||||||
|
|
||||||
|
FChkSpectrumFill := TFlatCheckBox.Create(Self);
|
||||||
|
FChkSpectrumFill.Parent := Grp;
|
||||||
|
FChkSpectrumFill.Caption := 'Spectrum gradient fill';
|
||||||
|
FChkSpectrumFill.SetBounds(PAD, R1 + 28, CHKW, 22);
|
||||||
|
FChkSpectrumFill.Checked := True;
|
||||||
|
FChkSpectrumFill.Font.Color := CLR_TEXT;
|
||||||
|
FChkSpectrumFill.Font.Name := UI_FONT;
|
||||||
|
FChkSpectrumFill.Font.Size := 9;
|
||||||
|
FChkSpectrumFill.OnChange := OnVisibilityChkChange;
|
||||||
|
|
||||||
Grp := MakeGroupPanel(FPageDisplay, 'Performance', MARGIN, 212, 650, 92);
|
Grp := MakeGroupPanel(FPageDisplay, 'Performance', MARGIN, 212, 650, 92);
|
||||||
|
|
||||||
MakeLbl(Grp, 'Refresh rate', PAD, R1 + 5, LW);
|
MakeLbl(Grp, 'Refresh rate', PAD, R1 + 5, LW);
|
||||||
@@ -2328,7 +2339,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsForm.LoadVisibility(ShowSpectrum, ShowWaterfall,
|
procedure TSettingsForm.LoadVisibility(ShowSpectrum, ShowWaterfall,
|
||||||
ShowWideband, WidebandFill: Boolean);
|
ShowWideband, WidebandFill, SpectrumFill: Boolean);
|
||||||
begin
|
begin
|
||||||
FLoading := True;
|
FLoading := True;
|
||||||
try
|
try
|
||||||
@@ -2336,6 +2347,7 @@ begin
|
|||||||
FChkShowWaterfall.Checked := ShowWaterfall;
|
FChkShowWaterfall.Checked := ShowWaterfall;
|
||||||
FChkShowWideband.Checked := ShowWideband;
|
FChkShowWideband.Checked := ShowWideband;
|
||||||
FChkWidebandFill.Checked := WidebandFill;
|
FChkWidebandFill.Checked := WidebandFill;
|
||||||
|
FChkSpectrumFill.Checked := SpectrumFill;
|
||||||
finally
|
finally
|
||||||
FLoading := False;
|
FLoading := False;
|
||||||
end;
|
end;
|
||||||
@@ -2357,7 +2369,7 @@ begin
|
|||||||
if FLoading then Exit;
|
if FLoading then Exit;
|
||||||
if not Assigned(FOnVisibilityChange) then Exit;
|
if not Assigned(FOnVisibilityChange) then Exit;
|
||||||
FOnVisibilityChange(FChkShowSpectrum.Checked, FChkShowWaterfall.Checked,
|
FOnVisibilityChange(FChkShowSpectrum.Checked, FChkShowWaterfall.Checked,
|
||||||
FChkShowWideband.Checked, FChkWidebandFill.Checked);
|
FChkShowWideband.Checked, FChkWidebandFill.Checked, FChkSpectrumFill.Checked);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSettingsForm.OnLightThemeChkChange(Sender: TObject);
|
procedure TSettingsForm.OnLightThemeChkChange(Sender: TObject);
|
||||||
|
|||||||
+17
-3
@@ -39,6 +39,7 @@ type
|
|||||||
FFMGridLastSpan: Double;
|
FFMGridLastSpan: Double;
|
||||||
FSpPts: array of TPoint;
|
FSpPts: array of TPoint;
|
||||||
FSpPtsLen: Integer;
|
FSpPtsLen: Integer;
|
||||||
|
FFillSpectrum: Boolean;
|
||||||
// ── Тема ─────────────────────────────────────────────────────────────────
|
// ── Тема ─────────────────────────────────────────────────────────────────
|
||||||
FTheme: TAppTheme;
|
FTheme: TAppTheme;
|
||||||
FLightTheme: Boolean;
|
FLightTheme: Boolean;
|
||||||
@@ -95,6 +96,7 @@ type
|
|||||||
procedure SetTXSpanHz(V: Double);
|
procedure SetTXSpanHz(V: Double);
|
||||||
procedure SetMarkerActive(V: Boolean);
|
procedure SetMarkerActive(V: Boolean);
|
||||||
procedure SetMarkerX(V: Integer);
|
procedure SetMarkerX(V: Integer);
|
||||||
|
procedure SetFillSpectrum(V: Boolean);
|
||||||
procedure DrawSpectrumGradient(const SpPts: array of TPoint; W, H: Integer);
|
procedure DrawSpectrumGradient(const SpPts: array of TPoint; W, H: Integer);
|
||||||
procedure DrawMarkerLine(C: TCanvas; W, H: Integer);
|
procedure DrawMarkerLine(C: TCanvas; W, H: Integer);
|
||||||
procedure BlendBand(X1, X2, H: Integer; R, G, B, Alpha: Byte);
|
procedure BlendBand(X1, X2, H: Integer; R, G, B, Alpha: Byte);
|
||||||
@@ -191,6 +193,7 @@ type
|
|||||||
|
|
||||||
// ── Флаги обновления ──────────────────────────────────────────────────────
|
// ── Флаги обновления ──────────────────────────────────────────────────────
|
||||||
property SpectrumDirty: Boolean read FSpectrumDirty write FSpectrumDirty;
|
property SpectrumDirty: Boolean read FSpectrumDirty write FSpectrumDirty;
|
||||||
|
property FillSpectrum: Boolean read FFillSpectrum write SetFillSpectrum;
|
||||||
property WaterfallDirty: Boolean read GetWaterfallDirty write SetWaterfallDirty;
|
property WaterfallDirty: Boolean read GetWaterfallDirty write SetWaterfallDirty;
|
||||||
property WfFrameInterval: Integer read GetWfFrameInterval write SetWfFrameInterval;
|
property WfFrameInterval: Integer read GetWfFrameInterval write SetWfFrameInterval;
|
||||||
|
|
||||||
@@ -304,6 +307,7 @@ begin
|
|||||||
FSpectrumBufCount := 1024;
|
FSpectrumBufCount := 1024;
|
||||||
FSpectrumDirty := True;
|
FSpectrumDirty := True;
|
||||||
FLightTheme := False;
|
FLightTheme := False;
|
||||||
|
FFillSpectrum := True;
|
||||||
FTheme := DarkTheme;
|
FTheme := DarkTheme;
|
||||||
// Sub-views
|
// Sub-views
|
||||||
FWaterfall := TWaterfallView.Create;
|
FWaterfall := TWaterfallView.Create;
|
||||||
@@ -388,6 +392,13 @@ begin
|
|||||||
FWaterfall.MarkerX := V;
|
FWaterfall.MarkerX := V;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpectrumView.SetFillSpectrum(V: Boolean);
|
||||||
|
begin
|
||||||
|
if FFillSpectrum = V then Exit;
|
||||||
|
FFillSpectrum := V;
|
||||||
|
FSpectrumDirty := True;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSpectrumView.GetWaterfallDirty: Boolean;
|
function TSpectrumView.GetWaterfallDirty: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FWaterfall.WaterfallDirty;
|
Result := FWaterfall.WaterfallDirty;
|
||||||
@@ -898,9 +909,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
FSpPts[W] := Point(W-1, H); FSpPts[W+1] := Point(0, H);
|
FSpPts[W] := Point(W-1, H); FSpPts[W+1] := Point(0, H);
|
||||||
|
|
||||||
// ── 5. Градиент ───────────────────────────────────────────────────────────
|
// ── 5. Градиент (заливка под кривой) ──────────────────────────────────────
|
||||||
C.Brush.Style := bsSolid; C.Pen.Style := psClear;
|
if FFillSpectrum then
|
||||||
DrawSpectrumGradient(FSpPts, W, H);
|
begin
|
||||||
|
C.Brush.Style := bsSolid; C.Pen.Style := psClear;
|
||||||
|
DrawSpectrumGradient(FSpPts, W, H);
|
||||||
|
end;
|
||||||
|
|
||||||
// ── 6. Линия спектра ──────────────────────────────────────────────────────
|
// ── 6. Линия спектра ──────────────────────────────────────────────────────
|
||||||
C.Pen.Style := psSolid; C.Pen.Color := FTheme.SpecLine; C.Pen.Width := 1;
|
C.Pen.Style := psSolid; C.Pen.Color := FTheme.SpecLine; C.Pen.Width := 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user