From 48bdc3b5c6dc7afddd147ce88c24a208fc956fa7 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 26 Jun 2016 08:14:09 +0000 Subject: [PATCH] tvplanit: Remove a few unused variables in DayViewPainter git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4838 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/examples/demo/demomain.lfm | 4 +-- components/tvplanit/source/vpdayview.pas | 1 + .../tvplanit/source/vpdayviewpainter.pas | 25 +++++++------------ 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/components/tvplanit/examples/demo/demomain.lfm b/components/tvplanit/examples/demo/demomain.lfm index 763792bcc..9d2edeca7 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 = TabEvents + ActivePage = TabResources Align = alClient - TabIndex = 0 + TabIndex = 3 TabOrder = 0 object TabEvents: TTabSheet Caption = 'Events' diff --git a/components/tvplanit/source/vpdayview.pas b/components/tvplanit/source/vpdayview.pas index 30ddfe114..2953cbe15 100644 --- a/components/tvplanit/source/vpdayview.pas +++ b/components/tvplanit/source/vpdayview.pas @@ -2049,6 +2049,7 @@ begin { for simplicity, bail out of editing while scrolling. } EndEdit(Self); + // wp: Next line should never happen after EndEdit... if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible then Exit; case Msg.ScrollCode of diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index 984c07178..8b71542ee 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -30,9 +30,6 @@ type CellsRect: TRect; RowHeadRect: TRect; ADEventsRect: TRect; - SaveBrushColor: TColor; - SavePenStyle: TPenStyle; - SavePenColor: TColor; Drawn: Boolean; ScrollBarOffset: Integer; EventCount: Integer; @@ -78,9 +75,10 @@ type OldFont: TFont; protected - function CountOverlappingEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer; + function CountOverlappingEvents(Event: TVpEvent; + const EArray: TVpDvEventArray): Integer; procedure CreateBitmaps; - function DetermineIconRect(AEventRect: TRect; AEvent: TVpEvent): TRect; + function DetermineIconRect(AEventRect: TRect): TRect; function GetMaxOLEvents(Event: TVpEvent; const EArray: TVpDvEventArray): Integer; procedure DrawAllDayEvents; procedure DrawAllDays; @@ -97,7 +95,6 @@ type procedure InitColors; procedure InitializeEventRectangles; procedure ScaleIcons(EventRect: TRect); - procedure SetMeasurements; override; public @@ -181,8 +178,7 @@ begin dvBmpCustom := TBitmap.Create; end; -function TVpDayViewPainter.DetermineIconRect(AEventRect: TRect; - AEvent: TVpEvent): TRect; +function TVpDayViewPainter.DetermineIconRect(AEventRect: TRect): TRect; var MaxHeight: Integer; begin @@ -729,10 +725,11 @@ begin { Initialize, collect useful information needed later } EventCategory := FDayView.Datastore.CategoryColorMap.GetCategory(AEvent.Category); - EventIsEditing := false; with TVpDayViewOpener(FDayView) do if (dvInplaceEditor <> nil) and dvInplaceEditor.Visible then - EventIsEditing := (ActiveEvent = AEvent); + EventIsEditing := (ActiveEvent = AEvent) + else + EventIsEditing := false; timeFmt := IfThen(FDayView.TimeFormat = tf24Hour, 'h:nn', 'h:nnam/pm'); @@ -868,12 +865,12 @@ begin GetIcons(AEvent); if AEventRec.Level = 0 then begin ScaleIcons(EventRect); - IconRect := DetermineIconRect(EventRect, AEvent); + IconRect := DetermineIconRect(EventRect); end else begin tmpRect := EventRect; inc(tmpRect.Left, FDayView.GutterWidth); ScaleIcons(tmpRect); - IconRect := DetermineIconRect(tmpRect, AEvent); + IconRect := DetermineIconRect(tmpRect); end; end; @@ -1064,7 +1061,6 @@ procedure TVpDayViewPainter.DrawEvents(ARenderDate: TDateTime; Col: Integer); var I,J: Integer; Level: Integer; - STime, ETime: Double; Event: TVpEvent; SaveFont: TFont; SaveColor: TColor; @@ -1165,9 +1161,6 @@ begin VisibleRect := TVpDayViewOpener(FDayView).dvLineMatrix[Col, StartLine].Rec; VisibleRect.Bottom := FDayView.ClientRect.Bottom; - STime := TVpDayViewOpener(FDayView).dvLineMatrix[0, StartLine].Time; - ETime := TVpDayViewOpener(FDayView).dvLineMatrix[0, StartLine + RealVisibleLines].Time; - LineDuration := GetLineDuration(FDayView.Granularity); { Determine how much time is represented by one pixel. It is the } { amount of time represented by one line, divided by the height of }