mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 08:59:13 +02:00
reduced firing CHange events for TCustomImageList from Martin Smat
git-svn-id: trunk@7419 -
This commit is contained in:
parent
5b8b66dc98
commit
4bf1bb1b58
@ -67,7 +67,6 @@ begin
|
|||||||
try
|
try
|
||||||
Result := Count;
|
Result := Count;
|
||||||
Insert(Result, Image, Mask);
|
Insert(Result, Image, Mask);
|
||||||
Change;
|
|
||||||
except
|
except
|
||||||
on E: Exception do begin
|
on E: Exception do begin
|
||||||
DebugLn('TCustomImageList.Add ',E.Message);
|
DebugLn('TCustomImageList.Add ',E.Message);
|
||||||
@ -132,6 +131,7 @@ var
|
|||||||
NewMask: TBitmap;
|
NewMask: TBitmap;
|
||||||
begin
|
begin
|
||||||
if (Value = nil) or (Value=Self) then exit;
|
if (Value = nil) or (Value=Self) then exit;
|
||||||
|
BeginUpdate;
|
||||||
for n := 0 to Value.Count - 1 do begin
|
for n := 0 to Value.Count - 1 do begin
|
||||||
SrcImage:=TBitmap(Value.FImageList[n]);
|
SrcImage:=TBitmap(Value.FImageList[n]);
|
||||||
if SrcImage<>nil then begin
|
if SrcImage<>nil then begin
|
||||||
@ -146,7 +146,7 @@ begin
|
|||||||
AddDirect(NewImage,NewMask);
|
AddDirect(NewImage,NewMask);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Change;
|
EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -163,7 +163,6 @@ begin
|
|||||||
try
|
try
|
||||||
Result := Count;
|
Result := Count;
|
||||||
InsertMasked(Result, Image, MaskColor);
|
InsertMasked(Result, Image, MaskColor);
|
||||||
Change;
|
|
||||||
except
|
except
|
||||||
on E: Exception do begin
|
on E: Exception do begin
|
||||||
DebugLn('TCustomImageList.AddMasked ',E.Message);
|
DebugLn('TCustomImageList.AddMasked ',E.Message);
|
||||||
@ -276,10 +275,10 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure TCustomImageList.Change;
|
procedure TCustomImageList.Change;
|
||||||
begin
|
begin
|
||||||
FChanged := true;
|
if (not FChanged) or (FUpdateCount > 0) then exit;
|
||||||
if FUpdateCount > 0 then exit;
|
|
||||||
NotifyChangeLink;
|
NotifyChangeLink;
|
||||||
if Assigned(FOnChange) then FOnChange(Self);
|
if Assigned(FOnChange) then FOnChange(Self);
|
||||||
|
FChanged := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -389,6 +388,7 @@ begin
|
|||||||
// ShiftImages(FBitmap.Canvas, Index, 1);
|
// ShiftImages(FBitmap.Canvas, Index, 1);
|
||||||
// ShiftImages(FMaskBitmap.Canvas, Index, 1);
|
// ShiftImages(FMaskBitmap.Canvas, Index, 1);
|
||||||
FCount := fImageList.Count;
|
FCount := fImageList.Count;
|
||||||
|
FChanged := true;
|
||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -450,10 +450,7 @@ begin
|
|||||||
if FUpdateCount<=0 then
|
if FUpdateCount<=0 then
|
||||||
RaiseGDBException('');
|
RaiseGDBException('');
|
||||||
dec(FUpdateCount);
|
dec(FUpdateCount);
|
||||||
if FChanged then begin
|
Change;
|
||||||
FChanged := False;
|
|
||||||
Change;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -616,6 +613,7 @@ begin
|
|||||||
FImageList.Insert(Index,Image);
|
FImageList.Insert(Index,Image);
|
||||||
FMaskList.Insert(Index,Mask);
|
FMaskList.Insert(Index,Mask);
|
||||||
FCount := FImageList.Count;
|
FCount := FImageList.Count;
|
||||||
|
FChanged := true;
|
||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -663,7 +661,6 @@ begin
|
|||||||
Mask(MaskColor);
|
Mask(MaskColor);
|
||||||
end;
|
end;
|
||||||
Insert(Index, Image, Mask);
|
Insert(Index, Image, Mask);
|
||||||
Change;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -679,6 +676,7 @@ begin
|
|||||||
if CurIndex <> NewIndex then begin
|
if CurIndex <> NewIndex then begin
|
||||||
FImageList.Move(CurIndex,NewIndex);
|
FImageList.Move(CurIndex,NewIndex);
|
||||||
FMaskList.Move(CurIndex,NewIndex);
|
FMaskList.Move(CurIndex,NewIndex);
|
||||||
|
FChanged := true;
|
||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1004,6 +1002,7 @@ begin
|
|||||||
then CopyImage(FMaskBitmap.Canvas, Mask.Canvas, DestinationRect, SourceRect)
|
then CopyImage(FMaskBitmap.Canvas, Mask.Canvas, DestinationRect, SourceRect)
|
||||||
else FMaskBitmap.Canvas.FillRect(DestinationRect);
|
else FMaskBitmap.Canvas.FillRect(DestinationRect);
|
||||||
|
|
||||||
|
FChanged := true;
|
||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1056,6 +1055,7 @@ begin
|
|||||||
if FBkColor <> Value
|
if FBkColor <> Value
|
||||||
then begin
|
then begin
|
||||||
FBkColor := Value;
|
FBkColor := Value;
|
||||||
|
FChanged := true;
|
||||||
Change;
|
Change;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1189,6 +1189,9 @@ end;
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.45 2005/07/25 09:15:03 mattias
|
||||||
|
reduced firing CHange events for TCustomImageList from Martin Smat
|
||||||
|
|
||||||
Revision 1.44 2005/07/24 10:56:27 mattias
|
Revision 1.44 2005/07/24 10:56:27 mattias
|
||||||
removed unneeded TCustomImageList.GetCount
|
removed unneeded TCustomImageList.GetCount
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user