| 3 |
|
uses |
| 4 |
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
| 5 |
|
Dialogs, StdCtrls, Template, ExtCtrls, Math, StrUtils, |
| 6 |
< |
ConnectionManager, {OniImgClass,} Data, TypeDefs, Menus, Buttons; |
| 6 |
> |
ConnectionManager, OniImgClass, Data, TypeDefs, Menus, Buttons; |
| 7 |
|
|
| 8 |
|
type |
| 9 |
|
TForm_Preview = class(TForm_ToolTemplate) |
| 29 |
|
procedure SetBitmapCount(Count: Integer); |
| 30 |
|
procedure LoadImage(fileid, index: Integer); |
| 31 |
|
private |
| 32 |
< |
bitmaps: array of TBitmap; |
| 32 |
> |
bitmaps: array of TOniImage; |
| 33 |
|
actualimg: Byte; |
| 34 |
|
_fileid: Integer; |
| 35 |
|
public |
| 40 |
|
|
| 41 |
|
implementation |
| 42 |
|
{$R *.dfm} |
| 43 |
+ |
uses Imaging, ImagingComponents, ImagingTypes; |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
procedure TForm_Preview.FormCreate(Sender: TObject); |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
procedure TForm_Preview.LoadImage(fileid, index: Integer); |
| 85 |
– |
var |
| 86 |
– |
Data: TByteArray; |
| 87 |
– |
memstream: TMemoryStream; |
| 88 |
– |
OniImage: TOniImage; |
| 89 |
– |
|
| 86 |
|
begin |
| 87 |
< |
OniImage := TOniImage.Create; |
| 92 |
< |
OniImage.Load(Connection, fileid); |
| 93 |
< |
Data := OniImage.GetAsBMP; |
| 94 |
< |
OniImage.Free; |
| 95 |
< |
|
| 96 |
< |
memstream := TMemoryStream.Create; |
| 97 |
< |
memstream.Write(Data[0], Length(Data)); |
| 98 |
< |
memstream.Seek(0, soFromBeginning); |
| 99 |
< |
bitmaps[index].LoadFromStream(memstream); |
| 100 |
< |
memstream.Free; |
| 87 |
> |
bitmaps[index].Load(ConnectionID, fileid); |
| 88 |
|
end; |
| 89 |
|
|
| 90 |
|
|
| 91 |
|
procedure TForm_Preview.DrawImage(index: Integer); |
| 92 |
|
begin |
| 93 |
< |
BitBlt(img.Canvas.Handle, 0, 0, img.Width, img.Height, |
| 107 |
< |
bitmaps[index].Canvas.Handle, 0, 0, WHITENESS); |
| 108 |
< |
BitBlt(img.Canvas.Handle, 0, 0, bitmaps[index].Width, bitmaps[index].Height, |
| 109 |
< |
bitmaps[index].Canvas.Handle, 0, 0, SRCCOPY); |
| 110 |
< |
img.Invalidate; |
| 93 |
> |
bitmaps[index].DrawOnCanvas(img.Canvas, 0); |
| 94 |
|
end; |
| 95 |
|
|
| 96 |
|
|
| 109 |
|
i := Length(bitmaps); |
| 110 |
|
SetLength(bitmaps, Count); |
| 111 |
|
for i := i to High(bitmaps) do |
| 112 |
< |
bitmaps[i] := TBitmap.Create; |
| 112 |
> |
bitmaps[i] := TOniImage.Create; |
| 113 |
|
end; |
| 114 |
|
end; |
| 115 |
|
|
| 125 |
|
procedure TForm_Preview.PreviewTXAN; |
| 126 |
|
var |
| 127 |
|
loop_speed: Word; |
| 128 |
< |
linkcount: LongWord; |
| 129 |
< |
link: LongWord; |
| 128 |
> |
linkcount: Integer; |
| 129 |
> |
link: Integer; |
| 130 |
|
i: Byte; |
| 131 |
|
begin |
| 132 |
< |
Connection.LoadDatFilePart(_fileid, $14, SizeOf(loop_speed), @loop_speed); |
| 133 |
< |
Connection.LoadDatFilePart(_fileid, $1C, SizeOf(linkcount), @linkcount); |
| 132 |
> |
ConManager.Connection[ConnectionID].LoadDatFilePart(_fileid, $14, SizeOf(loop_speed), @loop_speed); |
| 133 |
> |
ConManager.Connection[ConnectionID].LoadDatFilePart(_fileid, $1C, SizeOf(linkcount), @linkcount); |
| 134 |
|
SetBitmapCount(linkcount); |
| 135 |
|
for i := 0 to linkcount - 1 do |
| 136 |
|
begin |
| 137 |
< |
Connection.LoadDatFilePart(_fileid, $20 + i * 4, SizeOf(link), @link); |
| 137 |
> |
ConManager.Connection[ConnectionID].LoadDatFilePart(_fileid, $20 + i * 4, SizeOf(link), @link); |
| 138 |
|
link := link div 256; |
| 139 |
|
if link = 0 then |
| 140 |
|
link := _fileid - 1; |
| 172 |
|
Dec(actualimg) |
| 173 |
|
else |
| 174 |
|
actualimg := High(bitmaps); |
| 175 |
< |
Self.Caption := 'Preview ' + Connection.GetFileInfo(_fileid).FileName + |
| 175 |
> |
Self.Caption := 'Preview ' + ConManager.Connection[ConnectionID].GetFileInfo(_fileid).Name + |
| 176 |
|
' (' + IntToStr(actualimg + 1) + '/' + IntToStr(Length(bitmaps)) + ')'; |
| 177 |
|
DrawImage(actualimg); |
| 178 |
|
end; |
| 184 |
|
Inc(actualimg) |
| 185 |
|
else |
| 186 |
|
actualimg := 0; |
| 187 |
< |
Self.Caption := 'Preview ' + Connection.GetFileInfo(_fileid).FileName + |
| 187 |
> |
Self.Caption := 'Preview ' + ConManager.Connection[ConnectionID].GetFileInfo(_fileid).Name + |
| 188 |
|
' (' + IntToStr(actualimg + 1) + '/' + IntToStr(Length(bitmaps)) + ')'; |
| 189 |
|
DrawImage(actualimg); |
| 190 |
|
end; |