From 57daf59d6e500fac6f90edc83267147b98f3b5dc Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 2 Dec 2010 07:21:19 +0000 Subject: [PATCH] lcl: use DefaultFormatSettings to prevent deprecated message generation git-svn-id: trunk@28588 - --- lcl/calendar.pp | 4 ++-- lcl/editbtn.pas | 6 +++--- lcl/extdlgs.pas | 12 ++++++------ lcl/include/customupdown.inc | 2 +- lcl/include/spinedit.inc | 6 +++--- lcl/lresources.pp | 28 ++++++++++++++-------------- lcl/maskedit.pp | 12 ++++++------ 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/lcl/calendar.pp b/lcl/calendar.pp index b7be3158f5..c8678dc39f 100644 --- a/lcl/calendar.pp +++ b/lcl/calendar.pp @@ -254,7 +254,7 @@ begin DateToStr(CalendarMinDate), DateToStr(CalendarMaxDate)]); {$ENDIF} FDate:=AValue; - FDateAsString:=FormatDateTime(ShortDateFormat,FDate); + FDateAsString:=FormatDateTime(DefaultFormatSettings.ShortDateFormat,FDate); {$IFDEF VerboseCalenderSetDate} DebugLn('TCustomCalendar.SetDateTime FDate=',DateToStr(FDate),' FDateAsString=',FDateAsString,' ShortDateFormat=',ShortDateFormat); {$ENDIF} @@ -266,7 +266,7 @@ begin if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then begin FDate := TWSCustomCalendarClass(WidgetSetClass).GetDateTime(Self); - FDateAsString := FormatDateTime(ShortDateFormat,FDate); + FDateAsString := FormatDateTime(DefaultFormatSettings.ShortDateFormat,FDate); {$IFDEF VerboseCalenderSetDate} DebugLn('TCustomCalendar.GetProps A ',DateToStr(FDate),' ',FDateAsString); {$ENDIF} diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index e5b8366c95..aa37b9169c 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -954,7 +954,7 @@ end; procedure TDateEdit.DateFormatChanged; begin - FDateFormat := ShortDateFormat; + FDateFormat := DefaultFormatSettings.ShortDateFormat; end; function TDateEdit.GetDateFormat: string; @@ -1034,13 +1034,13 @@ Var begin Result:=Def; - P:=Pos(DateSeparator,S); + P:=Pos(DefaultFormatSettings.DateSeparator,S); If (P=0) then Exit; N1:=StrToIntDef(Copy(S,1,P-1),-1); If (N1=-1) then Exit; Delete(S,1,P); - P:=Pos(DateSeparator,S); + P:=Pos(DefaultFormatSettings.DateSeparator,S); If (P=0) then Exit; N2:=StrToIntDef(Copy(S,1,P-1),-1); diff --git a/lcl/extdlgs.pas b/lcl/extdlgs.pas index 2158abeffe..0c64c67cec 100644 --- a/lcl/extdlgs.pas +++ b/lcl/extdlgs.pas @@ -545,7 +545,7 @@ begin if Kind in [cbNum0..cbNum9] then Caption:=IntToStr(Tag) else if Kind = cbDcm then - Caption:=DecimalSeparator + Caption:=DefaultFormatSettings.DecimalSeparator else if Kind in [cbSgn..cbMC] then Caption:=BtnCaptions[Kind]; Left:=BtnPos[ALayout, Kind].X; @@ -792,11 +792,11 @@ begin Key:=#0; if Assigned(FOnCalcKey) then FOnCalcKey(Self, Key); - if Key in [DecimalSeparator, '.', ','] then + if Key in [DefaultFormatSettings.DecimalSeparator, '.', ','] then begin CheckFirst; - if Pos(DecimalSeparator, FText) = 0 then - SetCalcText(FText + DecimalSeparator); + if Pos(DefaultFormatSettings.DecimalSeparator, FText) = 0 then + SetCalcText(FText + DefaultFormatSettings.DecimalSeparator); end else case Key of @@ -903,7 +903,7 @@ var I: Integer; BtnTag: Longint; begin - if Key in [DecimalSeparator, '.', ','] then + if Key in [DefaultFormatSettings.DecimalSeparator, '.', ','] then Key:='.' else if Key = #13 then Key:='=' @@ -929,7 +929,7 @@ begin case TCalcButton(Sender).Kind of cbNum0..cbNum9: CalcKey(Char(TComponent(Sender).Tag + Ord('0'))); cbSgn: CalcKey('_'); - cbDcm: CalcKey(DecimalSeparator); + cbDcm: CalcKey(DefaultFormatSettings.DecimalSeparator); cbDiv: CalcKey('/'); cbMul: CalcKey('*'); cbSub: CalcKey('-'); diff --git a/lcl/include/customupdown.inc b/lcl/include/customupdown.inc index ae2b83d1f6..4712e74638 100644 --- a/lcl/include/customupdown.inc +++ b/lcl/include/customupdown.inc @@ -418,7 +418,7 @@ begin str := Trim(Associate.Caption); InvalidNumber := str = ''; For I := Length(str) downto 1 do - if str[I] = ThousandSeparator then + if str[I] = DefaultFormatSettings.ThousandSeparator then Delete(Str,I,1) else if str[I] in ['0'..'9'] then else begin diff --git a/lcl/include/spinedit.inc b/lcl/include/spinedit.inc index 0bfa7b4cf6..7abcbfa4e5 100644 --- a/lcl/include/spinedit.inc +++ b/lcl/include/spinedit.inc @@ -111,9 +111,9 @@ procedure TCustomFloatSpinEdit.KeyPress(var Key: char); } begin inherited KeyPress(Key); - if (Key in ['.',',']) then Key := Decimalseparator; - if not (Key in ['0'..'9',DecimalSeparator,'+','-',#8,#9]) then Key := #0; - if (Key = DecimalSeparator) and (FDecimals = 0) then Key := #0; + if (Key in ['.',',']) then Key := DefaultFormatSettings.Decimalseparator; + if not (Key in ['0'..'9', DefaultFormatSettings.DecimalSeparator,'+','-',#8,#9]) then Key := #0; + if (Key = DefaultFormatSettings.DecimalSeparator) and (FDecimals = 0) then Key := #0; end; class function TCustomFloatSpinEdit.GetControlClassDefaultSize: TSize; diff --git a/lcl/lresources.pp b/lcl/lresources.pp index d6aff81ec5..e715bc1895 100644 --- a/lcl/lresources.pp +++ b/lcl/lresources.pp @@ -2533,15 +2533,15 @@ begin Input.Read(Signature[1], length(Signature)); if Signature<>FilerSignature then raise EReadError.Create('Illegal stream image' {###SInvalidImage}); - OldDecimalSeparator:=DecimalSeparator; - DecimalSeparator:='.'; - OldThousandSeparator:=ThousandSeparator; - ThousandSeparator:=','; + OldDecimalSeparator:=DefaultFormatSettings.DecimalSeparator; + DefaultFormatSettings.DecimalSeparator:='.'; + OldThousandSeparator:=DefaultFormatSettings.ThousandSeparator; + DefaultFormatSettings.ThousandSeparator:=','; try ReadObject(''); finally - DecimalSeparator:=OldDecimalSeparator; - ThousandSeparator:=OldThousandSeparator; + DefaultFormatSettings.DecimalSeparator:=OldDecimalSeparator; + DefaultFormatSettings.ThousandSeparator:=OldThousandSeparator; end; end; @@ -2965,17 +2965,17 @@ begin Links.Sort(true); end; parser := {$IFDEF DisableWindowsUnicodeSupport}TParser{$ELSE}TUTF8Parser{$ENDIF}.Create(Input); - OldDecimalSeparator:=DecimalSeparator; - DecimalSeparator:='.'; - OldThousandSeparator:=ThousandSeparator; - ThousandSeparator:=','; + OldDecimalSeparator:=DefaultFormatSettings.DecimalSeparator; + DefaultFormatSettings.DecimalSeparator:='.'; + OldThousandSeparator:=DefaultFormatSettings.ThousandSeparator; + DefaultFormatSettings.ThousandSeparator:=','; try Output.Write(FilerSignature[1], length(FilerSignature)); ProcessObject; finally parser.Free; - DecimalSeparator:=OldDecimalSeparator; - ThousandSeparator:=OldThousandSeparator; + DefaultFormatSettings.DecimalSeparator:=OldDecimalSeparator; + DefaultFormatSettings.ThousandSeparator:=OldThousandSeparator; end; end; @@ -3510,7 +3510,7 @@ begin DeletePos:=p; while (DeletePos>1) and (Result[DeletePos]='0') do Dec(DeletePos); - if (DeletePos>0) and (Result[DeletePos]=DecimalSeparator) Then + if (DeletePos>0) and (Result[DeletePos]=DefaultFormatSettings.DecimalSeparator) Then Dec(DeletePos); if (DeletePos0) and (Result[P] = '0') Do Dec(P); - If (P>0) and (Result[P]=DecimalSeparator) Then + If (P>0) and (Result[P]=DefaultFormatSettings.DecimalSeparator) Then Dec(P); SetLength(Result, P); end; diff --git a/lcl/maskedit.pp b/lcl/maskedit.pp index 19235ac729..3a8072fbd2 100644 --- a/lcl/maskedit.pp +++ b/lcl/maskedit.pp @@ -904,8 +904,8 @@ begin Char_AllFixedUpCase : OK := Ch in [#32..#126]; //True; Char_AllFixedDownCase : OK := Ch in [#32..#126]; //True; {Char_Space : OK := Ch in [' ', '_']; //not Delphi compatible, see notes above} - Char_HourSeparator : OK := Ch in [TimeSeparator]; - Char_DateSeparator : OK := Ch in [DateSeparator]; + Char_HourSeparator : OK := Ch in [DefaultFormatSettings.TimeSeparator]; + Char_DateSeparator : OK := Ch in [DefaultFormatSettings.DateSeparator]; else//it's a literal begin OK := (Ch = FMask[Position]); @@ -1003,8 +1003,8 @@ begin Char_AllFixedUpCase : Result := FSpaceChar; //'0'; Char_AllFixedDownCase : Result := FSpaceChar; //'0'; {Char_Space : Result := #32; //FSpaceChar?; //not Delphi compatible, see notes above} - Char_HourSeparator : Result := TimeSeparator; - Char_DateSeparator : Result := DateSeparator; + Char_HourSeparator : Result := DefaultFormatSettings.TimeSeparator; + Char_DateSeparator : Result := DefaultFormatSettings.DateSeparator; end; end; @@ -1091,8 +1091,8 @@ Begin Char_AllFixedUpCase : Result := Ch in [#32..#126]; //True; Char_AllFixedDownCase : Result := Ch in [#32..#126]; //True; {Char_Space : Result := Ch in [' ', '_']; //not Delphi compatible, see notes above} - Char_HourSeparator : Result := Ch in [TimeSeparator]; - Char_DateSeparator : Result := Ch in [DateSeparator]; + Char_HourSeparator : Result := Ch in [DefaultFormatSettings.TimeSeparator]; + Char_DateSeparator : Result := Ch in [DefaultFormatSettings.DateSeparator]; end; end;