jvcllaz: Fix lcl scaling for TJvTMTimeline; previous scaling solution could not be switched off.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7274 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-01-12 16:25:43 +00:00
parent 8cd74ec918
commit cc8edbe51e

View File

@ -104,11 +104,6 @@ type
FShowTodayIcon: Boolean; FShowTodayIcon: Boolean;
function IsStoredMaxDate: Boolean; function IsStoredMaxDate: Boolean;
function IsStoredMinDate: Boolean; function IsStoredMinDate: Boolean;
function IsStoredButtonWidth: Boolean;
function IsStoredDayWidth: Boolean;
function IsStoredIconDayDist: Boolean;
function GetDayWidth: Integer;
function GetIconDayDist: Integer;
function GetRectForDate(ADate: TDate): TRect; function GetRectForDate(ADate: TDate): TRect;
function DateFromPos(APos: Integer): TDate; function DateFromPos(APos: Integer): TDate;
procedure DoTimer(Sender: TObject); procedure DoTimer(Sender: TObject);
@ -180,11 +175,11 @@ type
procedure SetBorderStyle(Value: TBorderStyle); override; procedure SetBorderStyle(Value: TBorderStyle); override;
property BorderStyle: TBorderStyle read GetBorderStyle write SetBorderStyle default bsSingle; property BorderStyle: TBorderStyle read GetBorderStyle write SetBorderStyle default bsSingle;
property ButtonWidth: Integer read FButtonWidth write SetButtonWidth stored IsStoredButtonWidth; property ButtonWidth: Integer read FButtonWidth write SetButtonWidth default cTMTimeLineButtonWidth;
property Cursor; property Cursor;
property DayWidth: Integer read GetDayWidth write SetDayWidth stored IsStoredDayWidth; property DayWidth: Integer read FDayWidth write SetDayWidth default cTMTimeLineDayWidth;
property ObjectsFontStyle: TFontStyles read FObjectsFontStyle write SetObjectsFontStyle default [fsUnderline]; property ObjectsFontStyle: TFontStyles read FObjectsFontStyle write SetObjectsFontStyle default [fsUnderline];
property IconDayDistance: Integer read GetIconDayDist write SetIconDayDist stored IsStoredIconDayDist; property IconDayDistance: Integer read FIconDayDist write SetIconDayDist default cTMTimeLineIconDayDist;
property ImageCursor: TCursor read FImageCursor write SetImageCursor default crHandPoint; property ImageCursor: TCursor read FImageCursor write SetImageCursor default crHandPoint;
property Images: TImageList read FImages write SetImages; property Images: TImageList read FImages write SetImages;
property LargeChange: Word read FLargeChange write SetLargeChange default 30; property LargeChange: Word read FLargeChange write SetLargeChange default 30;
@ -215,7 +210,6 @@ type
property Align default alTop; property Align default alTop;
{ lcl scaling } { lcl scaling }
{$IF LCL_FullVersion >= 1080000}
protected protected
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override; const AXProportion, AYProportion: Double); override;
@ -225,7 +219,6 @@ type
{$IF LCL_FullVersion >= 2010000} {$IF LCL_FullVersion >= 2010000}
procedure FixDesignFontsPPI(const ADesignTimePPI: Integer); override; procedure FixDesignFontsPPI(const ADesignTimePPI: Integer); override;
{$IFEND} {$IFEND}
{$IFEND}
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -454,8 +447,8 @@ begin
FMonthFont.OnChange := @MonthFontChanged; FMonthFont.OnChange := @MonthFontChanged;
FObjectsFontStyle := [fsUnderline]; FObjectsFontStyle := [fsUnderline];
FDayWidth := -1; FDayWidth := cTMTimeLineDayWidth;
FIconDayDist := -1; FIconDayDist := cTMTimeLineIconDayDist;
FDate := SysUtils.Date - 7; FDate := SysUtils.Date - 7;
FSelDate := FDate - 1; FSelDate := FDate - 1;
FImageCursor := crHandPoint; FImageCursor := crHandPoint;
@ -470,7 +463,7 @@ begin
Font.Size := 0; Font.Size := 0;
Font.Name := 'default'; Font.Name := 'default';
FButtonWidth := Scale96ToFont(cTMTimeLineButtonWidth); FButtonWidth := cTMTimeLineButtonWidth;
FLeftBtn := TSpeedButton.Create(Self); FLeftBtn := TSpeedButton.Create(Self);
with FLeftBtn do with FLeftBtn do
@ -926,40 +919,9 @@ begin
Result := FMinDate <> 0; Result := FMinDate <> 0;
end; end;
function TJvCustomTMTimeLine.IsStoredButtonWidth: Boolean;
begin
Result := ButtonWidth <> Scale96ToFont(cTMTimeLineButtonWidth);
end;
function TJvCustomTMTimeLine.IsStoredDayWidth: Boolean;
begin
Result := FDayWidth >= 0;
end;
function TJvCustomTMTimeLine.GetDayWidth: Integer;
begin
if IsStoredDayWidth then
Result := FDayWidth
else
Result := Scale96ToFont(cTMTimeLineDayWidth);
end;
function TJvCustomTMTimeLine.GetIconDayDist: Integer;
begin
if IsStoredIconDayDist then
Result := FIconDayDist
else
Result := Scale96ToFont(cTMTimelineIconDayDist);
end;
function TJvCustomTMTimeLine.IsStoredIconDayDist: Boolean;
begin
Result := FIconDayDist >= 0;
end;
procedure TJvCustomTMTimeline.SetDayWidth(const Value: Integer); procedure TJvCustomTMTimeline.SetDayWidth(const Value: Integer);
begin begin
if (FDayWidth <> Value) and (Value <> 0) and (Value >= -1) then if (FDayWidth <> Value) and (Value > 0) then
begin begin
FDayWidth := Value; FDayWidth := Value;
Invalidate; Invalidate;
@ -1072,7 +1034,6 @@ begin
FOnChange(Self); FOnChange(Self);
end; end;
{$IF LCL_FullVersion >= 1080000}
procedure TJvCustomTMTimeLine.DoAutoAdjustLayout( procedure TJvCustomTMTimeLine.DoAutoAdjustLayout(
const AMode: TLayoutAdjustmentPolicy; const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); const AXProportion, AYProportion: Double);
@ -1081,19 +1042,11 @@ begin
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin begin
if IsStoredDayWidth then FDayWidth := Round(FDayWidth * AXProportion);
FDayWidth := Round(FDayWidth * AXProportion); FIconDayDist := Round(FIconDayDist * AYProportion);
if IsStoredIconDayDist then SetButtonWidth(Round(FButtonWidth * AXProportion));
FIconDayDist := Round(FIconDayDist * AYProportion);
if IsStoredButtonWidth then begin
FButtonWidth := Round(FButtonWidth * AXProportion);
FLeftBtn.Width := FButtonWidth;
FRightBtn.Width := FButtonWidth;
end;
Invalidate;
end; end;
end; end;
{$IFEND}
{$IF LCL_FullVersion >= 1080000} {$IF LCL_FullVersion >= 1080000}
procedure TJvCustomTMTimeLine.ScaleFontsPPI( procedure TJvCustomTMTimeLine.ScaleFontsPPI(