mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-10 14:08:14 +02:00
ide: allow other types than XPM as component images
git-svn-id: trunk@12947 -
This commit is contained in:
parent
dd774d76b7
commit
1b68ef3e5c
@ -373,47 +373,28 @@ begin
|
||||
if OnComponentIsInvisible=@CheckComponentDesignerVisible then
|
||||
OnComponentIsInvisible:=nil;
|
||||
NoteBook:=nil;
|
||||
fComponents.Free;
|
||||
fComponents:=nil;
|
||||
if fUnregisteredIcon<>nil then begin
|
||||
fUnregisteredIcon.Free;
|
||||
fUnregisteredIcon:=nil;
|
||||
end;
|
||||
if fSelectButtonIcon<>nil then begin
|
||||
fSelectButtonIcon.Free;
|
||||
fSelectButtonIcon:=nil;
|
||||
end;
|
||||
PopupMenu.Free;
|
||||
PopupMenu:=nil;
|
||||
FreeAndNil(fComponents);
|
||||
FreeAndNil(fUnregisteredIcon);
|
||||
FreeAndNil(fSelectButtonIcon);
|
||||
FreeAndNil(PopupMenu);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
function TComponentPalette.GetUnregisteredIcon: TBitMap;
|
||||
var
|
||||
ResName: string;
|
||||
res: TLResource;
|
||||
begin
|
||||
if fUnregisteredIcon=nil then begin
|
||||
fUnregisteredIcon:=TPixmap.Create;
|
||||
fUnregisteredIcon.TransparentColor:=clWhite;
|
||||
ResName:='unregisteredcomponent';
|
||||
res:=LazarusResources.Find(ResName);
|
||||
if (res<>nil) and (res.Value<>'') and (res.ValueType='XPM') then begin
|
||||
fUnregisteredIcon.LoadFromLazarusResource(ResName);
|
||||
end else begin
|
||||
fUnregisteredIcon.LoadFromLazarusResource('default');
|
||||
end;
|
||||
if fUnregisteredIcon = nil then
|
||||
begin
|
||||
fUnregisteredIcon := LoadBitmapFromLazarusResource('unregisteredcomponent');
|
||||
if fUnregisteredIcon = nil then
|
||||
fUnregisteredIcon := LoadBitmapFromLazarusResource('default');
|
||||
end;
|
||||
Result:=fUnregisteredIcon;
|
||||
Result := fUnregisteredIcon;
|
||||
end;
|
||||
|
||||
function TComponentPalette.GetSelectButtonIcon: TBitmap;
|
||||
begin
|
||||
if fSelectButtonIcon=nil then begin
|
||||
fSelectButtonIcon:=TPixmap.Create;
|
||||
fSelectButtonIcon.TransparentColor:=clWhite;
|
||||
fSelectButtonIcon.LoadFromLazarusResource('tmouse');
|
||||
end;
|
||||
if fSelectButtonIcon=nil then
|
||||
fSelectButtonIcon := LoadBitmapFromLazarusResource('tmouse');
|
||||
Result:=fSelectButtonIcon;
|
||||
end;
|
||||
|
||||
@ -488,6 +469,7 @@ var
|
||||
CurPageIndex: Integer;
|
||||
j: Integer;
|
||||
OldActivePage: String;
|
||||
Bitmap: TBitmap;
|
||||
begin
|
||||
if fUpdatingNotebook then exit;
|
||||
if IsUpdateLocked then begin
|
||||
@ -544,7 +526,9 @@ begin
|
||||
with CurBtn do begin
|
||||
Name:='PaletteSelectBtn'+IntToStr(i);
|
||||
OnClick := @SelectionToolClick;
|
||||
Glyph.LoadFromLazarusResource('tmouse');
|
||||
Bitmap := LoadBitmapFromLazarusResource('tmouse');
|
||||
Glyph := Bitmap;
|
||||
Bitmap.Free;
|
||||
Flat := True;
|
||||
GroupIndex:= 1;
|
||||
Down := True;
|
||||
|
@ -25,8 +25,8 @@ uses
|
||||
Classes, SysUtils, TypInfo, Forms, Controls, ProjectIntf, ComponentEditors;
|
||||
|
||||
const
|
||||
ComponentPaletteBtnWidth = 25;
|
||||
ComponentPaletteBtnHeight = 25;
|
||||
ComponentPaletteBtnWidth = 26;
|
||||
ComponentPaletteBtnHeight = 26;
|
||||
|
||||
type
|
||||
{ TIComponentInterface }
|
||||
|
@ -3407,19 +3407,10 @@ begin
|
||||
end;
|
||||
|
||||
function TPkgComponent.GetIconCopy: TBitMap;
|
||||
var
|
||||
ResName: string;
|
||||
res: TLResource;
|
||||
begin
|
||||
Result:=TBitmap.Create;
|
||||
ResName:=ComponentClass.ClassName;
|
||||
res:=LazarusResources.Find(ResName);
|
||||
if (res<>nil) and (res.Value<>'')
|
||||
and Result.LazarusResourceTypeValid(res.ValueType) then begin
|
||||
Result.LoadFromLazarusResource(ResName);
|
||||
end else begin
|
||||
Result.LoadFromLazarusResource('default');
|
||||
end;
|
||||
Result := LoadBitmapFromLazarusResource(ComponentClass.ClassName);
|
||||
if Result = nil then
|
||||
Result := LoadBitmapFromLazarusResource('default');
|
||||
end;
|
||||
|
||||
function TPkgComponent.HasIcon: boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user