mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 07:59:45 +02:00
Merge revision(s) 55435 #c727f965e6 from trunk
git-svn-id: branches/fixes_1_8@55587 -
This commit is contained in:
parent
706c59eea8
commit
2baab14dcb
@ -88,7 +88,6 @@ type
|
||||
When ddoTryDefault is set, the actual order is determined from
|
||||
ShortDateFormat global variable -- see coments above
|
||||
AdjustEffectiveDateDisplayOrder procedure }
|
||||
|
||||
TDateDisplayOrder = (ddoDMY, ddoMDY, ddoYMD, ddoTryDefault);
|
||||
|
||||
TTimeDisplay = (tdHM, // hour and minute
|
||||
@ -193,7 +192,6 @@ type
|
||||
FConfirmedDateTime: TDateTime;
|
||||
FNoEditingDone: Integer;
|
||||
FAllowDroppingCalendar: Boolean;
|
||||
|
||||
FCorrectedDTP: TDateTimePart;
|
||||
FCorrectedValue: Word;
|
||||
FSkipChangeInUpdateDate: Integer;
|
||||
@ -299,7 +297,6 @@ type
|
||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
|
||||
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
|
||||
procedure UpdateDate(const CallChangeFromSetDateTime: Boolean = False); virtual;
|
||||
|
||||
procedure DoEnter; override;
|
||||
procedure DoExit; override;
|
||||
procedure Click; override;
|
||||
@ -1094,8 +1091,6 @@ begin
|
||||
end;
|
||||
|
||||
procedure TCustomDateTimePicker.SetDateTime(const AValue: TDateTime);
|
||||
|
||||
|
||||
begin
|
||||
if not EqualDateTime(AValue, FDateTime) then begin
|
||||
if IsNullDate(AValue) then
|
||||
@ -1107,18 +1102,6 @@ begin
|
||||
end else
|
||||
UpdateDate;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
procedure TCustomDateTimePicker.SetDateSeparator(const AValue: String);
|
||||
@ -1989,7 +1972,6 @@ begin
|
||||
UpdateDate;
|
||||
end;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
{ GetDateTimePartFromTextPart function
|
||||
@ -2597,131 +2579,126 @@ var
|
||||
WT: Array[dtpHour..dtpAMPM] of Word;
|
||||
DTP: TDateTimePart;
|
||||
begin
|
||||
if HandleAllocated then begin
|
||||
FCorrectedDTP := dtpAMPM;
|
||||
FCorrectedDTP := dtpAMPM;
|
||||
|
||||
FUserChangedText := False;
|
||||
FUserChangedText := False;
|
||||
|
||||
if not (DateIsNull or FJumpMinMax) then begin
|
||||
if Int(FDateTime) > FMaxDate then
|
||||
FDateTime := ComposeDateTime(FMaxDate, FDateTime);
|
||||
if not (DateIsNull or FJumpMinMax) then begin
|
||||
if Int(FDateTime) > FMaxDate then
|
||||
FDateTime := ComposeDateTime(FMaxDate, FDateTime);
|
||||
|
||||
if FDateTime < FMinDate then
|
||||
FDateTime := ComposeDateTime(FMinDate, FDateTime);
|
||||
end;
|
||||
|
||||
if (FSkipChangeInUpdateDate = 0) then begin
|
||||
// we'll skip the next part if called from UndoChanges
|
||||
// and in recursive calls which could be made through calling Change
|
||||
Inc(FSkipChangeInUpdateDate);
|
||||
|
||||
try
|
||||
if (FUserChanging > 0) // the change is caused by user interaction
|
||||
or CallChangeFromSetDateTime // call from SetDateTime with option dtpoDoChangeOnSetDateTime
|
||||
then
|
||||
try
|
||||
Change;
|
||||
except
|
||||
UndoChanges;
|
||||
raise;
|
||||
end;
|
||||
|
||||
if FUserChanging = 0 then
|
||||
|
||||
|
||||
FConfirmedDateTime := FDateTime;
|
||||
|
||||
finally
|
||||
Dec(FSkipChangeInUpdateDate);
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
if DateIsNull then begin
|
||||
if dtpYear in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FYearPos] := ''
|
||||
else
|
||||
FTextPart[FYearPos] := '0000';
|
||||
|
||||
if dtpMonth in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FMonthPos] := ''
|
||||
else
|
||||
FTextPart[FMonthPos] := '00';
|
||||
|
||||
if dtpDay in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FDayPos] := ''
|
||||
else
|
||||
FTextPart[FDayPos] := '00';
|
||||
|
||||
for DTP := dtpHour to dtpAMPM do begin
|
||||
if DTP in FEffectiveHideDateTimeParts then
|
||||
FTimeText[DTP] := ''
|
||||
else if DTP = dtpAMPM then
|
||||
FTimeText[DTP] := 'XX'
|
||||
else if DTP = dtpMiliSec then
|
||||
FTimeText[DTP] := '999'
|
||||
else
|
||||
FTimeText[DTP] := '99';
|
||||
end;
|
||||
|
||||
end else begin
|
||||
DecodeDate(FDateTime, W[3], W[2], W[1]);
|
||||
|
||||
if dtpYear in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FYearPos] := ''
|
||||
else if FLeadingZeros then
|
||||
FTextPart[FYearPos] := RightStr('000' + IntToStr(W[3]), 4)
|
||||
else
|
||||
FTextPart[FYearPos] := IntToStr(W[3]);
|
||||
|
||||
if dtpMonth in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FMonthPos] := ''
|
||||
else if FShowMonthNames then
|
||||
FTextPart[FMonthPos] := FMonthNamesArray[W[2]]
|
||||
else if FLeadingZeros then
|
||||
FTextPart[FMonthPos] := RightStr('0' + IntToStr(W[2]), 2)
|
||||
else
|
||||
FTextPart[FMonthPos] := IntToStr(W[2]);
|
||||
|
||||
if dtpDay in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FDayPos] := ''
|
||||
else if FLeadingZeros then
|
||||
FTextPart[FDayPos] := RightStr('0' + IntToStr(W[1]), 2)
|
||||
else
|
||||
FTextPart[FDayPos] := IntToStr(W[1]);
|
||||
|
||||
DecodeTime(FDateTime, WT[dtpHour], WT[dtpMinute], WT[dtpSecond], WT[dtpMiliSec]);
|
||||
|
||||
if dtpAMPM in FEffectiveHideDateTimeParts then
|
||||
FTimeText[dtpAMPM] := ''
|
||||
else begin
|
||||
if WT[dtpHour] < 12 then begin
|
||||
FTimeText[dtpAMPM] := 'AM';
|
||||
if WT[dtpHour] = 0 then
|
||||
WT[dtpHour] := 12;
|
||||
end else begin
|
||||
FTimeText[dtpAMPM] := 'PM';
|
||||
if WT[dtpHour] > 12 then
|
||||
Dec(WT[dtpHour], 12);
|
||||
end;
|
||||
end;
|
||||
|
||||
for DTP := dtpHour to dtpMiliSec do begin
|
||||
if DTP in FEffectiveHideDateTimeParts then
|
||||
FTimeText[DTP] := ''
|
||||
else if (DTP = dtpHour) and (not FLeadingZeros) then
|
||||
FTimeText[DTP] := IntToStr(WT[dtpHour])
|
||||
else if DTP = dtpMiliSec then
|
||||
FTimeText[DTP] := RightStr('00' + IntToStr(WT[DTP]), 3)
|
||||
else
|
||||
FTimeText[DTP] := RightStr('0' + IntToStr(WT[DTP]), 2);
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
Invalidate;
|
||||
if FDateTime < FMinDate then
|
||||
FDateTime := ComposeDateTime(FMinDate, FDateTime);
|
||||
end;
|
||||
|
||||
if (FSkipChangeInUpdateDate = 0) then begin
|
||||
// we'll skip the next part if called from UndoChanges
|
||||
// and in recursive calls which could be made through calling Change
|
||||
Inc(FSkipChangeInUpdateDate);
|
||||
try
|
||||
if (FUserChanging > 0) // the change is caused by user interaction
|
||||
or CallChangeFromSetDateTime // call from SetDateTime with option dtpoDoChangeOnSetDateTime
|
||||
then
|
||||
try
|
||||
Change;
|
||||
except
|
||||
UndoChanges;
|
||||
raise;
|
||||
end;
|
||||
|
||||
if FUserChanging = 0 then
|
||||
FConfirmedDateTime := FDateTime;
|
||||
|
||||
finally
|
||||
Dec(FSkipChangeInUpdateDate);
|
||||
end;
|
||||
end;
|
||||
|
||||
if DateIsNull then begin
|
||||
if dtpYear in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FYearPos] := ''
|
||||
else
|
||||
FTextPart[FYearPos] := '0000';
|
||||
|
||||
if dtpMonth in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FMonthPos] := ''
|
||||
else
|
||||
FTextPart[FMonthPos] := '00';
|
||||
|
||||
if dtpDay in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FDayPos] := ''
|
||||
else
|
||||
FTextPart[FDayPos] := '00';
|
||||
|
||||
for DTP := dtpHour to dtpAMPM do begin
|
||||
if DTP in FEffectiveHideDateTimeParts then
|
||||
FTimeText[DTP] := ''
|
||||
else if DTP = dtpAMPM then
|
||||
FTimeText[DTP] := 'XX'
|
||||
else if DTP = dtpMiliSec then
|
||||
FTimeText[DTP] := '999'
|
||||
else
|
||||
FTimeText[DTP] := '99';
|
||||
end;
|
||||
|
||||
end else begin
|
||||
DecodeDate(FDateTime, W[3], W[2], W[1]);
|
||||
|
||||
if dtpYear in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FYearPos] := ''
|
||||
else if FLeadingZeros then
|
||||
FTextPart[FYearPos] := RightStr('000' + IntToStr(W[3]), 4)
|
||||
else
|
||||
FTextPart[FYearPos] := IntToStr(W[3]);
|
||||
|
||||
if dtpMonth in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FMonthPos] := ''
|
||||
else if FShowMonthNames then
|
||||
FTextPart[FMonthPos] := FMonthNamesArray[W[2]]
|
||||
else if FLeadingZeros then
|
||||
FTextPart[FMonthPos] := RightStr('0' + IntToStr(W[2]), 2)
|
||||
else
|
||||
FTextPart[FMonthPos] := IntToStr(W[2]);
|
||||
|
||||
if dtpDay in FEffectiveHideDateTimeParts then
|
||||
FTextPart[FDayPos] := ''
|
||||
else if FLeadingZeros then
|
||||
FTextPart[FDayPos] := RightStr('0' + IntToStr(W[1]), 2)
|
||||
else
|
||||
FTextPart[FDayPos] := IntToStr(W[1]);
|
||||
|
||||
DecodeTime(FDateTime, WT[dtpHour], WT[dtpMinute], WT[dtpSecond], WT[dtpMiliSec]);
|
||||
|
||||
if dtpAMPM in FEffectiveHideDateTimeParts then
|
||||
FTimeText[dtpAMPM] := ''
|
||||
else begin
|
||||
if WT[dtpHour] < 12 then begin
|
||||
FTimeText[dtpAMPM] := 'AM';
|
||||
if WT[dtpHour] = 0 then
|
||||
WT[dtpHour] := 12;
|
||||
end else begin
|
||||
FTimeText[dtpAMPM] := 'PM';
|
||||
if WT[dtpHour] > 12 then
|
||||
Dec(WT[dtpHour], 12);
|
||||
end;
|
||||
end;
|
||||
|
||||
for DTP := dtpHour to dtpMiliSec do begin
|
||||
if DTP in FEffectiveHideDateTimeParts then
|
||||
FTimeText[DTP] := ''
|
||||
else if (DTP = dtpHour) and (not FLeadingZeros) then
|
||||
FTimeText[DTP] := IntToStr(WT[dtpHour])
|
||||
else if DTP = dtpMiliSec then
|
||||
FTimeText[DTP] := RightStr('00' + IntToStr(WT[DTP]), 3)
|
||||
else
|
||||
FTimeText[DTP] := RightStr('0' + IntToStr(WT[DTP]), 2);
|
||||
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
if HandleAllocated then
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
procedure TCustomDateTimePicker.DoEnter;
|
||||
@ -2795,17 +2772,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
procedure TCustomDateTimePicker.SendExternalKeyCode(const Key: Word);
|
||||
var
|
||||
Ch: Char;
|
||||
@ -2891,7 +2857,6 @@ procedure TCustomDateTimePicker.CreateWnd;
|
||||
begin
|
||||
inherited CreateWnd;
|
||||
|
||||
UpdateDate;
|
||||
if FDoNotArrangeControls then begin { This field is set to True in constructor.
|
||||
Its purpose is to prevent control anchoring until this point. That's because
|
||||
on Linux Lazarus crashes when control is dropped on form in designer if
|
||||
@ -3899,7 +3864,6 @@ begin
|
||||
FCorrectedDTP := dtpAMPM;
|
||||
FCorrectedValue := 0;
|
||||
FSkipChangeInUpdateDate := 0;
|
||||
|
||||
FNoEditingDone := 0;
|
||||
FArrowShape := asTheme;
|
||||
FAllowDroppingCalendar := True;
|
||||
|
Loading…
Reference in New Issue
Block a user