richmemo: cleanup warnings

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6525 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2018-06-25 02:11:10 +00:00
parent c6b5ea4fa8
commit b66e16bb76
2 changed files with 17 additions and 9 deletions

View File

@ -340,7 +340,7 @@ type
property ZoomFactor; property ZoomFactor;
end; end;
procedure InitFontParams(var p: TFontParams); procedure InitFontParams(out p: TFontParams);
function GetFontParams(styles: TFontStyles): TFontParams; overload; function GetFontParams(styles: TFontStyles): TFontParams; overload;
function GetFontParams(color: TColor; styles: TFontStyles): TFontParams; overload; function GetFontParams(color: TColor; styles: TFontStyles): TFontParams; overload;
function GetFontParams(const Name: String; color: TColor; styles: TFontStyles): TFontParams; overload; function GetFontParams(const Name: String; color: TColor; styles: TFontStyles): TFontParams; overload;
@ -366,7 +366,7 @@ implementation
uses uses
{%H-}RichMemoFactory, WSRichMemo; {%H-}RichMemoFactory, WSRichMemo;
procedure InitFontParams(var p: TFontParams); procedure InitFontParams(out p: TFontParams);
begin begin
FillChar(p, SizeOf(p), 0); FillChar(p, SizeOf(p), 0);
end; end;
@ -835,7 +835,9 @@ function TCustomRichMemo.CanPaste: Boolean;
begin begin
if not HandleAllocated then HandleNeeded; if not HandleAllocated then HandleNeeded;
if HandleAllocated then if HandleAllocated then
Result:=TWSCustomRichMemoClass(WidgetSetClass).CanPasteFromClipboard(Self); Result:=TWSCustomRichMemoClass(WidgetSetClass).CanPasteFromClipboard(Self)
else
Result:=false;
end; end;
procedure TCustomRichMemo.SetRangeColor(TextStart, TextLength: Integer; FontColor: TColor); procedure TCustomRichMemo.SetRangeColor(TextStart, TextLength: Integer; FontColor: TColor);
@ -1035,7 +1037,7 @@ begin
if not HandleAllocated then HandleNeeded; if not HandleAllocated then HandleNeeded;
if HandleAllocated and not TWSCustomRichMemoClass(WidgetSetClass).GetSubText(Self, TextStart, TextLength, false, isu, txt, utxt) then if HandleAllocated and not TWSCustomRichMemoClass(WidgetSetClass).GetSubText(Self, TextStart, TextLength, false, isu, txt, utxt) then
Exit; Exit;
if isu then Result:=UTF8Decode(utxt) if isu then Result:=UTF8Encode(utxt)
else Result:=txt; else Result:=txt;
end; end;
@ -1050,7 +1052,7 @@ begin
if HandleAllocated and not TWSCustomRichMemoClass(WidgetSetClass).GetSubText(Self, TextStart, TextLength, false, isu, txt, utxt) then if HandleAllocated and not TWSCustomRichMemoClass(WidgetSetClass).GetSubText(Self, TextStart, TextLength, false, isu, txt, utxt) then
Exit; Exit;
if isu then Result:=utxt if isu then Result:=utxt
else Result:=UTF8Encode(txt); else Result:=UTF8Decode(txt);
end; end;
procedure TCustomRichMemo.SetSelLengthFor(const aselstr: string); procedure TCustomRichMemo.SetSelLengthFor(const aselstr: string);
@ -1072,6 +1074,7 @@ function TCustomRichMemo.Search(const ANiddle: string; Start, Len: Integer; cons
var var
so : TIntSearchOpt; so : TIntSearchOpt;
begin begin
Result:=false;
if not HandleAllocated then HandleNeeded; if not HandleAllocated then HandleNeeded;
if HandleAllocated then begin if HandleAllocated then begin
so.len:=Len; so.len:=Len;
@ -1126,6 +1129,7 @@ begin
if HandleAllocated then begin if HandleAllocated then begin
est.Pages:=TWSCustomRichMemoClass(WidgetSetClass).Print(Self, Printer, params, false); est.Pages:=TWSCustomRichMemoClass(WidgetSetClass).Print(Self, Printer, params, false);
Result:=true;
end else end else
Result:=false; Result:=false;
end; end;

View File

@ -209,11 +209,13 @@ function TRichEditParaAttributes.GetTab(Index: Byte): Integer;
var var
m : TCustomRichMemo; m : TCustomRichMemo;
stop : TTabStopList; stop : TTabStopList;
idx : integer;
begin begin
idx:=Index;
m:=TCustomRichMemo(TObject(Self)); m:=TCustomRichMemo(TObject(Self));
m.GetParaTabs(m.SelStart, stop); m.GetParaTabs(m.SelStart, stop);
if (Index<0) or (Index>=stop.Count) then Result:=0 if (idx<0) or (idx>=stop.Count) then Result:=0
else Result:=round(stop.Tabs[Index].Offset); else Result:=round(stop.Tabs[idx].Offset);
end; end;
function TRichEditParaAttributes.GetTabCount: Integer; function TRichEditParaAttributes.GetTabCount: Integer;
@ -263,13 +265,15 @@ procedure TRichEditParaAttributes.SetTab(Index: Byte; AValue: Integer);
var var
m : TCustomRichMemo; m : TCustomRichMemo;
stop : TTabStopList; stop : TTabStopList;
idx : integer;
begin begin
idx:=Index;
m:=TCustomRichMemo(TObject(Self)); m:=TCustomRichMemo(TObject(Self));
m.GetParaTabs(m.SelStart, stop); m.GetParaTabs(m.SelStart, stop);
if (Index<0) or (Index>=stop.Count) then if (idx<0) or (idx>=stop.Count) then
Exit Exit
else begin else begin
stop.Tabs[index].Offset:=AValue; stop.Tabs[idx].Offset:=AValue;
m.SetParaTabs(m.SelStart, m.SelLength, stop); m.SetParaTabs(m.SelStart, m.SelLength, stop);
end; end;
end; end;