You've already forked lazarus-ccr
jvcllaz: Add property IconDayDistance to TJvTMTimeline
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6624 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -634,13 +634,13 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LblImages
|
||||
Left = 92
|
||||
Height = 161
|
||||
Height = 192
|
||||
Top = 8
|
||||
Width = 191
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 12
|
||||
Caption = ' Widths and sizes: '
|
||||
ClientHeight = 141
|
||||
ClientHeight = 172
|
||||
ClientWidth = 187
|
||||
TabOrder = 0
|
||||
object Label1: TLabel
|
||||
@ -923,6 +923,63 @@ object TMTimeLineMainForm: TTMTimeLineMainForm
|
||||
Position = 12
|
||||
TabOrder = 9
|
||||
end
|
||||
object Label21: TLabel
|
||||
AnchorSideTop.Control = edIconDayDist
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = Label9
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 14
|
||||
Height = 15
|
||||
Top = 145
|
||||
Width = 72
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Icon-day dist.'
|
||||
ParentColor = False
|
||||
end
|
||||
object edIconDayDist: TEdit
|
||||
AnchorSideLeft.Control = edScrollSmall
|
||||
AnchorSideTop.Control = edButtonWidth
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edScrollSmall
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 90
|
||||
Height = 23
|
||||
Hint = 'Sets the width of the scrollbuttons'
|
||||
Top = 141
|
||||
Width = 33
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
TabOrder = 10
|
||||
Text = '4'
|
||||
end
|
||||
object udIconDayDist: TUpDown
|
||||
AnchorSideRight.Control = udScrollSmall
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 127
|
||||
Height = 23
|
||||
Top = 141
|
||||
Width = 15
|
||||
Anchors = [akTop, akRight]
|
||||
Associate = edIconDayDist
|
||||
Max = 35
|
||||
Min = 0
|
||||
OnClick = udIconDayDistClick
|
||||
Position = 4
|
||||
TabOrder = 11
|
||||
end
|
||||
object Label22: TLabel
|
||||
AnchorSideLeft.Control = Label15
|
||||
AnchorSideTop.Control = edIconDayDist
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 146
|
||||
Height = 15
|
||||
Top = 145
|
||||
Width = 29
|
||||
Caption = 'pixels'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
object LbImages: TListBox
|
||||
AnchorSideLeft.Control = Panel1
|
||||
|
@ -41,9 +41,12 @@ type
|
||||
{ TTMTimeLineMainForm }
|
||||
|
||||
TTMTimeLineMainForm = class(TForm)
|
||||
edIconDayDist: TEdit;
|
||||
Images: TImageList;
|
||||
Images_150: TImageList;
|
||||
Images_200: TImageList;
|
||||
Label21: TLabel;
|
||||
Label22: TLabel;
|
||||
LbImages: TListBox;
|
||||
Panel1: TPanel;
|
||||
LblImages: TLabel;
|
||||
@ -74,6 +77,7 @@ type
|
||||
Label4: TLabel;
|
||||
Label5: TLabel;
|
||||
edImageNo: TEdit;
|
||||
udIconDayDist: TUpDown;
|
||||
udImageNo: TUpDown;
|
||||
dtpImageDate: TDateTimePicker;
|
||||
btnAdd: TButton;
|
||||
@ -128,6 +132,7 @@ type
|
||||
procedure LbImagesDrawItem(Control: TWinControl; Index: Integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
procedure LbImagesSelectionChange(Sender: TObject; User: boolean);
|
||||
procedure udIconDayDistClick(Sender: TObject; Button: TUDBtnType);
|
||||
procedure udDayWidthClick(Sender: TObject; Button: TUDBtnType);
|
||||
procedure btnColorClick(Sender: TObject);
|
||||
procedure chkFlatClick(Sender: TObject);
|
||||
@ -437,6 +442,12 @@ begin
|
||||
udImageNo.Position := LbImages.ItemIndex;
|
||||
end;
|
||||
|
||||
procedure TTMTimeLineMainForm.udIconDayDistClick(Sender: TObject;
|
||||
Button: TUDBtnType);
|
||||
begin
|
||||
JvTimeLine1.IconDayDistance := udIconDayDist.Position;
|
||||
end;
|
||||
|
||||
procedure TTMTimeLineMainForm.FormShow(Sender: TObject);
|
||||
var
|
||||
ex: TSize;
|
||||
|
@ -40,6 +40,7 @@ uses
|
||||
const
|
||||
cTMTimeLineDayWidth = 19;
|
||||
cTMTimeLineButtonWidth = 16;
|
||||
cTMTimeLineIconDayDist = 4;
|
||||
|
||||
type
|
||||
TJvTLSelFrame = class(TPersistent)
|
||||
@ -81,6 +82,7 @@ type
|
||||
FRightClickSelect: Boolean;
|
||||
FDayWidth: Integer;
|
||||
FButtonWidth: Integer;
|
||||
FIconDayDist: Integer;
|
||||
FDate: TDate;
|
||||
FSelDate: TDate;
|
||||
FMinDate: TDate;
|
||||
@ -103,8 +105,10 @@ type
|
||||
FShowTodayIcon: Boolean;
|
||||
function ButtonWidthStored: Boolean;
|
||||
function DayWidthStored: Boolean;
|
||||
function IconDayDistStored: Boolean;
|
||||
function GetButtonWidth: Integer;
|
||||
function GetDayWidth: Integer;
|
||||
function GetIconDayDist: Integer;
|
||||
function GetRectForDate(ADate: TDate): TRect;
|
||||
function DateFromPos(APos: Integer): TDate;
|
||||
procedure DoTimer(Sender: TObject);
|
||||
@ -143,6 +147,7 @@ type
|
||||
function GetObjects(ADate: TDate): TObject;
|
||||
procedure SetObjects(ADate: TDate; const Value: TObject);
|
||||
procedure SetButtonWidth(const Value: Integer);
|
||||
procedure SetIconDayDist(const Value: Integer);
|
||||
procedure SetObjectsFontStyle(const Value: TFontStyles);
|
||||
procedure SetShowMonths(const Value: Boolean);
|
||||
procedure SetShowToday(const Value: Boolean);
|
||||
@ -181,6 +186,7 @@ type
|
||||
property Cursor;
|
||||
property DayWidth: Integer read GetDayWidth write SetDayWidth stored DayWidthStored;
|
||||
property ObjectsFontStyle: TFontStyles read FObjectsFontStyle write SetObjectsFontStyle default [fsUnderline];
|
||||
property IconDayDistance: Integer read GetIconDayDist write SetIconDayDist stored IconDayDistStored;
|
||||
property ImageCursor: TCursor read FImageCursor write SetImageCursor default crHandPoint;
|
||||
property Images: TImageList read FImages write SetImages;
|
||||
property LargeChange: Word read FLargeChange write SetLargeChange default 30;
|
||||
@ -247,6 +253,8 @@ type
|
||||
property SelDate;
|
||||
// gets / sets the width of each day
|
||||
property DayWidth;
|
||||
// gets / sets the distance between days and associated icons
|
||||
property IconDayDistance;
|
||||
// gets / sets the cursor to use when a date has an image associated
|
||||
property ImageCursor;
|
||||
// sets / gets the imagelist associated with the control
|
||||
@ -438,6 +446,7 @@ begin
|
||||
FObjectsFontStyle := [fsUnderline];
|
||||
FButtonWidth := -1;
|
||||
FDayWidth := -1;
|
||||
FIconDayDist := -1;
|
||||
FDate := SysUtils.Date - 7;
|
||||
FSelDate := FDate - 1;
|
||||
FImageCursor := crHandPoint;
|
||||
@ -647,7 +656,7 @@ begin
|
||||
resname := 'jvcustomtmtimelinemilestonelarge' + HighDpi_Suffix;
|
||||
png.LoadFromResourceName(HInstance, resname);
|
||||
x := (ARect.Left + ARect.Right - png.Width) div 2;
|
||||
y := ARect.Top + CanvasMaxTextHeight(ACanvas) + 4;
|
||||
y := ARect.Top + CanvasMaxTextHeight(ACanvas) + IconDayDistance;
|
||||
R := Classes.Rect(x, y, x + png.Width, y + png.Height);
|
||||
ACanvas.Draw(R.Left, R.Top, png);
|
||||
finally
|
||||
@ -811,8 +820,7 @@ begin
|
||||
begin
|
||||
I := ImageIndex[ADate];
|
||||
X := ARect.Left + (DayWidth - Images.Width) div 2;
|
||||
// Y := Max((Height - Images.Height) div 4, CanvasMaxTextHeight(ACanvas) + 2);
|
||||
Y := CanvasMaxTextHeight(ACanvas) + 2;
|
||||
Y := CanvasMaxTextHeight(ACanvas) + IconDayDistance;
|
||||
Images.Draw(ACanvas, X, Y, I);
|
||||
end;
|
||||
end;
|
||||
@ -924,6 +932,19 @@ begin
|
||||
Result := Scale96ToFont(cTMTimeLineDayWidth);
|
||||
end;
|
||||
|
||||
function TJvCustomTMTimeLine.GetIconDayDist: Integer;
|
||||
begin
|
||||
if IconDayDistStored then
|
||||
Result := FIconDayDist
|
||||
else
|
||||
Result := Scale96ToFont(cTMTimelineIconDayDist);
|
||||
end;
|
||||
|
||||
function TJvCustomTMTimeLine.IconDayDistStored: Boolean;
|
||||
begin
|
||||
Result := FIconDayDist >= 0;
|
||||
end;
|
||||
|
||||
procedure TJvCustomTMTimeline.SetDayWidth(const Value: Integer);
|
||||
begin
|
||||
if (FDayWidth <> Value) and (Value <> 0) and (Value >= -1) then
|
||||
@ -1230,6 +1251,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvCustomTMTimeLine.SetIconDayDist(const Value: Integer);
|
||||
begin
|
||||
if (FIconDayDist <> Value) and (Value >= -1) then begin
|
||||
FIconDayDist := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvCustomTMTimeline.LoadFromFile(const Filename: string);
|
||||
var
|
||||
F: TFileStream;
|
||||
|
Reference in New Issue
Block a user