tvplanit: Fix linewrapping in DayView cells. Fix DayView event display if recurring event is edited.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4844 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-26 22:21:39 +00:00
parent b108ef2f7a
commit 7ec6f3104d
3 changed files with 37 additions and 30 deletions

View File

@@ -25,9 +25,9 @@ object MainForm: TMainForm
Height = 532 Height = 532
Top = 48 Top = 48
Width = 780 Width = 780
ActivePage = TabResources ActivePage = TabEvents
Align = alClient Align = alClient
TabIndex = 3 TabIndex = 0
TabOrder = 0 TabOrder = 0
object TabEvents: TTabSheet object TabEvents: TTabSheet
Caption = 'Events' Caption = 'Events'
@@ -138,6 +138,7 @@ object MainForm: TMainForm
Granularity = gr30Min Granularity = gr30Min
DefaultTopHour = h_07 DefaultTopHour = h_07
TimeFormat = tf12Hour TimeFormat = tf12Hour
WrapStyle = wsNoFlow
end end
object DaySelectorPanel: TPanel object DaySelectorPanel: TPanel
Left = 0 Left = 0

View File

@@ -1738,7 +1738,8 @@ begin
WorkRect := GetNextRectangle(ARegion, LineHeight, AvgCharSize, HPos, linepos); WorkRect := GetNextRectangle(ARegion, LineHeight, AvgCharSize, HPos, linepos);
if (WorkRect.Top = 0) and (WorkRect.left = 0) and (WorkRect.Bottom = 0) and (WorkRect.Right = 0) then 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 if WorkRect.Right - WorkRect.Left > 0 then begin
VpRotatedCanvas.TextOut(WorkRect.Left + FTextMargin, WorkRect.Top, VpRotatedCanvas.TextOut(WorkRect.Left + FTextMargin, WorkRect.Top,
FitStringInRect(ACanvas, WidthOf(WorkRect) - FTextMargin, AvgCharSize, AString, CharsWritten) FitStringInRect(ACanvas, WidthOf(WorkRect) - FTextMargin, AvgCharSize, AString, CharsWritten)

View File

@@ -103,7 +103,7 @@ type
procedure InitializeEventRectangles; procedure InitializeEventRectangles;
procedure PopulateEventArray(ARenderDate: TDateTime); procedure PopulateEventArray(ARenderDate: TDateTime);
procedure PrepareEventRect(AWidthDivisor, ALevel: Integer; procedure PrepareEventRect(AWidthDivisor, ALevel: Integer;
var AEventRect: TRect; var AEventWidth: Integer); var AEventRect: TRect);
procedure PrepareEventTimes(AEvent: TVpEvent; ARenderDate: TDateTime; procedure PrepareEventTimes(AEvent: TVpEvent; ARenderDate: TDateTime;
out AStartTime, AEndTime: TDateTime); out AStartTime, AEndTime: TDateTime);
procedure ScaleIcons(EventRect: TRect); procedure ScaleIcons(EventRect: TRect);
@@ -755,7 +755,6 @@ var
EventSTime, EventETime: Double; EventSTime, EventETime: Double;
EventDuration: Double; EventDuration: Double;
EventSLine, EventELine, EventLineCount: Integer; EventSLine, EventELine, EventLineCount: Integer;
EventWidth: Integer;
EventRect, GutterRect: TRect; EventRect, GutterRect: TRect;
StartPixelOffset, EndPixelOffset: Integer; StartPixelOffset, EndPixelOffset: Integer;
StartOffset, EndOffset: Double; StartOffset, EndOffset: Double;
@@ -789,7 +788,7 @@ begin
{ Build the rectangle in which the event will be painted. } { Build the rectangle in which the event will be painted. }
EventRect := TVpDayViewOpener(FDayView).dvLineMatrix[Col, EventSLine].Rec; EventRect := TVpDayViewOpener(FDayView).dvLineMatrix[Col, EventSLine].Rec;
EventRect.Bottom := TVpDayViewOpener(FDayView).dvLineMatrix[Col, EventELine].Rec.Bottom; 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 } { Draw the event rectangle }
{ paint Event text area clWindow } { paint Event text area clWindow }
@@ -831,7 +830,7 @@ begin
end; end;
end; end;
{ Paint the gutter inside the EventRect all events } { Paint the gutter inside the EventRect of all events }
if (AEventRec.Level = 0) then if (AEventRec.Level = 0) then
GutterRect.Left := EventRect.Left - Trunc(FDayView.GutterWidth * Scale) GutterRect.Left := EventRect.Left - Trunc(FDayView.GutterWidth * Scale)
else else
@@ -1063,7 +1062,12 @@ var
TextRegion: HRGN; TextRegion: HRGN;
CW: Integer; CW: Integer;
begin 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) if (AEventRect.Bottom <> AIconRect.Bottom) and (AEventRect.Left <> AIconRect.Right)
then begin then begin
if FDayView.WrapStyle = wsIconFlow then if FDayView.WrapStyle = wsIconFlow then
@@ -1103,25 +1107,24 @@ begin
end; end;
end; 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 else
if (not AEventIsEditing) then begin TPSTextOut(RenderCanvas,
if ALevel = 0 then Angle,
{ don't draw the gutter in the EventRest for level 0 events. } RenderIn,
TPSTextOut(RenderCanvas, // wp: both cases are the same ?! AIconRect.Right + FDayView.GutterWidth + TextMargin,
Angle, AEventRect.Top + TextMargin,
RenderIn, AText
AIconRect.Right + FDayView.GutterWidth + TextMargin, );
AEventRect.Top + TextMargin,
AText
)
else
TPSTextOut(RenderCanvas,
Angle,
RenderIn,
AIconRect.Right + FDayView.GutterWidth + TextMargin,
AEventRect.Top + TextMargin,
AText
);
end; end;
end; end;
@@ -1695,7 +1698,9 @@ begin
end; end;
procedure TVpDayViewPainter.PrepareEventRect(AWidthDivisor, ALevel: Integer; procedure TVpDayViewPainter.PrepareEventRect(AWidthDivisor, ALevel: Integer;
var AEventRect: TRect; var AEventWidth: Integer); var AEventRect: TRect);
var
eventWidth: Integer;
begin begin
if AEventRect.Left < VisibleRect.Left then if AEventRect.Left < VisibleRect.Left then
AEventRect.Left := VisibleRect.Left; AEventRect.Left := VisibleRect.Left;
@@ -1705,15 +1710,15 @@ begin
if AEventRect.Bottom < VisibleRect.Top then if AEventRect.Bottom < VisibleRect.Top then
AEventRect.Bottom := VisibleRect.Bottom; AEventRect.Bottom := VisibleRect.Bottom;
AEventWidth := WidthOf(VisibleRect) div AWidthDivisor; eventWidth := WidthOf(VisibleRect) div AWidthDivisor;
{ Slide the rect over to correspond with the level } { Slide the rect over to correspond with the level }
if ALevel > 0 then 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 } { added because level 0 events were one pixel too far to the right }
else else
AEventRect.Left := AEventRect.Left - 1; AEventRect.Left := AEventRect.Left - 1;
AEventRect.Right := AEventRect.Left + AEventWidth - FDayView.GutterWidth; AEventRect.Right := AEventRect.Left + eventWidth - FDayView.GutterWidth;
end; end;
{ remove the date portion from the start and end times } { remove the date portion from the start and end times }