jvcllaz: Fix LCL scaling of TJvTMTimeline.DayWidth

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6616 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-08-28 16:37:43 +00:00
parent 7e6025369f
commit 5d76cc9d8c
5 changed files with 269 additions and 223 deletions

View File

@ -7,6 +7,7 @@
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="SimpleTLTest1"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>

View File

@ -10,6 +10,7 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
Constraints.MinHeight = 376
Constraints.MinWidth = 710
DefaultMonitor = dmDesktop
DesignTimePPI = 144
Font.Color = clWindowText
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
@ -22,13 +23,13 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
Scaled = False
object Panel1: TPanel
Left = 0
Height = 339
Top = 225
Height = 469
Top = 90
Width = 926
Align = alBottom
AutoSize = True
BevelOuter = bvNone
ClientHeight = 339
ClientHeight = 469
ClientWidth = 926
TabOrder = 0
TabStop = True
@ -37,9 +38,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = Panel1
AnchorSideRight.Side = asrBottom
Left = 8
Height = 15
Height = 25
Top = 8
Width = 41
Width = 62
BorderSpacing.Top = 8
Caption = 'Images:'
ParentColor = False
@ -48,10 +49,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = gbDates
AnchorSideTop.Control = gbDates
AnchorSideTop.Side = asrBottom
Left = 601
Height = 15
Top = 192
Width = 112
Left = 760
Height = 25
Top = 245
Width = 168
BorderSpacing.Top = 24
Caption = 'Keyboard navigation:'
ParentColor = False
@ -60,10 +61,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = LblKeyboardNavigation
AnchorSideTop.Control = LblKeyboardNavigation
AnchorSideTop.Side = asrBottom
Left = 617
Height = 30
Top = 211
Width = 181
Left = 776
Height = 50
Top = 274
Width = 280
BorderSpacing.Left = 16
BorderSpacing.Top = 4
Caption = 'Left/Right arrow:'#13#10#9'move Small Change days'
@ -73,10 +74,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label18
AnchorSideTop.Control = Label18
AnchorSideTop.Side = asrBottom
Left = 617
Height = 30
Top = 245
Width = 181
Left = 776
Height = 50
Top = 328
Width = 280
BorderSpacing.Top = 4
Caption = 'Ctrl+Left/Right arrow:'#13#10#9'move Large Change days'
ParentColor = False
@ -85,10 +86,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label19
AnchorSideTop.Control = Label19
AnchorSideTop.Side = asrBottom
Left = 617
Height = 30
Top = 279
Width = 173
Left = 776
Height = 50
Top = 382
Width = 268
BorderSpacing.Top = 4
Caption = 'Shift+Left/Right arrow:'#13#10#9'move selection one day'
ParentColor = False
@ -97,24 +98,24 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = gbAppearance
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbWidths
Left = 601
Height = 160
Left = 760
Height = 213
Top = 8
Width = 230
Width = 264
AutoSize = True
BorderSpacing.Left = 24
BorderSpacing.Right = 8
Caption = ' Dates: '
ClientHeight = 140
ClientWidth = 226
ClientHeight = 183
ClientWidth = 260
TabOrder = 2
object Label2: TLabel
AnchorSideLeft.Control = gbDates
AnchorSideTop.Control = gbDates
Left = 12
Height = 15
Height = 25
Top = 0
Width = 87
Width = 131
BorderSpacing.Left = 12
Caption = 'First visible date:'
ParentColor = False
@ -124,9 +125,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = dtpFirstDate
AnchorSideTop.Side = asrBottom
Left = 12
Height = 15
Top = 48
Width = 73
Height = 25
Top = 68
Width = 110
BorderSpacing.Top = 8
Caption = 'Selected date:'
ParentColor = False
@ -134,20 +135,20 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object Label4: TLabel
AnchorSideLeft.Control = edImageNo
AnchorSideTop.Control = Label2
Left = 131
Height = 15
Left = 165
Height = 25
Top = 0
Width = 61
Width = 92
Caption = 'Add image:'
ParentColor = False
end
object Label5: TLabel
AnchorSideLeft.Control = edImageNo
AnchorSideTop.Control = Label3
Left = 131
Height = 15
Top = 48
Width = 39
Left = 165
Height = 25
Top = 68
Width = 59
Caption = 'at date:'
ParentColor = False
end
@ -156,10 +157,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
Left = 12
Height = 23
Height = 33
Hint = 'Sets the first displayed date'
Top = 17
Width = 79
Top = 27
Width = 113
CenturyFrom = 1941
MaxDate = 2958465
MinDate = -53780
@ -184,10 +185,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = Label3
AnchorSideTop.Side = asrBottom
Left = 12
Height = 23
Height = 33
Hint = 'Sets the selected day'
Top = 65
Width = 79
Top = 95
Width = 113
CenturyFrom = 1941
MaxDate = 2958465
MinDate = -53780
@ -212,10 +213,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom
Left = 131
Height = 23
Left = 165
Height = 33
Hint = 'Sets the imageindex to insert at the current date'#13#10'(use -1 to remove image)'
Top = 17
Top = 27
Width = 68
BorderSpacing.Left = 40
BorderSpacing.Top = 2
@ -225,9 +226,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object udImageNo: TUpDown
AnchorSideLeft.Control = edImageNo
AnchorSideLeft.Side = asrBottom
Left = 199
Height = 23
Top = 17
Left = 233
Height = 33
Top = 27
Width = 15
Associate = edImageNo
BorderSpacing.Right = 12
@ -241,10 +242,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = udImageNo
AnchorSideRight.Side = asrBottom
Left = 131
Height = 23
Left = 165
Height = 33
Hint = 'Sets the date to insert / delete an image'
Top = 65
Top = 95
Width = 83
CenturyFrom = 1941
MaxDate = 2958465
@ -266,15 +267,18 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
CalAlignment = dtaLeft
end
object btnAdd: TButton
AnchorSideTop.Control = dtpImageDate
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = udImageNo
AnchorSideRight.Side = asrBottom
Left = 166
Height = 25
Left = 188
Height = 35
Hint = 'Adds an image to the chosen date'
Top = 103
Width = 48
Top = 136
Width = 60
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Top = 8
BorderSpacing.Bottom = 12
Caption = '&Add'
OnClick = btnAddClick
@ -285,24 +289,24 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = gbWidths
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbWidths
Left = 319
Height = 194
Left = 369
Height = 284
Top = 8
Width = 258
Width = 367
AutoSize = True
BorderSpacing.Left = 24
Caption = ' Appearance: '
ClientHeight = 174
ClientWidth = 254
ClientHeight = 254
ClientWidth = 363
TabOrder = 1
object Label13: TLabel
AnchorSideLeft.Control = chkRClick
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = chkEnabled
Left = 128
Height = 15
Top = 63
Width = 114
Left = 179
Height = 25
Top = 93
Width = 172
BorderSpacing.Left = 8
BorderSpacing.Right = 12
Caption = 'Assigned object style:'
@ -312,10 +316,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = gbAppearance
AnchorSideTop.Control = gbAppearance
Left = 12
Height = 19
Height = 29
Hint = 'Makes the control read-only'
Top = 0
Width = 74
Width = 111
BorderSpacing.Left = 12
Caption = 'Read-only'
OnClick = chkReadOnlyClick
@ -326,10 +330,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = chkReadOnly
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Height = 29
Hint = 'Makes the control flat'
Top = 21
Width = 39
Top = 31
Width = 58
BorderSpacing.Top = 2
Caption = 'Flat'
OnClick = chkFlatClick
@ -340,10 +344,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = chkFlat
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Height = 29
Hint = 'Moves the selection on right-click too'
Top = 42
Width = 108
Top = 62
Width = 159
BorderSpacing.Top = 2
Caption = 'Right click select'
OnClick = chkRClickClick
@ -354,10 +358,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = chkRClick
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Height = 29
Hint = 'Enables the control'
Top = 63
Width = 62
Top = 93
Width = 93
BorderSpacing.Top = 2
Caption = 'Enabled'
Checked = True
@ -370,9 +374,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = chkEnabled
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 84
Width = 82
Height = 29
Top = 124
Width = 125
BorderSpacing.Top = 2
Caption = 'Show today'
Checked = True
@ -385,9 +389,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = chkShowTodayIcon
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 126
Width = 84
Height = 29
Top = 186
Width = 127
BorderSpacing.Top = 2
Caption = 'Show weeks'
Checked = True
@ -401,9 +405,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 12
Height = 19
Top = 147
Width = 93
Height = 29
Top = 217
Width = 140
BorderSpacing.Top = 2
BorderSpacing.Bottom = 8
Caption = 'Show months'
@ -416,15 +420,16 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label13
AnchorSideTop.Control = Label13
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbAppearance
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = chkShowMonths
AnchorSideBottom.Side = asrBottom
Left = 128
Height = 86
Left = 179
Height = 126
Hint = 'Sets the font to use for day items that'#13#10'have a non-nil Objects item'
Top = 80
Width = 107
Anchors = [akTop, akLeft, akBottom]
Top = 120
Width = 172
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 12
IntegralHeight = True
@ -434,7 +439,7 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
'Underline'
'Strikeout'
)
ItemHeight = 17
ItemHeight = 27
OnClickCheck = lbObjFontStyleClickCheck
TabOrder = 8
Data = {
@ -446,9 +451,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = chkShowToday
AnchorSideTop.Side = asrBottom
Left = 12
Height = 19
Top = 105
Width = 108
Height = 29
Top = 155
Width = 163
BorderSpacing.Top = 2
Caption = 'Show today icon'
Checked = True
@ -462,25 +467,25 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = gbFonts
AnchorSideBottom.Side = asrBottom
Left = 373
Height = 94
Top = 210
Width = 145
Left = 447
Height = 124
Top = 300
Width = 185
AutoSize = True
BorderSpacing.Left = 24
BorderSpacing.Bottom = 16
Caption = ' Misc. '
ClientHeight = 74
ClientWidth = 141
ClientHeight = 94
ClientWidth = 181
TabOrder = 4
object btnLoad: TButton
AnchorSideLeft.Control = gbMisc
AnchorSideTop.Control = gbMisc
Left = 16
Height = 25
Height = 35
Hint = 'Loads a previously saved timeline file'
Top = 4
Width = 109
Width = 149
AutoSize = True
BorderSpacing.Left = 16
BorderSpacing.Top = 4
@ -496,10 +501,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideRight.Control = btnLoad
AnchorSideRight.Side = asrBottom
Left = 16
Height = 25
Height = 35
Hint = 'Saves the current content to a timeline file'
Top = 37
Width = 109
Top = 47
Width = 149
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
@ -514,14 +519,14 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = gbAppearance
AnchorSideTop.Side = asrBottom
Left = 104
Height = 129
Top = 210
Width = 245
Height = 169
Top = 300
Width = 319
AutoSize = True
BorderSpacing.Top = 8
Caption = ' Fonts and colors: '
ClientHeight = 109
ClientWidth = 241
ClientHeight = 139
ClientWidth = 315
TabOrder = 3
object btnFont: TButton
AnchorSideLeft.Control = btnColor
@ -530,10 +535,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideRight.Control = btnMonthFont
AnchorSideRight.Side = asrBottom
Left = 12
Height = 25
Height = 35
Hint = 'Sets the font for days'
Top = 37
Width = 96
Top = 47
Width = 129
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 8
@ -547,10 +552,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideRight.Control = btnMonthFont
AnchorSideRight.Side = asrBottom
Left = 12
Height = 25
Height = 35
Hint = 'Sets the background color'
Top = 4
Width = 96
Width = 129
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 4
@ -563,10 +568,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = btnFont
AnchorSideTop.Side = asrBottom
Left = 12
Height = 25
Height = 35
Hint = 'Sets the font for months and years'
Top = 70
Width = 96
Top = 90
Width = 129
AutoSize = True
BorderSpacing.Left = 12
BorderSpacing.Top = 8
@ -579,11 +584,11 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = btnFont
AnchorSideRight.Control = btnPenColor
AnchorSideRight.Side = asrBottom
Left = 116
Height = 25
Left = 149
Height = 35
Hint = 'Sets the background color for the today item'
Top = 37
Width = 113
Top = 47
Width = 154
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Today color...'
@ -595,10 +600,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = btnColor
AnchorSideRight.Control = btnPenColor
AnchorSideRight.Side = asrBottom
Left = 116
Height = 25
Left = 149
Height = 35
Top = 4
Width = 113
Width = 154
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'Line color...'
@ -609,11 +614,11 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = btnMonthFont
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = btnMonthFont
Left = 116
Height = 25
Left = 149
Height = 35
Hint = 'Sets the color of the selection frame'
Top = 70
Width = 113
Top = 90
Width = 154
AutoSize = True
BorderSpacing.Left = 8
BorderSpacing.Right = 12
@ -628,24 +633,24 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = LblImages
Left = 104
Height = 161
Height = 221
Top = 8
Width = 191
Width = 241
AutoSize = True
BorderSpacing.Left = 12
Caption = ' Widths and sizes: '
ClientHeight = 141
ClientWidth = 187
ClientHeight = 191
ClientWidth = 237
TabOrder = 0
object Label1: TLabel
AnchorSideTop.Control = edDayWidth
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label9
AnchorSideRight.Side = asrBottom
Left = 30
Height = 15
Top = 60
Width = 56
Left = 37
Height = 25
Top = 80
Width = 84
Anchors = [akTop, akRight]
BorderSpacing.Left = 8
Caption = 'Day width:'
@ -656,10 +661,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label9
AnchorSideRight.Side = asrBottom
Left = 10
Height = 15
Top = 87
Width = 76
Left = 9
Height = 25
Top = 117
Width = 112
Anchors = [akTop, akRight]
BorderSpacing.Left = 8
Caption = 'Sel. line width:'
@ -670,9 +675,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edScrollSmall
Left = 12
Height = 15
Height = 25
Top = 6
Width = 74
Width = 109
Anchors = [akTop, akRight]
BorderSpacing.Left = 12
BorderSpacing.Right = 4
@ -685,9 +690,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideRight.Control = Label9
AnchorSideRight.Side = asrBottom
Left = 12
Height = 15
Top = 33
Width = 74
Height = 25
Top = 43
Width = 109
Anchors = [akTop, akRight]
BorderSpacing.Left = 9
Caption = 'Large change:'
@ -698,10 +703,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = Label9
AnchorSideRight.Side = asrBottom
Left = 14
Height = 15
Top = 114
Width = 72
Left = 15
Height = 25
Top = 154
Width = 106
Anchors = [akTop, akRight]
BorderSpacing.Left = 8
Caption = 'Button width:'
@ -711,10 +716,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label15
AnchorSideTop.Control = edScrollSmall
AnchorSideTop.Side = asrCenter
Left = 146
Height = 15
Left = 181
Height = 25
Top = 6
Width = 24
Width = 37
Caption = 'days'
ParentColor = False
end
@ -722,10 +727,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label15
AnchorSideTop.Control = edScrollLarge
AnchorSideTop.Side = asrCenter
Left = 146
Height = 15
Top = 33
Width = 24
Left = 181
Height = 25
Top = 43
Width = 37
Caption = 'days'
ParentColor = False
end
@ -733,10 +738,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Control = edDayWidth
AnchorSideTop.Side = asrCenter
AnchorSideRight.Side = asrBottom
Left = 146
Height = 15
Top = 60
Width = 29
Left = 181
Height = 25
Top = 80
Width = 44
Anchors = [akTop, akRight]
BorderSpacing.Right = 12
Caption = 'pixels'
@ -746,10 +751,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label15
AnchorSideTop.Control = edPenWidth
AnchorSideTop.Side = asrCenter
Left = 146
Height = 15
Top = 87
Width = 29
Left = 181
Height = 25
Top = 117
Width = 44
Caption = 'pixels'
ParentColor = False
end
@ -757,10 +762,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideLeft.Control = Label15
AnchorSideTop.Control = edButtonWidth
AnchorSideTop.Side = asrCenter
Left = 146
Height = 15
Top = 114
Width = 29
Left = 181
Height = 25
Top = 154
Width = 44
Caption = 'pixels'
ParentColor = False
end
@ -770,10 +775,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edScrollSmall
AnchorSideRight.Side = asrBottom
Left = 90
Height = 23
Left = 125
Height = 33
Hint = 'Sets the width in pixels of a single day'
Top = 56
Top = 76
Width = 33
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
@ -783,9 +788,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object udDayWidth: TUpDown
AnchorSideRight.Control = udScrollSmall
AnchorSideRight.Side = asrBottom
Left = 127
Height = 23
Top = 56
Left = 162
Height = 33
Top = 76
Width = 15
Anchors = [akTop, akRight]
Associate = edDayWidth
@ -801,10 +806,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edScrollSmall
AnchorSideRight.Side = asrBottom
Left = 90
Height = 23
Left = 125
Height = 33
Hint = 'Sets the width of the selection frame'
Top = 83
Top = 113
Width = 33
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
@ -814,9 +819,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object udPenWidth: TUpDown
AnchorSideRight.Control = udScrollSmall
AnchorSideRight.Side = asrBottom
Left = 127
Height = 23
Top = 83
Left = 162
Height = 33
Top = 113
Width = 15
Anchors = [akTop, akRight]
Associate = edPenWidth
@ -828,8 +833,8 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object edScrollSmall: TEdit
AnchorSideTop.Control = gbWidths
AnchorSideRight.Control = udScrollSmall
Left = 90
Height = 23
Left = 125
Height = 33
Hint = 'Sets the number of days to scroll when clicking the buttons '#13#10'or when using the arrow-keys'
Top = 2
Width = 33
@ -841,8 +846,8 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
end
object udScrollSmall: TUpDown
AnchorSideRight.Control = Label11
Left = 127
Height = 23
Left = 162
Height = 33
Top = 2
Width = 15
Anchors = [akTop, akRight]
@ -860,10 +865,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edScrollSmall
AnchorSideRight.Side = asrBottom
Left = 90
Height = 23
Left = 125
Height = 33
Hint = 'Sets the number of days to scroll when Ctrl + clicking the buttons '#13#10'or when using Ctrl+left arrow or Ctrl+right arrow'
Top = 29
Top = 39
Width = 33
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
@ -873,9 +878,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object udScrollLarge: TUpDown
AnchorSideRight.Control = udScrollSmall
AnchorSideRight.Side = asrBottom
Left = 127
Height = 23
Top = 29
Left = 162
Height = 33
Top = 39
Width = 15
Anchors = [akTop, akRight]
Associate = edScrollLarge
@ -891,10 +896,10 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edScrollSmall
AnchorSideRight.Side = asrBottom
Left = 90
Height = 23
Left = 125
Height = 33
Hint = 'Sets the width of the scrollbuttons'
Top = 110
Top = 150
Width = 33
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
@ -905,9 +910,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
object udButtonWidth: TUpDown
AnchorSideRight.Control = udScrollSmall
AnchorSideRight.Side = asrBottom
Left = 127
Height = 23
Top = 110
Left = 162
Height = 33
Top = 150
Width = 15
Anchors = [akTop, akRight]
Associate = edButtonWidth
@ -925,8 +930,8 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
AnchorSideBottom.Control = Panel1
AnchorSideBottom.Side = asrBottom
Left = 8
Height = 312
Top = 27
Height = 432
Top = 37
Width = 84
Anchors = [akTop, akLeft, akBottom]
BorderSpacing.Left = 8
@ -940,9 +945,9 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
end
object StatusBar: TStatusBar
Left = 0
Height = 23
Height = 28
Hint = 'Displays info about the control'
Top = 568
Top = 563
Width = 926
BorderSpacing.Top = 4
Panels = <

View File

@ -34,7 +34,7 @@ interface
uses
LCLType, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, ComCtrls, StdCtrls, Buttons, ImgList, DateTimePicker,
Menus, CheckLst, ComboEx, JvTMTimeLine, Types;
Menus, CheckLst, JvTMTimeLine, Types;
type
@ -197,13 +197,15 @@ begin
'Double-click a date to edit it''s memo content.' +
LineEnding +
'Right-click to display pop-up menu.';
JvTimeLine1.Date := dtpFirstDate.Date;
JvTimeLine1.SelDate := dtpSelDate.Date;
dtpSelDate.Date := Date;
dtpFirstDate.Date := Date-7;
dtpImageDate.Date := Date+7;
udDayWidth.Position := JvTimeLine1.DayWidth;
udButtonWidth.Position := JvTimeLine1.ButtonWidth;
chkReadOnly.Checked := JvTimeLine1.ReadOnly;
JvTimeLine1.Date := dtpFirstDate.Date;
JvTimeLine1.SelDate := dtpSelDate.Date;
lbObjFontStyle.Checked[2] := true;
for i := 0 to il16.Count - 1 do
LbImages.Items.Add(IntToStr(i));
@ -211,9 +213,10 @@ begin
LbImages.ItemHeight := Max(il16.Height, abs(LbImages.Font.Height)) + IMAGE_DIST;
i := LbImages.Canvas.TextWidth('99');
LbImages.Width := Max(
il16.Width + 4 * abs(LbImages.Font.Height) + 3 * IMAGE_DIST,
il16.Width + 4 * abs(LbImages.Font.Height) + 3 * Scale96ToFont(IMAGE_DIST),
LblImages.Width
);
udDayWidth.Position := jvTimeLine1.DayWidth;
ActiveControl := JvTimeLine1;
end;
@ -352,7 +355,6 @@ end;
procedure TTMTimeLineMainForm.udDayWidthClick(Sender: TObject; Button: TUDBtnType);
begin
JvTimeLine1.DayWidth := udDayWidth.Position;
udDayWidth.Position := JvTimeLine1.DayWidth;
StatusBarResize(Sender);
end;

View File

@ -1129,12 +1129,12 @@ begin
FItemHintImageList.Free;
inherited Destroy;
end;
procedure TJvCustomTimeLine.DoYearFontChange(Sender: TObject);
begin
Invalidate;
end;
procedure TJvCustomTimeLine.CreateWnd;
var
I: TJvScrollArrow;

View File

@ -33,10 +33,13 @@ unit JvTMTimeLine;
interface
uses
LCLIntf, LCLType, LMessages, Types,
LCLIntf, LCLType, LMessages, LCLVersion, Types,
SysUtils, Classes, Controls, Buttons, Graphics, ExtCtrls, Forms, ImgList,
JvExControls;
const
cTMTimeLineDayWidth = 19;
type
TJvTLSelFrame = class(TPersistent)
private
@ -97,6 +100,8 @@ type
FLineColor: TColor;
FShift: TShiftState;
FShowTodayIcon: Boolean;
function DayWidthStored: Boolean;
function GetDayWidth: Integer;
function GetRectForDate(ADate: TDate): TRect;
function DateFromPos(APos: Integer): TDate;
procedure DoTimer(Sender: TObject);
@ -148,6 +153,10 @@ type
// procedure GetDlgCode(var Code: TDlgCodes); override; <--- wp
// procedure CursorChanged; override; <--- wo
procedure Change; virtual;
{$IFDEF LCL_FullVersion >= 1080000}
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override;
{$IFEND}
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
procedure EnabledChanged; override;
@ -167,7 +176,7 @@ type
property BorderStyle: TBorderStyle read GetBorderStyle write SetBorderStyle;
property ButtonWidth: Integer read FButtonWidth write SetButtonWidth default 16;
property Cursor;
property DayWidth: Integer read FDayWidth write SetDayWidth default 19;
property DayWidth: Integer read GetDayWidth write SetDayWidth stored DayWidthStored;
property ObjectsFontStyle: TFontStyles read FObjectsFontStyle write SetObjectsFontStyle default [fsUnderline];
property ImageCursor: TCursor read FImageCursor write SetImageCursor default crHandPoint;
property Images: TImageList read FImages write SetImages;
@ -417,7 +426,7 @@ begin
FButtonWidth := 16;
FDate := SysUtils.Date - 7;
FSelDate := FDate - 1;
FDayWidth := 19;
FDayWidth := -1;
FImageCursor := crHandPoint;
FSmallChange := 7;
FLargeChange := 30;
@ -600,7 +609,7 @@ begin
Tmp := APos - ButtonWidth
else
Tmp := APos - 1;
Result := Self.Date + (Tmp div FDayWidth);
Result := Self.Date + (Tmp div DayWidth);
end;
procedure TJvCustomTMTimeline.DrawToday(ACanvas: TCanvas; const ARect: TRect);
@ -653,14 +662,14 @@ begin
FirstOffset := 1;
// first loop: draw dates, today and images
FTmpStyle := Font.Style;
for I := 0 to Width div FDayWidth do
for I := 0 to Width div DayWidth do
begin
R := GetRectForDate(Self.Date + I);
if Self.Date + I = SysUtils.Date then
DrawToday(ACanvas, R);
DecodeDate(Self.Date + I, Y, M, D);
R := Classes.Rect(I * FDayWidth, 8, I * FDayWidth + FDayWidth, Font.Size+8);
R := Classes.Rect(I * DayWidth, 8, I * DayWidth + DayWidth, Font.Size+8);
OffsetRect(R, FirstOffset, 0);
S := Format('%.2d', [D]);
SetBkMode(ACanvas.Handle, TRANSPARENT);
@ -695,8 +704,8 @@ begin
Pen.Width := 1;
Pen.Style := psDot;
Pen.Color := FLineColor;
MoveTo(I * FDayWidth + FDayWidth + FirstOffset, 0);
LineTo(I * FDayWidth + FDayWidth + FirstOffset, Height);
MoveTo(I * DayWidth + DayWidth + FirstOffset, 0);
LineTo(I * DayWidth + DayWidth + FirstOffset, Height);
end;
ACanvas.Font := MonthFont;
@ -709,8 +718,8 @@ begin
// draw text for end of this month:
S := FormatSettings.ShortMonthNames[M];
Size := ACanvas.TextExtent(S);
R := Classes.Rect(I * FDayWidth + FDayWidth - Size.cx - 8,
Height - Size.cy - 4, I * FDayWidth + FDayWidth, Height - 4);
R := Classes.Rect(I * DayWidth + DayWidth - Size.cx - 8,
Height - Size.cy - 4, I * DayWidth + DayWidth, Height - 4);
OffsetRect(R, FirstOffset, 0);
SetBkMode(ACanvas.Handle, TRANSPARENT);
DrawText(ACanvas.Handle, PChar(S), Length(S), R,
@ -722,7 +731,7 @@ begin
// draw text for start of this month and the year:
S := Format('%s %d', [FormatSettings.ShortMonthNames[M], Y]);
Size := ACanvas.TextExtent(S);
R := Classes.Rect(I * FDayWidth + 4, Height - Size.cy - 4, I * FDayWidth + Size.cx + 4, Height - 4);
R := Classes.Rect(I * DayWidth + 4, Height - Size.cy - 4, I * DayWidth + Size.cx + 4, Height - 4);
OffsetRect(R, FirstOffset, 0);
SetBkMode(ACanvas.Handle, TRANSPARENT);
DrawText(ACanvas.Handle, PChar(S), Length(S), R,
@ -734,8 +743,8 @@ begin
Pen.Width := 1;
Pen.Style := psSolid;
Pen.Color := FLineColor;
MoveTo(I * FDayWidth + FirstOffset, 0);
LineTo(I * FDayWidth + FirstOffset, Height);
MoveTo(I * DayWidth + FirstOffset, 0);
LineTo(I * DayWidth + FirstOffset, Height);
end;
end;
end;
@ -781,7 +790,7 @@ begin
if DateHasImage(ADate) then
begin
I := ImageIndex[ADate];
X := ARect.Left + (FDayWidth - Images.Width) div 2;
X := ARect.Left + (DayWidth - Images.Width) div 2;
// Y := Max((Height - Images.Height) div 4, CanvasMaxTextHeight(ACanvas) + 2);
Y := CanvasMaxTextHeight(ACanvas) + 2;
Images.Draw(ACanvas, X, Y, I);
@ -869,9 +878,22 @@ begin
end;
end;
function TJvCustomTMTimeLine.DayWidthStored: Boolean;
begin
Result := FDayWidth >= 0;
end;
function TJvCustomTMTimeLine.GetDayWidth: Integer;
begin
if DayWidthStored then
Result := FDayWidth
else
Result := Scale96ToFont(cTMTimeLineDayWidth);
end;
procedure TJvCustomTMTimeline.SetDayWidth(const Value: Integer);
begin
if (FDayWidth <> Value) and (Value > 0) then
if (FDayWidth <> Value) and (Value <> 0) and (Value >= -1) then
begin
FDayWidth := Value;
Invalidate;
@ -979,6 +1001,22 @@ begin
FOnChange(Self);
end;
{$IFDEF LCL_FullVersion >= 1080000}
procedure TCustomTMTimeLine.DoAutoAdjustLayout(
const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double);
begin
inherited DoAutoAdjustLayout(AMode, AXProportion, AYProportion);
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin
if FDayWidthStored then
FDayWidth := Round(FDayWidth * AXProportion);
Invalidate;
end;
end;
{$IFEND}
procedure TJvCustomTMTimeline.MouseMove(Shift: TShiftState; X, Y: Integer);
var
ADate: TDate;