You've already forked lazarus-ccr
tvplanit: Update VpEdFmt to scale correctly in the HighDpi mode of Lazarus 1.8. Less hints.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5884 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="9"/>
|
||||
<Version Value="10"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
|
@ -1597,7 +1597,7 @@ var
|
||||
DC: HDC;
|
||||
begin
|
||||
DC := GetDC(0);
|
||||
SavedFontHandle := SelectObject(DC, ACanvas.Font.Handle);
|
||||
SavedFontHandle := SelectObject(DC, ACanvas.Font.Reference.Handle);
|
||||
try
|
||||
GetTextMetrics(DC, Metrics{%H-});
|
||||
Result := Metrics.tmAveCharWidth;
|
||||
|
@ -14,7 +14,7 @@ object ContactEditForm: TContactEditForm
|
||||
OnKeyDown = FormKeyDown
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object PageControl: TPageControl
|
||||
Left = 0
|
||||
Height = 577
|
||||
|
@ -505,7 +505,6 @@ procedure TContactEditForm.PositionControls;
|
||||
type
|
||||
TLabelArray = array of TLabel;
|
||||
TComboboxArray = array of TCombobox;
|
||||
TEditArray = array of TEdit;
|
||||
var
|
||||
Labels: TLabelArray;
|
||||
Comboboxes: TComboboxArray;
|
||||
|
@ -1,71 +1,147 @@
|
||||
object frmEditFormat: TfrmEditFormat
|
||||
Left = 403
|
||||
Height = 193
|
||||
Top = 199
|
||||
Width = 329
|
||||
Left = 583
|
||||
Height = 199
|
||||
Top = 339
|
||||
Width = 347
|
||||
HorzScrollBar.Page = 328
|
||||
VertScrollBar.Page = 188
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Edit Format'
|
||||
ClientHeight = 193
|
||||
ClientWidth = 329
|
||||
ClientHeight = 199
|
||||
ClientWidth = 347
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.7'
|
||||
object LblIncrement: TLabel
|
||||
Left = 16
|
||||
LCLVersion = '1.6.4.0'
|
||||
object Panel1: TPanel
|
||||
Left = 8
|
||||
Height = 157
|
||||
Top = 8
|
||||
Width = 331
|
||||
Align = alClient
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 157
|
||||
ClientWidth = 331
|
||||
TabOrder = 0
|
||||
object LblName: TLabel
|
||||
AnchorSideTop.Control = edName
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = edName
|
||||
Left = 77
|
||||
Height = 15
|
||||
Top = 72
|
||||
Top = 4
|
||||
Width = 38
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Name: '
|
||||
FocusControl = edName
|
||||
ParentColor = False
|
||||
end
|
||||
object LblIncrement: TLabel
|
||||
AnchorSideTop.Control = edIncrement
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = edIncrement
|
||||
Left = 35
|
||||
Height = 15
|
||||
Top = 66
|
||||
Width = 80
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Day Increment:'
|
||||
FocusControl = edIncrement
|
||||
ParentColor = False
|
||||
end
|
||||
object LblDescription: TLabel
|
||||
Left = 16
|
||||
AnchorSideTop.Control = edDescription
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = edDescription
|
||||
Left = 49
|
||||
Height = 15
|
||||
Top = 44
|
||||
Top = 35
|
||||
Width = 66
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Description: '
|
||||
FocusControl = edDescription
|
||||
ParentColor = False
|
||||
end
|
||||
object LblName: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 38
|
||||
Caption = 'Name: '
|
||||
FocusControl = edName
|
||||
ParentColor = False
|
||||
object edDescription: TEdit
|
||||
AnchorSideLeft.Control = edName
|
||||
AnchorSideTop.Control = edName
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 123
|
||||
Height = 23
|
||||
Top = 31
|
||||
Width = 208
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnOk: TButton
|
||||
Left = 157
|
||||
Height = 25
|
||||
Top = 160
|
||||
Width = 75
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
OnClick = btnOkClick
|
||||
TabOrder = 5
|
||||
object edIncrement: TEdit
|
||||
AnchorSideLeft.Control = edName
|
||||
AnchorSideTop.Control = edDescription
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 123
|
||||
Height = 23
|
||||
Top = 62
|
||||
Width = 71
|
||||
Alignment = taRightJustify
|
||||
BorderSpacing.Top = 8
|
||||
TabOrder = 1
|
||||
Text = '0'
|
||||
end
|
||||
object btnCancel: TButton
|
||||
Left = 237
|
||||
Height = 25
|
||||
Top = 160
|
||||
Width = 75
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
OnClick = btnCancelClick
|
||||
TabOrder = 6
|
||||
object udIncrement: TUpDown
|
||||
AnchorSideLeft.Control = edIncrement
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = edIncrement
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 194
|
||||
Height = 23
|
||||
Top = 62
|
||||
Width = 12
|
||||
Associate = edIncrement
|
||||
Max = 365
|
||||
Min = 0
|
||||
Position = 0
|
||||
TabOrder = 2
|
||||
Wrap = False
|
||||
end
|
||||
object edName: TEdit
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 123
|
||||
Height = 23
|
||||
Top = 0
|
||||
Width = 208
|
||||
Anchors = [akTop, akRight]
|
||||
TabOrder = 3
|
||||
end
|
||||
object rgDayIncrement: TRadioGroup
|
||||
Left = 16
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = edIncrement
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Panel1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 51
|
||||
Top = 101
|
||||
Width = 296
|
||||
Top = 93
|
||||
Width = 331
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
Caption = ' Day Increment Unit '
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
@ -76,7 +152,7 @@ object frmEditFormat: TfrmEditFormat
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 4
|
||||
ClientHeight = 31
|
||||
ClientWidth = 292
|
||||
ClientWidth = 327
|
||||
Columns = 4
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
@ -88,38 +164,54 @@ object frmEditFormat: TfrmEditFormat
|
||||
TabOrder = 4
|
||||
TabStop = True
|
||||
end
|
||||
object edDescription: TEdit
|
||||
Left = 88
|
||||
Height = 23
|
||||
Top = 40
|
||||
Width = 224
|
||||
TabOrder = 1
|
||||
end
|
||||
object edName: TEdit
|
||||
Left = 64
|
||||
Height = 23
|
||||
Top = 12
|
||||
Width = 248
|
||||
object ButtonPanel: TPanel
|
||||
Left = 0
|
||||
Height = 34
|
||||
Top = 165
|
||||
Width = 347
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 34
|
||||
ClientWidth = 347
|
||||
TabOrder = 1
|
||||
object btnOk: TButton
|
||||
AnchorSideTop.Control = ButtonPanel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = btnCancel
|
||||
Left = 231
|
||||
Height = 25
|
||||
Top = 5
|
||||
Width = 42
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
OnClick = btnOkClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object udIncrement: TUpDown
|
||||
Left = 158
|
||||
Height = 23
|
||||
Top = 68
|
||||
Width = 12
|
||||
Associate = edIncrement
|
||||
Max = 365
|
||||
Min = 0
|
||||
Position = 0
|
||||
TabOrder = 3
|
||||
Wrap = False
|
||||
object btnCancel: TButton
|
||||
AnchorSideTop.Control = ButtonPanel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = ButtonPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 277
|
||||
Height = 25
|
||||
Top = 5
|
||||
Width = 62
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
OnClick = btnCancelClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object edIncrement: TEdit
|
||||
Left = 104
|
||||
Height = 23
|
||||
Top = 68
|
||||
Width = 54
|
||||
TabOrder = 2
|
||||
Text = '0'
|
||||
end
|
||||
end
|
||||
|
@ -54,6 +54,8 @@ type
|
||||
LblIncrement: TLabel;
|
||||
LblDescription: TLabel;
|
||||
LblName: TLabel;
|
||||
Panel1: TPanel;
|
||||
ButtonPanel: TPanel;
|
||||
rgDayIncrement: TRadioGroup;
|
||||
udIncrement: TUpDown;
|
||||
edIncrement: TEdit;
|
||||
@ -82,7 +84,6 @@ implementation
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Math,
|
||||
VpMisc, VpSR;
|
||||
|
||||
{ TfrmEditLayout }
|
||||
@ -92,12 +93,12 @@ begin
|
||||
PositionControls;
|
||||
edName.SetFocus;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TfrmEditFormat.btnCancelClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult := mrCancel;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TfrmEditFormat.btnOkClick(Sender: TObject);
|
||||
begin
|
||||
if Validate then
|
||||
@ -108,7 +109,7 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TfrmEditFormat.Execute(AFormat: TVpPrintFormatItem) : Boolean;
|
||||
begin
|
||||
SetData(AFormat);
|
||||
@ -122,7 +123,6 @@ begin
|
||||
SetCaptions;
|
||||
end;
|
||||
|
||||
{=====}
|
||||
procedure TfrmEditFormat.SaveData(AFormat: TVpPrintFormatItem);
|
||||
var
|
||||
EnumVal : Integer;
|
||||
@ -154,84 +154,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TfrmEditFormat.PositionControls;
|
||||
var
|
||||
DELTA: integer = 8;
|
||||
margin: Integer = 8;
|
||||
vdist: Integer = 4;
|
||||
var
|
||||
w, h: Integer;
|
||||
dummyRB: TRadioButton;
|
||||
editHeight: Integer;
|
||||
btnHeight: Integer;
|
||||
begin
|
||||
// Fix edit and button heights at higher dpi
|
||||
with TEdit.Create(self) do
|
||||
try
|
||||
Parent := self;
|
||||
editHeight := Height;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
|
||||
btnHeight := ScaleY(btnOK.Height, DesignTimeDPI);
|
||||
|
||||
DELTA := ScaleX(DELTA, DesignTimeDPI);
|
||||
MARGIN := ScaleX(MARGIN, DesignTimeDPI);
|
||||
VDIST := ScaleY(VDIST, DesignTimeDPI);
|
||||
|
||||
w := MaxValue([GetLabelWidth(LblName), GetLabelWidth(LblDescription), GetLabelWidth(LblIncrement)]);
|
||||
edName.Left := margin + w + DELTA;
|
||||
edDescription.Left := edName.Left;
|
||||
edDescription.Width := edName.Width;
|
||||
edIncrement.Left := edName.Left;
|
||||
udIncrement.Left := edIncrement.Left + edIncrement.Width;
|
||||
LblName.Left := edName.Left - GetLabelWidth(LblName) - DELTA;
|
||||
LblDescription.Left := edDescription.Left - GetLabelWidth(lblDescription) - DELTA;
|
||||
lblIncrement.Left := edIncrement.Left - GetLabelWidth(lblIncrement) - DELTA;
|
||||
|
||||
ClientWidth := MARGIN + w + DELTA + edName.Width + MARGIN;
|
||||
rgDayIncrement.Left := MARGIN;
|
||||
rgDayIncrement.Width := ClientWidth - 2*MARGIN;
|
||||
|
||||
w := Max(GetButtonWidth(btnOK), GetButtonWidth(btnCancel));
|
||||
btnOK.Width := w;
|
||||
btnCancel.Width := w;
|
||||
{$IFDEF MSWINDOWS}
|
||||
btnCancel.Left := RightOf(rgDayIncrement) - btnCancel.Width;
|
||||
btnOK.Left := btnCancel.Left - DELTA - btnOK.Width;
|
||||
btnOK.TabOrder := rgDayIncrement.TabOrder + 1;
|
||||
btnCancel.TabOrder := btnOK.TabOrder + 1;
|
||||
{$ELSE}
|
||||
btnOK.Left := RightOf(rgDayIncrement) - btnOK.Width;
|
||||
btnCancel.Left := btnOK.Left - DELTA - btnCancel.Width;
|
||||
btnCancel.TabOrder := rgDayIncrement.TabOrder + 1;
|
||||
btnOK.TabOrder := btnCancel.TabOrder + 1;
|
||||
{$ENDIF}
|
||||
|
||||
edName.Height := editHeight;
|
||||
edDescription.Height := editHeight;
|
||||
edIncrement.Height := editHeight;
|
||||
udIncrement.Height := editHeight;
|
||||
|
||||
edDescription.Top := BottomOf(edName) + VDIST;
|
||||
lblDescription.Top := edDescription.Top + (edDescription.Height - lblDescription.Height) div 2;
|
||||
edIncrement.Top := BottomOf(edDescription) + VDIST;
|
||||
udIncrement.Top := edIncrement.Top;
|
||||
lblIncrement.top := edIncrement.Top + (edIncrement.Height - lblIncrement.Height) div 2;
|
||||
rgDayIncrement.Top := BottomOf(edIncrement) + VDISt + VDIST;
|
||||
|
||||
DummyRB := TRadioButton.Create(self);
|
||||
DummyRB.Parent := self;
|
||||
h := DummyRB.Height;
|
||||
DummyRB.Free;
|
||||
|
||||
rgdayIncrement.Height := h + 2*LblName.Height;
|
||||
btnOK.Height := btnHeight;
|
||||
btnCancel.Height := btnHeight;
|
||||
btnOK.Top := Bottomof(rgDayIncrement) + MARGIN;
|
||||
btnCancel.Top := btnOK.Top;
|
||||
|
||||
ClientHeight := Bottomof(btnOK) + VDIST*2;
|
||||
AlignOKCancel(btnOK, btnCancel, ButtonPanel);
|
||||
udIncrement.Width := udIncrement.Height div 2 + 1;
|
||||
end;
|
||||
|
||||
procedure TfrmEditFormat.SetData(AFormat: TVpPrintFormatItem);
|
||||
@ -249,14 +174,11 @@ begin
|
||||
else
|
||||
rgDayIncrement.ItemIndex := 0;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TfrmEditFormat.Validate : Boolean;
|
||||
begin
|
||||
Result := edName.Text <> '';
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
@ -11,7 +11,7 @@ object DlgEventEdit: TDlgEventEdit
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object ButtonPanel: TPanel
|
||||
Left = 0
|
||||
Height = 37
|
||||
|
@ -180,7 +180,7 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, DateUtils,
|
||||
DateUtils,
|
||||
VpSR, VpMisc, VpWavDlg;
|
||||
|
||||
{$IFDEF LCL}
|
||||
@ -622,12 +622,8 @@ end;
|
||||
{=====}
|
||||
|
||||
procedure TDlgEventEdit.PositionControls;
|
||||
const
|
||||
DELTA = 8;
|
||||
VDELTA = 8;
|
||||
VDIST = 5;
|
||||
var
|
||||
w, h: Integer;
|
||||
w: Integer;
|
||||
cnv: TControlCanvas;
|
||||
editHeight: Integer;
|
||||
begin
|
||||
|
@ -12,7 +12,7 @@ object ResEditForm: TResEditForm
|
||||
Constraints.MinWidth = 400
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object pnlBottom: TPanel
|
||||
Left = 0
|
||||
Height = 33
|
||||
|
@ -100,7 +100,6 @@ implementation
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Math,
|
||||
vpSR, vpMisc;
|
||||
|
||||
function ExecuteResourceDlg(Resource: TVpResource): Boolean;
|
||||
|
@ -12,7 +12,7 @@ object FrmSoundDialog: TFrmSoundDialog
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object PageControl1: TPageControl
|
||||
Left = 0
|
||||
Height = 474
|
||||
|
@ -88,7 +88,6 @@ type
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math,
|
||||
VpSR, VpMisc;
|
||||
|
||||
{$IFDEF LCL}
|
||||
|
Reference in New Issue
Block a user