jvcllaz: Fix black background color of TJvTimeline demo in Linux

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6338 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-04-22 12:13:45 +00:00
parent 9c6eade58b
commit 7c329f8bc7
4 changed files with 53 additions and 59 deletions

View File

@ -13,7 +13,6 @@
<XPManifest> <XPManifest>
<DpiAware Value="True"/> <DpiAware Value="True"/>
</XPManifest> </XPManifest>
<Icon Value="0"/>
</General> </General>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>

View File

@ -43,7 +43,7 @@ object TimelineMainForm: TTimelineMainForm
Top = 3 Top = 3
Width = 731 Width = 731
Align = alClient Align = alClient
Color = clInfoBk Color = clCream
HelperYears = False HelperYears = False
PopupMenu = PopupMenu1 PopupMenu = PopupMenu1
ParentShowHint = False ParentShowHint = False
@ -240,6 +240,7 @@ object TimelineMainForm: TTimelineMainForm
end> end>
ItemHeight = 40 ItemHeight = 40
HorzSupports = True HorzSupports = True
SupportsColor = clSilver
OnItemClick = TimeLine1ItemClick OnItemClick = TimeLine1ItemClick
OnDrawItem = TimeLine1DrawItem OnDrawItem = TimeLine1DrawItem
OnSaveItem = TimeLine1SaveItem OnSaveItem = TimeLine1SaveItem
@ -282,7 +283,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 12 Left = 12
Height = 15 Height = 15
Top = 4 Top = 6
Width = 45 Width = 45
BorderSpacing.Left = 12 BorderSpacing.Left = 12
Caption = '&Caption:' Caption = '&Caption:'
@ -295,11 +296,10 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 12 Left = 12
Height = 15 Height = 15
Top = 62 Top = 64
Width = 64 Width = 64
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = 'ImageInde&x:' Caption = 'ImageInde&x:'
FocusControl = edImIndex
ParentColor = False ParentColor = False
end end
object lblDate: TLabel object lblDate: TLabel
@ -308,7 +308,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 12 Left = 12
Height = 15 Height = 15
Top = 35 Top = 37
Width = 27 Width = 27
Caption = '&Date:' Caption = '&Date:'
FocusControl = dtpItemdate FocusControl = dtpItemdate
@ -320,7 +320,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Control = lblImIndex AnchorSideTop.Control = lblImIndex
Left = 104 Left = 104
Height = 15 Height = 15
Top = 62 Top = 64
Width = 30 Width = 30
Caption = 'Le&vel:' Caption = 'Le&vel:'
FocusControl = edLevel FocusControl = edLevel
@ -336,7 +336,7 @@ object TimelineMainForm: TTimelineMainForm
Width = 75 Width = 75
Caption = '&Add' Caption = '&Add'
OnClick = btnAddClick OnClick = btnAddClick
TabOrder = 7 TabOrder = 5
end end
object edCaption: TEdit object edCaption: TEdit
AnchorSideLeft.Control = lblCaption AnchorSideLeft.Control = lblCaption
@ -346,40 +346,27 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 65 Left = 65
Height = 23 Height = 23
Top = 0 Top = 2
Width = 115 Width = 115
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Top = 2
BorderSpacing.Right = 12 BorderSpacing.Right = 12
TabOrder = 0 TabOrder = 0
Text = 'New item' Text = 'New item'
end end
object edImIndex: TEdit
AnchorSideLeft.Control = lblImIndex
AnchorSideTop.Control = lblImIndex
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = udImIndex
Left = 12
Height = 23
Top = 81
Width = 61
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4
TabOrder = 1
Text = '0'
end
object dtpItemdate: TDateTimePicker object dtpItemdate: TDateTimePicker
AnchorSideLeft.Control = edCaption AnchorSideLeft.Control = edCaption
AnchorSideTop.Control = edCaption AnchorSideTop.Control = edCaption
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 65 Left = 65
Height = 23 Height = 23
Top = 31 Top = 33
Width = 79 Width = 79
CenturyFrom = 1941 CenturyFrom = 1941
MaxDate = 2958465 MaxDate = 2958465
MinDate = -53780 MinDate = -53780
TabOrder = 6 TabOrder = 4
BorderSpacing.Top = 8 BorderSpacing.Top = 8
TrailingSeparator = False TrailingSeparator = False
LeadingZeros = True LeadingZeros = True
@ -394,30 +381,15 @@ object TimelineMainForm: TTimelineMainForm
MonthNames = 'Long' MonthNames = 'Long'
CalAlignment = dtaLeft CalAlignment = dtaLeft
end end
object udImIndex: TUpDown
AnchorSideRight.Control = Bevel1
Left = 73
Height = 23
Top = 81
Width = 15
Anchors = [akTop, akRight]
Associate = edImIndex
Max = 8
Min = 0
Position = 0
TabOrder = 2
Wrap = False
end
object edLevel: TEdit object edLevel: TEdit
AnchorSideLeft.Control = lblLevel AnchorSideLeft.Control = lblLevel
AnchorSideTop.Control = edImIndex
AnchorSideRight.Control = udLevel AnchorSideRight.Control = udLevel
Left = 104 Left = 104
Height = 23 Height = 23
Top = 81 Top = 81
Width = 61 Width = 61
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
TabOrder = 3 TabOrder = 1
Text = '0' Text = '0'
end end
object udLevel: TUpDown object udLevel: TUpDown
@ -432,7 +404,7 @@ object TimelineMainForm: TTimelineMainForm
Max = 8 Max = 8
Min = 0 Min = 0
Position = 0 Position = 0
TabOrder = 4 TabOrder = 2
Wrap = False Wrap = False
end end
object btnColor: TButton object btnColor: TButton
@ -445,7 +417,7 @@ object TimelineMainForm: TTimelineMainForm
BorderSpacing.Left = 16 BorderSpacing.Left = 16
Caption = 'Color...' Caption = 'Color...'
OnClick = btnColorClick OnClick = btnColorClick
TabOrder = 5 TabOrder = 3
end end
object Bevel1: TBevel object Bevel1: TBevel
AnchorSideLeft.Control = GroupBox1 AnchorSideLeft.Control = GroupBox1
@ -456,6 +428,23 @@ object TimelineMainForm: TTimelineMainForm
Width = 16 Width = 16
Shape = bsSpacer Shape = bsSpacer
end end
object CbImgIndex: TComboBoxEx
AnchorSideLeft.Control = lblImIndex
AnchorSideTop.Control = lblImIndex
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Bevel1
Left = 12
Height = 24
Top = 81
Width = 76
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
DropDownCount = 24
Images = ImageList1
ItemHeight = 16
ItemsEx = <>
TabOrder = 6
end
end end
object GroupBox2: TGroupBox object GroupBox2: TGroupBox
Left = 240 Left = 240
@ -646,10 +635,10 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Control = GroupBox3 AnchorSideTop.Control = GroupBox3
Left = 12 Left = 12
Height = 15 Height = 15
Top = 4 Top = 2
Width = 47 Width = 47
BorderSpacing.Left = 12 BorderSpacing.Left = 12
BorderSpacing.Top = 4 BorderSpacing.Top = 2
Caption = '&Year size:' Caption = '&Year size:'
FocusControl = edYrSize FocusControl = edYrSize
ParentColor = False ParentColor = False
@ -658,7 +647,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Control = lblYrSize AnchorSideTop.Control = lblYrSize
Left = 111 Left = 111
Height = 15 Height = 15
Top = 4 Top = 2
Width = 61 Width = 61
Caption = 'Item&height:' Caption = 'Item&height:'
FocusControl = edItemHeight FocusControl = edItemHeight
@ -670,7 +659,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 12 Left = 12
Height = 15 Height = 15
Top = 54 Top = 52
Width = 87 Width = 87
BorderSpacing.Top = 8 BorderSpacing.Top = 8
Caption = '&First visible date:' Caption = '&First visible date:'
@ -703,7 +692,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 12 Left = 12
Height = 23 Height = 23
Top = 23 Top = 21
Width = 50 Width = 50
BorderSpacing.Top = 4 BorderSpacing.Top = 4
TabOrder = 0 TabOrder = 0
@ -712,7 +701,7 @@ object TimelineMainForm: TTimelineMainForm
object udYrSize: TUpDown object udYrSize: TUpDown
Left = 62 Left = 62
Height = 23 Height = 23
Top = 23 Top = 21
Width = 15 Width = 15
Associate = edYrSize Associate = edYrSize
Increment = 120 Increment = 120
@ -728,7 +717,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Control = edYrSize AnchorSideTop.Control = edYrSize
Left = 111 Left = 111
Height = 23 Height = 23
Top = 23 Top = 21
Width = 50 Width = 50
TabOrder = 2 TabOrder = 2
Text = '36' Text = '36'
@ -736,7 +725,7 @@ object TimelineMainForm: TTimelineMainForm
object udItemHeight: TUpDown object udItemHeight: TUpDown
Left = 161 Left = 161
Height = 23 Height = 23
Top = 23 Top = 21
Width = 15 Width = 15
Associate = edItemHeight Associate = edItemHeight
Min = 0 Min = 0
@ -751,7 +740,7 @@ object TimelineMainForm: TTimelineMainForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 12 Left = 12
Height = 23 Height = 23
Top = 73 Top = 71
Width = 79 Width = 79
CenturyFrom = 1941 CenturyFrom = 1941
MaxDate = 2958465 MaxDate = 2958465

