LCL: Formatting of TCustomMemo code. Remove useless setters.

git-svn-id: trunk@63744 -
This commit is contained in:
juha 2020-08-15 09:10:06 +00:00
parent 298d6ab8fb
commit b8d20c837f
2 changed files with 27 additions and 45 deletions

View File

@ -37,9 +37,9 @@ begin
inherited Destroy; inherited Destroy;
end; end;
procedure TCustomMemo.Append(const Value: String); procedure TCustomMemo.Append(const AValue: String);
begin begin
Lines.Add(Value); Lines.Add(AValue);
end; end;
procedure TCustomMemo.ScrollBy(DeltaX, DeltaY: Integer); procedure TCustomMemo.ScrollBy(DeltaX, DeltaY: Integer);
@ -47,24 +47,9 @@ begin
ScrollBy_WS(DeltaX, DeltaY); ScrollBy_WS(DeltaX, DeltaY);
end; end;
procedure TCustomMemo.SetHorzScrollBar(const AValue: TMemoScrollBar); procedure TCustomMemo.SetCaretPos(const AValue: TPoint);
begin begin
if FHorzScrollBar=AValue then exit; TWSCustomMemoClass(WidgetSetClass).SetCaretPos(Self, AValue);
FHorzScrollBar:=AValue;
end;
{------------------------------------------------------------------------------
Setter for CaretPos
------------------------------------------------------------------------------}
procedure TCustomMemo.SetCaretPos(const Value: TPoint);
begin
TWSCustomMemoClass(WidgetSetClass).SetCaretPos(Self, Value);
end;
procedure TCustomMemo.SetVertScrollBar(const AValue: TMemoScrollBar);
begin
if FVertScrollBar=AValue then exit;
FVertScrollBar:=AValue;
end; end;
procedure TCustomMemo.SetWantReturns(const AValue: Boolean); procedure TCustomMemo.SetWantReturns(const AValue: Boolean);
@ -168,12 +153,12 @@ begin
{$endif} {$endif}
end; end;
procedure TCustomMemo.RealSetText(const Value: TCaption); procedure TCustomMemo.RealSetText(const AValue: TCaption);
begin begin
{$ifdef DEBUG_MEMO} {$ifdef DEBUG_MEMO}
debugln('TCustomMemo.RealSetText "',Value,'"'); debugln('TCustomMemo.RealSetText "',AValue,'"');
{$endif} {$endif}
Lines.Text := Value; Lines.Text := AValue;
end; end;
function TCustomMemo.GetCachedText(var CachedText: TCaption): boolean; function TCustomMemo.GetCachedText(var CachedText: TCaption): boolean;
@ -200,25 +185,24 @@ begin
inherited; inherited;
end; end;
procedure TCustomMemo.SetLines(const Value: TStrings); procedure TCustomMemo.SetLines(const AValue: TStrings);
begin begin
if (Value <> nil) then if (AValue <> nil) then
FLines.Assign(Value); FLines.Assign(AValue);
end; end;
procedure TCustomMemo.SetScrollBars(const Value: TScrollStyle); procedure TCustomMemo.SetScrollBars(const AValue: TScrollStyle);
begin begin
if Value <> FScrollbars then begin if AValue <> FScrollbars then begin
FScrollbars:= Value; FScrollbars:= AValue;
if HandleAllocated and (not (csLoading in ComponentState)) then if HandleAllocated and (not (csLoading in ComponentState)) then
TWSCustomMemoClass(WidgetSetClass).SetScrollbars(Self, Value); TWSCustomMemoClass(WidgetSetClass).SetScrollbars(Self, AValue);
end; end;
end; end;
procedure TCustomMemo.Loaded; procedure TCustomMemo.Loaded;
begin begin
inherited Loaded; inherited Loaded;
if HandleAllocated then if HandleAllocated then
begin begin
TWSCustomMemoClass(WidgetSetClass).SetScrollbars(Self, FScrollbars); TWSCustomMemoClass(WidgetSetClass).SetScrollbars(Self, FScrollbars);
@ -280,16 +264,16 @@ begin
TWSCustomMemoClass(WidgetSetClass).SetWantTabs(Self, NewWantTabs); TWSCustomMemoClass(WidgetSetClass).SetWantTabs(Self, NewWantTabs);
end; end;
procedure TCustomMemo.SetWordWrap(const Value: boolean); procedure TCustomMemo.SetWordWrap(const AValue: boolean);
begin begin
if Value <> FWordWrap then if AValue <> FWordWrap then
begin begin
{$ifdef DEBUG_MEMO} {$ifdef DEBUG_MEMO}
DebugLn(['TCustomMemo.SetWordWrap ',Name,' Old=',FWordWrap,' New=',Value]); DebugLn(['TCustomMemo.SetWordWrap ',Name,' Old=',FWordWrap,' New=',AValue]);
{$endif} {$endif}
FWordWrap := Value; FWordWrap := AValue;
if HandleAllocated and (not (csLoading in ComponentState)) then if HandleAllocated and (not (csLoading in ComponentState)) then
TWSCustomMemoClass(WidgetSetClass).SetWordWrap(Self, Value); TWSCustomMemoClass(WidgetSetClass).SetWordWrap(Self, AValue);
end; end;
end; end;

