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