mirror of
https://git.vladimir.cc/vladimir/ewsdr.git
synced 2026-08-25 19:45:09 +00:00
fix(ui): DPI-масштабирование SettingsForm/DeviceForm + общий DpiScale
Вся раскладка окон, построенных кодом (SettingsForm, DeviceForm), была захардкожена в пикселях под неявные 96 DPI — на Windows 125-200% или HiDPI-десктопах контролы физически не росли вместе с укрупнившимся шрифтом. Добавлено масштабирование SetBounds через MulDiv(V, Screen.PixelsPerInch, 96) на каждой листовой точке потребления (const-блоки раскладки не трогались). Общий DpiScale вынесен в новый юнит DpiUtils.pas — убрана дублированная копия одноимённого приватного метода в 9 классах (FlatCheckBox, FlatComboBox, FlatListBox, FlatSpinEdit, FlatFloatSpinEdit, FlatEdit, FlatRadioButton, FlatPopupMenu, SettingsForm, DeviceForm) и инлайн-MulDiv без обёртки в MainForm.pas/PanafallPanel.pas. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+6
-6
@@ -45,7 +45,7 @@ uses
|
||||
PowerInhibit,
|
||||
DeviceStore,
|
||||
RadioBackend, PlutoBackend,
|
||||
RadioController, ChannelController;
|
||||
RadioController, ChannelController, DpiUtils;
|
||||
|
||||
const
|
||||
// Меню шапки пана: теги ниже — rate в кГц, от DDC_MENU_TAG — выбор hw-DDC.
|
||||
@@ -2746,21 +2746,21 @@ var
|
||||
RULER_H: Integer;
|
||||
PANZOOM_H: Integer;
|
||||
begin
|
||||
RULER_H := MulDiv(18, Screen.PixelsPerInch, 96);
|
||||
RULER_H := DpiScale(18);
|
||||
if PanelRight = nil then Exit;
|
||||
if Assigned(FSpecView) then SyncSpecViewFreq;
|
||||
RW := PanelRight.ClientWidth;
|
||||
RH := PanelRight.ClientHeight;
|
||||
// Низ занят панелью пана/зума (позиционирует FPan.Layout той же формулой) —
|
||||
// wideband-блок делит оставшуюся высоту.
|
||||
PANZOOM_H := MulDiv(22, Screen.PixelsPerInch, 96);
|
||||
PANZOOM_H := DpiScale(22);
|
||||
if FController.FShowSpectrum or FController.FShowWaterfall then
|
||||
RH := RH - PANZOOM_H;
|
||||
UpdateWidebandFrequencyView;
|
||||
WideH := 0;
|
||||
WideSpecH := 0;
|
||||
if FController.FShowWideband then
|
||||
WideH := Min(MulDiv(WB_H, Screen.PixelsPerInch, 96), Max(40, RH div 2));
|
||||
WideH := Min(DpiScale(WB_H), Max(40, RH div 2));
|
||||
if WideH > 0 then
|
||||
WideSpecH := Max(1, WideH - RULER_H);
|
||||
// Wideband — всегда во всю ширину PanelRight, самой верхней полосой.
|
||||
@@ -2816,7 +2816,7 @@ end;
|
||||
function TMainForm.Pan0HeaderH: Integer;
|
||||
begin
|
||||
if Pan0HeaderVisible then
|
||||
Result := MulDiv(20, Screen.PixelsPerInch, 96) // = HEADER_H панели
|
||||
Result := DpiScale(20) // = HEADER_H панели
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
@@ -7829,7 +7829,7 @@ begin
|
||||
MaxBottom := BtnBand[i].Top + BtnBand[i].Height;
|
||||
BtnH := BtnBand[i].Height;
|
||||
end;
|
||||
if BtnH = 0 then BtnH := MulDiv(24, Screen.PixelsPerInch, 96);
|
||||
if BtnH = 0 then BtnH := DpiScale(24);
|
||||
RowH := BtnH + 3; // шаг ряда: высота кнопки + 3px зазор (как 27=24+3 при 1x)
|
||||
|
||||
Pos := 0; // позиция среди enabled слотов
|
||||
|
||||
Reference in New Issue
Block a user