mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 07:38:14 +02:00
lcl: move VerboseScrollingWinControl debug condition to separate method (to simplify condition change)
git-svn-id: trunk@12328 -
This commit is contained in:
parent
81d81a6040
commit
852f93d82f
@ -117,6 +117,9 @@ type
|
||||
procedure SetVisible(const Value: Boolean); virtual;
|
||||
procedure UpdateScrollBar; virtual;
|
||||
procedure InvalidateScollInfo;
|
||||
{$ifdef VerboseScrollingWinControl}
|
||||
function DebugCondition: Boolean;
|
||||
{$endif}
|
||||
public
|
||||
constructor Create(AControl: TWinControl; AKind: TScrollBarKind);
|
||||
procedure Assign(Source: TPersistent); override;
|
||||
|
@ -40,7 +40,7 @@ begin
|
||||
if Value > FAutoRange then
|
||||
begin
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if Kind=sbHorizontal then
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.SetPosition FAutoRange Value=',Value,' > AutoRange=',FAutoRange]);
|
||||
{$ENDIF}
|
||||
SetPosition(FAutoRange);
|
||||
@ -51,7 +51,7 @@ begin
|
||||
if Value > Range then
|
||||
begin
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if Kind = sbHorizontal then
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.SetPosition Range Value=',Value,' > Range=',Range]);
|
||||
{$ENDIF}
|
||||
SetPosition(Range);
|
||||
@ -59,7 +59,7 @@ begin
|
||||
end;
|
||||
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if Kind = sbHorizontal then
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.SetPosition Value=',Value,' FPosition=',FPosition]);
|
||||
{$ENDIF}
|
||||
if Value = FPosition then
|
||||
@ -76,7 +76,7 @@ begin
|
||||
begin
|
||||
InvalidateScollInfo;
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if Kind = sbHorizontal then
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.SetPosition FPosition=',FPosition]);
|
||||
{$ENDIF}
|
||||
SetScrollPos(ControlHandle, IntfBarKind[Kind], FPosition, Visible);
|
||||
@ -195,7 +195,7 @@ begin
|
||||
exit;
|
||||
FRange := Value;
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if Kind = sbHorizontal then
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.SetRange ',Self,' fRange=',FRange]);
|
||||
{$ENDIF}
|
||||
ControlUpdateScrollBars;
|
||||
@ -292,14 +292,15 @@ begin
|
||||
SetScrollInfo(FControl.Handle, IntfBarKind[Kind], ScrollInfo, FVisible);
|
||||
end;
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if Kind = sbHorizontal then
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.UpdateScrollBar ',DbgSName(FControl),' ',DbgSName(Self),' FVisible=',FVisible,' Range=',FRange,' FPosition=',FPosition,' FPage=',FPage,' FAutoRange=',FAutoRange]);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
SetPosition(FPosition);
|
||||
|
||||
if FControl is TScrollingWinControl then begin
|
||||
if FControl is TScrollingWinControl then
|
||||
begin
|
||||
// I am not positive that this is right, but it appeared to be when I
|
||||
// compared results to Delphi 4
|
||||
if FSmooth then
|
||||
@ -312,6 +313,13 @@ begin
|
||||
FOldScrollInfoValid:=false;
|
||||
end;
|
||||
|
||||
{$ifdef VerboseScrollingWinControl}
|
||||
function TControlScrollBar.DebugCondition: Boolean;
|
||||
begin
|
||||
Result := (Kind = sbHorizontal);
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function TControlScrollBar.ControlAutoScroll: boolean;
|
||||
begin
|
||||
if FControl is TScrollingWinControl then
|
||||
@ -347,7 +355,8 @@ begin
|
||||
Exit;
|
||||
end;
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
DebugLn(['TControlScrollBar.ScrollHandler Message.ScrollCode=',Message.ScrollCode,' FPosition=',FPosition,' NewPos=',NewPos,' Range=',Range]);
|
||||
if DebugCondition then
|
||||
DebugLn(['TControlScrollBar.ScrollHandler Message.ScrollCode=',Message.ScrollCode,' FPosition=',FPosition,' NewPos=',NewPos,' Range=',Range]);
|
||||
{$ENDIF}
|
||||
if NewPos < 0 then
|
||||
NewPos := 0;
|
||||
|
@ -82,7 +82,7 @@ function TScrollingWinControl.ComputeScrollbars: Boolean;
|
||||
OtherScrollbar: TControlScrollBar;
|
||||
OldAutoRange: LongInt;
|
||||
begin
|
||||
OldAutoRange:=p_Bar.FAutoRange;
|
||||
OldAutoRange := p_Bar.FAutoRange;
|
||||
p_Bar.FAutoRange := 0;
|
||||
OtherScrollbar := p_Bar.GetOtherScrollBar;
|
||||
if OtherScrollbar.FVisible then
|
||||
@ -93,16 +93,16 @@ function TScrollingWinControl.ComputeScrollbars: Boolean;
|
||||
SBSize := ClientHeight - SBSize
|
||||
else
|
||||
SBSize := ClientWidth - SBSize;
|
||||
if (p_Bar.fRange>SBSize) and (SBSize>0) then
|
||||
if (p_Bar.FRange > SBSize) and (SBSize>0) then
|
||||
p_Bar.FAutoRange := (p_Bar.FRange - SBSize)
|
||||
else
|
||||
p_Bar.FAutoRange := 0;
|
||||
{$IFDEF VerboseScrollingWinControl}
|
||||
if p_Bar.Kind = sbHorizontal then
|
||||
if p_Bar.DebugCondition then
|
||||
DebugLn(['UpdateRange p_Bar.fRange=',p_Bar.fRange,' SBSize=',SBSize,' ClientWidth=',ClientWidth,' FAutoRange=',p_Bar.FAutoRange]);
|
||||
{$ENDIF}
|
||||
if OldAutoRange<>p_Bar.FAutoRange then
|
||||
Result:=true;
|
||||
if OldAutoRange <> p_Bar.FAutoRange then
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
procedure UpdateVisible(p_Bar: TControlScrollBar);
|
||||
@ -121,24 +121,26 @@ function TScrollingWinControl.ComputeScrollbars: Boolean;
|
||||
p_Bar.FVisible := True
|
||||
else
|
||||
p_Bar.FVisible := False;
|
||||
if OldVisible<>p_Bar.FVisible then
|
||||
Result:=true;
|
||||
if OldVisible <> p_Bar.FVisible then
|
||||
Result := true;
|
||||
end;
|
||||
|
||||
var
|
||||
NewPage: Integer;
|
||||
begin
|
||||
Result:=false;
|
||||
Result := false;
|
||||
// page
|
||||
NewPage:=Max(1,Min(ClientWidth -1, High(HorzScrollbar.FPage)));
|
||||
if NewPage<>HorzScrollbar.FPage then begin
|
||||
NewPage := Max(1,Min(ClientWidth -1, High(HorzScrollbar.FPage)));
|
||||
if NewPage <> HorzScrollbar.FPage then
|
||||
begin
|
||||
HorzScrollbar.FPage := NewPage;
|
||||
Result:=true;
|
||||
Result := true;
|
||||
end;
|
||||
NewPage := Max(1,Min(ClientHeight -1, High(VertScrollbar.FPage)));
|
||||
if NewPage<>VertScrollbar.FPage then begin
|
||||
if NewPage <> VertScrollbar.FPage then
|
||||
begin
|
||||
VertScrollbar.FPage := NewPage;
|
||||
Result:=true;
|
||||
Result := true;
|
||||
end;
|
||||
// range
|
||||
UpdateRange(HorzScrollbar);
|
||||
|
Loading…
Reference in New Issue
Block a user