LazReport, fix reading barcode zoom values when decimal separator=',', issue #24393

git-svn-id: trunk@41070 -
This commit is contained in:
jesus 2013-05-08 06:57:43 +00:00
parent 4581bac94e
commit 49effd635f
2 changed files with 21 additions and 5 deletions

View File

@ -11634,7 +11634,6 @@ end;
function TfrObject.GetSaveProperty(const Prop: String; aObj : TPersistent=nil): string; function TfrObject.GetSaveProperty(const Prop: String; aObj : TPersistent=nil): string;
Var PropInfo : PPropInfo; Var PropInfo : PPropInfo;
Obj : TObject; Obj : TObject;
OldSep : char;
begin begin
Result:=''; Result:='';
@ -11657,10 +11656,9 @@ begin
end; end;
tkSet : Result:=GetSetProp(aObj,Prop); tkSet : Result:=GetSetProp(aObj,Prop);
tkFloat : begin tkFloat : begin
OldSep := DecimalSeparator; lrNormalizeLocaleFloats(True);
DecimalSeparator := '.';
Result := FloatToStr(GetFloatProp(aObj,Prop)); Result := FloatToStr(GetFloatProp(aObj,Prop));
DecimalSeparator := OldSep; lrNormalizeLocaleFloats(false);
end; end;
tkEnumeration : Result:=GetEnumProp(aObj,Prop); tkEnumeration : Result:=GetEnumProp(aObj,Prop);
tkClass : Begin tkClass : Begin
@ -11700,7 +11698,11 @@ begin
SetOrdProp(aObj,PropInfo,StrToInt(aValue)) SetOrdProp(aObj,PropInfo,StrToInt(aValue))
end; end;
tkSet : SetSetProp(aObj,Prop,aValue); tkSet : SetSetProp(aObj,Prop,aValue);
tkFloat : SetFloatProp(aObj,Prop,StrToFloat(aValue)); tkFloat : begin
lrNormalizeLocaleFloats(true);
SetFloatProp(aObj,Prop,StrToFloat(aValue));
lrNormalizeLocaleFloats(false);
end;
tkEnumeration : SetEnumProp(aObj,Prop,aValue); tkEnumeration : SetEnumProp(aObj,Prop,aValue);
tkClass : Begin tkClass : Begin
Obj:=GetObjectProp(aObj,Prop); Obj:=GetObjectProp(aObj,Prop);

View File

@ -67,6 +67,7 @@ function lrValidFieldReference(s: string):boolean;
function lrDateTimeToStr(ADate:TDateTime):string; function lrDateTimeToStr(ADate:TDateTime):string;
function lrStrToDateTime(AValue: string): TDateTime; function lrStrToDateTime(AValue: string): TDateTime;
function lrExpandVariables(const S:string):string; function lrExpandVariables(const S:string):string;
procedure lrNormalizeLocaleFloats(DisableLocale: boolean);
// utf8 tools // utf8 tools
function UTF8Desc(S:string; var Desc: string): Integer; function UTF8Desc(S:string; var Desc: string): Integer;
@ -82,6 +83,9 @@ implementation
uses LR_Class, LR_Const, LR_Pars; uses LR_Class, LR_Const, LR_Pars;
var
PreviousFormatSettings: TFormatSettings;
procedure frInitFont(aFont : TFont; aColor : TColor; aSize : Integer; aStyle : TFontStyles); procedure frInitFont(aFont : TFont; aColor : TColor; aSize : Integer; aStyle : TFontStyles);
begin begin
with aFont do with aFont do
@ -727,6 +731,16 @@ begin
Result:=Result + Copy(S, K, I-K); Result:=Result + Copy(S, K, I-K);
end; end;
procedure lrNormalizeLocaleFloats(DisableLocale: boolean);
begin
if DisableLocale then
begin
PreviousFormatSettings := DefaultFormatSettings;
DefaultFormatSettings.DecimalSeparator := '.';
end else
DefaultFormatSettings := PreviousFormatSettings;
end;
function UTF8Desc(S: string; var Desc: string): Integer; function UTF8Desc(S: string; var Desc: string): Integer;
var var
i,b: Integer; i,b: Integer;