spktoolbar: Fix LCLScaling (minor issue remaining when form is loaded from hi-dpi system into low-dpi system: modify form a bit, save and load again).

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6196 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-02-12 09:29:36 +00:00
parent 38fc173d25
commit f17eb37074
8 changed files with 122 additions and 70 deletions

View File

@ -290,9 +290,6 @@ type
// *** Getters and setters ***
// ***************************
{Getter for property Height }
function GetHeight: integer;
{ Setter for property Appearance }
procedure SetAppearance(const Value: TSpkToolbarAppearance);
@ -418,9 +415,6 @@ type
{ Object containing attributes of toolbar appearance }
property Appearance: TSpkToolbarAppearance read FAppearance write SetAppearance;
{ Height of toolbar (read-only) }
property Height: integer read GetHeight;
{ Index of active tab }
property TabIndex: integer read FTabIndex write SetTabIndex;
@ -572,7 +566,7 @@ begin
if (AOwner is TForm) then
SpkInitLayoutConsts(96); // This default dpi value is ignored for LCL scaling
inherited Height := ToolbarHeight;
Height := ToolbarHeight;
//inherited Doublebuffered:=true;
@ -688,11 +682,6 @@ begin
Result := inherited Color;
end;
function TSpkToolbar.GetHeight: integer;
begin
Result := inherited Height;
end;
function TSpkToolbar.GetTempBitmap: TBitmap;
begin
Result := FTemporary;
@ -1081,7 +1070,8 @@ end;
procedure TSpkToolbar.DoOnResize;
begin
inherited Height := ToolbarHeight;
if Height <> ToolbarHeight then
Height := ToolbarHeight;
{$IFDEF DELAYRUNTIMER}
FDelayRunTimer.Enabled := False;

View File

@ -18,11 +18,7 @@ uses
Graphics, LCLVersion;
const
{$IF lcl_fullversion < 1080000}
SPK_DPI_AWARE = true;
{$ELSE}
SPK_DPI_AWARE = false; // use lcl scaling instead
{$ENDIF}
procedure SpkInitLayoutConsts(FromDPI: Integer; ToDPI: Integer = 0);
function SpkScaleX(Size: Integer; FromDPI: Integer; ToDPI: Integer = 0): integer;

View File

@ -1,23 +1,25 @@
object Form1: TForm1
Left = 301
Height = 378
Top = 242
Width = 585
Left = 368
Height = 304
Top = 248
Width = 501
Caption = 'Form1'
ClientHeight = 358
ClientWidth = 585
ClientHeight = 284
ClientWidth = 501
Menu = MainMenu
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
object ToolBar1: TToolBar
Left = 0
Height = 26
Height = 24
Top = 0
Width = 585
Width = 501
AutoSize = True
Caption = 'ToolBar1'
EdgeBorders = [ebBottom]
Images = ImageList
ParentFont = False
TabOrder = 0
object ToolButton1: TToolButton
Left = 1
@ -30,71 +32,71 @@ object Form1: TForm1
Action = AcSave
end
object ToolButton3: TToolButton
Left = 47
Left = 70
Height = 22
Top = 0
Caption = 'ToolButton3'
Style = tbsDivider
end
object ToolButton4: TToolButton
Left = 52
Left = 47
Top = 0
Action = AcEditCut
end
object ToolButton5: TToolButton
Left = 75
Left = 73
Top = 0
Action = AcEditCopy
end
object ToolButton6: TToolButton
Left = 98
Left = 96
Top = 0
Action = AcEditPaste
end
object ToolButton7: TToolButton
Left = 121
Left = 188
Height = 22
Top = 0
Caption = 'ToolButton7'
Style = tbsDivider
end
object ToolButton8: TToolButton
Left = 269
Left = 260
Top = 0
Action = AcQuit
end
object ToolButton9: TToolButton
Left = 126
Left = 119
Top = 0
Action = AcBold
end
object ToolButton10: TToolButton
Left = 149
Left = 142
Top = 0
Action = AcItalic
end
object ToolButton11: TToolButton
Left = 195
Left = 191
Top = 0
Action = AcLeftJustify
end
object ToolButton12: TToolButton
Left = 172
Left = 165
Top = 0
Action = AcUnderline
end
object ToolButton13: TToolButton
Left = 218
Left = 214
Top = 0
Action = AcCenter
end
object ToolButton14: TToolButton
Left = 241
Left = 237
Top = 0
Action = AcRightJustify
end
object ToolButton15: TToolButton
Left = 264
Left = 283
Height = 22
Top = 0
Caption = 'ToolButton15'
@ -103,27 +105,30 @@ object Form1: TForm1
end
object Panel1: TPanel
Left = 0
Height = 220
Top = 138
Width = 585
Height = 185
Top = 99
Width = 501
Align = alClient
BevelOuter = bvNone
ClientHeight = 220
ClientWidth = 585
ClientHeight = 185
ClientWidth = 501
ParentFont = False
TabOrder = 1
object Label1: TLabel
Left = 16
Left = 24
Height = 15
Top = 8
Top = 12
Width = 34
Caption = 'Label1'
ParentColor = False
ParentFont = False
end
end
object SpkToolbar1: TSpkToolbar
Left = 0
Top = 26
Width = 585
Height = 75
Top = 24
Width = 501
Appearance.Tab.TabHeaderFont.Color = 9126421
Appearance.Tab.BorderColor = 14922381
Appearance.Tab.GradientFromColor = 16115934

