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