tvplanit: Fixing errors in shape editor's control positions for gtk2/qt.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5010 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-07-20 15:50:18 +00:00
parent 3068e728b5
commit dbe08a2511
2 changed files with 92 additions and 51 deletions

View File

@ -2,52 +2,61 @@ object frmEditShape: TfrmEditShape
Left = 772 Left = 772
Height = 243 Height = 243
Top = 248 Top = 248
Width = 363 Width = 426
HorzScrollBar.Page = 362 HorzScrollBar.Page = 362
VertScrollBar.Page = 313 VertScrollBar.Page = 313
BorderStyle = bsDialog BorderStyle = bsDialog
Caption = 'Edit Shape' Caption = 'Edit Shape'
ClientHeight = 243 ClientHeight = 243
ClientWidth = 363 ClientWidth = 426
OnCreate = FormCreate OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
Position = poScreenCenter Position = poScreenCenter
ShowHint = True ShowHint = True
LCLVersion = '1.7' LCLVersion = '1.7'
object btnOk: TButton object btnOk: TButton
Left = 192 AnchorSideBottom.Control = gbPen
AnchorSideBottom.Side = asrBottom
Left = 253
Height = 25 Height = 25
Top = 203 Top = 203
Width = 75 Width = 75
Anchors = [akLeft, akBottom]
Caption = 'OK' Caption = 'OK'
Default = True Default = True
OnClick = btnOkClick OnClick = btnOkClick
TabOrder = 3 TabOrder = 3
end end
object btnCancel: TButton object btnCancel: TButton
Left = 272 AnchorSideBottom.Control = gbPen
AnchorSideBottom.Side = asrBottom
Left = 333
Height = 25 Height = 25
Top = 203 Top = 203
Width = 75 Width = 75
Anchors = [akLeft, akBottom]
BorderSpacing.Right = 8
Cancel = True Cancel = True
Caption = 'Cancel' Caption = 'Cancel'
OnClick = btnCancelClick OnClick = btnCancelClick
TabOrder = 4 TabOrder = 4
end end
object gbBrush: TGroupBox object gbBrush: TGroupBox
Left = 186 Left = 216
Height = 86 Height = 86
Top = 88 Top = 88
Width = 165 Width = 192
BorderSpacing.Right = 8
Caption = ' Brush ' Caption = ' Brush '
ClientHeight = 66 ClientHeight = 66
ClientWidth = 161 ClientWidth = 188
TabOrder = 2 TabOrder = 2
object lblBrushStyle: TLabel object lblBrushStyle: TLabel
Left = 8 Left = 8
Height = 15 Height = 15
Top = 35 Top = 35
Width = 28 Width = 28
BorderSpacing.Left = 8
Caption = 'Style:' Caption = 'Style:'
FocusControl = cbBrushStyle FocusControl = cbBrushStyle
ParentColor = False ParentColor = False
@ -56,7 +65,9 @@ object frmEditShape: TfrmEditShape
Left = 52 Left = 52
Height = 23 Height = 23
Top = 32 Top = 32
Width = 97 Width = 129
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 15 ItemHeight = 15
OnChange = cbBrushStyleChange OnChange = cbBrushStyleChange
OnDrawItem = cbBrushStyleDrawItem OnDrawItem = cbBrushStyleDrawItem
@ -67,6 +78,7 @@ object frmEditShape: TfrmEditShape
Height = 15 Height = 15
Top = 5 Top = 5
Width = 32 Width = 32
BorderSpacing.Left = 8
Caption = 'Color:' Caption = 'Color:'
FocusControl = cbBrushColor FocusControl = cbBrushColor
ParentColor = False ParentColor = False
@ -75,8 +87,9 @@ object frmEditShape: TfrmEditShape
Left = 52 Left = 52
Height = 22 Height = 22
Top = 1 Top = 1
Width = 97 Width = 124
Style = [cbStandardColors, cbExtendedColors, cbPrettyNames, cbCustomColors] Style = [cbStandardColors, cbExtendedColors, cbPrettyNames, cbCustomColors]
BorderSpacing.Right = 8
ItemHeight = 16 ItemHeight = 16
OnChange = cbBrushColorChange OnChange = cbBrushColorChange
TabOrder = 1 TabOrder = 1
@ -86,16 +99,19 @@ object frmEditShape: TfrmEditShape
Left = 8 Left = 8
Height = 140 Height = 140
Top = 88 Top = 88
Width = 165 Width = 192
BorderSpacing.Left = 8
BorderSpacing.Bottom = 8
Caption = ' Pen ' Caption = ' Pen '
ClientHeight = 120 ClientHeight = 120
ClientWidth = 161 ClientWidth = 188
TabOrder = 1 TabOrder = 1
object lblPenStyle: TLabel object lblPenStyle: TLabel
Left = 8 Left = 8
Height = 15 Height = 15
Top = 35 Top = 35
Width = 28 Width = 28
BorderSpacing.Left = 8
Caption = 'Style:' Caption = 'Style:'
FocusControl = cbPenStyle FocusControl = cbPenStyle
ParentColor = False ParentColor = False
@ -105,6 +121,7 @@ object frmEditShape: TfrmEditShape
Height = 15 Height = 15
Top = 64 Top = 64
Width = 35 Width = 35
BorderSpacing.Left = 8
Caption = 'Width:' Caption = 'Width:'
FocusControl = edPenWidth FocusControl = edPenWidth
ParentColor = False ParentColor = False
@ -114,6 +131,7 @@ object frmEditShape: TfrmEditShape
Height = 15 Height = 15
Top = 92 Top = 92
Width = 34 Width = 34
BorderSpacing.Left = 8
Caption = 'Mode:' Caption = 'Mode:'
FocusControl = cbPenMode FocusControl = cbPenMode
ParentColor = False ParentColor = False
@ -122,7 +140,8 @@ object frmEditShape: TfrmEditShape
Left = 52 Left = 52
Height = 23 Height = 23
Top = 32 Top = 32
Width = 97 Width = 124
BorderSpacing.Right = 8
ItemHeight = 15 ItemHeight = 15
OnChange = cbPenStyleChange OnChange = cbPenStyleChange
OnDrawItem = cbPenStyleDrawItem OnDrawItem = cbPenStyleDrawItem
@ -132,7 +151,9 @@ object frmEditShape: TfrmEditShape
Left = 52 Left = 52
Height = 23 Height = 23
Top = 88 Top = 88
Width = 97 Width = 124
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
ItemHeight = 15 ItemHeight = 15
TabOrder = 4 TabOrder = 4
end end
@ -160,8 +181,9 @@ object frmEditShape: TfrmEditShape
Left = 52 Left = 52
Height = 22 Height = 22
Top = 1 Top = 1
Width = 97 Width = 124
Style = [cbStandardColors, cbExtendedColors, cbPrettyNames, cbCustomColors] Style = [cbStandardColors, cbExtendedColors, cbPrettyNames, cbCustomColors]
BorderSpacing.Right = 8
ItemHeight = 16 ItemHeight = 16
OnChange = cbPenColorChange OnChange = cbPenColorChange
TabOrder = 0 TabOrder = 0
@ -171,6 +193,7 @@ object frmEditShape: TfrmEditShape
Height = 15 Height = 15
Top = 5 Top = 5
Width = 29 Width = 29
BorderSpacing.Left = 8
Caption = 'Color' Caption = 'Color'
FocusControl = cbPenColor FocusControl = cbPenColor
ParentColor = False ParentColor = False
@ -180,66 +203,71 @@ object frmEditShape: TfrmEditShape
Left = 8 Left = 8
Height = 67 Height = 67
Top = 8 Top = 8
Width = 324 Width = 400
BorderSpacing.Right = 8
Caption = 'gbShapes' Caption = 'gbShapes'
ClientHeight = 47 ClientHeight = 47
ClientWidth = 320 ClientWidth = 396
TabOrder = 0 TabOrder = 0
object SpeedButton1: TSpeedButton object SpeedButton1: TSpeedButton
Left = 12 Left = 12
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
BorderSpacing.Left = 8
BorderSpacing.Bottom = 8
Down = True Down = True
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton2: TSpeedButton object SpeedButton2: TSpeedButton
Left = 49 Left = 49
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton3: TSpeedButton object SpeedButton3: TSpeedButton
Left = 86 Left = 86
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton4: TSpeedButton object SpeedButton4: TSpeedButton
Left = 123 Left = 123
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton5: TSpeedButton object SpeedButton5: TSpeedButton
Left = 160 Left = 160
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton6: TSpeedButton object SpeedButton6: TSpeedButton
Left = 197 Left = 197
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton7: TSpeedButton object SpeedButton7: TSpeedButton
Left = 234 Left = 234
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
GroupIndex = 1 GroupIndex = 1
end end
object SpeedButton8: TSpeedButton object SpeedButton8: TSpeedButton
Left = 271 Left = 271
Height = 32 Height = 32
Top = 7 Top = 4
Width = 32 Width = 32
BorderSpacing.Right = 8
BorderSpacing.Bottom = 8
GroupIndex = 1 GroupIndex = 1
end end
end end

