diff --git a/components/tvplanit/examples/demo/demomain.lfm b/components/tvplanit/examples/demo/demomain.lfm index 5182c55b3..fcab0c532 100644 --- a/components/tvplanit/examples/demo/demomain.lfm +++ b/components/tvplanit/examples/demo/demomain.lfm @@ -25,9 +25,9 @@ object MainForm: TMainForm Height = 532 Top = 48 Width = 780 - ActivePage = TabResources + ActivePage = TabEvents Align = alClient - TabIndex = 3 + TabIndex = 0 TabOrder = 0 object TabEvents: TTabSheet Caption = 'Events' @@ -138,6 +138,7 @@ object MainForm: TMainForm Granularity = gr30Min DefaultTopHour = h_07 TimeFormat = tf12Hour + WrapStyle = wsNoFlow end object DaySelectorPanel: TPanel Left = 0 diff --git a/components/tvplanit/source/vpcanvasutils.pas b/components/tvplanit/source/vpcanvasutils.pas index 3e5110027..56987eaf2 100644 --- a/components/tvplanit/source/vpcanvasutils.pas +++ b/components/tvplanit/source/vpcanvasutils.pas @@ -1738,7 +1738,8 @@ begin WorkRect := GetNextRectangle(ARegion, LineHeight, AvgCharSize, HPos, linepos); if (WorkRect.Top = 0) and (WorkRect.left = 0) and (WorkRect.Bottom = 0) and (WorkRect.Right = 0) then - Workrect := Regionrect; + break; +// Workrect := Regionrect; if WorkRect.Right - WorkRect.Left > 0 then begin VpRotatedCanvas.TextOut(WorkRect.Left + FTextMargin, WorkRect.Top, FitStringInRect(ACanvas, WidthOf(WorkRect) - FTextMargin, AvgCharSize, AString, CharsWritten) diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index faf9ad924..ddd338036 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -103,7 +103,7 @@ type procedure InitializeEventRectangles; procedure PopulateEventArray(ARenderDate: TDateTime); procedure PrepareEventRect(AWidthDivisor, ALevel: Integer; - var AEventRect: TRect; var AEventWidth: Integer); + var AEventRect: TRect); procedure PrepareEventTimes(AEvent: TVpEvent; ARenderDate: TDateTime; out AStartTime, AEndTime: TDateTime); procedure ScaleIcons(EventRect: TRect); @@ -755,7 +755,6 @@ var EventSTime, EventETime: Double; EventDuration: Double; EventSLine, EventELine, EventLineCount: Integer; - EventWidth: Integer; EventRect, GutterRect: TRect; StartPixelOffset, EndPixelOffset: Integer; StartOffset, EndOffset: Double; @@ -789,7 +788,7 @@ begin { Build the rectangle in which the event will be painted. } EventRect := TVpDayViewOpener(FDayView).dvLineMatrix[Col, EventSLine].Rec; EventRect.Bottom := TVpDayViewOpener(FDayView).dvLineMatrix[Col, EventELine].Rec.Bottom; - PrepareEventRect(AEventRec.WidthDivisor, AEventRec.Level, EventRect, EventWidth); + PrepareEventRect(AEventRec.WidthDivisor, AEventRec.Level, EventRect); { Draw the event rectangle } { paint Event text area clWindow } @@ -831,7 +830,7 @@ begin end; end; - { Paint the gutter inside the EventRect all events } + { Paint the gutter inside the EventRect of all events } if (AEventRec.Level = 0) then GutterRect.Left := EventRect.Left - Trunc(FDayView.GutterWidth * Scale) else @@ -1063,7 +1062,12 @@ var TextRegion: HRGN; CW: Integer; begin - if (FDayView.WrapStyle <> wsNone) and (not AEventIsEditing) then begin + { + if AEventIsEditing then + exit; + } + + if (FDayView.WrapStyle <> wsNone) then begin if (AEventRect.Bottom <> AIconRect.Bottom) and (AEventRect.Left <> AIconRect.Right) then begin if FDayView.WrapStyle = wsIconFlow then @@ -1103,25 +1107,24 @@ begin end; end; end + else begin + if ALevel = 0 then + { don't draw the gutter in the EventRest for level 0 events. } + TPSTextOut(RenderCanvas, // wp: both cases are the same ?! + Angle, + RenderIn, + AIconRect.Right + FDayView.GutterWidth + TextMargin, + AEventRect.Top + TextMargin, + AText + ) else - if (not AEventIsEditing) then begin - if ALevel = 0 then - { don't draw the gutter in the EventRest for level 0 events. } - TPSTextOut(RenderCanvas, // wp: both cases are the same ?! - Angle, - RenderIn, - AIconRect.Right + FDayView.GutterWidth + TextMargin, - AEventRect.Top + TextMargin, - AText - ) - else - TPSTextOut(RenderCanvas, - Angle, - RenderIn, - AIconRect.Right + FDayView.GutterWidth + TextMargin, - AEventRect.Top + TextMargin, - AText - ); + TPSTextOut(RenderCanvas, + Angle, + RenderIn, + AIconRect.Right + FDayView.GutterWidth + TextMargin, + AEventRect.Top + TextMargin, + AText + ); end; end; @@ -1695,7 +1698,9 @@ begin end; procedure TVpDayViewPainter.PrepareEventRect(AWidthDivisor, ALevel: Integer; - var AEventRect: TRect; var AEventWidth: Integer); + var AEventRect: TRect); +var + eventWidth: Integer; begin if AEventRect.Left < VisibleRect.Left then AEventRect.Left := VisibleRect.Left; @@ -1705,15 +1710,15 @@ begin if AEventRect.Bottom < VisibleRect.Top then AEventRect.Bottom := VisibleRect.Bottom; - AEventWidth := WidthOf(VisibleRect) div AWidthDivisor; + eventWidth := WidthOf(VisibleRect) div AWidthDivisor; { Slide the rect over to correspond with the level } if ALevel > 0 then - AEventRect.Left := AEventRect.Left + AEventWidth * ALevel + AEventRect.Left := AEventRect.Left + eventWidth * ALevel { added because level 0 events were one pixel too far to the right } else AEventRect.Left := AEventRect.Left - 1; - AEventRect.Right := AEventRect.Left + AEventWidth - FDayView.GutterWidth; + AEventRect.Right := AEventRect.Left + eventWidth - FDayView.GutterWidth; end; { remove the date portion from the start and end times }