View File

@ -10,9 +10,10 @@ object Form2: TForm2
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
LCLVersion = '1.9.0.0'
LCLVersion = '1.6.4.0'
object SpkToolbar1: TSpkToolbar
Left = 0
Height = 112
Top = 0
Width = 777
Color = clBtnFace

View File

@ -1,26 +1,27 @@
object Form1: TForm1
Left = 280
Height = 667
Height = 614
Top = 130
Width = 636
Caption = 'spkToolbar Styles'
ClientHeight = 667
ClientHeight = 614
ClientWidth = 636
Color = clMedGray
LCLVersion = '1.9.0.0'
LCLVersion = '1.6.4.0'
object ScrollBox1: TScrollBox
Left = 0
Height = 667
Height = 614
Top = 0
Width = 636
HorzScrollBar.Page = 75
VertScrollBar.Page = 660
VertScrollBar.Page = 608
Align = alClient
ClientHeight = 663
ClientHeight = 610
ClientWidth = 632
TabOrder = 0
object SpkToolbar1: TSpkToolbar
Left = 0
Height = 112
Top = 0
Width = 632
Color = clMedGray
@ -268,7 +269,8 @@ object Form1: TForm1
end
object SpkToolbar2: TSpkToolbar
Left = 0
Top = 137
Height = 112
Top = 124
Width = 632
Color = clMedGray
Style = spkOffice2007Silver
@ -515,7 +517,8 @@ object Form1: TForm1
end
object SpkToolbar3: TSpkToolbar
Left = 0
Top = 274
Height = 112
Top = 248
Width = 632
Color = clMedGray
Style = spkOffice2007SilverTurquoise
@ -762,7 +765,7 @@ object Form1: TForm1
end
object Panel1: TPanel
Left = 0
Height = 25
Height = 12
Top = 112
Width = 632
Align = alTop
@ -771,8 +774,8 @@ object Form1: TForm1
end
object Panel4: TPanel
Left = 0
Height = 25
Top = 523
Height = 12
Top = 484
Width = 632
Align = alTop
BevelOuter = bvNone
@ -780,8 +783,8 @@ object Form1: TForm1
end
object Panel3: TPanel
Left = 0
Height = 25
Top = 386
Height = 12
Top = 360
Width = 632
Align = alTop
BevelOuter = bvNone
@ -789,7 +792,8 @@ object Form1: TForm1
end
object SpkToolbar4: TSpkToolbar
Left = 0
Top = 411
Height = 112
Top = 372
Width = 632
Color = clMedGray
Style = spkMetroLight
@ -1038,8 +1042,8 @@ object Form1: TForm1
end
object Panel2: TPanel
Left = 0
Height = 25
Top = 249
Height = 12
Top = 236
Width = 632
Align = alTop
BevelOuter = bvNone
@ -1049,7 +1053,8 @@ object Form1: TForm1
end
object SpkToolbar5: TSpkToolbar
Left = 0
Top = 548
Height = 112
Top = 496
Width = 632
Color = clMedGray
Style = spkMetroDark

