mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 20:37:33 +00:00
Refactor VFO-B top panel layout
This commit is contained in:
+24
-2
@@ -15,7 +15,7 @@ unit FreqDisplay;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, Graphics, LCLType, Math;
|
Classes, SysUtils, Controls, Graphics, LCLType;
|
||||||
|
|
||||||
type
|
type
|
||||||
TFreqChangeEvent = procedure(Sender: TObject; NewFreq: Int64) of object;
|
TFreqChangeEvent = procedure(Sender: TObject; NewFreq: Int64) of object;
|
||||||
@@ -30,6 +30,8 @@ type
|
|||||||
FColorNormal: TColor;
|
FColorNormal: TColor;
|
||||||
FColorHover: TColor;
|
FColorHover: TColor;
|
||||||
FColorDim: TColor;
|
FColorDim: TColor;
|
||||||
|
FMinMhzDigits: Integer;
|
||||||
|
FDimLeadingZeros: Boolean;
|
||||||
FOnChange: TFreqChangeEvent;
|
FOnChange: TFreqChangeEvent;
|
||||||
|
|
||||||
FHoverDigit: Integer; // 0=единицы .. 8=100МГц, -1=нет
|
FHoverDigit: Integer; // 0=единицы .. 8=100МГц, -1=нет
|
||||||
@@ -65,6 +67,8 @@ type
|
|||||||
property ColorNormal: TColor read FColorNormal write FColorNormal;
|
property ColorNormal: TColor read FColorNormal write FColorNormal;
|
||||||
property ColorHover: TColor read FColorHover write FColorHover;
|
property ColorHover: TColor read FColorHover write FColorHover;
|
||||||
property ColorDim: TColor read FColorDim write FColorDim;
|
property ColorDim: TColor read FColorDim write FColorDim;
|
||||||
|
property MinMhzDigits: Integer read FMinMhzDigits write FMinMhzDigits;
|
||||||
|
property DimLeadingZeros: Boolean read FDimLeadingZeros write FDimLeadingZeros;
|
||||||
property OnChange: TFreqChangeEvent read FOnChange write FOnChange;
|
property OnChange: TFreqChangeEvent read FOnChange write FOnChange;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -81,6 +85,8 @@ begin
|
|||||||
FColorNormal := TColor($00E8F0FF);
|
FColorNormal := TColor($00E8F0FF);
|
||||||
FColorHover := TColor($0040DDFF);
|
FColorHover := TColor($0040DDFF);
|
||||||
FColorDim := TColor($00607080);
|
FColorDim := TColor($00607080);
|
||||||
|
FMinMhzDigits := 1;
|
||||||
|
FDimLeadingZeros := False;
|
||||||
FHoverDigit := -1;
|
FHoverDigit := -1;
|
||||||
FDigitW := 14;
|
FDigitW := 14;
|
||||||
FCharH := 24;
|
FCharH := 24;
|
||||||
@@ -162,6 +168,9 @@ var
|
|||||||
Mhz: Integer;
|
Mhz: Integer;
|
||||||
KHz: Integer;
|
KHz: Integer;
|
||||||
Ones: Integer;
|
Ones: Integer;
|
||||||
|
MhzFmt: string;
|
||||||
|
MhzText: string;
|
||||||
|
LeadingMhzZeros: Integer;
|
||||||
TotalW: Integer;
|
TotalW: Integer;
|
||||||
StartX: Integer;
|
StartX: Integer;
|
||||||
ChW, ChH: Integer;
|
ChW, ChH: Integer;
|
||||||
@@ -194,7 +203,18 @@ begin
|
|||||||
Mhz := Hz div 1000000;
|
Mhz := Hz div 1000000;
|
||||||
KHz := (Hz div 1000) mod 1000;
|
KHz := (Hz div 1000) mod 1000;
|
||||||
Ones := Hz mod 1000;
|
Ones := Hz mod 1000;
|
||||||
S := Format('%d.%3.3d.%3.3d', [Mhz, KHz, Ones]);
|
if FMinMhzDigits > 1 then
|
||||||
|
MhzFmt := '%.' + IntToStr(FMinMhzDigits) + 'd'
|
||||||
|
else
|
||||||
|
MhzFmt := '%d';
|
||||||
|
MhzText := Format(MhzFmt, [Mhz]);
|
||||||
|
S := MhzText + Format('.%3.3d.%3.3d', [KHz, Ones]);
|
||||||
|
|
||||||
|
LeadingMhzZeros := 0;
|
||||||
|
while FDimLeadingZeros and
|
||||||
|
(LeadingMhzZeros < Length(MhzText) - 1) and
|
||||||
|
(MhzText[LeadingMhzZeros + 1] = '0') do
|
||||||
|
Inc(LeadingMhzZeros);
|
||||||
|
|
||||||
TotalW := C.TextWidth(S);
|
TotalW := C.TextWidth(S);
|
||||||
StartX := (Width - TotalW) div 2;
|
StartX := (Width - TotalW) div 2;
|
||||||
@@ -227,6 +247,8 @@ begin
|
|||||||
|
|
||||||
if ch = '.' then
|
if ch = '.' then
|
||||||
col := FColorDim
|
col := FColorDim
|
||||||
|
else if FDimLeadingZeros and (ci < LeadingMhzZeros) then
|
||||||
|
col := FColorDim
|
||||||
else if dIdx = FHoverDigit then
|
else if dIdx = FHoverDigit then
|
||||||
col := FColorHover
|
col := FColorHover
|
||||||
else
|
else
|
||||||
|
|||||||
+230
-36
@@ -173,6 +173,7 @@ type
|
|||||||
FPABandCal: array[0..BAND_COUNT-1] of Double; // калибровка 38.8..100.0 на диапазон
|
FPABandCal: array[0..BAND_COUNT-1] of Double; // калибровка 38.8..100.0 на диапазон
|
||||||
FRunning: Boolean;
|
FRunning: Boolean;
|
||||||
FTransmitting: Boolean;
|
FTransmitting: Boolean;
|
||||||
|
FSplitTxB: Boolean;
|
||||||
FHWPTTActive: Boolean; // True = hardware PTT нажата
|
FHWPTTActive: Boolean; // True = hardware PTT нажата
|
||||||
FMuted: Boolean;
|
FMuted: Boolean;
|
||||||
FVolume: Integer;
|
FVolume: Integer;
|
||||||
@@ -266,11 +267,15 @@ type
|
|||||||
PanelVfoB: TPanel;
|
PanelVfoB: TPanel;
|
||||||
LblVfoBLabel: TLabel;
|
LblVfoBLabel: TLabel;
|
||||||
FreqDispB: TFreqDisplay;
|
FreqDispB: TFreqDisplay;
|
||||||
|
BtnTopVfoBSelect: TFlatButton;
|
||||||
|
BtnTopVfoBTX: TFlatButton;
|
||||||
|
|
||||||
PanelVfoButtons: TPanel;
|
PanelVfoButtons: TPanel;
|
||||||
BtnVfoSwap: TFlatButton;
|
BtnVfoSwap: TFlatButton;
|
||||||
BtnVfoACopyB: TFlatButton;
|
BtnVfoACopyB: TFlatButton;
|
||||||
BtnVfoBCopyA: TFlatButton;
|
BtnVfoBCopyA: TFlatButton;
|
||||||
|
PanelTopVfoB: TPanel;
|
||||||
|
PanelTopVfoSep: TPanel;
|
||||||
|
|
||||||
PanelBands: TPanel;
|
PanelBands: TPanel;
|
||||||
BtnBand: array[0..BAND_COUNT-1] of TFlatButton;
|
BtnBand: array[0..BAND_COUNT-1] of TFlatButton;
|
||||||
@@ -334,6 +339,7 @@ type
|
|||||||
procedure PositionSpanOverlayButtons;
|
procedure PositionSpanOverlayButtons;
|
||||||
procedure UpdateVfoDisplay;
|
procedure UpdateVfoDisplay;
|
||||||
function FormatFreq(Hz: Double): string;
|
function FormatFreq(Hz: Double): string;
|
||||||
|
procedure LayoutTopVfoBlock;
|
||||||
|
|
||||||
procedure ResizeSMeter;
|
procedure ResizeSMeter;
|
||||||
procedure ResizeSpectrumPanels;
|
procedure ResizeSpectrumPanels;
|
||||||
@@ -369,6 +375,8 @@ type
|
|||||||
procedure ApplyVfoA(NewFreq: Int64);
|
procedure ApplyVfoA(NewFreq: Int64);
|
||||||
procedure FreqDispAClick(Sender: TObject);
|
procedure FreqDispAClick(Sender: TObject);
|
||||||
procedure FreqDispBClick(Sender: TObject);
|
procedure FreqDispBClick(Sender: TObject);
|
||||||
|
procedure BtnTopVfoBSelectClick(Sender: TObject);
|
||||||
|
procedure BtnTopVfoBTXClick(Sender: TObject);
|
||||||
procedure ActivateVfo(Idx: Integer);
|
procedure ActivateVfo(Idx: Integer);
|
||||||
function ActiveVfoFreq: Int64;
|
function ActiveVfoFreq: Int64;
|
||||||
// Настройки
|
// Настройки
|
||||||
@@ -943,6 +951,7 @@ begin
|
|||||||
for i := 0 to BAND_COUNT - 1 do FPABandCal[i] := 100.0;
|
for i := 0 to BAND_COUNT - 1 do FPABandCal[i] := 100.0;
|
||||||
FRunning := False;
|
FRunning := False;
|
||||||
FTransmitting := False;
|
FTransmitting := False;
|
||||||
|
FSplitTxB := False;
|
||||||
FMuted := False;
|
FMuted := False;
|
||||||
FVolume := 70;
|
FVolume := 70;
|
||||||
FCenterFreq := FVfoA;
|
FCenterFreq := FVfoA;
|
||||||
@@ -1176,7 +1185,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
if FRunning then
|
if FRunning then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, 0, False, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, 0, False, True, True);
|
||||||
FNetwork.SetRunAndFreq(False, FCenterFreq, FCenterFreq, 0);
|
FNetwork.SetRunAndFreq(False, FCenterFreq, FCenterFreq, 0);
|
||||||
FRunning := False;
|
FRunning := False;
|
||||||
FTransmitting := False;
|
FTransmitting := False;
|
||||||
@@ -1196,6 +1205,10 @@ const
|
|||||||
BTN_H = 26;
|
BTN_H = 26;
|
||||||
BTN_SM = 24;
|
BTN_SM = 24;
|
||||||
LEFT_W = 232;
|
LEFT_W = 232;
|
||||||
|
TOP_VFO_W = 244;
|
||||||
|
TOP_VFO_FREQ_H = 47;
|
||||||
|
TOP_VFO_BTN_H = 14;
|
||||||
|
TOP_VFO_GAP = 6;
|
||||||
var
|
var
|
||||||
i, X, Y, W: Integer;
|
i, X, Y, W: Integer;
|
||||||
B: TFlatButton;
|
B: TFlatButton;
|
||||||
@@ -1291,44 +1304,82 @@ begin
|
|||||||
|
|
||||||
Inc(Y, 58);
|
Inc(Y, 58);
|
||||||
|
|
||||||
// VFO B
|
// VFO B (compact top block)
|
||||||
|
PanelTopVfoB := TPanel.Create(Self);
|
||||||
|
PanelTopVfoB.Parent := Self;
|
||||||
|
PanelTopVfoB.SetBounds(0, 0, TOP_VFO_W, 60);
|
||||||
|
PanelTopVfoB.BevelOuter := bvNone;
|
||||||
|
PanelTopVfoB.Color := CLR_PANEL;
|
||||||
|
|
||||||
|
PanelTopVfoSep := TPanel.Create(Self);
|
||||||
|
PanelTopVfoSep.Parent := Self;
|
||||||
|
PanelTopVfoSep.SetBounds(0, 0, 1, 60);
|
||||||
|
PanelTopVfoSep.BevelOuter := bvNone;
|
||||||
|
PanelTopVfoSep.Color := CLR_TEXTDIM;
|
||||||
|
|
||||||
PanelVfoB := TPanel.Create(Self);
|
PanelVfoB := TPanel.Create(Self);
|
||||||
PanelVfoB.Parent := PanelLeft;
|
PanelVfoB.Parent := PanelTopVfoB;
|
||||||
PanelVfoB.SetBounds(0, Y, LEFT_W, 46);
|
PanelVfoB.SetBounds(0, 0, TOP_VFO_W, TOP_VFO_FREQ_H);
|
||||||
PanelVfoB.BevelOuter := bvNone;
|
PanelVfoB.BevelOuter := bvNone;
|
||||||
|
|
||||||
|
BtnTopVfoBSelect := MakeBtn(PanelVfoB, 'B', 0, 7, 18, 16, BtnTopVfoBSelectClick);
|
||||||
|
BtnTopVfoBSelect.Font.Name := 'Courier New';
|
||||||
|
BtnTopVfoBSelect.Font.Size := 6;
|
||||||
|
BtnTopVfoBSelect.Font.Bold := True;
|
||||||
|
BtnTopVfoBSelect.ClrNorm := TColor($00303030);
|
||||||
|
BtnTopVfoBSelect.ClrHot := TColor($00404040);
|
||||||
|
BtnTopVfoBSelect.ClrActive := TColor($00404040);
|
||||||
|
BtnTopVfoBSelect.ClrBorder := TColor($00505050);
|
||||||
|
BtnTopVfoBSelect.ClrText := CLR_TEXTDIM;
|
||||||
|
BtnTopVfoBSelect.ClrTextAct := CLR_TEXT;
|
||||||
|
|
||||||
|
BtnTopVfoBTX := MakeBtn(PanelVfoB, 'TX', 0, 25, 18, 16, BtnTopVfoBTXClick);
|
||||||
|
BtnTopVfoBTX.Font.Name := 'Courier New';
|
||||||
|
BtnTopVfoBTX.Font.Size := 6;
|
||||||
|
BtnTopVfoBTX.Font.Bold := True;
|
||||||
|
BtnTopVfoBTX.ClrNorm := TColor($00303030);
|
||||||
|
BtnTopVfoBTX.ClrHot := TColor($00404040);
|
||||||
|
BtnTopVfoBTX.ClrActive := TColor($00404040);
|
||||||
|
BtnTopVfoBTX.ClrBorder := TColor($00505050);
|
||||||
|
BtnTopVfoBTX.ClrText := CLR_TEXTDIM;
|
||||||
|
BtnTopVfoBTX.ClrTextAct := CLR_TEXT;
|
||||||
|
|
||||||
LblVfoBLabel := TLabel.Create(Self);
|
LblVfoBLabel := TLabel.Create(Self);
|
||||||
LblVfoBLabel.Parent := PanelVfoB;
|
LblVfoBLabel.Parent := PanelVfoB;
|
||||||
LblVfoBLabel.Caption := 'VFO-B';
|
LblVfoBLabel.Caption := 'VFO-B';
|
||||||
LblVfoBLabel.Left := 4; LblVfoBLabel.Top := 2;
|
LblVfoBLabel.Left := 0; LblVfoBLabel.Top := 0;
|
||||||
LblVfoBLabel.Font.Name := 'Courier New'; LblVfoBLabel.Font.Size := 7;
|
LblVfoBLabel.Font.Name := 'Courier New'; LblVfoBLabel.Font.Size := 7;
|
||||||
LblVfoBLabel.Font.Color := CLR_TEXTDIM;
|
LblVfoBLabel.Font.Color := CLR_TEXTDIM;
|
||||||
|
LblVfoBLabel.Visible := False;
|
||||||
|
|
||||||
FreqDispB := TFreqDisplay.Create(Self);
|
FreqDispB := TFreqDisplay.Create(Self);
|
||||||
FreqDispB.Parent := PanelVfoB;
|
FreqDispB.Parent := PanelVfoB;
|
||||||
FreqDispB.SetBounds(0, 14, LEFT_W, 28);
|
FreqDispB.SetBounds(58, -2, TOP_VFO_W - 58, TOP_VFO_FREQ_H);
|
||||||
FreqDispB.FontSize := 14;
|
FreqDispB.FontSize := 22;
|
||||||
FreqDispB.FontName := 'Courier New';
|
FreqDispB.FontName := 'Courier New';
|
||||||
FreqDispB.Frequency := Round(FVfoB);
|
FreqDispB.Frequency := Round(FVfoB);
|
||||||
FreqDispB.ColorNormal := CLR_FREQ_DIM;
|
FreqDispB.ColorNormal := CLR_FREQ_DIM;
|
||||||
FreqDispB.ColorHover := TColor($0040DDFF);
|
FreqDispB.ColorHover := TColor($0040DDFF);
|
||||||
FreqDispB.ColorDim := CLR_TEXTDIM;
|
FreqDispB.ColorDim := CLR_TEXTDIM;
|
||||||
|
FreqDispB.MinMhzDigits := 3;
|
||||||
|
FreqDispB.DimLeadingZeros := True;
|
||||||
FreqDispB.OnChange := FreqDispBChanged;
|
FreqDispB.OnChange := FreqDispBChanged;
|
||||||
FreqDispB.OnClick := FreqDispBClick;
|
FreqDispB.OnClick := FreqDispBClick;
|
||||||
|
|
||||||
Inc(Y, 50);
|
// VFO buttons (compact top block)
|
||||||
|
|
||||||
// VFO buttons
|
|
||||||
PanelVfoButtons := TPanel.Create(Self);
|
PanelVfoButtons := TPanel.Create(Self);
|
||||||
PanelVfoButtons.Parent := PanelLeft;
|
PanelVfoButtons.Parent := PanelTopVfoB;
|
||||||
PanelVfoButtons.SetBounds(0, Y, LEFT_W, BTN_H + 4);
|
PanelVfoButtons.SetBounds(0, TOP_VFO_FREQ_H + TOP_VFO_GAP, TOP_VFO_W, TOP_VFO_BTN_H);
|
||||||
PanelVfoButtons.BevelOuter := bvNone;
|
PanelVfoButtons.BevelOuter := bvNone;
|
||||||
|
|
||||||
BtnVfoSwap := MakeBtn(PanelVfoButtons, 'A<>B', 2, 2, 72, BTN_H, BtnVfoSwapClick);
|
BtnVfoSwap := MakeBtn(PanelVfoButtons, 'A<>B', 0, 0, 52, TOP_VFO_BTN_H, BtnVfoSwapClick);
|
||||||
BtnVfoACopyB := MakeBtn(PanelVfoButtons, 'A>B', 78, 2, 72, BTN_H, BtnVfoACopyBClick);
|
BtnVfoACopyB := MakeBtn(PanelVfoButtons, 'A>B', 58, 0, 52, TOP_VFO_BTN_H, BtnVfoACopyBClick);
|
||||||
BtnVfoBCopyA := MakeBtn(PanelVfoButtons, 'B>A', 154, 2, 72, BTN_H, BtnVfoBCopyAClick);
|
BtnVfoBCopyA := MakeBtn(PanelVfoButtons, 'B>A', 116, 0, 52, TOP_VFO_BTN_H, BtnVfoBCopyAClick);
|
||||||
|
BtnVfoSwap.Font.Size := 6;
|
||||||
|
BtnVfoACopyB.Font.Size := 6;
|
||||||
|
BtnVfoBCopyA.Font.Size := 6;
|
||||||
|
|
||||||
Inc(Y, BTN_H + 8);
|
LayoutTopVfoBlock;
|
||||||
|
|
||||||
// Band selector
|
// Band selector
|
||||||
PanelBands := TPanel.Create(Self);
|
PanelBands := TPanel.Create(Self);
|
||||||
@@ -1701,6 +1752,82 @@ begin
|
|||||||
ResizeSpectrumPanels;
|
ResizeSpectrumPanels;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.LayoutTopVfoBlock;
|
||||||
|
const
|
||||||
|
MARGIN = 4;
|
||||||
|
TOP_OFFSET = 2;
|
||||||
|
TOP_VFO_BTN_H = 14;
|
||||||
|
TOP_VFO_FREQ_H = 47;
|
||||||
|
SEP_GAP = 4;
|
||||||
|
SEP_W = 1;
|
||||||
|
SEP_TOP_OFFSET = 10;
|
||||||
|
SEP_BOTTOM_OFFSET = 8;
|
||||||
|
S_METER_GAP = SEP_GAP + SEP_W + SEP_GAP + 2;
|
||||||
|
SEP_SHIFT_LEFT = 3;
|
||||||
|
SETTINGS_GAP = 4;
|
||||||
|
BTN_GAP = 4;
|
||||||
|
var
|
||||||
|
BlockH: Integer;
|
||||||
|
BtnY: Integer;
|
||||||
|
BtnRowW: Integer;
|
||||||
|
BtnX: Integer;
|
||||||
|
SepDrawLeft: Integer;
|
||||||
|
SepLeft: Integer;
|
||||||
|
LeftEdge: Integer;
|
||||||
|
RightW: Integer;
|
||||||
|
SMW: Integer;
|
||||||
|
SMLeft: Integer;
|
||||||
|
begin
|
||||||
|
if (PanelToolbar = nil) or (PanelTopVfoB = nil) or (PanelTopVfoSep = nil) then Exit;
|
||||||
|
|
||||||
|
SepLeft := PanelToolbar.ClientWidth - MARGIN - SEP_W;
|
||||||
|
if PanelLeft <> nil then
|
||||||
|
begin
|
||||||
|
RightW := ClientWidth - PanelLeft.Width;
|
||||||
|
if RightW > 200 then
|
||||||
|
begin
|
||||||
|
SMW := Round(RightW * 0.40);
|
||||||
|
SMLeft := ClientWidth - SMW - 3;
|
||||||
|
SepLeft := Min(SepLeft, SMLeft - SEP_GAP - SEP_W - 2);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
LeftEdge := SepLeft - SEP_GAP - PanelTopVfoB.Width;
|
||||||
|
if BtnSettings <> nil then
|
||||||
|
LeftEdge := Max(LeftEdge, BtnSettings.Left + BtnSettings.Width + SETTINGS_GAP);
|
||||||
|
|
||||||
|
if LeftEdge + PanelTopVfoB.Width > SepLeft - SEP_GAP then
|
||||||
|
begin
|
||||||
|
PanelTopVfoB.Visible := False;
|
||||||
|
PanelTopVfoSep.Visible := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
PanelTopVfoB.Visible := True;
|
||||||
|
PanelTopVfoSep.Visible := True;
|
||||||
|
BlockH := PanelToolbar.Height + PanelSpanButtons.Height - (MARGIN * 2);
|
||||||
|
if BlockH < 56 then BlockH := 56;
|
||||||
|
PanelTopVfoB.SetBounds(LeftEdge, TOP_OFFSET, PanelTopVfoB.Width, BlockH);
|
||||||
|
PanelVfoB.SetBounds(0, 0, PanelTopVfoB.Width, TOP_VFO_FREQ_H);
|
||||||
|
BtnTopVfoBSelect.Left := FreqDispB.Left - BtnTopVfoBSelect.Width;
|
||||||
|
BtnTopVfoBTX.Left := FreqDispB.Left - BtnTopVfoBTX.Width;
|
||||||
|
BtnY := PanelTopVfoB.Height - TOP_VFO_BTN_H - 8;
|
||||||
|
if BtnY < 42 then BtnY := 42;
|
||||||
|
PanelVfoButtons.SetBounds(4, BtnY, PanelTopVfoB.Width - 8, TOP_VFO_BTN_H);
|
||||||
|
BtnRowW := BtnVfoSwap.Width + BtnVfoACopyB.Width + BtnVfoBCopyA.Width + BTN_GAP * 2;
|
||||||
|
BtnX := FreqDispB.Left + (FreqDispB.Width - BtnRowW) div 2 - PanelVfoButtons.Left;
|
||||||
|
if BtnX < 0 then BtnX := 0;
|
||||||
|
BtnVfoSwap.Left := BtnX;
|
||||||
|
BtnVfoACopyB.Left := BtnVfoSwap.Left + BtnVfoSwap.Width + BTN_GAP;
|
||||||
|
BtnVfoBCopyA.Left := BtnVfoACopyB.Left + BtnVfoACopyB.Width + BTN_GAP;
|
||||||
|
SepDrawLeft := SepLeft - SEP_SHIFT_LEFT;
|
||||||
|
PanelTopVfoSep.SetBounds(SepDrawLeft,
|
||||||
|
TOP_OFFSET + SEP_TOP_OFFSET, SEP_W,
|
||||||
|
PanelTopVfoB.Height - SEP_TOP_OFFSET - SEP_BOTTOM_OFFSET);
|
||||||
|
PanelTopVfoB.BringToFront;
|
||||||
|
PanelTopVfoSep.BringToFront;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ResizeSMeter;
|
procedure TMainForm.ResizeSMeter;
|
||||||
// PanelSMeterRight на главной форме (Parent=Self).
|
// PanelSMeterRight на главной форме (Parent=Self).
|
||||||
// По Y: от самого верха формы до низа PanelSpanButtons (Toolbar+Span = 66px).
|
// По Y: от самого верха формы до низа PanelSpanButtons (Toolbar+Span = 66px).
|
||||||
@@ -1718,6 +1845,8 @@ begin
|
|||||||
if (PanelSMeterRight = nil) or (PanelToolbar = nil) or
|
if (PanelSMeterRight = nil) or (PanelToolbar = nil) or
|
||||||
(PanelSpanButtons = nil) or (PanelLeft = nil) then Exit;
|
(PanelSpanButtons = nil) or (PanelLeft = nil) then Exit;
|
||||||
|
|
||||||
|
LayoutTopVfoBlock;
|
||||||
|
|
||||||
FW := ClientWidth;
|
FW := ClientWidth;
|
||||||
// Ширина зоны спектра (PanelRight)
|
// Ширина зоны спектра (PanelRight)
|
||||||
RightW := FW - PanelLeft.Width;
|
RightW := FW - PanelLeft.Width;
|
||||||
@@ -1997,6 +2126,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.UpdateVfoDisplay;
|
procedure TMainForm.UpdateVfoDisplay;
|
||||||
|
const
|
||||||
|
TOP_VFO_FREQ_H = 47;
|
||||||
|
TOP_VFO_FONT = 22;
|
||||||
begin
|
begin
|
||||||
FreqDispA.Frequency := Round(FVfoA);
|
FreqDispA.Frequency := Round(FVfoA);
|
||||||
FreqDispB.Frequency := Round(FVfoB);
|
FreqDispB.Frequency := Round(FVfoB);
|
||||||
@@ -2004,19 +2136,57 @@ begin
|
|||||||
begin
|
begin
|
||||||
// VFO-A активен: яркий зелёный, крупный
|
// VFO-A активен: яркий зелёный, крупный
|
||||||
FreqDispA.ColorNormal := CLR_FREQ; FreqDispA.FontSize := 20;
|
FreqDispA.ColorNormal := CLR_FREQ; FreqDispA.FontSize := 20;
|
||||||
FreqDispB.ColorNormal := CLR_FREQ_DIM; FreqDispB.FontSize := 14;
|
FreqDispB.ColorNormal := CLR_FREQ_DIM; FreqDispB.FontSize := TOP_VFO_FONT;
|
||||||
FreqDispA.Height := 36;
|
FreqDispA.Height := 36;
|
||||||
FreqDispB.Height := 28;
|
FreqDispB.Height := TOP_VFO_FREQ_H;
|
||||||
LblVfoALabel.Font.Color := CLR_FREQ;
|
LblVfoALabel.Font.Color := CLR_FREQ;
|
||||||
LblVfoBLabel.Font.Color := CLR_TEXTDIM;
|
LblVfoBLabel.Font.Color := CLR_TEXTDIM;
|
||||||
|
if BtnTopVfoBSelect <> nil then StyleButton(BtnTopVfoBSelect, False);
|
||||||
end else begin
|
end else begin
|
||||||
// VFO-B активен: яркий зелёный, крупный
|
// VFO-B активен: яркий зелёный; размер зависит от размещения
|
||||||
FreqDispA.ColorNormal := CLR_FREQ_DIM; FreqDispA.FontSize := 14;
|
FreqDispA.ColorNormal := CLR_FREQ_DIM; FreqDispA.FontSize := 14;
|
||||||
FreqDispB.ColorNormal := CLR_FREQ; FreqDispB.FontSize := 20;
|
FreqDispB.ColorNormal := CLR_FREQ;
|
||||||
|
if (PanelVfoB <> nil) and (PanelVfoB.Parent = PanelTopVfoB) then
|
||||||
|
FreqDispB.FontSize := TOP_VFO_FONT
|
||||||
|
else
|
||||||
|
FreqDispB.FontSize := 20;
|
||||||
FreqDispA.Height := 28;
|
FreqDispA.Height := 28;
|
||||||
FreqDispB.Height := 36;
|
if (PanelVfoB <> nil) and (PanelVfoB.Parent = PanelTopVfoB) then
|
||||||
|
FreqDispB.Height := TOP_VFO_FREQ_H
|
||||||
|
else
|
||||||
|
FreqDispB.Height := 36;
|
||||||
LblVfoALabel.Font.Color := CLR_TEXTDIM;
|
LblVfoALabel.Font.Color := CLR_TEXTDIM;
|
||||||
LblVfoBLabel.Font.Color := CLR_FREQ;
|
LblVfoBLabel.Font.Color := CLR_FREQ;
|
||||||
|
if BtnTopVfoBSelect <> nil then StyleButton(BtnTopVfoBSelect, True);
|
||||||
|
end;
|
||||||
|
if BtnTopVfoBTX <> nil then
|
||||||
|
begin
|
||||||
|
if FSplitTxB then
|
||||||
|
begin
|
||||||
|
BtnTopVfoBTX.ClrNorm := TColor($00000060);
|
||||||
|
BtnTopVfoBTX.ClrHot := TColor($00000090);
|
||||||
|
BtnTopVfoBTX.ClrActive := TColor($00000090);
|
||||||
|
BtnTopVfoBTX.ClrBorder := TColor($001010B0);
|
||||||
|
BtnTopVfoBTX.ClrText := TColor($00C8D8FF);
|
||||||
|
BtnTopVfoBTX.ClrTextAct := TColor($00E8F0FF);
|
||||||
|
BtnTopVfoBTX.Active := True;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
BtnTopVfoBTX.ClrNorm := TColor($00303030);
|
||||||
|
BtnTopVfoBTX.ClrHot := TColor($00404040);
|
||||||
|
BtnTopVfoBTX.ClrActive := TColor($00404040);
|
||||||
|
BtnTopVfoBTX.ClrBorder := TColor($00505050);
|
||||||
|
BtnTopVfoBTX.ClrText := CLR_TEXTDIM;
|
||||||
|
BtnTopVfoBTX.ClrTextAct := CLR_TEXT;
|
||||||
|
BtnTopVfoBTX.Active := False;
|
||||||
|
end;
|
||||||
|
BtnTopVfoBTX.Invalidate;
|
||||||
|
end;
|
||||||
|
if (PanelVfoB <> nil) and (PanelVfoB.Parent = PanelTopVfoB) then
|
||||||
|
begin
|
||||||
|
FreqDispB.FontSize := TOP_VFO_FONT;
|
||||||
|
FreqDispB.Height := TOP_VFO_FREQ_H;
|
||||||
end;
|
end;
|
||||||
FreqDispA.Invalidate;
|
FreqDispA.Invalidate;
|
||||||
FreqDispB.Invalidate;
|
FreqDispB.Invalidate;
|
||||||
@@ -2591,7 +2761,7 @@ begin
|
|||||||
// --- STOP ---
|
// --- STOP ---
|
||||||
if FRunning then
|
if FRunning then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, 0, False, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, 0, False, True, True);
|
||||||
FNetwork.SetRunAndFreq(False, FCenterFreq, FCenterFreq, 0);
|
FNetwork.SetRunAndFreq(False, FCenterFreq, FCenterFreq, 0);
|
||||||
FRunning := False;
|
FRunning := False;
|
||||||
FTransmitting := False;
|
FTransmitting := False;
|
||||||
@@ -2862,7 +3032,7 @@ begin
|
|||||||
// Сначала отправляем Run=1 — эмулятор/железо создают ddc_specific_thread
|
// Сначала отправляем Run=1 — эмулятор/железо создают ddc_specific_thread
|
||||||
// (порт 1025) и rx_thread (порт 1035+) только после получения HP Run=1.
|
// (порт 1025) и rx_thread (порт 1035+) только после получения HP Run=1.
|
||||||
// DDC Specific и DUC Specific отправляем ПОСЛЕ, иначе порты ещё не открыты.
|
// DDC Specific и DUC Specific отправляем ПОСЛЕ, иначе порты ещё не открыты.
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, False, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, False, True, True);
|
||||||
FNetwork.SetRunAndFreq(True, FCenterFreq, FCenterFreq, FDriveLevel);
|
FNetwork.SetRunAndFreq(True, FCenterFreq, FCenterFreq, FDriveLevel);
|
||||||
FRunning := True;
|
FRunning := True;
|
||||||
FRXStartTime := GetTickCount64;
|
FRXStartTime := GetTickCount64;
|
||||||
@@ -2969,7 +3139,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -2981,7 +3151,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -3018,6 +3188,28 @@ begin
|
|||||||
ActivateVfo(1);
|
ActivateVfo(1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BtnTopVfoBSelectClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if FActiveVfo <> 1 then
|
||||||
|
ActivateVfo(1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BtnTopVfoBTXClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FSplitTxB := not FSplitTxB;
|
||||||
|
if FSplitTxB and (FActiveVfo <> 0) then
|
||||||
|
ActivateVfo(0)
|
||||||
|
else
|
||||||
|
UpdateVfoDisplay;
|
||||||
|
|
||||||
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
|
begin
|
||||||
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel,
|
||||||
|
FTransmitting, True, True);
|
||||||
|
FNetwork.SendFullHP;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.FreqDispAChanged(Sender: TObject; NewFreq: Int64);
|
procedure TMainForm.FreqDispAChanged(Sender: TObject; NewFreq: Int64);
|
||||||
begin
|
begin
|
||||||
if FActiveVfo = 0 then
|
if FActiveVfo = 0 then
|
||||||
@@ -3038,7 +3230,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
// Обновляем диапазон
|
// Обновляем диапазон
|
||||||
@@ -3182,7 +3374,7 @@ begin
|
|||||||
// DDC: передаём FCenterFreq (при CTUN OFF = FVfoA, при CTUN ON = фиксирован)
|
// DDC: передаём FCenterFreq (при CTUN OFF = FVfoA, при CTUN ON = фиксирован)
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -3219,7 +3411,7 @@ begin
|
|||||||
FDSPEngine.SetShift(0.0);
|
FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@@ -3266,7 +3458,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
BandIdx := FreqToBandIdx(FVfoB);
|
BandIdx := FreqToBandIdx(FVfoB);
|
||||||
@@ -3306,7 +3498,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
FSpectrumDirty := True;
|
FSpectrumDirty := True;
|
||||||
@@ -3324,7 +3516,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
FSpectrumDirty := True;
|
FSpectrumDirty := True;
|
||||||
@@ -3547,7 +3739,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -3579,7 +3771,7 @@ begin
|
|||||||
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
if FWDSPReady then FDSPEngine.SetShift(0.0);
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
begin
|
begin
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FNetwork.SendFullHP;
|
FNetwork.SendFullHP;
|
||||||
end;
|
end;
|
||||||
FSpecView.InvalidateRulerCache;
|
FSpecView.InvalidateRulerCache;
|
||||||
@@ -3606,7 +3798,9 @@ end;
|
|||||||
|
|
||||||
function TMainForm.ActiveTXFreqHz: Double;
|
function TMainForm.ActiveTXFreqHz: Double;
|
||||||
begin
|
begin
|
||||||
if FActiveVfo = 0 then Result := FVfoA else Result := FVfoB;
|
if FSplitTxB then Result := FVfoB
|
||||||
|
else if FActiveVfo = 0 then Result := FVfoA
|
||||||
|
else Result := FVfoB;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ApplyMOX(Active: Boolean);
|
procedure TMainForm.ApplyMOX(Active: Boolean);
|
||||||
@@ -4283,7 +4477,7 @@ begin
|
|||||||
else FDSPEngine.SetShift(FVfoB - FCenterFreq);
|
else FDSPEngine.SetShift(FVfoB - FCenterFreq);
|
||||||
end;
|
end;
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
FSpecView.InvalidateRulerCache;
|
FSpecView.InvalidateRulerCache;
|
||||||
FSpectrumDirty := True;
|
FSpectrumDirty := True;
|
||||||
end;
|
end;
|
||||||
@@ -4373,7 +4567,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
FDriveLevel := CalcDriveByte;
|
FDriveLevel := CalcDriveByte;
|
||||||
if FNetwork.Connected and FNetwork.Running then
|
if FNetwork.Connected and FNetwork.Running then
|
||||||
FNetwork.UpdateState(FCenterFreq, FCenterFreq, FDriveLevel, FTransmitting, True, True);
|
FNetwork.UpdateState(FCenterFreq, ActiveTXFreqHz, FDriveLevel, FTransmitting, True, True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.TrkVolumeChange(Sender: TObject);
|
procedure TMainForm.TrkVolumeChange(Sender: TObject);
|
||||||
|
|||||||
Reference in New Issue
Block a user