View File

@ -303,6 +303,10 @@ var
DELTA: Integer = 8; DELTA: Integer = 8;
VDIST: Integer = 4; VDIST: Integer = 4;
begin begin
AutoSize := false;
gbPen.AutoSize := false;
gbBrush.AutoSize := false;
// This is needed as workaround for the combobox height at higher dpi. // This is needed as workaround for the combobox height at higher dpi.
// We design it with Style csDropdown where the height is correct, and then // We design it with Style csDropdown where the height is correct, and then
// use the corresponding, correct ItemHeight after switching to csOwnerDrawFixed // use the corresponding, correct ItemHeight after switching to csOwnerDrawFixed
@ -316,7 +320,7 @@ begin
DELTA := round(DELTA * Screen.PixelsPerInch / DesignTimeDPI); DELTA := round(DELTA * Screen.PixelsPerInch / DesignTimeDPI);
VDIST := round(VDIST * Screen.PixelsPerInch / DesignTimeDPI); VDIST := round(VDIST * Screen.PixelsPerInch / DesignTimeDPI);
// Horizontal alignment { gbPen - hor }
w := MaxValue([GetLabelWidth(lblPenColor), GetLabelWidth(lblPenStyle), w := MaxValue([GetLabelWidth(lblPenColor), GetLabelWidth(lblPenStyle),
GetLabelWidth(lblPenWidth), GetLabelWidth(lblPenMode)]) + 2 * DELTA; GetLabelWidth(lblPenWidth), GetLabelWidth(lblPenMode)]) + 2 * DELTA;
cbPenColor.Left := w; cbPenColor.Left := w;
@ -327,27 +331,55 @@ begin
lblPenStyle.Left := cbPenColor.Left - GetLabelWidth(lblPenStyle) - DELTA; lblPenStyle.Left := cbPenColor.Left - GetLabelWidth(lblPenStyle) - DELTA;
lblPenWidth.Left := cbPenColor.Left - GetLabelWidth(lblPenWidth) - DELTA; lblPenWidth.Left := cbPenColor.Left - GetLabelWidth(lblPenWidth) - DELTA;
lblPenMode.Left := cbPenColor.Left - GetLabelWidth(lblPenMode) - DELTA; lblPenMode.Left := cbPenColor.Left - GetLabelWidth(lblPenMode) - DELTA;
gbPen.Width := RightOf(cbPenColor) + DELTA;
udPenWidth.Left := RightOf(edPenWidth); udPenWidth.Left := RightOf(edPenWidth);
{ gbPen - vert }
lblPenColor.Top := cbPenColor.Top + (cbPenColor.Height - lblPenColor.Height) div 2;
cbPenStyle.Top := BottomOf(cbPenColor) + VDIST;
lblPenstyle.Top := cbPenStyle.Top + (cbPenStyle.Height - lblPenStyle.Height) div 2;
edPenWidth.Top := BottomOf(cbPenStyle) + VDIST;
udPenWidth.Top := edPenWidth.Top;
lblPenWidth.Top := edPenWidth.Top + (edPenWidth.Height - lblPenWidth.Height) div 2;
cbPenMode.Top := BottomOf(edPenWidth) + VDIST;
lblPenMode.Top := cbPenMode.Top + (cbPenMode.Height - lblPenMode.Height) div 2;
{ gpPen - set size }
gbPen.AutoSize := true;
{ gbBrush - hor }
w := MaxValue([GetLabelWidth(lblBrushColor), GetLabelWidth(lblBrushStyle)]) + 2*DELTA; w := MaxValue([GetLabelWidth(lblBrushColor), GetLabelWidth(lblBrushStyle)]) + 2*DELTA;
cbBrushColor.Left := w; cbBrushColor.Left := w;
cbBrushStyle.Left := w; cbBrushStyle.Left := w;
cbBrushColor.Width := cbPenColor.Width;
cbBrushStyle.Width := cbPenStyle.Width;
lblBrushColor.Left := cbBrushColor.Left - GetLabelWidth(lblBrushColor) - DELTA; lblBrushColor.Left := cbBrushColor.Left - GetLabelWidth(lblBrushColor) - DELTA;
lblBrushStyle.Left := cbBrushColor.Left - GetLabelWidth(lblBrushStyle) - DELTA; lblBrushStyle.Left := cbBrushColor.Left - GetLabelWidth(lblBrushStyle) - DELTA;
gbBrush.Left := RightOf(gbPen) + 16; gbBrush.Left := RightOf(gbPen) + 16;
gbBrush.Width := RightOf(cbBrushColor) + DELTA;
{ gbBrush - ver }
lblBrushColor.Top := lblPenColor.Top;
cbBrushStyle.Top := cbPenStyle.Top;
lblBrushStyle.Top := lblPenStyle.Top;
{ gbBrush - set size }
gbBrush.AutoSize := true;
{ Buttons - hor }
btnOK.Width := Max(GetButtonWidth(btnOK), GetButtonWidth(btnCancel)); btnOK.Width := Max(GetButtonWidth(btnOK), GetButtonWidth(btnCancel));
btnCancel.Width := btnOK.Width; btnCancel.Width := btnOK.Width;
if btnOK.Width + DELTA + btnCancel.Width > gbBrush.Width then if btnOK.Width + DELTA + btnCancel.Width > gbBrush.Width then begin
gbBrush.Width := btnOK.Width + DELTA + btnCancel.Width; cbBrushColor.Width := cbBrushColor.Width + btnOK.Width + DELTA + btnCancel.Width - gbBrush.Width;
cbBrushStyle.Width := cbBrushColor.Width;
end;
btnCancel.Left := RightOf(gbBrush) - btnCancel.Width; btnCancel.Left := RightOf(gbBrush) - btnCancel.Width;
btnOK.Left := btnCancel.Left - DELTA - btnOK.Width; btnOK.Left := btnCancel.Left - DELTA - btnOK.Width;
ClientWidth := RightOf(gbBrush) + gbPen.Left; { Buttons - vert }
btnOK.Top := BottomOf(gbPen) - btnOK.Height;
btnCancel.Top := btnOK.Top;
gbShapes.Width := ClientWidth - gbShapes.Left * 2; { shapes - hor }
gbShapes.Width := RightOf(gbBrush) - gbShapes.Left;
w := (gbShapes.ClientWidth - 11 * DELTA) div 8; w := (gbShapes.ClientWidth - 11 * DELTA) div 8;
for shape := Low(TVpShapeType) to High(TVpShapeType) do begin for shape := Low(TVpShapeType) to High(TVpShapeType) do begin
if shape = Low(TVpShapeType) then if shape = Low(TVpShapeType) then
@ -356,26 +388,7 @@ begin
FShapeButtons[shape].Width := w; FShapeButtons[shape].Width := w;
end; end;
// Vertical alignment AutoSize := true;
lblPenColor.Top := cbPenColor.Top + (cbPenColor.Height - lblPenColor.Height) div 2;
lblBrushColor.Top := lblPenColor.Top;
cbPenStyle.Top := BottomOf(cbPenColor) + VDIST;
cbBrushStyle.Top := cbPenStyle.Top;
lblPenstyle.Top := cbPenStyle.Top + (cbPenStyle.Height - lblPenStyle.Height) div 2;
lblBrushStyle.Top := lblPenStyle.Top;
edPenWidth.Top := BottomOf(cbPenStyle) + VDIST;
udPenWidth.Top := edPenWidth.Top;
lblPenWidth.Top := edPenWidth.Top + (edPenWidth.Height - lblPenWidth.Height) div 2;
cbPenMode.Top := BottomOf(edPenWidth) + VDIST;
lblPenMode.Top := cbPenMode.Top + (cbPenMode.Height - lblPenMode.Height) div 2;
gbPen.ClientHeight := BottomOf(cbPenMode) + DELTA;
gbBrush.ClientHeight := BottomOf(cbBrushStyle) + DELTA;
btnOK.Top := BottomOf(gbPen) - btnOK.Height;
btnCancel.Top := btnOK.Top;
ClientHeight := BottomOf(btnOK) + DELTA;
end; end;
procedure TfrmEditShape.SaveData(AShape: TVpPrintShape); procedure TfrmEditShape.SaveData(AShape: TVpPrintShape);