diff --git a/FreqDisplay.pas b/FreqDisplay.pas index a2bd90a..a1da351 100644 --- a/FreqDisplay.pas +++ b/FreqDisplay.pas @@ -32,6 +32,7 @@ type FColorDim: TColor; FMinMhzDigits: Integer; FDimLeadingZeros: Boolean; + FCenterText: Boolean; FOnChange: TFreqChangeEvent; FHoverDigit: Integer; // 0=единицы .. 8=100МГц, -1=нет @@ -69,6 +70,7 @@ type property ColorDim: TColor read FColorDim write FColorDim; property MinMhzDigits: Integer read FMinMhzDigits write FMinMhzDigits; property DimLeadingZeros: Boolean read FDimLeadingZeros write FDimLeadingZeros; + property CenterText: Boolean read FCenterText write FCenterText; property OnChange: TFreqChangeEvent read FOnChange write FOnChange; end; @@ -87,6 +89,7 @@ begin FColorDim := TColor($00607080); FMinMhzDigits := 1; FDimLeadingZeros := False; + FCenterText := True; FHoverDigit := -1; FDigitW := 14; FCharH := 24; @@ -217,7 +220,10 @@ begin Inc(LeadingMhzZeros); TotalW := C.TextWidth(S); - StartX := (Width - TotalW) div 2; + if FCenterText then + StartX := (Width - TotalW) div 2 + else + StartX := 2; if StartX < 2 then StartX := 2; // Строим карту digit → X diff --git a/MainForm.pas b/MainForm.pas index 26e322f..5b050c3 100644 --- a/MainForm.pas +++ b/MainForm.pas @@ -93,6 +93,7 @@ const SMETER_WIDTH_RATIO = 0.32; SMETER_MARGIN = 3; TOP_SMETER_GAP = 72; + TOP_VFO_FONT = 25; type TDeviceItem = record @@ -1336,8 +1337,8 @@ begin FreqDispA := TFreqDisplay.Create(Self); FreqDispA.Parent := PanelVfoA; - FreqDispA.SetBounds(22, -2, TOP_VFO_W - 22, TOP_VFO_FREQ_H); - FreqDispA.FontSize := 22; + FreqDispA.SetBounds(20, -2, TOP_VFO_W - 20, TOP_VFO_FREQ_H); + FreqDispA.FontSize := TOP_VFO_FONT; FreqDispA.FontName := 'Courier New'; FreqDispA.Frequency := Round(FVfoA); FreqDispA.ColorNormal := CLR_FREQ; @@ -1345,6 +1346,7 @@ begin FreqDispA.ColorDim := CLR_TEXTDIM; FreqDispA.MinMhzDigits := 3; FreqDispA.DimLeadingZeros := True; + FreqDispA.CenterText := False; FreqDispA.OnChange := FreqDispAChanged; FreqDispA.OnClick := FreqDispAClick; @@ -1392,8 +1394,8 @@ begin FreqDispB := TFreqDisplay.Create(Self); FreqDispB.Parent := PanelVfoB; - FreqDispB.SetBounds(22, -2, TOP_VFO_W - 22, TOP_VFO_FREQ_H); - FreqDispB.FontSize := 22; + FreqDispB.SetBounds(20, -2, TOP_VFO_W - 20, TOP_VFO_FREQ_H); + FreqDispB.FontSize := TOP_VFO_FONT; FreqDispB.FontName := 'Courier New'; FreqDispB.Frequency := Round(FVfoB); FreqDispB.ColorNormal := CLR_FREQ_DIM; @@ -1401,6 +1403,7 @@ begin FreqDispB.ColorDim := CLR_TEXTDIM; FreqDispB.MinMhzDigits := 3; FreqDispB.DimLeadingZeros := True; + FreqDispB.CenterText := False; FreqDispB.OnChange := FreqDispBChanged; FreqDispB.OnClick := FreqDispBClick; @@ -1797,7 +1800,8 @@ const TOP_VFO_FREQ_H = 47; VFO_BTN_W = 18; VFO_BTN_FREQ_GAP = 4; - VFO_FREQ_PAD = 2; + VFO_FREQ_LEFT_PAD = 2; + VFO_FREQ_RIGHT_PAD = 8; TRANSFER_LEFT_GAP = 12; TRANSFER_RIGHT_GAP = 24; TRANSFER_W = 52; @@ -1828,11 +1832,11 @@ begin Canvas.Font.Name := FreqDispB.FontName; Canvas.Font.Size := FreqDispB.FontSize; Canvas.Font.Style := [fsBold]; - FreqDispA.Left := VFO_BTN_W + VFO_BTN_FREQ_GAP; - FreqDispB.Left := VFO_BTN_W + VFO_BTN_FREQ_GAP; + FreqDispA.Left := VFO_BTN_W + VFO_BTN_FREQ_GAP - VFO_FREQ_LEFT_PAD; + FreqDispB.Left := VFO_BTN_W + VFO_BTN_FREQ_GAP - VFO_FREQ_LEFT_PAD; FreqTextW := Canvas.TextWidth('000.000.000'); - NeedFreqAW := FreqDispA.Left + FreqTextW + VFO_FREQ_PAD * 2; - NeedFreqBW := FreqDispB.Left + FreqTextW + VFO_FREQ_PAD * 2; + NeedFreqAW := FreqDispA.Left + FreqTextW + VFO_FREQ_LEFT_PAD + VFO_FREQ_RIGHT_PAD; + NeedFreqBW := FreqDispB.Left + FreqTextW + VFO_FREQ_LEFT_PAD + VFO_FREQ_RIGHT_PAD; TopVfoAW := NeedFreqAW; TopVfoBW := NeedFreqBW; GroupW := TopVfoAW + TRANSFER_LEFT_GAP + TRANSFER_W + @@ -1873,7 +1877,7 @@ begin FreqTop := ((BtnTopVfoASelect.Top + BtnTopVfoASelect.Height + BtnTopVfoATX.Top) div 2) - (TOP_VFO_FREQ_H div 2); FreqDispA.SetBounds(FreqDispA.Left, FreqDispA.Top, - FreqTextW + VFO_FREQ_PAD * 2, TOP_VFO_FREQ_H); + FreqTextW + VFO_FREQ_LEFT_PAD + VFO_FREQ_RIGHT_PAD, TOP_VFO_FREQ_H); FreqDispA.Top := FreqTop; BtnTopVfoASelect.Left := 0; BtnTopVfoATX.Left := 0; @@ -1894,7 +1898,7 @@ begin FreqTop := ((BtnTopVfoBSelect.Top + BtnTopVfoBSelect.Height + BtnTopVfoBTX.Top) div 2) - (TOP_VFO_FREQ_H div 2); FreqDispB.SetBounds(FreqDispB.Left, FreqDispB.Top, - FreqTextW + VFO_FREQ_PAD * 2, TOP_VFO_FREQ_H); + FreqTextW + VFO_FREQ_LEFT_PAD + VFO_FREQ_RIGHT_PAD, TOP_VFO_FREQ_H); FreqDispB.Top := FreqTop; BtnTopVfoBSelect.Left := 0; BtnTopVfoBTX.Left := 0; @@ -2199,7 +2203,6 @@ end; procedure TMainForm.UpdateVfoDisplay; const TOP_VFO_FREQ_H = 47; - TOP_VFO_FONT = 22; begin FreqDispA.Frequency := Round(FVfoA); FreqDispB.Frequency := Round(FVfoB);