From 30ece2b2965866036908fa4982b59ab77e01d898 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 11 Sep 2016 13:46:45 +0000 Subject: [PATCH] tvplanit: Improved assembly of event text in WeekView. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5153 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/examples/fulldemo/demomain.pas | 2 +- .../tvplanit/source/vpweekviewpainter.pas | 29 +++++++++---------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/components/tvplanit/examples/fulldemo/demomain.pas b/components/tvplanit/examples/fulldemo/demomain.pas index 33bb1cf5b..192655f3d 100644 --- a/components/tvplanit/examples/fulldemo/demomain.pas +++ b/components/tvplanit/examples/fulldemo/demomain.pas @@ -413,9 +413,9 @@ var begin datastore := VpControlLink1.Datastore; grp := datastore.Resources.AddResourceGroup([1, 2], NAME_OF_GROUP); - grp.Pattern := opDiagCross; // Optionally uncomment these lines to get not-default behavior: + //grp.Pattern := opDiagCross; //grp.ReadOnly := false; //grp.ShowDetails := [odResource, odEventDescription, odEventCategory]; diff --git a/components/tvplanit/source/vpweekviewpainter.pas b/components/tvplanit/source/vpweekviewpainter.pas index 5a42f8623..d603b0a83 100644 --- a/components/tvplanit/source/vpweekviewpainter.pas +++ b/components/tvplanit/source/vpweekviewpainter.pas @@ -86,32 +86,29 @@ begin grp := FWeekView.Datastore.Resource.Group; isOverlayed := AEvent.IsOverlayed; + if FWeekView.ShowEventTime then + begin + timefmt := IfThen(FWeekView.TimeFormat = tf24Hour, 'hh:nn', 'hh:nn AM/PM'); + Result := Result + Format('%s - %s: ', [ + FormatDateTime(timeFmt, AStartTime), + FormatDateTime(timeFmt, AEndTime) + ]); + end else + Result := ''; + if isOverlayed then begin if (grp <> nil) and (odResource in grp.ShowDetails) then begin res := FWeekView.Datastore.Resources.GetResource(AEvent.ResourceID); if res <> nil then - Result := '[' + res.Description + ']'; + Result := Result + '[' + res.Description + '] '; end else - Result := '[' + RSOverlayedEvent + ']'; + Result := Result + '[' + RSOverlayedEvent + '] '; end; if (not isOverlayed) or ((grp <> nil) and (odEventDescription in grp.ShowDetails)) then - begin - if Result <> '' then - Result := Result + ' '; - if FWeekView.ShowEventTime then - begin - timefmt := IfThen(FWeekView.TimeFormat = tf24Hour, 'hh:nn', 'hh:nn AM/PM'); - Result := Result + Format('%s - %s: %s', [ - FormatDateTime(timeFmt, AStartTime), - FormatDateTime(timeFmt, AEndTime), - AEvent.Description - ]); - end else - Result := Result + AEvent.Description; - end; + Result := Result + AEvent.Description; end; procedure TVpWeekViewPainter.Clear;