You've already forked lazarus-ccr
tvplanit: Use PointInRect function instead of huge "if" monsters
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4870 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -193,11 +193,9 @@ begin
|
||||
OnDrawItem(Self, RenderDate + NewIdx - OldIdx, clRowCol[R,C])
|
||||
else
|
||||
if clRowCol[R, C].Top <> 0 then begin
|
||||
DrawRect := Rect (clRowCol[R, C].Left + RealLeft,
|
||||
clRowCol[R, C].Top + RealTop,
|
||||
clRowCol[R, C].Right + RealLeft,
|
||||
clRowCol[R, C].Bottom + RealTop);
|
||||
TH := RenderCanvas.TextHeight (S);
|
||||
DrawRect := clRowCol[R, C];
|
||||
OffsetRect(DrawRect, RealLeft, RealTop);
|
||||
TH := RenderCanvas.TextHeight(S);
|
||||
if TH < DrawRect.Bottom - DrawRect.Top then
|
||||
DrawRect.Top := DrawRect.Top + ((DrawRect.Bottom - DrawRect.Top) - TH) div 2;
|
||||
TPSCenteredTextOut(RenderCanvas, Angle, RenderIn, DrawRect, S);
|
||||
|
@ -1818,11 +1818,8 @@ begin
|
||||
for I := 0 to pred(Length(dvEventArray)) do begin
|
||||
if dvEventArray[I].Event = nil then
|
||||
Exit;
|
||||
if (APoint.X > dvEventArray[I].Rec.Left) and
|
||||
(APoint.X < dvEventArray[I].Rec.Right) and
|
||||
(APoint.Y > dvEventArray[I].Rec.Top) and
|
||||
(APoint.Y < dvEventArray[I].Rec.Bottom)
|
||||
then begin
|
||||
if PointInRect(APoint, dvEventArray[I].Rec) then
|
||||
begin
|
||||
FActiveEvent := TVpEvent(dvEventArray[I].Event);
|
||||
dvActiveEventRec := dvEventArray[I].Rec;
|
||||
dvActiveIconRec := dvEventArray[I].IconRect;
|
||||
@ -1845,11 +1842,8 @@ begin
|
||||
if dvEventArray[I].Event = nil then
|
||||
{ we've hit the end of visible events without finding a match }
|
||||
Exit;
|
||||
if (Point.X > dvEventArray[I].Rec.Left) and
|
||||
(Point.X < dvEventArray[I].Rec.Right) and
|
||||
(Point.Y > dvEventArray[I].Rec.Top) and
|
||||
(Point.Y < dvEventArray[I].Rec.Bottom)
|
||||
then begin
|
||||
if PointInRect(Point, dvEventArray[I].Rec) then
|
||||
begin
|
||||
FActiveEvent := TVpEvent(dvEventArray[I].Event);
|
||||
dvActiveEventRec := dvEventArray[I].Rec;
|
||||
dvActiveIconRec := dvEventArray[I].IconRect;
|
||||
@ -1869,11 +1863,8 @@ begin
|
||||
for I := 0 to pred(Length(dvEventArray)) do begin
|
||||
if dvEventArray[I].Event = nil then
|
||||
Exit;
|
||||
if (Point.X > dvEventArray[I].Rec.Left) and
|
||||
(Point.X < dvEventArray[I].Rec.Right) and
|
||||
(Point.Y > dvEventArray[I].Rec.Top) and
|
||||
(Point.Y < dvEventArray[I].Rec.Bottom)
|
||||
then begin
|
||||
if PointInRect(Point, dvEventArray[I].Rec) then
|
||||
begin
|
||||
result := TVpEvent(dvEventArray[I].Event);
|
||||
Exit;
|
||||
end;
|
||||
@ -2174,11 +2165,8 @@ begin
|
||||
ActiveRow := I;
|
||||
Exit;
|
||||
end else
|
||||
if (Pnt.x > dvLineMatrix[ActiveCol, I].Rec.Left) and
|
||||
(Pnt.x < dvLineMatrix[ActiveCol, I].Rec.Right) and
|
||||
(Pnt.y <= dvLineMatrix[ActiveCol, I].Rec.Bottom) and
|
||||
(Pnt.y > dvLineMatrix[ActiveCol, I].Rec.Top)
|
||||
then begin
|
||||
if PointInRect(Pnt, dvLineMatrix[ActiveCol, I].Rec) then
|
||||
begin
|
||||
ActiveRow := I;
|
||||
Exit;
|
||||
end;
|
||||
@ -2191,11 +2179,8 @@ var
|
||||
I : Integer;
|
||||
begin
|
||||
for I := 0 to pred(length(dvColRectArray)) do begin
|
||||
if (Pnt.x > dvColRectArray[I].Rec.Left) and
|
||||
(Pnt.x < dvColRectArray[I].Rec.Right) and
|
||||
(Pnt.y < dvColRectArray[I].Rec.Bottom) and
|
||||
(Pnt.y > dvColRectArray[I].Rec.Top)
|
||||
then begin
|
||||
if PointInRect(Pnt, dvColRectArray[I].Rec) then
|
||||
begin
|
||||
ActiveCol := I;
|
||||
Exit;
|
||||
end;
|
||||
|
@ -1112,11 +1112,8 @@ var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to pred(Length(wvWeekdayArray)) do
|
||||
if (Point.X >= wvWeekdayArray[I].Rec.Left) and
|
||||
(Point.X <= wvWeekdayArray[I].Rec.Right) and
|
||||
(Point.Y >= wvWeekdayArray[I].Rec.Top) and
|
||||
(Point.Y <= wvWeekdayArray[I].Rec.Bottom)
|
||||
then begin
|
||||
if PointInRect(Point, wvWeekdayArray[I].Rec) then
|
||||
begin
|
||||
Date := wvWeekdayArray[I].Day;
|
||||
Invalidate;
|
||||
Exit;
|
||||
@ -1141,11 +1138,8 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if (Pt.X > wvEventArray[I].Rec.Left) and
|
||||
(Pt.X < wvEventArray[I].Rec.Right) and
|
||||
(Pt.Y > wvEventArray[I].Rec.Top) and
|
||||
(Pt.Y < wvEventArray[I].Rec.Bottom)
|
||||
then begin
|
||||
if PointInRect(Pt, wvEventArray[I].Rec) then
|
||||
begin
|
||||
{ point falls inside this event's rectangle }
|
||||
wvHotPoint := Pt;
|
||||
ActiveEvent := TVpEvent(wvEventArray[I].Event);
|
||||
|
Reference in New Issue
Block a user