mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 12:18:13 +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 SetVisible(const Value: Boolean); virtual;
|
||||||
procedure UpdateScrollBar; virtual;
|
procedure UpdateScrollBar; virtual;
|
||||||
procedure InvalidateScollInfo;
|
procedure InvalidateScollInfo;
|
||||||
|
{$ifdef VerboseScrollingWinControl}
|
||||||
|
function DebugCondition: Boolean;
|
||||||
|
{$endif}
|
||||||
public
|
public
|
||||||
constructor Create(AControl: TWinControl; AKind: TScrollBarKind);
|
constructor Create(AControl: TWinControl; AKind: TScrollBarKind);
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
|
@ -40,7 +40,7 @@ begin
|
|||||||
if Value > FAutoRange then
|
if Value > FAutoRange then
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$IFDEF VerboseScrollingWinControl}
|
||||||
if Kind=sbHorizontal then
|
if DebugCondition then
|
||||||
DebugLn(['TControlScrollBar.SetPosition FAutoRange Value=',Value,' > AutoRange=',FAutoRange]);
|
DebugLn(['TControlScrollBar.SetPosition FAutoRange Value=',Value,' > AutoRange=',FAutoRange]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SetPosition(FAutoRange);
|
SetPosition(FAutoRange);
|
||||||
@ -51,7 +51,7 @@ begin
|
|||||||
if Value > Range then
|
if Value > Range then
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$IFDEF VerboseScrollingWinControl}
|
||||||
if Kind = sbHorizontal then
|
if DebugCondition then
|
||||||
DebugLn(['TControlScrollBar.SetPosition Range Value=',Value,' > Range=',Range]);
|
DebugLn(['TControlScrollBar.SetPosition Range Value=',Value,' > Range=',Range]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SetPosition(Range);
|
SetPosition(Range);
|
||||||
@ -59,7 +59,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$IFDEF VerboseScrollingWinControl}
|
||||||
if Kind = sbHorizontal then
|
if DebugCondition then
|
||||||
DebugLn(['TControlScrollBar.SetPosition Value=',Value,' FPosition=',FPosition]);
|
DebugLn(['TControlScrollBar.SetPosition Value=',Value,' FPosition=',FPosition]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if Value = FPosition then
|
if Value = FPosition then
|
||||||
@ -76,7 +76,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
InvalidateScollInfo;
|
InvalidateScollInfo;
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$IFDEF VerboseScrollingWinControl}
|
||||||
if Kind = sbHorizontal then
|
if DebugCondition then
|
||||||
DebugLn(['TControlScrollBar.SetPosition FPosition=',FPosition]);
|
DebugLn(['TControlScrollBar.SetPosition FPosition=',FPosition]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
SetScrollPos(ControlHandle, IntfBarKind[Kind], FPosition, Visible);
|
SetScrollPos(ControlHandle, IntfBarKind[Kind], FPosition, Visible);
|
||||||
@ -195,7 +195,7 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
FRange := Value;
|
FRange := Value;
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$IFDEF VerboseScrollingWinControl}
|
||||||
if Kind = sbHorizontal then
|
if DebugCondition then
|
||||||
DebugLn(['TControlScrollBar.SetRange ',Self,' fRange=',FRange]);
|
DebugLn(['TControlScrollBar.SetRange ',Self,' fRange=',FRange]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
ControlUpdateScrollBars;
|
ControlUpdateScrollBars;
|
||||||
@ -292,14 +292,15 @@ begin
|
|||||||
SetScrollInfo(FControl.Handle, IntfBarKind[Kind], ScrollInfo, FVisible);
|
SetScrollInfo(FControl.Handle, IntfBarKind[Kind], ScrollInfo, FVisible);
|
||||||
end;
|
end;
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$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]);
|
DebugLn(['TControlScrollBar.UpdateScrollBar ',DbgSName(FControl),' ',DbgSName(Self),' FVisible=',FVisible,' Range=',FRange,' FPosition=',FPosition,' FPage=',FPage,' FAutoRange=',FAutoRange]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
SetPosition(FPosition);
|
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
|
// I am not positive that this is right, but it appeared to be when I
|
||||||
// compared results to Delphi 4
|
// compared results to Delphi 4
|
||||||
if FSmooth then
|
if FSmooth then
|
||||||
@ -312,6 +313,13 @@ begin
|
|||||||
FOldScrollInfoValid:=false;
|
FOldScrollInfoValid:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$ifdef VerboseScrollingWinControl}
|
||||||
|
function TControlScrollBar.DebugCondition: Boolean;
|
||||||
|
begin
|
||||||
|
Result := (Kind = sbHorizontal);
|
||||||
|
end;
|
||||||
|
{$endif}
|
||||||
|
|
||||||
function TControlScrollBar.ControlAutoScroll: boolean;
|
function TControlScrollBar.ControlAutoScroll: boolean;
|
||||||
begin
|
begin
|
||||||
if FControl is TScrollingWinControl then
|
if FControl is TScrollingWinControl then
|
||||||
@ -347,6 +355,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$IFDEF VerboseScrollingWinControl}
|
||||||
|
if DebugCondition then
|
||||||
DebugLn(['TControlScrollBar.ScrollHandler Message.ScrollCode=',Message.ScrollCode,' FPosition=',FPosition,' NewPos=',NewPos,' Range=',Range]);
|
DebugLn(['TControlScrollBar.ScrollHandler Message.ScrollCode=',Message.ScrollCode,' FPosition=',FPosition,' NewPos=',NewPos,' Range=',Range]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if NewPos < 0 then
|
if NewPos < 0 then
|
||||||
|
@ -93,12 +93,12 @@ function TScrollingWinControl.ComputeScrollbars: Boolean;
|
|||||||
SBSize := ClientHeight - SBSize
|
SBSize := ClientHeight - SBSize
|
||||||
else
|
else
|
||||||
SBSize := ClientWidth - SBSize;
|
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)
|
p_Bar.FAutoRange := (p_Bar.FRange - SBSize)
|
||||||
else
|
else
|
||||||
p_Bar.FAutoRange := 0;
|
p_Bar.FAutoRange := 0;
|
||||||
{$IFDEF VerboseScrollingWinControl}
|
{$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]);
|
DebugLn(['UpdateRange p_Bar.fRange=',p_Bar.fRange,' SBSize=',SBSize,' ClientWidth=',ClientWidth,' FAutoRange=',p_Bar.FAutoRange]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if OldAutoRange <> p_Bar.FAutoRange then
|
if OldAutoRange <> p_Bar.FAutoRange then
|
||||||
@ -131,12 +131,14 @@ begin
|
|||||||
Result := false;
|
Result := false;
|
||||||
// page
|
// page
|
||||||
NewPage := Max(1,Min(ClientWidth -1, High(HorzScrollbar.FPage)));
|
NewPage := Max(1,Min(ClientWidth -1, High(HorzScrollbar.FPage)));
|
||||||
if NewPage<>HorzScrollbar.FPage then begin
|
if NewPage <> HorzScrollbar.FPage then
|
||||||
|
begin
|
||||||
HorzScrollbar.FPage := NewPage;
|
HorzScrollbar.FPage := NewPage;
|
||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
NewPage := Max(1,Min(ClientHeight -1, High(VertScrollbar.FPage)));
|
NewPage := Max(1,Min(ClientHeight -1, High(VertScrollbar.FPage)));
|
||||||
if NewPage<>VertScrollbar.FPage then begin
|
if NewPage <> VertScrollbar.FPage then
|
||||||
|
begin
|
||||||
VertScrollbar.FPage := NewPage;
|
VertScrollbar.FPage := NewPage;
|
||||||
Result := true;
|
Result := true;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user