View File

@ -898,24 +898,22 @@ type
FWantReturns: Boolean; FWantReturns: Boolean;
FWantTabs: boolean; FWantTabs: boolean;
FWordWrap: Boolean; FWordWrap: Boolean;
procedure SetHorzScrollBar(const AValue: TMemoScrollBar);
procedure SetVertScrollBar(const AValue: TMemoScrollBar);
protected protected
class procedure WSRegisterClass; override; class procedure WSRegisterClass; override;
procedure CreateParams(var Params: TCreateParams); override; procedure CreateParams(var Params: TCreateParams); override;
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure FinalizeWnd; override; procedure FinalizeWnd; override;
function RealGetText: TCaption; override; function RealGetText: TCaption; override;
procedure RealSetText(const Value: TCaption); override; procedure RealSetText(const AValue: TCaption); override;
function GetCachedText(var CachedText: TCaption): boolean; override; function GetCachedText(var CachedText: TCaption): boolean; override;
function GetCaretPos: TPoint; override; function GetCaretPos: TPoint; override;
procedure KeyUpAfterInterface(var Key: Word; Shift: TShiftState); override; procedure KeyUpAfterInterface(var Key: Word; Shift: TShiftState); override;
procedure SetCaretPos(const Value: TPoint); override; procedure SetCaretPos(const AValue: TPoint); override;
procedure SetLines(const Value: TStrings); procedure SetLines(const AValue: TStrings);
procedure SetWantReturns(const AValue: Boolean); procedure SetWantReturns(const AValue: Boolean);
procedure SetWantTabs(const NewWantTabs: boolean); procedure SetWantTabs(const NewWantTabs: boolean);
procedure SetWordWrap(const Value: boolean); procedure SetWordWrap(const AValue: boolean);
procedure SetScrollBars(const Value: TScrollStyle); procedure SetScrollBars(const AValue: TScrollStyle);
procedure Loaded; override; procedure Loaded; override;
procedure CMWantSpecialKey(var Message: TCMWantSpecialKey); message CM_WANTSPECIALKEY; procedure CMWantSpecialKey(var Message: TCMWantSpecialKey); message CM_WANTSPECIALKEY;
procedure WMGetDlgCode(var Message: TLMGetDlgCode); message LM_GETDLGCODE; procedure WMGetDlgCode(var Message: TLMGetDlgCode); message LM_GETDLGCODE;
@ -925,12 +923,12 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure Append(const Value: String); procedure Append(const AValue: String);
procedure ScrollBy(DeltaX, DeltaY: Integer); override; procedure ScrollBy(DeltaX, DeltaY: Integer); override;
public public
property Lines: TStrings read FLines write SetLines; property Lines: TStrings read FLines write SetLines;
property HorzScrollBar: TMemoScrollBar read FHorzScrollBar write SetHorzScrollBar; property HorzScrollBar: TMemoScrollBar read FHorzScrollBar write FHorzScrollBar;
property VertScrollBar: TMemoScrollBar read FVertScrollBar write SetVertScrollBar; property VertScrollBar: TMemoScrollBar read FVertScrollBar write FVertScrollBar;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssNone; property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssNone;
property WantReturns: Boolean read FWantReturns write SetWantReturns default true; property WantReturns: Boolean read FWantReturns write SetWantReturns default true;
property WantTabs: Boolean read FWantTabs write SetWantTabs default false; property WantTabs: Boolean read FWantTabs write SetWantTabs default false;