mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 05:19:22 +02:00
* Changed typing fixes to casting
git-svn-id: trunk@6193 -
This commit is contained in:
parent
328ff73c91
commit
ccbcdd833d
@ -27,13 +27,8 @@ type
|
||||
end;
|
||||
PLogFontAndName = ^TLogFontAndName;
|
||||
|
||||
function CompareLogFontAndNameWithResDesc(AKey, ADesc: Pointer): integer;
|
||||
var
|
||||
Key: PLogFontAndName;
|
||||
Desc: TFontHandleCacheDescriptor;
|
||||
function CompareLogFontAndNameWithResDesc(Key: PLogFontAndName; Desc: TFontHandleCacheDescriptor): integer;
|
||||
begin
|
||||
Key := PLogFontAndName(AKey);
|
||||
Desc := TFontHandleCacheDescriptor(ADesc);
|
||||
Result:=CompareStr(Key^.LongFontName,Desc.LongFontName);
|
||||
//writeln('CompareLogFontAndNameWithResDesc A ',Key^.LongFontName,' ',Desc.LongFontName,' ',HexStr(Cardinal(Desc),8),' Result=',Result);
|
||||
if Result=0 then
|
||||
@ -71,7 +66,7 @@ function TFontHandleCache.FindFont(TheFont: HFONT): TResourceCacheItem;
|
||||
var
|
||||
ANode: TAvgLvlTreeNode;
|
||||
begin
|
||||
ANode:=FItems.FindKey(@THandle(TheFont),@ComparePHandleWithResourceCacheItem);
|
||||
ANode:=FItems.FindKey(@THandle(TheFont), TListSortCompare(@ComparePHandleWithResourceCacheItem));
|
||||
if ANode<>nil then
|
||||
Result:=TResourceCacheItem(ANode.Data)
|
||||
else
|
||||
@ -87,7 +82,7 @@ begin
|
||||
LogFontAndName.LogFont:=LogFont;
|
||||
LogFontAndName.LongFontName:=LongFontName;
|
||||
ANode:=FDescriptors.Findkey(@LogFontAndName,
|
||||
@CompareLogFontAndNameWithResDesc);
|
||||
TListSortCompare(@CompareLogFontAndNameWithResDesc));
|
||||
if ANode<>nil then
|
||||
Result:=TFontHandleCacheDescriptor(ANode.Data)
|
||||
else
|
||||
@ -954,6 +949,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.18 2004/11/04 00:52:23 marc
|
||||
* Changed typing fixes to casting
|
||||
|
||||
Revision 1.17 2004/11/03 22:13:48 marc
|
||||
* Fixed fpc stronger typing
|
||||
|
||||
|
@ -21,21 +21,18 @@
|
||||
|
||||
{$IFNDEF OldToolBar}
|
||||
|
||||
function CompareToolBarControl(AControl1, AControl2: Pointer): integer;
|
||||
function CompareToolBarControl(Control1, Control2: TControl): integer;
|
||||
var
|
||||
ToolBar: TToolBar;
|
||||
Row1: Integer;
|
||||
Row2: Integer;
|
||||
BtnHeight: Integer;
|
||||
Control1, Control2: TControl;
|
||||
begin
|
||||
Result:=0;
|
||||
Control1 := TControl(AControl1);
|
||||
if not (Control1.Parent is TToolBar) then Exit;
|
||||
|
||||
ToolBar := TToolBar(Control1.Parent);
|
||||
BtnHeight := ToolBar.FRealizedButtonHeight;
|
||||
Control2 := TControl(AControl2);
|
||||
|
||||
Row1:=(Control1.Top+(BtnHeight div 2)) div ToolBar.FRealizedButtonHeight;
|
||||
Row2:=(Control2.Top+(BtnHeight div 2)) div ToolBar.FRealizedButtonHeight;
|
||||
@ -526,7 +523,7 @@ begin
|
||||
end;
|
||||
// sort OrderedControls
|
||||
if FRealizedButtonHeight=0 then FRealizedButtonHeight:=FButtonHeight;
|
||||
OrderedControls.Sort(@CompareToolBarControl);
|
||||
OrderedControls.Sort(TListSortCompare(@CompareToolBarControl));
|
||||
|
||||
// position OrderedControls
|
||||
ARect:=ClientRect;
|
||||
@ -2088,6 +2085,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.33 2004/11/04 00:52:23 marc
|
||||
* Changed typing fixes to casting
|
||||
|
||||
Revision 1.32 2004/11/03 22:13:48 marc
|
||||
* Fixed fpc stronger typing
|
||||
|
||||
|
@ -112,10 +112,9 @@ end;
|
||||
|
||||
{ TGdkFontCache }
|
||||
|
||||
function CompareGdkFontWithResItem(Font, Item: Pointer): integer;
|
||||
// Font = PGDKFont
|
||||
function CompareGdkFontWithResItem(Font: PGDKFont; Item: TGdkFontCacheItem): integer;
|
||||
begin
|
||||
Result := ComparePointers(Font, TGdkFontCacheItem(Item).GdkFont);
|
||||
Result := ComparePointers(Font, Item.GdkFont);
|
||||
end;
|
||||
|
||||
function CompareLogFontAndNameWithResDesc(AKey, ADesc: Pointer): integer;
|
||||
@ -171,7 +170,7 @@ function TGdkFontCache.FindGDKFont(TheGdkFont: PGDKFont): TGdkFontCacheItem;
|
||||
var
|
||||
ANode: TAvgLvlTreeNode;
|
||||
begin
|
||||
ANode:=FItems.Findkey(TheGdkFont,@CompareGdkFontWithResItem);
|
||||
ANode:=FItems.Findkey(TheGdkFont,TListSortCompare(@CompareGdkFontWithResItem));
|
||||
if ANode<>nil then
|
||||
Result:=TGdkFontCacheItem(ANode.Data)
|
||||
else
|
||||
|
@ -2236,17 +2236,14 @@ type
|
||||
end;
|
||||
PLazAVLPaletteEntry = ^TLazAVLPaletteEntry;
|
||||
|
||||
function CompareLazAVLPaletteEntries(Entry1, Entry2: Pointer): integer;
|
||||
function CompareLazAVLPaletteEntries(Entry1, Entry2: PLazAVLPaletteEntry): integer;
|
||||
begin
|
||||
with PLazAVLPaletteEntry(Entry1)^ do
|
||||
Result := Palette.CompareEntries(Index,
|
||||
PLazAVLPaletteEntry(Entry2)^.Index);
|
||||
Result := Entry1^.Palette.CompareEntries(Entry1^.Index, Entry2^.Index);
|
||||
end;
|
||||
|
||||
function ComparePFPColorAndLazAVLPalEntry(PColor, Entry: Pointer): integer;
|
||||
function ComparePFPColorAndLazAVLPalEntry(PColor: PFPColor; Entry: PLazAVLPaletteEntry): integer;
|
||||
begin
|
||||
with PLazAVLPaletteEntry(Entry)^ do
|
||||
Result := Palette.CompareColorWithEntries(PFPColor(PColor)^, Index);
|
||||
Result := Entry^.Palette.CompareColorWithEntries(PColor^, Entry^.Index);
|
||||
end;
|
||||
|
||||
procedure TLazAVLPalette.SetCount(NewCount: integer);
|
||||
@ -2270,7 +2267,7 @@ begin
|
||||
inherited SetCount(NewCount);
|
||||
// create tree if not already done
|
||||
if (FAVLPalette=nil) and (FCount>0) then
|
||||
FAVLPalette:=TAvgLvlTree.Create(@CompareLazAVLPaletteEntries);
|
||||
FAVLPalette:=TAvgLvlTree.Create(TListSortCompare(@CompareLazAVLPaletteEntries));
|
||||
if FAVLPalette=nil then exit;
|
||||
// add new colors to 'color to index' tree and 'index to node' array
|
||||
while FAVLPalette.Count<FCount do begin
|
||||
@ -2316,7 +2313,7 @@ var
|
||||
Node: TAvgLvlTreeNode;
|
||||
begin
|
||||
if FAVLPalette<>nil then
|
||||
Node:=FAVLPalette.FindKey(@AColor,@ComparePFPColorAndLazAVLPalEntry)
|
||||
Node:=FAVLPalette.FindKey(@AColor,TListSortCompare(@ComparePFPColorAndLazAVLPalEntry))
|
||||
else
|
||||
Node:=nil;
|
||||
if Node<>nil then
|
||||
|
@ -139,24 +139,25 @@ type
|
||||
read FOnCompareDescPtrWithDescriptor;
|
||||
end;
|
||||
|
||||
function ComparePHandleWithResourceCacheItem(HandlePtr, Item: Pointer): integer;
|
||||
function CompareDescPtrWithBlockResDesc(ADescPtr, AItem: Pointer): integer;
|
||||
function ComparePHandleWithResourceCacheItem(HandlePtr: PHandle; Item:
|
||||
TResourceCacheItem): integer;
|
||||
function CompareDescPtrWithBlockResDesc(DescPtr: Pointer;
|
||||
Item: TBlockResourceCacheDescriptor): integer;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
function ComparePHandleWithResourceCacheItem(HandlePtr, Item: Pointer): integer;
|
||||
function ComparePHandleWithResourceCacheItem(HandlePtr: PHandle; Item:
|
||||
TResourceCacheItem): integer;
|
||||
begin
|
||||
Result := CompareHandles(PHandle(HandlePtr)^, TResourceCacheItem(Item).Handle);
|
||||
Result := CompareHandles(HandlePtr^, Item.Handle);
|
||||
end;
|
||||
|
||||
function CompareDescPtrWithBlockResDesc(ADescPtr, AItem: Pointer): integer;
|
||||
var
|
||||
Item: TBlockResourceCacheDescriptor;
|
||||
function CompareDescPtrWithBlockResDesc(DescPtr: Pointer;
|
||||
Item: TBlockResourceCacheDescriptor): integer;
|
||||
begin
|
||||
Item := TBlockResourceCacheDescriptor(AItem);
|
||||
Result := CompareMemRange(ADescPtr, Item.Data,
|
||||
Result := CompareMemRange(DescPtr, Item.Data,
|
||||
TBlockResourceCache(Item.Cache).DataSize);
|
||||
end;
|
||||
|
||||
@ -358,7 +359,7 @@ function THandleResourceCache.FindItem(Handle: THandle): TResourceCacheItem;
|
||||
var
|
||||
ANode: TAvgLvlTreeNode;
|
||||
begin
|
||||
ANode:=FItems.FindKey(@Handle,@ComparePHandleWithResourceCacheItem);
|
||||
ANode:=FItems.FindKey(@Handle,TListSortCompare(@ComparePHandleWithResourceCacheItem));
|
||||
if ANode<>nil then
|
||||
Result:=TResourceCacheItem(ANode.Data)
|
||||
else
|
||||
@ -372,7 +373,7 @@ begin
|
||||
inherited Create;
|
||||
FDataSize:=TheDataSize;
|
||||
FResourceCacheDescriptorClass:=TBlockResourceCacheDescriptor;
|
||||
FOnCompareDescPtrWithDescriptor:=@CompareDescPtrWithBlockResDesc;
|
||||
FOnCompareDescPtrWithDescriptor:=TListSortCompare(@CompareDescPtrWithBlockResDesc);
|
||||
end;
|
||||
|
||||
function TBlockResourceCache.FindDescriptor(DescPtr: Pointer
|
||||
|
Loading…
Reference in New Issue
Block a user