1
0
mirror of synced 2024-11-22 01:53:50 +00:00

Export/Import GraphicList

This commit is contained in:
Mark van Renswoude 2013-12-08 09:27:27 +00:00
parent 9ffd13c06e
commit d3ca72b5ff
4 changed files with 255 additions and 231 deletions

View File

@ -1,10 +1,10 @@
object GraphicsEditorForm: TGraphicsEditorForm
Left = 325
Top = 363
Width = 534
Height = 451
BorderIcons = [biSystemMenu]
Caption = '<runtime>'
ClientHeight = 413
ClientWidth = 518
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
@ -12,7 +12,6 @@ object GraphicsEditorForm: TGraphicsEditorForm
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poDefaultPosOnly
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
@ -20,24 +19,25 @@ object GraphicsEditorForm: TGraphicsEditorForm
Left = 189
Top = 0
Width = 4
Height = 424
Height = 413
ExplicitHeight = 424
end
object pnlImage: TPanel
Left = 193
Top = 0
Width = 333
Height = 424
Width = 325
Height = 413
Align = alClient
BevelOuter = bvNone
TabOrder = 1
object tbImage: TToolBar
Left = 0
Top = 0
Width = 333
Width = 325
Height = 26
AutoSize = True
DrawingStyle = dsGradient
EdgeBorders = [ebTop, ebBottom]
Flat = True
Images = ilsIcons
TabOrder = 0
object tbOpen: TToolButton
@ -59,8 +59,8 @@ object GraphicsEditorForm: TGraphicsEditorForm
object sbImage: TScrollBox
Left = 0
Top = 26
Width = 333
Height = 370
Width = 325
Height = 334
Align = alClient
BevelInner = bvNone
BevelKind = bkTile
@ -78,27 +78,40 @@ object GraphicsEditorForm: TGraphicsEditorForm
end
object pnlProperties: TPanel
Left = 0
Top = 396
Width = 333
Height = 28
Top = 360
Width = 325
Height = 53
Align = alBottom
BevelOuter = bvNone
Caption = 'pnlProperties'
TabOrder = 2
DesignSize = (
333
28)
325
53)
object lblName: TLabel
Left = 8
Top = 8
Top = 32
Width = 31
Height = 13
Caption = 'Name:'
end
object lblClassType: TLabel
Left = 8
Top = 6
Width = 309
Height = 13
Anchors = [akLeft, akTop, akRight]
AutoSize = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clGrayText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object txtName: TEdit
Left = 52
Top = 4
Width = 277
Top = 28
Width = 269
Height = 21
Anchors = [akLeft, akTop, akRight]
TabOrder = 0
@ -110,7 +123,7 @@ object GraphicsEditorForm: TGraphicsEditorForm
Left = 0
Top = 0
Width = 189
Height = 424
Height = 413
Align = alLeft
BevelOuter = bvNone
TabOrder = 0
@ -118,7 +131,7 @@ object GraphicsEditorForm: TGraphicsEditorForm
Left = 0
Top = 26
Width = 189
Height = 398
Height = 387
Style = lbVirtual
Align = alClient
ItemHeight = 13
@ -134,8 +147,8 @@ object GraphicsEditorForm: TGraphicsEditorForm
Width = 189
Height = 26
AutoSize = True
DrawingStyle = dsGradient
EdgeBorders = [ebTop, ebBottom]
Flat = True
Images = ilsIcons
TabOrder = 0
object tbNew: TToolButton
@ -165,6 +178,23 @@ object GraphicsEditorForm: TGraphicsEditorForm
Top = 0
Action = actDown
end
object tbSep2: TToolButton
Left = 100
Top = 0
Width = 8
ImageIndex = 9
Style = tbsSeparator
end
object tbExport: TToolButton
Left = 108
Top = 0
Action = actExport
end
object tbImport: TToolButton
Left = 131
Top = 0
Action = actImport
end
end
end
object ilsIcons: TImageList
@ -172,135 +202,7 @@ object GraphicsEditorForm: TGraphicsEditorForm
Top = 360
Bitmap = {
494C010107000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000003000000001002000000000000030
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000003600000028000000400000002000000001002000000000000020
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
@ -558,12 +460,8 @@ object GraphicsEditorForm: TGraphicsEditorForm
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000300000000100010000000000800100000000000000000000
000000000000000000000000FFFFFF0000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000FFFFFFFFFFFF0000EFFDFFFFFFFF0000
2800000040000000200000000100010000000000000100000000000000000000
000000000000000000000000FFFFFF00FFFFFFFFFFFF0000EFFDFFFFFFFF0000
C7FFFFFFFFFF0000C3FBF83FFEFF0000E3F7F83FFC7F0000F1E7F83FF83F0000
F8CFF83FF01F0000FC1FC007E00F0000FE3FE00FC0070000FC1FF01FF83F0000
F8CFF83FF83F0000E1E7FC7FF83F0000C3F3FEFFF83F0000C7FDFFFFFFFF0000
@ -627,6 +525,18 @@ object GraphicsEditorForm: TGraphicsEditorForm
ShortCut = 16424
OnExecute = actDownExecute
end
object actExport: TAction
Caption = '&Export'
Hint = 'Export all graphics'
ImageIndex = 3
OnExecute = actExportExecute
end
object actImport: TAction
Caption = '&Import'
Hint = 'Import all graphics'
ImageIndex = 2
OnExecute = actImportExecute
end
end
object dlgOpen: TOpenPictureDialog
Left = 20
@ -636,4 +546,14 @@ object GraphicsEditorForm: TGraphicsEditorForm
Left = 104
Top = 304
end
object dlgExport: TSaveDialog
Filter = 'GraphicList Export (*.gle)|*.gle'
Left = 104
Top = 256
end
object dlgImport: TOpenDialog
Filter = 'GraphicList Export (*.gle)|*.gle'
Left = 24
Top = 256
end
end

View File

@ -26,64 +26,72 @@ uses
type
TGraphicsEditorForm = class(TForm)
actAdd: TAction;
actClear: TAction;
actDelete: TAction;
actDown: TAction;
actOpen: TAction;
actSave: TAction;
actUp: TAction;
alGraphics: TActionList;
dlgOpen: TOpenPictureDialog;
dlgSave: TSavePictureDialog;
ilsIcons: TImageList;
imgPreview: TImage;
lblName: TLabel;
lstGraphics: TListBox;
pnlGraphics: TPanel;
pnlImage: TPanel;
pnlProperties: TPanel;
sbImage: TScrollBox;
spltGraphics: TSplitter;
tbClear: TToolButton;
tbDelete: TToolButton;
tbDown: TToolButton;
tbGraphics: TToolBar;
tbImage: TToolBar;
tbNew: TToolButton;
tbOpen: TToolButton;
tbSave: TToolButton;
tbSep1: TToolButton;
tbUp: TToolButton;
txtName: TEdit;
actAdd: TAction;
actClear: TAction;
actDelete: TAction;
actDown: TAction;
actOpen: TAction;
actSave: TAction;
actUp: TAction;
alGraphics: TActionList;
dlgOpen: TOpenPictureDialog;
dlgSave: TSavePictureDialog;
ilsIcons: TImageList;
imgPreview: TImage;
lblName: TLabel;
lstGraphics: TListBox;
pnlGraphics: TPanel;
pnlImage: TPanel;
pnlProperties: TPanel;
sbImage: TScrollBox;
spltGraphics: TSplitter;
tbClear: TToolButton;
tbDelete: TToolButton;
tbDown: TToolButton;
tbGraphics: TToolBar;
tbImage: TToolBar;
tbNew: TToolButton;
tbOpen: TToolButton;
tbSave: TToolButton;
tbSep1: TToolButton;
tbUp: TToolButton;
txtName: TEdit;
lblClassType: TLabel;
tbExport: TToolButton;
tbImport: TToolButton;
actExport: TAction;
actImport: TAction;
tbSep2: TToolButton;
dlgExport: TSaveDialog;
dlgImport: TOpenDialog;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure lstGraphicsClick(Sender: TObject);
procedure txtNameChange(Sender: TObject);
function lstGraphicsDataFind(Control: TWinControl; FindString: String): Integer;
procedure actAddExecute(Sender: TObject);
procedure actClearExecute(Sender: TObject);
procedure actDeleteExecute(Sender: TObject);
procedure actUpExecute(Sender: TObject);
procedure actDownExecute(Sender: TObject);
procedure actExportExecute(Sender: TObject);
procedure actImportExecute(Sender: TObject);
procedure actOpenExecute(Sender: TObject);
procedure actSaveExecute(Sender: TObject);
procedure actClearExecute(Sender: TObject);
procedure lstGraphicsData(Control: TWinControl; Index: Integer;
var Data: String);
function lstGraphicsDataFind(Control: TWinControl;
FindString: String): Integer;
procedure actUpExecute(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure lstGraphicsClick(Sender: TObject);
procedure lstGraphicsData(Control: TWinControl; Index: Integer; var Data: String);
procedure lstGraphicsKeyPress(Sender: TObject; var Key: Char);
procedure txtNameChange(Sender: TObject);
private
FComponent: TX2GraphicContainer;
FComponentDesigner: IDesigner;
FUpdating: Boolean;
FComponent: TX2GraphicContainer;
FComponentDesigner: IDesigner;
FUpdating: Boolean;
procedure InternalExecute(const AComponent: TComponent; const ADesigner: IDesigner);
procedure LoadGraphic(AGraphic: TX2GraphicContainerItem; const AFileName: string);
procedure ItemChanged(AUpdatePreview: Boolean = True);
procedure UpdateUI();
procedure UpdatePreview();
procedure UpdateUI;
procedure UpdatePreview;
function Active(out AIndex: Integer; out AGraphic: TX2GraphicContainerItem): Boolean;
protected
@ -95,12 +103,13 @@ type
implementation
uses
Graphics,
IniFiles,
SysUtils,
Windows;
var
EditorInstance: TGraphicsEditorForm;
EditorInstance: TGraphicsEditorForm;
{$R *.dfm}
@ -115,6 +124,7 @@ begin
EditorInstance.InternalExecute(AComponent, ADesigner);
end;
procedure TGraphicsEditorForm.InternalExecute(const AComponent: TComponent; const ADesigner: IDesigner);
begin
FComponent := TX2GraphicContainer(AComponent);
@ -126,9 +136,9 @@ begin
lstGraphics.Count := FComponent.GraphicCount;
lstGraphics.ItemIndex := 0;
UpdateUI();
UpdatePreview();
Show();
UpdateUI;
UpdatePreview;
Show;
end;
@ -147,6 +157,7 @@ end;
procedure TGraphicsEditorForm.LoadGraphic(AGraphic: TX2GraphicContainerItem; const AFileName: string);
begin
AGraphic.Picture.LoadFromFile(AFileName);
if Length(AGraphic.PictureName) = 0 then
begin
AGraphic.PictureName := ChangeFileExt(ExtractFileName(AFileName), '');
@ -160,14 +171,14 @@ begin
if Assigned(FComponentDesigner) then
FComponentDesigner.Modified;
UpdateUI();
UpdateUI;
if AUpdatePreview then
UpdatePreview;
end;
procedure TGraphicsEditorForm.UpdateUI();
procedure TGraphicsEditorForm.UpdateUI;
var
enabled: Boolean;
index: Integer;
@ -185,13 +196,14 @@ begin
actSave.Enabled := enabled;
actClear.Enabled := enabled;
actExport.Enabled := (FComponent.GraphicCount > 0);
actUp.Enabled := enabled and (index > 0);
actDown.Enabled := enabled and (index < Pred(FComponent.GraphicCount));
end;
procedure TGraphicsEditorForm.UpdatePreview();
procedure TGraphicsEditorForm.UpdatePreview;
var
index: Integer;
graphic: TX2GraphicContainerItem;
@ -202,11 +214,18 @@ begin
if Active(index, graphic) then
begin
imgPreview.Picture.Assign(graphic.Picture);
txtName.Text := graphic.PictureName;
if Assigned(graphic.Picture.Graphic) then
lblClassType.Caption := graphic.Picture.Graphic.ClassName
else
lblClassType.Caption := '';
txtName.Text := graphic.PictureName;
lstGraphics.Invalidate;
end else
begin
imgPreview.Picture.Assign(nil);
lblClassType.Caption := '';
txtName.Text := '';
end;
finally
@ -230,8 +249,8 @@ end;
procedure TGraphicsEditorForm.lstGraphicsClick(Sender: TObject);
begin
UpdateUI();
UpdatePreview();
UpdateUI;
UpdatePreview;
end;
@ -265,7 +284,7 @@ begin
dlgOpen.Filter := GraphicFilter(TGraphic);
dlgOpen.Options := dlgOpen.Options + [ofAllowMultiSelect];
if dlgOpen.Execute() then
if dlgOpen.Execute then
begin
for fileIndex := 0 to Pred(dlgOpen.Files.Count) do
begin
@ -281,7 +300,7 @@ begin
raise Exception.Create('Failed to create TX2GraphicContainerItem!');
end;
ItemChanged();
ItemChanged;
end;
end else
raise Exception.Create('Designer not found!');
@ -299,7 +318,7 @@ begin
{ First attempt to remove the component; this will raise an exception
if it's not allowed, for example due to it being introduced in
an ancestor. }
graphic.Free();
graphic.Free;
lstGraphics.Count := FComponent.GraphicCount;
if index > Pred(FComponent.GraphicCount) then
@ -307,7 +326,7 @@ begin
lstGraphics.ItemIndex := index;
ItemChanged();
ItemChanged;
end;
end;
@ -359,14 +378,15 @@ begin
dlgOpen.Filter := GraphicFilter(TGraphic);
dlgOpen.Options := dlgOpen.Options - [ofAllowMultiSelect];
if dlgOpen.Execute() then
if dlgOpen.Execute then
begin
LoadGraphic(graphic, dlgOpen.FileName);
ItemChanged();
ItemChanged;
end;
end;
end;
procedure TGraphicsEditorForm.actSaveExecute(Sender: TObject);
var
index: Integer;
@ -380,11 +400,12 @@ begin
dlgSave.Filter := GraphicFilter(graphicClass);
dlgSave.FileName := ChangeFileExt(graphic.PictureName, '.' + GraphicExtension(graphicClass));
if dlgSave.Execute() then
if dlgSave.Execute then
graphic.Picture.SaveToFile(dlgSave.FileName);
end;
end;
procedure TGraphicsEditorForm.actClearExecute(Sender: TObject);
var
index: Integer;
@ -394,7 +415,97 @@ begin
if Active(index, graphic) then
begin
graphic.Picture.Assign(nil);
ItemChanged();
ItemChanged;
end;
end;
procedure TGraphicsEditorForm.actExportExecute(Sender: TObject);
var
exportFile: TIniFile;
exportBaseFileName: string;
exportPath: string;
index: Integer;
graphic: TX2GraphicContainerItem;
fileName: string;
begin
if dlgExport.Execute then
begin
exportPath := ExtractFilePath(dlgExport.FileName);
exportBaseFileName := ChangeFileExt(ExtractFileName(dlgExport.FileName), '');
exportFile := TIniFile.Create(dlgExport.FileName);
try
for index := 0 to Pred(FComponent.GraphicCount) do
begin
graphic := FComponent.Graphics[index];
exportFile.WriteString('PictureName', IntToStr(index), graphic.PictureName);
if Assigned(graphic.Picture.Graphic) then
begin
fileName := exportBaseFileName + '.' + IntToStr(index) + '.' + GraphicExtension(TGraphicClass(graphic.Picture.Graphic.ClassType));
graphic.Picture.Graphic.SaveToFile(exportPath + fileName);
exportFile.WriteString('FileName', IntToStr(index), fileName);
end;
end;
ShowMessage('Graphics have been exported');
finally
FreeAndNil(exportFile);
end;
end;
end;
procedure TGraphicsEditorForm.actImportExecute(Sender: TObject);
var
importFile: TIniFile;
importPath: string;
index: Integer;
graphic: TX2GraphicContainerItem;
fileName: string;
begin
if dlgImport.Execute then
begin
if FComponent.GraphicCount > 0 then
begin
if MessageBox(Self.Handle, 'All graphics will be replaced. Do you want to continue?', 'Import', MB_YESNO or MB_ICONQUESTION) <> ID_YES then
exit;
end;
lstGraphics.Clear;
FComponent.Clear;
importPath := ExtractFilePath(dlgImport.FileName);
importFile := TIniFile.Create(dlgImport.FileName);
try
index := 0;
while importFile.ValueExists('PictureName', IntToStr(index)) do
begin
graphic := TX2GraphicContainerItem(FComponentDesigner.CreateComponent(TX2GraphicContainerItem, nil, 0, 0, 0, 0));
if Assigned(graphic) then
begin
graphic.Container := FComponent;
graphic.PictureName := importFile.ReadString('PictureName', IntToStr(index), IntToStr(index));
fileName := importFile.ReadString('FileName', IntToStr(index), '');
if (Length(fileName) > 0) and FileExists(importPath + fileName) then
graphic.Picture.LoadFromFile(importPath + fileName);
end;
Inc(index);
end;
finally
FreeAndNil(importFile);
lstGraphics.Count := FComponent.GraphicCount;
ItemChanged(True);
end;
end;
end;
@ -406,7 +517,7 @@ begin
if (Operation = opRemove) and (AComponent = FComponent) then
begin
FComponent := nil;
Close();
Close;
end;
end;

View File

@ -22,18 +22,11 @@ uses
Controls,
Graphics;
{$IFDEF VER150}
{$IF CompilerVersion >= 15}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$WARN UNSAFE_TYPE OFF}
{$ENDIF}
{$IFDEF VER180}
{$WARN UNSAFE_CODE OFF}
{$WARN UNSAFE_CAST OFF}
{$WARN UNSAFE_TYPE OFF}
{$ENDIF}
{$IFEND}
type
// Forward declarations

View File

@ -13,7 +13,7 @@
<Borland.Personality>Default.Personality</Borland.Personality>
<Borland.ProjectType />
<BorlandProject>
<BorlandProject xmlns=""> <Default.Personality> </Default.Personality> </BorlandProject></BorlandProject>
<BorlandProject xmlns=""><Default.Personality></Default.Personality></BorlandProject></BorlandProject>
</ProjectExtensions>
<Target Name="X2CLGL">
<MSBuild Projects="Packages\D7\X2CLGL.dproj" Targets="" />