mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 19:45:09 +00:00
Refine top VFO layout
This commit is contained in:
+75
-62
@@ -280,6 +280,7 @@ type
|
||||
BtnVfoSwap: TFlatButton;
|
||||
BtnVfoACopyB: TFlatButton;
|
||||
BtnVfoBCopyA: TFlatButton;
|
||||
PanelTopVfoGroup: TPanel;
|
||||
PanelTopVfoA: TPanel;
|
||||
PanelTopVfoB: TPanel;
|
||||
|
||||
@@ -1216,7 +1217,6 @@ const
|
||||
TOP_VFO_W = 244;
|
||||
TOP_VFO_FREQ_H = 47;
|
||||
TOP_VFO_BTN_H = 14;
|
||||
TOP_VFO_GAP = 6;
|
||||
var
|
||||
i, X, Y, W: Integer;
|
||||
B: TFlatButton;
|
||||
@@ -1285,9 +1285,16 @@ begin
|
||||
|
||||
Y := 2;
|
||||
|
||||
// VFO A (compact top block)
|
||||
// Compact top VFO group
|
||||
PanelTopVfoGroup := TPanel.Create(Self);
|
||||
PanelTopVfoGroup.Parent := Self;
|
||||
PanelTopVfoGroup.SetBounds(0, 0, TOP_VFO_W * 2 + 64, 60);
|
||||
PanelTopVfoGroup.BevelOuter := bvNone;
|
||||
PanelTopVfoGroup.Color := CLR_PANEL;
|
||||
|
||||
// VFO A
|
||||
PanelTopVfoA := TPanel.Create(Self);
|
||||
PanelTopVfoA.Parent := Self;
|
||||
PanelTopVfoA.Parent := PanelTopVfoGroup;
|
||||
PanelTopVfoA.SetBounds(0, 0, TOP_VFO_W, 60);
|
||||
PanelTopVfoA.BevelOuter := bvNone;
|
||||
PanelTopVfoA.Color := CLR_PANEL;
|
||||
@@ -1329,7 +1336,7 @@ begin
|
||||
|
||||
FreqDispA := TFreqDisplay.Create(Self);
|
||||
FreqDispA.Parent := PanelVfoA;
|
||||
FreqDispA.SetBounds(58, -2, TOP_VFO_W - 58, TOP_VFO_FREQ_H);
|
||||
FreqDispA.SetBounds(22, -2, TOP_VFO_W - 22, TOP_VFO_FREQ_H);
|
||||
FreqDispA.FontSize := 22;
|
||||
FreqDispA.FontName := 'Courier New';
|
||||
FreqDispA.Frequency := Round(FVfoA);
|
||||
@@ -1341,9 +1348,9 @@ begin
|
||||
FreqDispA.OnChange := FreqDispAChanged;
|
||||
FreqDispA.OnClick := FreqDispAClick;
|
||||
|
||||
// VFO B (compact top block)
|
||||
// VFO B
|
||||
PanelTopVfoB := TPanel.Create(Self);
|
||||
PanelTopVfoB.Parent := Self;
|
||||
PanelTopVfoB.Parent := PanelTopVfoGroup;
|
||||
PanelTopVfoB.SetBounds(0, 0, TOP_VFO_W, 60);
|
||||
PanelTopVfoB.BevelOuter := bvNone;
|
||||
PanelTopVfoB.Color := CLR_PANEL;
|
||||
@@ -1385,7 +1392,7 @@ begin
|
||||
|
||||
FreqDispB := TFreqDisplay.Create(Self);
|
||||
FreqDispB.Parent := PanelVfoB;
|
||||
FreqDispB.SetBounds(58, -2, TOP_VFO_W - 58, TOP_VFO_FREQ_H);
|
||||
FreqDispB.SetBounds(22, -2, TOP_VFO_W - 22, TOP_VFO_FREQ_H);
|
||||
FreqDispB.FontSize := 22;
|
||||
FreqDispB.FontName := 'Courier New';
|
||||
FreqDispB.Frequency := Round(FVfoB);
|
||||
@@ -1397,15 +1404,15 @@ begin
|
||||
FreqDispB.OnChange := FreqDispBChanged;
|
||||
FreqDispB.OnClick := FreqDispBClick;
|
||||
|
||||
// VFO buttons (compact top block)
|
||||
// VFO transfer buttons (between A and B)
|
||||
PanelVfoButtons := TPanel.Create(Self);
|
||||
PanelVfoButtons.Parent := PanelTopVfoB;
|
||||
PanelVfoButtons.SetBounds(0, TOP_VFO_FREQ_H + TOP_VFO_GAP, TOP_VFO_W, TOP_VFO_BTN_H);
|
||||
PanelVfoButtons.Parent := PanelTopVfoGroup;
|
||||
PanelVfoButtons.SetBounds(0, 0, 56, 60);
|
||||
PanelVfoButtons.BevelOuter := bvNone;
|
||||
|
||||
BtnVfoSwap := MakeBtn(PanelVfoButtons, 'A<>B', 0, 0, 52, TOP_VFO_BTN_H, BtnVfoSwapClick);
|
||||
BtnVfoACopyB := MakeBtn(PanelVfoButtons, 'A>B', 58, 0, 52, TOP_VFO_BTN_H, BtnVfoACopyBClick);
|
||||
BtnVfoBCopyA := MakeBtn(PanelVfoButtons, 'B>A', 116, 0, 52, TOP_VFO_BTN_H, BtnVfoBCopyAClick);
|
||||
BtnVfoACopyB := MakeBtn(PanelVfoButtons, 'A>B', 0, 0, 52, TOP_VFO_BTN_H, BtnVfoACopyBClick);
|
||||
BtnVfoBCopyA := MakeBtn(PanelVfoButtons, 'B>A', 0, 0, 52, TOP_VFO_BTN_H, BtnVfoBCopyAClick);
|
||||
BtnVfoSwap.Font.Size := 6;
|
||||
BtnVfoACopyB.Font.Size := 6;
|
||||
BtnVfoBCopyA.Font.Size := 6;
|
||||
@@ -1787,21 +1794,23 @@ procedure TMainForm.LayoutTopVfoBlock;
|
||||
const
|
||||
MARGIN = 4;
|
||||
TOP_OFFSET = 2;
|
||||
TOP_VFO_MIN_W = 244;
|
||||
TOP_VFO_BTN_H = 14;
|
||||
TOP_VFO_FREQ_H = 47;
|
||||
TOP_VFO_PAIR_GAP = 8;
|
||||
SEP_GAP = 4;
|
||||
VFO_BTN_W = 18;
|
||||
VFO_BTN_FREQ_GAP = 4;
|
||||
VFO_FREQ_PAD = 2;
|
||||
TRANSFER_LEFT_GAP = 12;
|
||||
TRANSFER_RIGHT_GAP = 24;
|
||||
TRANSFER_W = 52;
|
||||
TRANSFER_BTN_H = 16;
|
||||
TRANSFER_BTN_GAP = 3;
|
||||
SETTINGS_GAP = 4;
|
||||
BTN_GAP = 4;
|
||||
var
|
||||
BlockH: Integer;
|
||||
BtnY: Integer;
|
||||
BtnRowW: Integer;
|
||||
BtnX: Integer;
|
||||
SepLeft: Integer;
|
||||
LeftEdge: Integer;
|
||||
LeftEdgeB: Integer;
|
||||
SafeLeft: Integer;
|
||||
SafeRight: Integer;
|
||||
GroupLeft: Integer;
|
||||
GroupTop: Integer;
|
||||
RightW: Integer;
|
||||
SMW: Integer;
|
||||
SMLeft: Integer;
|
||||
@@ -1809,24 +1818,29 @@ var
|
||||
TopVfoBW: Integer;
|
||||
NeedFreqAW: Integer;
|
||||
NeedFreqBW: Integer;
|
||||
NeedBtnW: Integer;
|
||||
PairW: Integer;
|
||||
FreqTextW: Integer;
|
||||
GroupW: Integer;
|
||||
begin
|
||||
if (PanelToolbar = nil) or (PanelSpanButtons = nil) or
|
||||
if (PanelToolbar = nil) or (PanelSpanButtons = nil) or (PanelTopVfoGroup = nil) or
|
||||
(PanelTopVfoA = nil) or (PanelTopVfoB = nil) then Exit;
|
||||
|
||||
Canvas.Font.Name := FreqDispB.FontName;
|
||||
Canvas.Font.Size := FreqDispB.FontSize;
|
||||
Canvas.Font.Style := [fsBold];
|
||||
NeedFreqAW := FreqDispA.Left + Canvas.TextWidth('000.000.000') + 8;
|
||||
NeedFreqBW := FreqDispB.Left + Canvas.TextWidth('000.000.000') + 8;
|
||||
NeedBtnW := BtnVfoSwap.Width + BtnVfoACopyB.Width + BtnVfoBCopyA.Width +
|
||||
BTN_GAP * 2 + 8;
|
||||
TopVfoAW := Max(TOP_VFO_MIN_W, NeedFreqAW);
|
||||
TopVfoBW := Max(TOP_VFO_MIN_W, Max(NeedFreqBW, NeedBtnW));
|
||||
PairW := TopVfoAW + TOP_VFO_PAIR_GAP + TopVfoBW;
|
||||
FreqDispA.Left := VFO_BTN_W + VFO_BTN_FREQ_GAP;
|
||||
FreqDispB.Left := VFO_BTN_W + VFO_BTN_FREQ_GAP;
|
||||
FreqTextW := Canvas.TextWidth('000.000.000');
|
||||
NeedFreqAW := FreqDispA.Left + FreqTextW + VFO_FREQ_PAD * 2;
|
||||
NeedFreqBW := FreqDispB.Left + FreqTextW + VFO_FREQ_PAD * 2;
|
||||
TopVfoAW := NeedFreqAW;
|
||||
TopVfoBW := NeedFreqBW;
|
||||
GroupW := TopVfoAW + TRANSFER_LEFT_GAP + TRANSFER_W +
|
||||
TRANSFER_RIGHT_GAP + TopVfoBW;
|
||||
|
||||
SepLeft := PanelToolbar.ClientWidth - MARGIN;
|
||||
SafeLeft := MARGIN;
|
||||
if BtnSettings <> nil then
|
||||
SafeLeft := BtnSettings.Left + BtnSettings.Width + SETTINGS_GAP;
|
||||
SafeRight := ClientWidth - MARGIN;
|
||||
if PanelLeft <> nil then
|
||||
begin
|
||||
RightW := ClientWidth - PanelLeft.Width;
|
||||
@@ -1834,51 +1848,50 @@ begin
|
||||
begin
|
||||
SMW := Round(RightW * SMETER_WIDTH_RATIO);
|
||||
SMLeft := ClientWidth - SMW - SMETER_MARGIN;
|
||||
SepLeft := Min(SepLeft, SMLeft - TOP_SMETER_GAP);
|
||||
SafeRight := Min(SafeRight, SMLeft - TOP_SMETER_GAP);
|
||||
end;
|
||||
end;
|
||||
|
||||
LeftEdge := SepLeft - SEP_GAP - PairW;
|
||||
if BtnSettings <> nil then
|
||||
LeftEdge := Max(LeftEdge, BtnSettings.Left + BtnSettings.Width + SETTINGS_GAP);
|
||||
|
||||
if LeftEdge + PairW > SepLeft - SEP_GAP then
|
||||
if SafeLeft + GroupW > SafeRight then
|
||||
begin
|
||||
PanelTopVfoA.Visible := False;
|
||||
PanelTopVfoB.Visible := False;
|
||||
PanelTopVfoGroup.Visible := False;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
PanelTopVfoGroup.Visible := True;
|
||||
PanelTopVfoA.Visible := True;
|
||||
PanelTopVfoB.Visible := True;
|
||||
BlockH := PanelToolbar.Height + PanelSpanButtons.Height - (MARGIN * 2);
|
||||
if BlockH < 56 then BlockH := 56;
|
||||
LeftEdgeB := LeftEdge + TopVfoAW + TOP_VFO_PAIR_GAP;
|
||||
GroupLeft := SafeLeft + (SafeRight - SafeLeft - GroupW) div 2;
|
||||
GroupTop := TOP_OFFSET;
|
||||
|
||||
PanelTopVfoA.SetBounds(LeftEdge, TOP_OFFSET, TopVfoAW, BlockH);
|
||||
PanelTopVfoGroup.SetBounds(GroupLeft, GroupTop, GroupW, BlockH);
|
||||
PanelTopVfoA.SetBounds(0, 0, TopVfoAW, BlockH);
|
||||
PanelVfoA.SetBounds(0, 0, TopVfoAW, TOP_VFO_FREQ_H);
|
||||
FreqDispA.SetBounds(FreqDispA.Left, FreqDispA.Top,
|
||||
Max(20, TopVfoAW - FreqDispA.Left), TOP_VFO_FREQ_H);
|
||||
BtnTopVfoASelect.Left := FreqDispA.Left - BtnTopVfoASelect.Width;
|
||||
BtnTopVfoATX.Left := FreqDispA.Left - BtnTopVfoATX.Width;
|
||||
FreqTextW + VFO_FREQ_PAD * 2, TOP_VFO_FREQ_H);
|
||||
BtnTopVfoASelect.Left := 0;
|
||||
BtnTopVfoATX.Left := 0;
|
||||
|
||||
PanelTopVfoB.SetBounds(LeftEdgeB, TOP_OFFSET, TopVfoBW, BlockH);
|
||||
PanelVfoButtons.SetBounds(TopVfoAW + TRANSFER_LEFT_GAP, 0, TRANSFER_W, BlockH);
|
||||
BtnY := (PanelVfoButtons.Height - (TRANSFER_BTN_H * 3 + TRANSFER_BTN_GAP * 2)) div 2;
|
||||
if BtnY < 0 then BtnY := 0;
|
||||
BtnVfoSwap.SetBounds(0, BtnY, TRANSFER_W, TRANSFER_BTN_H);
|
||||
BtnVfoACopyB.SetBounds(0, BtnY + TRANSFER_BTN_H + TRANSFER_BTN_GAP,
|
||||
TRANSFER_W, TRANSFER_BTN_H);
|
||||
BtnVfoBCopyA.SetBounds(0, BtnY + (TRANSFER_BTN_H + TRANSFER_BTN_GAP) * 2,
|
||||
TRANSFER_W, TRANSFER_BTN_H);
|
||||
|
||||
PanelTopVfoB.SetBounds(TopVfoAW + TRANSFER_LEFT_GAP + TRANSFER_W +
|
||||
TRANSFER_RIGHT_GAP,
|
||||
0, TopVfoBW, BlockH);
|
||||
PanelVfoB.SetBounds(0, 0, TopVfoBW, TOP_VFO_FREQ_H);
|
||||
FreqDispB.SetBounds(FreqDispB.Left, FreqDispB.Top,
|
||||
Max(20, TopVfoBW - FreqDispB.Left), 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, TopVfoBW - 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;
|
||||
PanelTopVfoA.BringToFront;
|
||||
PanelTopVfoB.BringToFront;
|
||||
FreqTextW + VFO_FREQ_PAD * 2, TOP_VFO_FREQ_H);
|
||||
BtnTopVfoBSelect.Left := 0;
|
||||
BtnTopVfoBTX.Left := 0;
|
||||
PanelTopVfoGroup.BringToFront;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ResizeSMeter;
|
||||
@@ -2066,7 +2079,7 @@ procedure TMainForm.ApplyDarkTheme;
|
||||
begin
|
||||
Color := CLR_BG; Font.Color := CLR_TEXT;
|
||||
DP(PanelToolbar); DP(PanelLeft);
|
||||
DP(PanelTopVfoA); DP(PanelTopVfoB);
|
||||
DP(PanelTopVfoGroup); DP(PanelTopVfoA); DP(PanelTopVfoB);
|
||||
DP(PanelVfoA); DP(PanelVfoB); DP(PanelVfoButtons);
|
||||
DP(PanelBands); DP(PanelMode); DP(PanelFilter);
|
||||
DP(PanelRX); DP(PanelTX);
|
||||
|
||||
Reference in New Issue
Block a user