DateTimePicker - improve readability (spaces aronund binary operators)

git-svn-id: trunk@60247 -
This commit is contained in:
zoran 2019-01-30 12:27:47 +00:00
parent 1513ba0c4c
commit fc99f0b187

View File

@ -810,7 +810,7 @@ begin
inherited; inherited;
PP := LCLIntf.GetParent(Handle); PP := LCLIntf.GetParent(Handle);
if (PP<>0) then if (PP <> 0) then
SendMessage(PP, LM_NCACTIVATE, Ord(Message.Active <> WA_INACTIVE), 0); SendMessage(PP, LM_NCACTIVATE, Ord(Message.Active <> WA_INACTIVE), 0);
end; end;
@ -946,7 +946,7 @@ end;
procedure TCustomDateTimePicker.SetChecked(const AValue: Boolean); procedure TCustomDateTimePicker.SetChecked(const AValue: Boolean);
begin begin
if (FChecked=AValue) or not FShowCheckBox then if (FChecked = AValue) or not FShowCheckBox then
Exit; Exit;
FChecked := AValue; FChecked := AValue;
@ -1077,7 +1077,7 @@ begin
if FOptions = aOptions then Exit; if FOptions = aOptions then Exit;
FOptions := aOptions; FOptions := aOptions;
if FArrowButton<>nil then if FArrowButton <> nil then
FArrowButton.Flat := dtpoFlatButton in Options; FArrowButton.Flat := dtpoFlatButton in Options;
if FUpDown <> nil then if FUpDown <> nil then
@ -1212,7 +1212,7 @@ end;
procedure TCustomDateTimePicker.SetTimeDisplay(const AValue: TTimeDisplay); procedure TCustomDateTimePicker.SetTimeDisplay(const AValue: TTimeDisplay);
begin begin
if FTimeDisplay <> AValue then begin if FTimeDisplay <> AValue then begin
FTimeDisplay:=AValue; FTimeDisplay:= AValue;
AdjustEffectiveHideDateTimeParts; AdjustEffectiveHideDateTimeParts;
end; end;
end; end;
@ -1971,15 +1971,15 @@ begin
CSize.cy := ScaleScreenToFont(CSize.cy); CSize.cy := ScaleScreenToFont(CSize.cy);
if IsRightToLeft and not IgnoreRightToLeft then if IsRightToLeft and not IgnoreRightToLeft then
begin begin
Result.Right := ClientWidth-(BorderSpacing.InnerBorder+BorderWidth); Result.Right := ClientWidth - (BorderSpacing.InnerBorder + BorderWidth);
Result.Left := Result.Right-CSize.cx; Result.Left := Result.Right - CSize.cx;
end else end else
begin begin
Result.Left := BorderSpacing.InnerBorder+BorderWidth; Result.Left := BorderSpacing.InnerBorder + BorderWidth;
Result.Right := Result.Left+CSize.cx; Result.Right := Result.Left + CSize.cx;
end; end;
Result.Top := (ClientHeight-CSize.cy) div 2; Result.Top := (ClientHeight - CSize.cy) div 2;
Result.Bottom := Result.Top+CSize.cy; Result.Bottom := Result.Top + CSize.cy;
end; end;
{ GetTextOrigin { GetTextOrigin
@ -2200,7 +2200,7 @@ begin
if ShowCheckBox then if ShowCheckBox then
begin begin
NewMouseInCheckBox := PtInRect(GetCheckBoxRect, Point(X, Y)); NewMouseInCheckBox := PtInRect(GetCheckBoxRect, Point(X, Y));
if FMouseInCheckBox<>NewMouseInCheckBox then if FMouseInCheckBox <> NewMouseInCheckBox then
begin begin
FMouseInCheckBox := NewMouseInCheckBox; FMouseInCheckBox := NewMouseInCheckBox;
Invalidate; Invalidate;
@ -2928,7 +2928,7 @@ procedure TCustomDateTimePicker.Change;
begin begin
if Assigned(FOnChange) then if Assigned(FOnChange) then
FOnChange(Self); FOnChange(Self);
if FOnChangeHandlers<>nil then if FOnChangeHandlers <> nil then
FOnChangeHandlers.CallNotifyEvents(Self); FOnChangeHandlers.CallNotifyEvents(Self);
end; end;
@ -3264,7 +3264,7 @@ begin
if FArrowShape = AValue then Exit; if FArrowShape = AValue then Exit;
FArrowShape := AValue; FArrowShape := AValue;
if FArrowButton<>nil then if FArrowButton <> nil then
FArrowButton.Invalidate; FArrowButton.Invalidate;
end; end;
@ -3315,7 +3315,7 @@ begin
if Assigned(FOnCheckBoxChange) then if Assigned(FOnCheckBoxChange) then
FOnCheckBoxChange(Self); FOnCheckBoxChange(Self);
if FOnCheckBoxChangeHandlers<>nil then if FOnCheckBoxChangeHandlers <> nil then
FOnCheckBoxChangeHandlers.CallNotifyEvents(Self); FOnCheckBoxChangeHandlers.CallNotifyEvents(Self);
end; end;
@ -3706,7 +3706,7 @@ procedure TDTSpeedButton.Paint;
Details := ThemeServices.GetElementDetails(ArrowState); Details := ThemeServices.GetElementDetails(ArrowState);
ASize := ThemeServices.GetDetailSize(Details); ASize := ThemeServices.GetDetailSize(Details);
ARect := DropDownButtonRect; ARect := DropDownButtonRect;
InflateRect(ARect, -(ARect.Right-ARect.Left-ASize.cx) div 2, 0); InflateRect(ARect, -(ARect.Right - ARect.Left - ASize.cx) div 2, 0);
ThemeServices.DrawElement(Canvas.Handle, Details, ARect); ThemeServices.DrawElement(Canvas.Handle, Details, ARect);
end; end;
const const
@ -3723,8 +3723,8 @@ begin
Canvas.Pen.Color := ArrowColor; Canvas.Pen.Color := ArrowColor;
Canvas.Brush.Color := Canvas.Pen.Color; Canvas.Brush.Color := Canvas.Pen.Color;
X := (Width-9) div 2; X := (Width - 9) div 2;
Y := (Height-6) div 2; Y := (Height - 6) div 2;
{ Let's draw shape of the arrow on the button: } { Let's draw shape of the arrow on the button: }
case DTPicker.FArrowShape of case DTPicker.FArrowShape of
@ -3733,24 +3733,24 @@ begin
asClassicLarger: asClassicLarger:
{ triangle: } { triangle: }
Canvas.Polygon([Point(X+0, Y+1), Point(X+8, Y+1), Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 8, Y + 1),
Point(X+4, Y+5)]); Point(X + 4, Y + 5)]);
asClassicSmaller: asClassicSmaller:
{ triangle -- smaller variant: } { triangle -- smaller variant: }
Canvas.Polygon([Point(X+1, Y+2), Point(X+7, Y+2), Canvas.Polygon([Point(X + 1, Y + 2), Point(X + 7, Y + 2),
Point(X+4, Y+5)]); Point(X + 4, Y + 5)]);
asModernLarger: asModernLarger:
{ modern: } { modern: }
Canvas.Polygon([Point(X+0, Y+1), Point(X+1, Y+0), Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 1, Y + 0),
Point(X+4, Y+3), Point(X+7, Y+0), Point(X+8, Y+1), Point(X+4, Y+5)]); Point(X + 4, Y + 3), Point(X + 7, Y + 0), Point(X + 8, Y + 1), Point(X + 4, Y + 5)]);
asModernSmaller: asModernSmaller:
{ modern -- smaller variant: } { modern -- smaller variant: }
Canvas.Polygon([Point(X+1, Y+2), Point(X+2, Y+1), Canvas.Polygon([Point(X + 1, Y + 2), Point(X + 2, Y + 1),
Point(X+4, Y+3), Point(X+6, Y+1), Point(X+7, Y+2), Point(X+4, Y+5)]); Point(X + 4, Y + 3), Point(X + 6, Y + 1), Point(X + 7, Y + 2), Point(X + 4, Y + 5)]);
asYetAnotherShape: asYetAnotherShape:
{ something in between, not very pretty: } { something in between, not very pretty: }
Canvas.Polygon([Point(X+0, Y+1), Point(X+1, Y+0), Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 1, Y + 0),
Point(X+2, Y+1), Point(X+6, Y+1),Point(X+7, Y+0), Point(X+8, Y+1), Point(X+4, Y+5)]); Point(X + 2, Y + 1), Point(X + 6, Y + 1),Point(X + 7, Y + 0), Point(X + 8, Y + 1), Point(X + 4, Y + 5)]);
end; end;
end; end;
@ -3960,7 +3960,7 @@ end;
procedure TCustomDateTimePicker.AddHandlerOnChange( procedure TCustomDateTimePicker.AddHandlerOnChange(
const AOnChange: TNotifyEvent; AsFirst: Boolean); const AOnChange: TNotifyEvent; AsFirst: Boolean);
begin begin
if FOnChangeHandlers=nil then if FOnChangeHandlers = nil then
FOnChangeHandlers := TMethodList.Create; FOnChangeHandlers := TMethodList.Create;
FOnChangeHandlers.Add(TMethod(AOnChange), not AsFirst); FOnChangeHandlers.Add(TMethod(AOnChange), not AsFirst);
end; end;
@ -3968,7 +3968,7 @@ end;
procedure TCustomDateTimePicker.AddHandlerOnCheckBoxChange( procedure TCustomDateTimePicker.AddHandlerOnCheckBoxChange(
const AOnCheckBoxChange: TNotifyEvent; AsFirst: Boolean); const AOnCheckBoxChange: TNotifyEvent; AsFirst: Boolean);
begin begin
if FOnCheckBoxChangeHandlers=nil then if FOnCheckBoxChangeHandlers = nil then
FOnCheckBoxChangeHandlers := TMethodList.Create; FOnCheckBoxChangeHandlers := TMethodList.Create;
FOnCheckBoxChangeHandlers.Add(TMethod(AOnCheckBoxChange), not AsFirst); FOnCheckBoxChangeHandlers.Add(TMethod(AOnCheckBoxChange), not AsFirst);
end; end;