View File

@ -13,7 +13,7 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
OnCreate = FormCreate
OnShow = FormShow
ShowHint = True
LCLVersion = '1.9.0.0'
LCLVersion = '1.6.4.0'
object gbPreview: TGroupBox
Left = 0
Height = 132
@ -125,6 +125,8 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
Caption = 'Sample toolbar'
OverrideAppearance = False
Visible = True
Panes = (
'SpkPane1'
'SpkPane2'
@ -132,21 +134,29 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
)
object SpkPane1: TSpkPane
Caption = 'Sample large buttons'
Visible = True
Items = (
'SpkLargeButton1'
'SpkLargeButton3'
'SpkLargeButton2'
)
object SpkLargeButton1: TSpkLargeButton
Visible = True
Enabled = True
Caption = 'Default'
LargeImageIndex = 0
ButtonKind = bkButton
end
object SpkLargeButton3: TSpkLargeButton
Visible = True
Enabled = True
Caption = 'Button and dropdown'
LargeImageIndex = 0
ButtonKind = bkButtonDropdown
end
object SpkLargeButton2: TSpkLargeButton
Visible = True
Enabled = True
Caption = 'Dropdown'
LargeImageIndex = 0
ButtonKind = bkDropdown
@ -154,34 +164,49 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
end
object SpkPane2: TSpkPane
Caption = 'Sample small buttons'
Visible = True
Items = (
'SpkSmallButton1'
'SpkSmallButton2'
'SpkSmallButton3'
)
object SpkSmallButton1: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Default'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow
ButtonKind = bkButton
end
object SpkSmallButton2: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button and dropdown'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow
ButtonKind = bkButtonDropdown
end
object SpkSmallButton3: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Dropdown'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True
ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow
ButtonKind = bkDropdown
end
end
object SpkPane3: TSpkPane
Caption = 'Tool buttons'
Visible = True
Items = (
'SpkSmallButton4'
'SpkSmallButton5'
@ -190,31 +215,59 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
'SpkSmallButton8'
)
object SpkSmallButton4: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button'
GroupBehaviour = gbBeginsGroup
HideFrameWhenIdle = False
ImageIndex = 0
ShowCaption = False
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end
object SpkSmallButton5: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button'
GroupBehaviour = gbContinuesGroup
HideFrameWhenIdle = False
ImageIndex = 0
ShowCaption = False
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end
object SpkSmallButton6: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button'
GroupBehaviour = gbEndsGroup
HideFrameWhenIdle = False
ImageIndex = 0
ShowCaption = False
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end
object SpkSmallButton7: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Btn1'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = False
ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow
ButtonKind = bkButton
end
object SpkSmallButton8: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Btn2'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = False
ImageIndex = 0
ShowCaption = True
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end
end
end
@ -263,6 +316,8 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded
Caption = 'Another tab'
OverrideAppearance = False
Visible = True
Panes = ( )
end
end
@ -272,13 +327,13 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
Height = 382
Top = 132
Width = 552
ActivePage = TabSheet2
ActivePage = TabSheet1
Align = alClient
TabIndex = 1
TabIndex = 0
TabOrder = 1
object TabSheet1: TTabSheet
Caption = 'Tab'
ClientHeight = 360
ClientHeight = 354
ClientWidth = 544
object sTabRectangle: TShape
AnchorSideLeft.Control = LblInactiveTabHeaderFontColor

View File

@ -321,7 +321,7 @@ implementation
{$R *.lfm}
uses
Types, clipbrd;
Types, clipbrd, spkt_Const;
var
CurrPageIndex: Integer = 0;