View File

@ -33,7 +33,7 @@ interface
uses uses
LCLIntf, LCLType, LCLIntf, LCLType,
SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DateTimePicker, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, DateTimePicker,
ComCtrls, StdCtrls, ExtCtrls, Menus, ImgList, JvTimeLine; ComCtrls, StdCtrls, ExtCtrls, Menus, ImgList, ComboEx, JvTimeLine;
type type
@ -42,6 +42,7 @@ type
TTimelineMainForm = class(TForm) TTimelineMainForm = class(TForm)
Bevel1: TBevel; Bevel1: TBevel;
Bevel2: TBevel; Bevel2: TBevel;
CbImgIndex: TComboBoxEx;
ImageList1: TImageList; ImageList1: TImageList;
Splitter1: TSplitter; Splitter1: TSplitter;
PopupMenu1: TPopupMenu; PopupMenu1: TPopupMenu;
@ -65,9 +66,7 @@ type
lblLevel: TLabel; lblLevel: TLabel;
btnAdd: TButton; btnAdd: TButton;
edCaption: TEdit; edCaption: TEdit;
edImIndex: TEdit;
dtpItemdate: TDateTimePicker; dtpItemdate: TDateTimePicker;
udImIndex: TUpDown;
edLevel: TEdit; edLevel: TEdit;
udLevel: TUpDown; udLevel: TUpDown;
btnColor: TButton; btnColor: TButton;
@ -177,11 +176,11 @@ var aItem: TJvTimeItem;
begin begin
aItem := TimeLine1.Items.Add; aItem := TimeLine1.Items.Add;
aItem.Caption := edCaption.Text; aItem.Caption := edCaption.Text;
aItem.ImageIndex := StrToIntDef(edImIndex.Text, -1); aItem.ImageIndex := CbImgIndex.ItemIndex;
aItem.Level := StrToIntDef(edLevel.Text, 0); aItem.Level := StrToIntDef(edLevel.Text, 0);
aItem.Date := dtpItemDate.Date; aItem.Date := dtpItemDate.Date;
aItem.Color := FCurColor; aItem.Color := FCurColor;
if FCurColor <> clWhite then if Integer(GetRValue(FCurColor)) + GetGValue(FCurColor) + GetBValue(FCurColor) < 3*128-1 then
aItem.TextColor := clWhite aItem.TextColor := clWhite
else else
aItem.TextColor := clBlack; aItem.TextColor := clBlack;
@ -381,13 +380,20 @@ end;
{ save all notes data and dispose of memory } { save all notes data and dispose of memory }
procedure TTimelineMainForm.FormCreate(Sender: TObject); procedure TTimelineMainForm.FormCreate(Sender: TObject);
var
i: Integer;
begin begin
FCurColor := TimeLine1.Color; FCurColor := TimeLine1.Color;
cbDragging.ItemIndex := 0; cbDragging.ItemIndex := 0;
TimelineNotesForm := TTimelineNotesForm.Create(nil); TimelineNotesForm := TTimelineNotesForm.Create(nil);
cbDraggingChange(nil); cbDraggingChange(nil);
TimeLine1.ShowSelection := false; TimeLine1.ShowSelection := false;
TimeLine1.DoubleBuffered := false; TimeLine1.DoubleBuffered := false;
for i := 0 to ImageList1.Count-1 do
CbImgIndex.Add(IntToStr(i), 0, i);
CbImgIndex.ItemIndex := 0;
end; end;
@ -559,7 +565,7 @@ procedure TTimelineMainForm.FormDestroy(Sender: TObject);
var var
i: integer; i: integer;
begin begin
TimelineNotesForm.free; TimelineNotesForm.Free;
{ free allocated memory } { free allocated memory }
for i := 0 to TimeLine1.Items.Count - 1 do for i := 0 to TimeLine1.Items.Count - 1 do
if TimeLine1.Items[i].Data <> nil then if TimeLine1.Items[i].Data <> nil then

View File

@ -18,7 +18,7 @@ object TimelineNotesForm: TTimelineNotesForm
Top = 0 Top = 0
Width = 207 Width = 207
Align = alClient Align = alClient
Color = clInfoBk Color = clCream
Font.Color = clWindowText Font.Color = clWindowText
ParentFont = False ParentFont = False
TabOrder = 0 TabOrder = 0