mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 17:19:23 +02:00
MG: renamed TFileFormatList to TPicFileFormatList
git-svn-id: trunk@1504 -
This commit is contained in:
parent
37da619d34
commit
1462c1cf7e
@ -100,7 +100,7 @@ end;
|
|||||||
procedure TGraphic.SetModified(Value: Boolean);
|
procedure TGraphic.SetModified(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
if Value then
|
if Value then
|
||||||
Changed(Self);
|
Changed(Self)
|
||||||
else
|
else
|
||||||
FModified := False;
|
FModified := False;
|
||||||
end;
|
end;
|
||||||
|
@ -13,7 +13,6 @@ type
|
|||||||
TPicFileFormatsList = class(TList)
|
TPicFileFormatsList = class(TList)
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
procedure Clear;
|
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Add(const Ext, Desc: String; AClass: TGraphicClass);
|
procedure Add(const Ext, Desc: String; AClass: TGraphicClass);
|
||||||
function FindExt(Ext: string): TGraphicClass;
|
function FindExt(Ext: string): TGraphicClass;
|
||||||
@ -37,7 +36,7 @@ var
|
|||||||
p: PPicFileFormat;
|
p: PPicFileFormat;
|
||||||
begin
|
begin
|
||||||
for I := 0 to Count-1 do begin
|
for I := 0 to Count-1 do begin
|
||||||
p:=PFileFormat(Pointer(Items[I]));
|
p:=PPicFileFormat(Pointer(Items[I]));
|
||||||
Dispose(p);
|
Dispose(p);
|
||||||
end;
|
end;
|
||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
@ -63,7 +62,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Ext := AnsiLowerCase(Ext);
|
Ext := AnsiLowerCase(Ext);
|
||||||
for I := Count-1 downto 0 do
|
for I := Count-1 downto 0 do
|
||||||
with PFileFormat(Items[I])^ do
|
with PPicFileFormat(Items[I])^ do
|
||||||
if Extension = Ext then
|
if Extension = Ext then
|
||||||
begin
|
begin
|
||||||
Result := GraphicClass;
|
Result := GraphicClass;
|
||||||
@ -79,7 +78,7 @@ var
|
|||||||
begin
|
begin
|
||||||
for I := Count-1 downto 0 do
|
for I := Count-1 downto 0 do
|
||||||
begin
|
begin
|
||||||
Result := PFileFormat(Items[I])^.GraphicClass;
|
Result := PPicFileFormat(Items[I])^.GraphicClass;
|
||||||
if AnsiLowerCase(Result.ClassName) = AnsiLowerCase(AClassname) then
|
if AnsiLowerCase(Result.ClassName) = AnsiLowerCase(AClassname) then
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
@ -89,11 +88,11 @@ end;
|
|||||||
procedure TPicFileFormatsList.Remove(AClass: TGraphicClass);
|
procedure TPicFileFormatsList.Remove(AClass: TGraphicClass);
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
P: PFileFormat;
|
P: PPicFileFormat;
|
||||||
begin
|
begin
|
||||||
for I := Count-1 downto 0 do
|
for I := Count-1 downto 0 do
|
||||||
begin
|
begin
|
||||||
P := PFileFormat(Items[I]);
|
P := PPicFileFormat(Items[I]);
|
||||||
if P^.GraphicClass.InheritsFrom(AClass) then
|
if P^.GraphicClass.InheritsFrom(AClass) then
|
||||||
begin
|
begin
|
||||||
Dispose(P);
|
Dispose(P);
|
||||||
@ -106,13 +105,13 @@ procedure TPicFileFormatsList.BuildFilterStrings(GraphicClass: TGraphicClass;
|
|||||||
var Descriptions, Filters: string);
|
var Descriptions, Filters: string);
|
||||||
var
|
var
|
||||||
C, I: Integer;
|
C, I: Integer;
|
||||||
P: PFileFormat;
|
P: PPicFileFormat;
|
||||||
begin
|
begin
|
||||||
Descriptions := '';
|
Descriptions := '';
|
||||||
Filters := '';
|
Filters := '';
|
||||||
C := 0;
|
C := 0;
|
||||||
for I := Count-1 downto 0 do begin
|
for I := Count-1 downto 0 do begin
|
||||||
P := PFileFormat(Items[I]);
|
P := PPicFileFormat(Items[I]);
|
||||||
if P^.GraphicClass.InheritsFrom(GraphicClass) and (P^.Extension <> '') then
|
if P^.GraphicClass.InheritsFrom(GraphicClass) and (P^.Extension <> '') then
|
||||||
with P^ do
|
with P^ do
|
||||||
begin
|
begin
|
||||||
@ -133,21 +132,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
PictureFileFormats: TFileFormatsList = nil;
|
PictureFileFormats: TPicFileFormatsList = nil;
|
||||||
|
|
||||||
function GetPicFileFormats: TFileFormatsList;
|
function GetPicFileFormats: TPicFileFormatsList;
|
||||||
begin
|
begin
|
||||||
if PictureFileFormats = nil then
|
if PictureFileFormats = nil then
|
||||||
PictureFileFormats := TPicFileFormatsList.Create;
|
PictureFileFormats := TPicFileFormatsList.Create;
|
||||||
Result := PictureFileFormats;
|
Result := PictureFileFormats;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetPicClipboardFormats: TPicClipboardFormats;
|
{function GetPicClipboardFormats: TPicClipboardFormats;
|
||||||
begin
|
begin
|
||||||
if PicClipboardFormats = nil then
|
if PicClipboardFormats = nil then
|
||||||
PicClipboardFormats := TPicClipboardFormats.Create;
|
PicClipboardFormats := TPicClipboardFormats.Create;
|
||||||
Result := PicClipboardFormats;
|
Result := PicClipboardFormats;
|
||||||
end;
|
end;}
|
||||||
|
|
||||||
//--TPicture--------------------------------------------------------------------
|
//--TPicture--------------------------------------------------------------------
|
||||||
|
|
||||||
@ -155,8 +154,8 @@ end;
|
|||||||
constructor TPicture.Create;
|
constructor TPicture.Create;
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
GetFileFormats;
|
GetPicFileFormats;
|
||||||
GetClipboardFormats;
|
//GetClipboardFormats;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TPicture.Destroy;
|
destructor TPicture.Destroy;
|
||||||
@ -253,7 +252,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Ext := ExtractFileExt(Filename);
|
Ext := ExtractFileExt(Filename);
|
||||||
System.Delete(Ext, 1, 1); // delete '.'
|
System.Delete(Ext, 1, 1); // delete '.'
|
||||||
GraphicClass := GetFileFormats.FindExt(Ext);
|
GraphicClass := GetPicFileFormats.FindExt(Ext);
|
||||||
if GraphicClass = nil then
|
if GraphicClass = nil then
|
||||||
raise EInvalidGraphic.CreateFmt('Unknown picture extension', [Ext]);
|
raise EInvalidGraphic.CreateFmt('Unknown picture extension', [Ext]);
|
||||||
|
|
||||||
@ -327,7 +326,7 @@ end;
|
|||||||
class procedure TPicture.RegisterFileFormat(const AnExtension,
|
class procedure TPicture.RegisterFileFormat(const AnExtension,
|
||||||
ADescription: string; AGraphicClass: TGraphicClass);
|
ADescription: string; AGraphicClass: TGraphicClass);
|
||||||
begin
|
begin
|
||||||
GetFileFormats.Add(AnExtension, ADescription, AGraphicClass);
|
GetPicFileFormats.Add(AnExtension, ADescription, AGraphicClass);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPicture.RegisterClipboardFormat(FormatID: TClipboardFormat;
|
procedure TPicture.RegisterClipboardFormat(FormatID: TClipboardFormat;
|
||||||
@ -338,7 +337,7 @@ end;
|
|||||||
|
|
||||||
class procedure TPicture.UnRegisterGraphicClass(AClass: TGraphicClass);
|
class procedure TPicture.UnRegisterGraphicClass(AClass: TGraphicClass);
|
||||||
begin
|
begin
|
||||||
if GetFileFormats <> nil then GetFileFormats.Remove(AClass);
|
if GetPicFileFormats <> nil then GetPicFileFormats.Remove(AClass);
|
||||||
//if ClipboardFormats <> nil then ClipboardFormats.Remove(AClass);
|
//if ClipboardFormats <> nil then ClipboardFormats.Remove(AClass);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -362,7 +361,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Stream.Read(GraphicClassName[0], 1);
|
Stream.Read(GraphicClassName[0], 1);
|
||||||
Stream.Read(GraphicClassName[1], length(GraphicClassName));
|
Stream.Read(GraphicClassName[1], length(GraphicClassName));
|
||||||
GraphicClass := GetFileFormats.FindClassName(GraphicClassName);
|
GraphicClass := GetPicFileFormats.FindClassName(GraphicClassName);
|
||||||
NewGraphic := nil;
|
NewGraphic := nil;
|
||||||
if GraphicClass <> nil then
|
if GraphicClass <> nil then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user