mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:19:16 +02:00
reduced overhead in TWinControl.IsControlMouseMsg from Darek
git-svn-id: trunk@9164 -
This commit is contained in:
parent
baa2ccb6bc
commit
422e644e54
@ -915,6 +915,8 @@ type
|
|||||||
FAsyncCallQueue: PAsyncCallQueueItem;
|
FAsyncCallQueue: PAsyncCallQueueItem;
|
||||||
FShowHint: Boolean;
|
FShowHint: Boolean;
|
||||||
FShowMainForm: Boolean;
|
FShowMainForm: Boolean;
|
||||||
|
FLastMousePos : TPoint;
|
||||||
|
FLastMouseControl : tControl;
|
||||||
procedure DoOnIdleEnd;
|
procedure DoOnIdleEnd;
|
||||||
function GetCurrentHelpFile: string;
|
function GetCurrentHelpFile: string;
|
||||||
function GetExename: String;
|
function GetExename: String;
|
||||||
|
@ -407,9 +407,15 @@ var
|
|||||||
P: TPoint;
|
P: TPoint;
|
||||||
begin
|
begin
|
||||||
GetCursorPos(P);
|
GetCursorPos(P);
|
||||||
Result := FindControlAtPosition(P, True);
|
if (P.X=FLastMousePos.x) and (P.Y=FLastMousePos.Y) then Result:=FLastMouseControl
|
||||||
|
else Result := FindControlAtPosition(P, True);
|
||||||
|
|
||||||
if (Result <> nil) and (csDesigning in Result.ComponentState) then
|
if (Result <> nil) and (csDesigning in Result.ComponentState) then
|
||||||
Result := nil;
|
Result := nil;
|
||||||
|
if Result<> nil then begin
|
||||||
|
FLastMousePos:=p;
|
||||||
|
FLastMouseControl:=Result;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TApplication.SetNavigation(const AValue: TApplicationNavigationOptions
|
procedure TApplication.SetNavigation(const AValue: TApplicationNavigationOptions
|
||||||
|
@ -144,7 +144,7 @@ end;
|
|||||||
|
|
||||||
Procedure TCheckbox.WMKeyDown(var Message : TLMKeyDown);
|
Procedure TCheckbox.WMKeyDown(var Message : TLMKeyDown);
|
||||||
begin
|
begin
|
||||||
ControlState := ControlState - [csClicked];
|
Exclude(FControlState, csClicked);
|
||||||
Case Message.CharCode of
|
Case Message.CharCode of
|
||||||
32:
|
32:
|
||||||
begin
|
begin
|
||||||
|
@ -1805,7 +1805,7 @@ begin
|
|||||||
if csClicked in ControlState then
|
if csClicked in ControlState then
|
||||||
begin
|
begin
|
||||||
Exclude(FControlState, csClicked);
|
Exclude(FControlState, csClicked);
|
||||||
//DebugLn('TControl.WMLButtonUp B ',ClientRect.Left,',',ClientRect.Top,',',ClientRect.Right,',',ClientRect.Bottom,' ',Message.Pos.X,',',Message.Pos.Y);
|
//DebugLn('TControl.WMLButtonUp B ',dbgs(ClientRect.Left),',',dbgs(ClientRect.Top),',',dbgs(ClientRect.Right),',',dbgs(ClientRect.Bottom),' ',dbgs(Message.Pos.X),',',dbgs(Message.Pos.Y));
|
||||||
if PtInRect(ClientRect, SmallPointToPoint(Message.Pos))
|
if PtInRect(ClientRect, SmallPointToPoint(Message.Pos))
|
||||||
then begin
|
then begin
|
||||||
//DebugLn('TControl.WMLButtonUp C');
|
//DebugLn('TControl.WMLButtonUp C');
|
||||||
|
@ -230,7 +230,6 @@ begin
|
|||||||
AutoCalcVRange
|
AutoCalcVRange
|
||||||
else
|
else
|
||||||
AutoCalcHRange;
|
AutoCalcHRange;
|
||||||
ControlUpdateScrollBars;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -264,12 +263,13 @@ begin
|
|||||||
SBSize := OtherScrollbar.Size
|
SBSize := OtherScrollbar.Size
|
||||||
else
|
else
|
||||||
SBSize := 0;
|
SBSize := 0;
|
||||||
if Kind=sbVertical then
|
if Kind=sbVertical then begin
|
||||||
FAutoRange := (FRange - ClientHeight)
|
SBSize:=ClientHeight - SBSize;
|
||||||
*Shortint(FRange >= ClientHeight + SBSize)
|
end else begin
|
||||||
else
|
SBSize:=ClientWidth - SBSize;
|
||||||
FAutoRange := (FRange - ClientWidth)
|
end;
|
||||||
*Shortint(FRange >= ClientWidth + SBSize);
|
if (fRange>SBSize) and (SBSize>0) then FAutoRange := (FRange - SBSize)
|
||||||
|
else FAutoRange := 0;
|
||||||
ScrollInfo.nMax := FRange;
|
ScrollInfo.nMax := FRange;
|
||||||
|
|
||||||
// visible
|
// visible
|
||||||
|
@ -2797,6 +2797,7 @@ end;
|
|||||||
function TWinControl.IsControlMouseMsg(var TheMessage: TLMMouse) : Boolean;
|
function TWinControl.IsControlMouseMsg(var TheMessage: TLMMouse) : Boolean;
|
||||||
var
|
var
|
||||||
Control : TControl;
|
Control : TControl;
|
||||||
|
ScrolledOffset,
|
||||||
P : TPoint;
|
P : TPoint;
|
||||||
ClientBounds: TRect;
|
ClientBounds: TRect;
|
||||||
begin
|
begin
|
||||||
@ -2817,8 +2818,10 @@ begin
|
|||||||
if Control <> nil then
|
if Control <> nil then
|
||||||
begin
|
begin
|
||||||
// map mouse coordinates to control
|
// map mouse coordinates to control
|
||||||
P.X := TheMessage.XPos - Control.Left;
|
ScrolledOffset:=GetClientScrollOffset;
|
||||||
P.Y := TheMessage.YPos - Control.Top;
|
|
||||||
|
P.X := TheMessage.XPos - Control.Left + ScrolledOffset.X;
|
||||||
|
P.Y := TheMessage.YPos - Control.Top + ScrolledOffset.Y;
|
||||||
if (Control is TWinControl) and TWinControl(Control).HandleAllocated then
|
if (Control is TWinControl) and TWinControl(Control).HandleAllocated then
|
||||||
begin
|
begin
|
||||||
// map coordinates to client area of control
|
// map coordinates to client area of control
|
||||||
@ -2950,7 +2953,7 @@ var
|
|||||||
P: TPoint;
|
P: TPoint;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
//DebugLn('[TWinControl.PaintControls] ',Name,':',ClassName,' DC=',DbgS(DC,8));
|
//DebugLn('[TWinControl.PaintControls] ',Name,':',ClassName,' DC=',DbgS(DC,8));
|
||||||
if (csDestroying in ComponentState)
|
if (csDestroying in ComponentState)
|
||||||
or ((DC=0) and (not HandleAllocated)) then
|
or ((DC=0) and (not HandleAllocated)) then
|
||||||
exit;
|
exit;
|
||||||
|
@ -2199,14 +2199,6 @@ var
|
|||||||
Flags := 4;
|
Flags := 4;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if parser.TokenSymbolIs('OBJECT') then
|
|
||||||
Flags :=0 { IsInherited := False }
|
|
||||||
else if parser.TokenSymbolIs('INHERITED') then
|
|
||||||
Flags := 1 { IsInherited := True; }
|
|
||||||
else begin
|
|
||||||
parser.CheckTokenSymbol('INLINE');
|
|
||||||
Flags := 4;
|
|
||||||
end;
|
|
||||||
parser.NextToken;
|
parser.NextToken;
|
||||||
parser.CheckToken(toSymbol);
|
parser.CheckToken(toSymbol);
|
||||||
ObjectName := '';
|
ObjectName := '';
|
||||||
|
Loading…
Reference in New Issue
Block a user