-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUFormViewEXIF.pas
222 lines (200 loc) · 4.84 KB
/
UFormViewEXIF.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
unit UFormViewEXIF;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, EXIF_Intf, EXIF_Defs, ComCtrls, StdCtrls, ExtCtrls;
type
TFormViewEXIF = class(TForm)
List: TListView;
tc: TTabControl;
Image: TImage;
ImagePanel: TPanel;
Label1: TLabel;
btnClose: TButton;
procedure FormCreate(Sender: TObject);
procedure ListDblClick(Sender: TObject);
procedure tcChange(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
private
EXIF: TEXIF;
public
procedure DisplayIFD0;
procedure DisplayIFD1;
procedure DisplayEXIFSubIFD;
procedure DisplayEXIFInteropIFD;
procedure DisplayMakerNote;
procedure DisplayThumbnail;
end;
procedure ShowEXIF(const FN: string);
implementation
uses
JPEG, ATxMsg, ATxMsgProc;
{$R *.dfm}
procedure TFormViewEXIF.FormCreate(Sender: TObject);
begin
EXIF:=TEXIF.Create;
end;
procedure TFormViewEXIF.ListDblClick(Sender: TObject);
var
s: string;
begin
try
s:=TListView(Sender).Selected.SubItems[1];
InputQuery(TListView(Sender).Selected.SubItems[0],TListView(Sender).Selected.Caption,s);
except
end;
end;
procedure TFormViewEXIF.tcChange(Sender: TObject);
begin
List.Hide;
ImagePanel.Hide;
case tc.TabIndex of
0: DisplayIFD0;
1: DisplayEXIFSubIFD;
2: DisplayEXIFInteropIFD;
3: DisplayMakerNote;
4: DisplayIFD1;
5: DisplayThumbnail;
end;
end;
procedure TFormViewEXIF.DisplayEXIFInteropIFD;
var
i: Integer;
begin
with EXIF do begin
List.Items.BeginUpdate;
try
List.Items.Clear;
for i:=0 to INTEROPCount-1 do
with List.Items.Add do begin
Caption:=Format('0x%x',[INTEROP_Index[i].Header.Tag]);
SubItems.Add(INTEROP_Index[i].Header.Name);
SubItems.Add(TranslateINTEROP(INTEROP_Index[i]));
ImageIndex:=-1;
end;
finally
List.Items.EndUpdate;
end;
end;
List.Show;
end;
procedure TFormViewEXIF.DisplayEXIFSubIFD;
var
i: Integer;
begin
with EXIF do begin
List.Items.BeginUpdate;
try
List.Items.Clear;
for i:=0 to EXIFCount-1 do
with List.Items.Add do begin
Caption:=Format('0x%x',[EXIF_Index[i].Header.Tag]);
SubItems.Add(EXIF_Index[i].Header.Name);
SubItems.Add(TranslateEXIF(EXIF_Index[i]));
ImageIndex:=-1;
end;
finally
List.Items.EndUpdate;
end;
end;
List.Show;
end;
procedure TFormViewEXIF.DisplayIFD0;
var
i: Integer;
begin
with EXIF do begin
List.Items.BeginUpdate;
try
List.Items.Clear;
for i:=0 to TIFFCount-1 do
with List.Items.Add do begin
Caption:=Format('0x%x',[TIFF_Index[i].Header.Tag]);
SubItems.Add(TIFF_Index[i].Header.Name);
SubItems.Add(TranslateTIFF(TIFF_Index[i]));
ImageIndex:=-1;
end;
finally
List.Items.EndUpdate;
end;
end;
List.Show;
end;
procedure TFormViewEXIF.DisplayMakerNote;
var
i: Integer;
begin
with EXIF do begin
List.Items.BeginUpdate;
try
List.Items.Clear;
for i:=0 to MakerNoteCount-1 do
with List.Items.Add do begin
Caption:=Format('0x%x',[MakerNote_Index[i].Header.Tag]);
SubItems.Add(MakerNote_Index[i].Header.Name);
SubItems.Add(TranslateMakerNote(MakerNoteFormat,MakerNote_Index[i]));
ImageIndex:=-1;
end;
finally
List.Items.EndUpdate;
end;
end;
List.Show;
end;
procedure TFormViewEXIF.DisplayIFD1;
var
i: Integer;
begin
with EXIF do begin
List.Items.BeginUpdate;
try
List.Items.Clear;
for i:=0 to EXIF_IFD1Count-1 do
with List.Items.Add do begin
Caption:=Format('0x%x',[EXIF_IFD1_Index[i].Header.Tag]);
SubItems.Add(EXIF_IFD1_Index[i].Header.Name);
SubItems.Add(TranslateTIFF(EXIF_IFD1_Index[i]));
ImageIndex:=-1;
end;
finally
List.Items.EndUpdate;
end;
end;
List.Show;
end;
procedure TFormViewEXIF.DisplayThumbnail;
begin
if Assigned(EXIF.Thumbnail) and (EXIF.Thumbnail.Height>0) then begin
Image.Picture.Assign(EXIF.Thumbnail);
ImagePanel.Show;
Label1.Caption:=Format('%d x %d',[Image.Picture.Width,Image.Picture.Height]);
end;
end;
procedure TFormViewEXIF.btnCloseClick(Sender: TObject);
begin
Close;
end;
procedure ShowEXIF(const FN: string);
begin
with TFormViewEXIF.Create(nil) do
try
{$I Lang.FormViewEXIF.inc}
EXIF.LoadFromFile(FN);
with EXIF do
if (TIFFCount = 0) and
(EXIFCount = 0) and
(EXIF_IFD1Count = 0) and
(INTEROPCount = 0) and
(MakerNoteCount = 0) and
not Assigned(Thumbnail) then
begin
Application.MessageBox(PChar(MsgViewerExifMissed), PChar(Caption), MB_OK or MB_ICONWARNING);
Exit
end;
tcChange(nil);
ShowModal;
finally
Release;
end;
end;
end.