You've already forked lazarus-ccr
tvplanit: Add new properties to TVpDayView: ShowNavButtons, FixedDate, CustomRowHeight, RowLinesStep, SimpleRowTime (slightly modified patch by "linux-man", issue #33723).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6413 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -261,6 +261,11 @@ type
|
||||
FAllowDragAndDrop: Boolean;
|
||||
FNumDays: Integer;
|
||||
FIncludeWeekends: Boolean;
|
||||
FRowLinesStep: Integer;
|
||||
FShowNavButtons: Boolean;
|
||||
FFixedDate: Boolean;
|
||||
FCustomRowHeight: Integer;
|
||||
FSimpleRowTime: Boolean;
|
||||
{ event variables }
|
||||
FOwnerDrawRowHead: TVpOwnerDrawRowEvent;
|
||||
FOwnerDrawCells: TVpOwnerDrawRowEvent;
|
||||
@ -323,7 +328,11 @@ type
|
||||
procedure SetIncludeWeekends(Value: Boolean);
|
||||
procedure SetDisplayDate(Value: TDateTime);
|
||||
procedure SetVScrollPos;
|
||||
procedure SetCustomRowHeight(Value: Integer);
|
||||
procedure SetRowLinesStep(Value: Integer);
|
||||
procedure SetShowNavButtons(Value: Boolean);
|
||||
procedure SetShowResourceName(Value: Boolean);
|
||||
procedure SetSimpleRowTime(Value: Boolean);
|
||||
procedure SetActiveRow(Value: Integer);
|
||||
procedure SetActiveCol(Value: Integer);
|
||||
procedure SetWrapStyle(const v: TVpDVWrapStyle);
|
||||
@ -486,6 +495,11 @@ type
|
||||
property NumDays: Integer read FNumDays write SetNumDays default 1;
|
||||
property WrapStyle: TVpDVWrapStyle read FWrapStyle Write SetWrapStyle default wsIconFlow;
|
||||
property HintMode: TVpHintMode read FHintMode write SetHintMode default hmPlannerHint;
|
||||
property ShowNavButtons: Boolean read FShowNavButtons write SetShowNavButtons default true;
|
||||
property FixedDate: Boolean read FFixedDate write FFixedDate default false;
|
||||
property CustomRowHeight: Integer read FCustomRowHeight write SetCustomRowHeight default 0;
|
||||
property RowLinesStep: Integer read FRowLinesStep write SetRowLinesStep default 1;
|
||||
property SimpleRowTime: Boolean read FSimpleRowTime write SetSimpleRowTime default false;
|
||||
{events}
|
||||
property AfterEdit: TVpAfterEditEvent read FAfterEdit write FAfterEdit;
|
||||
property BeforeEdit: TVpBeforeEditEvent read FBeforeEdit write FBeforeEdit;
|
||||
@ -768,12 +782,17 @@ begin
|
||||
dvCreatingEditor := false;
|
||||
FDrawingStyle := ds3d;
|
||||
dvPainting := false;
|
||||
FShowNavButtons := true;
|
||||
FShowResourceName := true;
|
||||
FColor := clWindow;
|
||||
FLineColor := clGray;
|
||||
Granularity := gr30min;
|
||||
FDefTopHour := h_07;
|
||||
FDisplayDate := Now;
|
||||
FFixedDate := false;
|
||||
FCustomRowHeight := 0;
|
||||
FRowLinesStep := 1;
|
||||
FSimpleRowTime := false;
|
||||
TopHour := FDefTopHour;
|
||||
FTimeFormat := tf12Hour;
|
||||
FDateLabelFormat := 'dddddd'; //'dddd, mmmm dd, yyyy';
|
||||
@ -1231,7 +1250,7 @@ begin
|
||||
Exit;
|
||||
|
||||
StartTime := trunc(FDisplayDate + ActiveCol) + dvLineMatrix[ActiveCol, ActiveRow].Time;
|
||||
EndTime := StartTime + dvTimeIncSize;
|
||||
EndTime := StartTime + dvTimeIncSize * FRowLinesStep;
|
||||
FActiveEvent := DataStore.Resource.Schedule.AddEvent(
|
||||
DataStore.GetNextID(EventsTableName),
|
||||
StartTime,
|
||||
@ -1603,7 +1622,10 @@ begin
|
||||
Temp := Canvas.TextHeight(TallShortChars);
|
||||
if Temp > Result then
|
||||
Result := Temp;
|
||||
Result := Result + TextMargin * 2;
|
||||
if FCustomRowHeight = 0 then
|
||||
Result := Result + TextMargin * 2
|
||||
else
|
||||
Result := FCustomRowHeight;
|
||||
|
||||
Result := Round(Result * Scale);
|
||||
dvClientVArea := Result * MinutesInDay div GranularityMinutes[UseGran];
|
||||
@ -1762,7 +1784,7 @@ end;
|
||||
|
||||
procedure TVpDayView.SetDisplayDate(Value: TDateTime);
|
||||
begin
|
||||
if FDisplayDate <> Value then begin
|
||||
if (not FFixedDate) and (FDisplayDate <> Value) then begin
|
||||
EndEdit(self);
|
||||
FDisplayDate := Value;
|
||||
if dvLoaded then
|
||||
@ -1963,7 +1985,7 @@ begin
|
||||
{ otherwise, we must want to create a new event }
|
||||
StartTime := trunc(FDisplayDate + ActiveCol)
|
||||
+ dvLineMatrix[ActiveCol, ActiveRow].Time;
|
||||
EndTime := StartTime + dvTimeIncSize;
|
||||
EndTime := StartTime + dvTimeIncSize * FRowLinesStep;
|
||||
FActiveEvent := DataStore.Resource.Schedule.AddEvent(
|
||||
DataStore.GetNextID(EventsTableName), StartTime, EndTime);
|
||||
{ edit this new event }
|
||||
@ -2363,6 +2385,34 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpDayView.SetCustomRowHeight(Value: Integer);
|
||||
begin
|
||||
if Value <> FCustomRowHeight then begin
|
||||
if (Value <> 0) and (Value < TextMargin)
|
||||
then FCustomRowHeight := TextMargin
|
||||
else FCustomRowHeight := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.SetRowLinesStep(Value: Integer);
|
||||
begin
|
||||
if Value <> FRowLinesStep then begin
|
||||
if Value < 1
|
||||
then FRowLinesStep := 1
|
||||
else FRowLinesStep := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.SetShowNavButtons(Value: Boolean);
|
||||
begin
|
||||
if Value <> FShowNavButtons then begin
|
||||
FShowNavButtons := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.SetShowResourceName(Value: Boolean);
|
||||
begin
|
||||
if Value <> FShowResourceName then begin
|
||||
@ -2371,6 +2421,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.SetSimpleRowTime(Value: Boolean);
|
||||
begin
|
||||
if Value <> FSimpleRowTime then begin
|
||||
FSimpleRowTime := Value;
|
||||
Invalidate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TVpDayView.SetNumDays(Value: Integer);
|
||||
begin
|
||||
if (Value <> FNumDays) and (Value > 0) and (Value < 31) then begin
|
||||
|
@ -557,11 +557,9 @@ begin
|
||||
|
||||
{ Draw the lines }
|
||||
RenderCanvas.Pen.Color := FDayView.LineColor;
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, LineRect.Left, LineRect.Top);
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, LineRect.Right - 1, LineRect.Top);
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, LineRect.Left, LineRect.Bottom);
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, LineRect.Right - 1, LineRect.Bottom);
|
||||
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, LineRect.Left, LineRect.Bottom - 1);
|
||||
if (lineIndex + 1) mod FDayView.RowLinesStep = 0 then
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, LineRect.Right - 1, LineRect.Bottom - 1);
|
||||
inc(I);
|
||||
end; // while true ...
|
||||
|
||||
@ -1120,6 +1118,11 @@ var
|
||||
begin
|
||||
{ size and place the Today button first. }
|
||||
with TVpDayViewOpener(FDayView) do begin
|
||||
dvDayUpBtn.Visible := FShowNavButtons;
|
||||
dvDayDownBtn.Visible := FShowNavButtons;
|
||||
dvTodayBtn.Visible := FShowNavButtons;
|
||||
dvWeekUpBtn.Visible := FShowNavButtons;
|
||||
dvWeekDownBtn.Visible := FShowNavButtons;
|
||||
{ Calculate width of buttons }
|
||||
dvTodayBtn.Height := trunc(RealColHeadHeight div 2);
|
||||
dvTodayBtn.Width := RealRowHeadWidth;
|
||||
@ -1373,7 +1376,7 @@ begin
|
||||
hourStr := '12';
|
||||
end;
|
||||
|
||||
if UseGran = gr60Min then
|
||||
if (UseGran = gr60Min) or FDayView.SimpleRowTime then
|
||||
begin
|
||||
// In case of 60-min granularity paint time as simple string
|
||||
RenderCanvas.Font.Assign(FDayView.RowHeadAttributes.MinuteFont);
|
||||
@ -1381,7 +1384,7 @@ begin
|
||||
RenderCanvas.Font.Size := ScaleY(RenderCanvas.Font.Size, DesignTimeDPI);
|
||||
{$ENDIF}
|
||||
timeStr := Format('%s:%s', [hourStr, minuteStr]);
|
||||
x := lineRect.Right - RenderCanvas.TextWidth(timeStr) - MINUTES_BORDER;
|
||||
x := lineRect.Left + TICK_DIST;
|
||||
TPSTextOut(RenderCanvas, Angle, RenderIn, x, y + TextMargin, timeStr);
|
||||
end else
|
||||
begin
|
||||
@ -1473,13 +1476,14 @@ begin
|
||||
else
|
||||
isFullHour := TVpDayViewOpener(FDayView).dvLineMatrix[0, lineIndex].Minute = 0;
|
||||
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, lineRect.Right - TICK_DIST, y);
|
||||
if isFullHour then
|
||||
// Hour tick line
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, lineRect.Left + TICK_DIST, y)
|
||||
else
|
||||
// Minutes tick lines
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, lineRect.Right - MinutesLen, y);
|
||||
TPSMoveTo(RenderCanvas, Angle, RenderIn, lineRect.Right - TICK_DIST, y - 1);
|
||||
if lineIndex mod FDayView.RowLinesStep = 0 then
|
||||
if isFullHour then
|
||||
// Hour tick line
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, lineRect.Left + TICK_DIST, y - 1)
|
||||
else
|
||||
// Minutes tick lines
|
||||
TPSLineTo(RenderCanvas, Angle, RenderIn, lineRect.Right - MinutesLen, y - 1);
|
||||
|
||||
inc(I);
|
||||
end;
|
||||
|
Reference in New Issue
Block a user