1 | unit _TemplateFileList;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
---|
7 | Dialogs, _TemplateFile, StdCtrls, ExtCtrls, Menus, Buttons,
|
---|
8 | ComCtrls, TypeDefs, VirtualTrees;
|
---|
9 |
|
---|
10 | type
|
---|
11 | TForm_TemplateFileList = class(TForm_TemplateFile)
|
---|
12 | panel_files: TPanel;
|
---|
13 | splitter_content: TSplitter;
|
---|
14 | panel_content: TPanel;
|
---|
15 | filepopup: TPopupMenu;
|
---|
16 | popup_separator2: TMenuItem;
|
---|
17 | popup_linkshere: TMenuItem;
|
---|
18 | popup_separator: TMenuItem;
|
---|
19 | popup_import: TMenuItem;
|
---|
20 | popup_export: TMenuItem;
|
---|
21 | importd: TOpenDialog;
|
---|
22 | exportd: TSaveDialog;
|
---|
23 | FilePages: TPageControl;
|
---|
24 | tab_files: TTabSheet;
|
---|
25 | panel_extension: TPanel;
|
---|
26 | label_sort2: TLabel;
|
---|
27 | label_sort1: TLabel;
|
---|
28 | label_extension: TLabel;
|
---|
29 | btn_sort_id_asc: TSpeedButton;
|
---|
30 | btn_sort_id_desc: TSpeedButton;
|
---|
31 | btn_sort_name_asc: TSpeedButton;
|
---|
32 | btn_sort_name_desc: TSpeedButton;
|
---|
33 | btn_sort_ext_asc: TSpeedButton;
|
---|
34 | btn_sort_ext_desc: TSpeedButton;
|
---|
35 | combo_extension: TComboBox;
|
---|
36 | check_zerobyte: TCheckBox;
|
---|
37 | edit_filtername: TEdit;
|
---|
38 | check_filtername: TCheckBox;
|
---|
39 | filelist: TListBox;
|
---|
40 | tab_meta: TTabSheet;
|
---|
41 | filelist_meta: TVirtualStringTree;
|
---|
42 | procedure NewCon(ID: Integer);
|
---|
43 |
|
---|
44 | procedure check_filternameClick(Sender: TObject);
|
---|
45 | procedure check_zerobyteClick(Sender: TObject);
|
---|
46 | procedure combo_extensionClick(Sender: TObject);
|
---|
47 | procedure btn_sortClick(Sender: TObject);
|
---|
48 | procedure listClick(Sender: TObject);
|
---|
49 | procedure listMouseDown(Sender: TObject; Button: TMouseButton;
|
---|
50 | Shift: TShiftState; X, Y: Integer);
|
---|
51 |
|
---|
52 | procedure popup_importClick(Sender: TObject);
|
---|
53 | procedure popup_exportClick(Sender: TObject);
|
---|
54 | procedure popup_opentool(Sender: TObject);
|
---|
55 | procedure popup_linkshereClick(Sender: TObject);
|
---|
56 | procedure filepopupPopup(Sender: TObject);
|
---|
57 | procedure filelist_metaGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
---|
58 | Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);
|
---|
59 | procedure filelist_metaInitChildren(Sender: TBaseVirtualTree;
|
---|
60 | Node: PVirtualNode; var ChildCount: Cardinal);
|
---|
61 | procedure filelist_metaPaintText(Sender: TBaseVirtualTree;
|
---|
62 | const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
|
---|
63 | TextType: TVSTTextType);
|
---|
64 | private
|
---|
65 | FSortBy: TSortType;
|
---|
66 | FAllowedExts: String;
|
---|
67 | FAllowMultiSelect: Boolean;
|
---|
68 | procedure SetAllowedExts(exts: String);
|
---|
69 | procedure SetMultiSelect(allow: Boolean);
|
---|
70 | public
|
---|
71 | constructor Create(AOwner: TComponent); override;
|
---|
72 | procedure RecreateExtList;
|
---|
73 | procedure LoadFileNames;
|
---|
74 | procedure SetFileFilters(pattern, extension: String; zerobytes: Boolean);
|
---|
75 | property AllowedExts: String read FAllowedExts write SetAllowedExts;
|
---|
76 | property AllowMultiSelect: Boolean read FAllowMultiSelect write SetMultiSelect;
|
---|
77 | end;
|
---|
78 |
|
---|
79 | implementation
|
---|
80 | {$R *.dfm}
|
---|
81 | uses ConnectionManager, Exporters, Functions, StrUtils, WhatLinksHere, Main,
|
---|
82 | _BaseTemplate, _MetaTypes, Data, _MetaManager, _FileTypes;
|
---|
83 |
|
---|
84 | type
|
---|
85 | PNodeData = ^TNodeData;
|
---|
86 |
|
---|
87 | TNodeData = record
|
---|
88 | Field: TObject;
|
---|
89 | end;
|
---|
90 |
|
---|
91 | function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode;
|
---|
92 | ARecord: TNodeData): PVirtualNode;
|
---|
93 | var
|
---|
94 | Data: PNodeData;
|
---|
95 | begin
|
---|
96 | Result := AVST.AddChild(ANode);
|
---|
97 | Data := AVST.GetNodeData(Result);
|
---|
98 | AVST.ValidateNode(Result, False);
|
---|
99 | Data^ := ARecord;
|
---|
100 | end;
|
---|
101 |
|
---|
102 |
|
---|
103 |
|
---|
104 | procedure TForm_TemplateFileList.RecreateExtList;
|
---|
105 | var
|
---|
106 | i: Integer;
|
---|
107 | exts: TStrings;
|
---|
108 | begin
|
---|
109 | combo_extension.Items.Clear;
|
---|
110 | if FConnectionID > -1 then
|
---|
111 | begin
|
---|
112 | combo_extension.Items.Add('_All files_ (' +
|
---|
113 | IntToStr(ConManager.Connection[FConnectionID].GetFileCount) + ')');
|
---|
114 | exts := nil;
|
---|
115 | exts := ConManager.Connection[FConnectionID].GetExtensionsList(EF_ExtCount);
|
---|
116 | for i := 0 to exts.Count - 1 do
|
---|
117 | if Length(FAllowedExts) > 0 then
|
---|
118 | begin
|
---|
119 | if Pos(MidStr(exts.Strings[i],1,4), FAllowedExts) > 0 then
|
---|
120 | combo_extension.Items.Add(exts.Strings[i]);
|
---|
121 | end
|
---|
122 | else
|
---|
123 | combo_extension.Items.Add(exts.Strings[i]);
|
---|
124 | combo_extension.ItemIndex := 0;
|
---|
125 | combo_extensionClick(Self);
|
---|
126 | exts.Free;
|
---|
127 | end;
|
---|
128 | end;
|
---|
129 |
|
---|
130 | procedure TForm_TemplateFileList.LoadFileNames;
|
---|
131 | var
|
---|
132 | Extension: String;
|
---|
133 | no_zero_bytes: Boolean;
|
---|
134 | pattern: String;
|
---|
135 | files: TStrings;
|
---|
136 | root: TExtensions;
|
---|
137 | i: Integer;
|
---|
138 | data: TNodeData;
|
---|
139 | node: PVirtualNode;
|
---|
140 | begin
|
---|
141 | if FConnectionID > -1 then
|
---|
142 | begin
|
---|
143 | Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4);
|
---|
144 | no_zero_bytes := not check_zerobyte.Checked;
|
---|
145 | pattern := '';
|
---|
146 | if check_filtername.Checked then
|
---|
147 | pattern := edit_filtername.Text;
|
---|
148 | if Extension = '_All' then
|
---|
149 | if Length(FAllowedExts) > 0 then
|
---|
150 | Extension := FAllowedExts
|
---|
151 | else
|
---|
152 | Extension := '';
|
---|
153 |
|
---|
154 | files := nil;
|
---|
155 | files := ConManager.Connection[FConnectionID].GetFilesList(extension, pattern, no_zero_bytes, FSortBy);
|
---|
156 |
|
---|
157 | filelist.Visible := False;
|
---|
158 | filelist.Items.Clear;
|
---|
159 | if files.Count > 0 then
|
---|
160 | filelist.Items.AddStrings(files);
|
---|
161 | filelist.Visible := True;
|
---|
162 |
|
---|
163 | //VST
|
---|
164 | filelist_meta.Clear;
|
---|
165 | filelist_meta.BeginUpdate;
|
---|
166 | root := ConManager.Connection[FConnectionID].MetaData.Root;
|
---|
167 | for i := 0 to High(root) do
|
---|
168 | begin
|
---|
169 | data.Field := root[i];
|
---|
170 | node := AddVSTEntry(filelist_meta, nil, data);
|
---|
171 | filelist_meta.HasChildren[node] := True;
|
---|
172 | end;
|
---|
173 | filelist_meta.EndUpdate;
|
---|
174 | end;
|
---|
175 | end;
|
---|
176 |
|
---|
177 |
|
---|
178 | procedure TForm_TemplateFileList.NewCon(ID: Integer);
|
---|
179 | begin
|
---|
180 | RecreateExtList;
|
---|
181 | end;
|
---|
182 |
|
---|
183 | procedure TForm_TemplateFileList.popup_exportClick(Sender: TObject);
|
---|
184 | var
|
---|
185 | id: Integer;
|
---|
186 | ext: String;
|
---|
187 | begin
|
---|
188 | id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]);
|
---|
189 | ext := RightStr(filelist.Items.Strings[filelist.ItemIndex], 4);
|
---|
190 | exportd.Filter := 'Files of matching extension (*.' + ext + ')|*.' + ext + '|All files|*.*';
|
---|
191 | exportd.DefaultExt := ext;
|
---|
192 | if exportd.Execute then
|
---|
193 | ExportDatFile(FConnectionID, id, exportd.FileName);
|
---|
194 | end;
|
---|
195 |
|
---|
196 | procedure TForm_TemplateFileList.popup_importClick(Sender: TObject);
|
---|
197 | var
|
---|
198 | id: Integer;
|
---|
199 | finfo: TFileInfo;
|
---|
200 | fs: TFileStream;
|
---|
201 | begin
|
---|
202 | if CR_EditDat in ConManager.Connection[FConnectionID].ChangeRights then
|
---|
203 | begin
|
---|
204 | id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]);
|
---|
205 | finfo := ConManager.Connection[FConnectionID].GetFileInfo(id);
|
---|
206 |
|
---|
207 | importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' +
|
---|
208 | finfo.Extension + '|All files|*.*';
|
---|
209 | if importd.Execute then
|
---|
210 | begin
|
---|
211 | fs := TFileStream.Create(importd.FileName, fmOpenRead);
|
---|
212 | if fs.Size <> finfo.Size then
|
---|
213 | begin
|
---|
214 | if not (CR_ResizeDat in ConManager.Connection[FConnectionID].ChangeRights) then
|
---|
215 | begin
|
---|
216 | ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) +
|
---|
217 | ', file has to have same size as file in .dat with this backend.' + CrLf +
|
---|
218 | 'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf +
|
---|
219 | 'Size of chosen file: ' + FormatFileSize(fs.Size));
|
---|
220 | Exit;
|
---|
221 | end else begin
|
---|
222 | if MessageBox(Self.Handle,
|
---|
223 | PChar('File has different size from the file in the .dat.' + CrLf +
|
---|
224 | 'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf +
|
---|
225 | 'Size of chosen file: ' + FormatFileSize(fs.Size) + CrLf +
|
---|
226 | 'Replace anyway?'), PChar('Different size'), MB_YESNO + MB_ICONWARNING) = ID_NO then
|
---|
227 | begin
|
---|
228 | Exit;
|
---|
229 | end;
|
---|
230 | end;
|
---|
231 | end;
|
---|
232 | ConManager.Connection[FConnectionID].UpdateDatFile(id, fs);
|
---|
233 | Self.listClick(Self);
|
---|
234 | fs.Free;
|
---|
235 | end;
|
---|
236 | end else begin
|
---|
237 | ShowMessage('Editing .dat-contents not allowed with this backend.');
|
---|
238 | end;
|
---|
239 | end;
|
---|
240 |
|
---|
241 |
|
---|
242 | procedure TForm_TemplateFileList.popup_linkshereClick(Sender: TObject);
|
---|
243 | begin
|
---|
244 | Form_WhatLinksHere.ConID := FConnectionID;
|
---|
245 | Form_WhatLinksHere.FileID := FSelectedFile.ID;
|
---|
246 | Form_WhatLinksHere.SenderForm := Self;
|
---|
247 | Form_WhatLinksHere.Show;
|
---|
248 | end;
|
---|
249 |
|
---|
250 | procedure TForm_TemplateFileList.popup_opentool(Sender: TObject);
|
---|
251 | var
|
---|
252 | sender_name, context: String;
|
---|
253 | id: Integer;
|
---|
254 | begin
|
---|
255 | sender_name := TComponent(Sender).Name;
|
---|
256 | id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]);
|
---|
257 | context := MidStr(sender_name, Pos('_', sender_name) + 1, Length(sender_name) - Pos('_', sender_name));
|
---|
258 | Form_Main.open_child(context, FConnectionID, id);
|
---|
259 | end;
|
---|
260 |
|
---|
261 |
|
---|
262 | procedure TForm_TemplateFileList.filepopupPopup(Sender: TObject);
|
---|
263 | var
|
---|
264 | ext: String;
|
---|
265 | i: Integer;
|
---|
266 | begin
|
---|
267 | ext := RightStr(filelist.Items.Strings[filelist.ItemIndex], 4);
|
---|
268 | for i := 0 to High(ToolList) do
|
---|
269 | begin
|
---|
270 | filepopup.Items.Items[i].Enabled := True;
|
---|
271 | if Length(ToolList[i].exts) > 0 then
|
---|
272 | if Pos(ext, ToolList[i].exts) = 0 then
|
---|
273 | filepopup.Items.Items[i].Enabled := False;
|
---|
274 | end;
|
---|
275 | end;
|
---|
276 |
|
---|
277 |
|
---|
278 | procedure TForm_TemplateFileList.check_zerobyteClick(Sender: TObject);
|
---|
279 | begin
|
---|
280 | LoadFileNames;
|
---|
281 | end;
|
---|
282 |
|
---|
283 | procedure TForm_TemplateFileList.btn_sortClick(Sender: TObject);
|
---|
284 | begin
|
---|
285 | if btn_sort_id_asc.Down then
|
---|
286 | FSortBy := ST_IDAsc
|
---|
287 | else if btn_sort_id_desc.Down then
|
---|
288 | FSortBy := ST_IDDesc
|
---|
289 | else if btn_sort_name_asc.Down then
|
---|
290 | FSortBy := ST_NameAsc
|
---|
291 | else if btn_sort_name_desc.Down then
|
---|
292 | FSortBy := ST_NameDesc
|
---|
293 | else if btn_sort_ext_asc.Down then
|
---|
294 | FSortBy := ST_ExtAsc
|
---|
295 | else if btn_sort_ext_desc.Down then
|
---|
296 | FSortBy := ST_ExtDesc;
|
---|
297 | LoadFileNames;
|
---|
298 | end;
|
---|
299 |
|
---|
300 | procedure TForm_TemplateFileList.check_filternameClick(Sender: TObject);
|
---|
301 | begin
|
---|
302 | edit_filtername.Enabled := not check_filtername.Checked;
|
---|
303 | LoadFileNames;
|
---|
304 | end;
|
---|
305 |
|
---|
306 | procedure TForm_TemplateFileList.combo_extensionClick(Sender: TObject);
|
---|
307 | begin
|
---|
308 | LoadFileNames;
|
---|
309 | end;
|
---|
310 |
|
---|
311 | procedure TForm_TemplateFileList.listClick(Sender: TObject);
|
---|
312 | var
|
---|
313 | fileid: Integer;
|
---|
314 | begin
|
---|
315 | if filelist.ItemIndex > -1 then
|
---|
316 | begin
|
---|
317 | fileid := ConManager.Connection[FConnectionID].ExtractFileIDOfName(
|
---|
318 | filelist.Items.Strings[filelist.ItemIndex]);
|
---|
319 | FSelectedFile := ConManager.Connection[FConnectionID].GetFileInfo(fileid);
|
---|
320 | if Assigned(FOnNewFileSelected) then
|
---|
321 | FOnNewFileSelected(FSelectedFile);
|
---|
322 | end;
|
---|
323 | end;
|
---|
324 |
|
---|
325 | procedure TForm_TemplateFileList.listMouseDown(Sender: TObject; Button: TMouseButton;
|
---|
326 | Shift: TShiftState; X, Y: Integer);
|
---|
327 | var
|
---|
328 | pt: TPoint;
|
---|
329 | begin
|
---|
330 | pt.X := x;
|
---|
331 | pt.Y := y;
|
---|
332 | if Shift = [ssRight] then
|
---|
333 | begin
|
---|
334 | filelist.ItemIndex := filelist.ItemAtPos(pt, true);
|
---|
335 | Self.listClick(Self);
|
---|
336 | end;
|
---|
337 | end;
|
---|
338 |
|
---|
339 |
|
---|
340 |
|
---|
341 | procedure TForm_TemplateFileList.SetAllowedExts(exts: String);
|
---|
342 | begin
|
---|
343 | FAllowedExts := exts;
|
---|
344 | RecreateExtList;
|
---|
345 | end;
|
---|
346 |
|
---|
347 | procedure TForm_TemplateFileList.SetFileFilters(pattern, extension: String;
|
---|
348 | zerobytes: Boolean);
|
---|
349 | var
|
---|
350 | i: Integer;
|
---|
351 | begin
|
---|
352 | if Length(pattern) > 0 then
|
---|
353 | Self.edit_filtername.Text := pattern;
|
---|
354 | Self.check_filtername.Checked := Length(pattern) > 0;
|
---|
355 | if Length(extension) > 0 then
|
---|
356 | begin
|
---|
357 | for i := 0 to Self.combo_extension.Items.Count - 1 do
|
---|
358 | if Pos(extension, Self.combo_extension.Items.Strings[i]) > 0 then
|
---|
359 | Break;
|
---|
360 | if i < Self.combo_extension.Items.Count then
|
---|
361 | Self.combo_extension.ItemIndex := i
|
---|
362 | else
|
---|
363 | Self.combo_extension.ItemIndex := -1;
|
---|
364 | end;
|
---|
365 | Self.check_zerobyte.Checked := zerobytes;
|
---|
366 | Self.LoadFileNames;
|
---|
367 | end;
|
---|
368 |
|
---|
369 | procedure TForm_TemplateFileList.SetMultiSelect(allow: Boolean);
|
---|
370 | begin
|
---|
371 | FAllowMultiSelect := allow;
|
---|
372 | filelist.MultiSelect := allow;
|
---|
373 | end;
|
---|
374 |
|
---|
375 |
|
---|
376 |
|
---|
377 | constructor TForm_TemplateFileList.Create(AOwner: TComponent);
|
---|
378 | var
|
---|
379 | i: Integer;
|
---|
380 | item: TMenuItem;
|
---|
381 | begin
|
---|
382 | inherited;
|
---|
383 | filelist_meta.NodeDataSize := SizeOf(TNodeData);
|
---|
384 | filelist_meta.Font.Charset := AppSettings.CharSet;
|
---|
385 | filelist_meta.Clear;
|
---|
386 |
|
---|
387 | FAllowedExts := '';
|
---|
388 | FAllowMultiSelect := False;
|
---|
389 | FOnNewConnection := NewCon;
|
---|
390 | UpdateConList;
|
---|
391 | if Length(ToolList) > 0 then
|
---|
392 | begin
|
---|
393 | for i := 0 to High(ToolList) do
|
---|
394 | begin
|
---|
395 | item := TMenuItem.Create(filepopup);
|
---|
396 | item.Name := 'popup_' + ToolList[i].context;
|
---|
397 | item.Caption := 'Open with ' + ToolList[i].name;
|
---|
398 | item.OnClick := Self.popup_opentool;
|
---|
399 | filepopup.Items.Insert(i, item);
|
---|
400 | end;
|
---|
401 | end;
|
---|
402 | end;
|
---|
403 |
|
---|
404 |
|
---|
405 |
|
---|
406 | procedure TForm_TemplateFileList.filelist_metaGetText(Sender: TBaseVirtualTree;
|
---|
407 | Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
|
---|
408 | var CellText: WideString);
|
---|
409 | var
|
---|
410 | data: PNodeData;
|
---|
411 | begin
|
---|
412 | inherited;
|
---|
413 | data := Sender.GetNodeData(Node);
|
---|
414 | if data.Field is TExtension then
|
---|
415 | begin
|
---|
416 | CellText := TExtension(data.Field).Ext;
|
---|
417 | end;
|
---|
418 | if data.Field is TFile then
|
---|
419 | begin
|
---|
420 | if TFile(data.Field).FileName = '' then
|
---|
421 | CellText := TFile(data.Field).FileExt + ' (unnamed)'
|
---|
422 | else
|
---|
423 | CellText := TFile(data.Field).FileExt + ': ' + TFile(data.Field).FileName;
|
---|
424 | end;
|
---|
425 | end;
|
---|
426 |
|
---|
427 |
|
---|
428 | procedure TForm_TemplateFileList.filelist_metaInitChildren(
|
---|
429 | Sender: TBaseVirtualTree; Node: PVirtualNode; var ChildCount: Cardinal);
|
---|
430 | var
|
---|
431 | data: PNodeData;
|
---|
432 | i: Integer;
|
---|
433 | newdata: TNodeData;
|
---|
434 | newnode: PVirtualNode;
|
---|
435 | id: Integer;
|
---|
436 | begin
|
---|
437 | inherited;
|
---|
438 | data := Sender.GetNodeData(Node);
|
---|
439 | Self.Cursor := crHourGlass;
|
---|
440 | Application.ProcessMessages;
|
---|
441 | if data.Field is TExtension then
|
---|
442 | begin
|
---|
443 | if TExtension(data.Field).FileCount = 0 then
|
---|
444 | TExtension(data.Field).InitList;
|
---|
445 | for i := 0 to TExtension(data.Field).FileCount - 1 do
|
---|
446 | begin
|
---|
447 | id := TExtension(data.Field).Files[i];
|
---|
448 | ConManager.Connection[FConnectionID].MetaData.InitFile(id);
|
---|
449 | newdata.Field := ConManager.Connection[FConnectionID].MetaData.FileById[id];
|
---|
450 | newnode := AddVSTEntry(filelist_meta, Node, newdata);
|
---|
451 | if ConManager.Connection[FConnectionID].MetaData.FileById[id].ChildCount > 0 then
|
---|
452 | filelist_meta.HasChildren[newnode] := True;
|
---|
453 | ChildCount := filelist_meta.ChildCount[node];
|
---|
454 | end;
|
---|
455 | end;
|
---|
456 | if data.Field is TFile then
|
---|
457 | begin
|
---|
458 | for i := 0 to TFile(data.Field).ChildCount - 1 do
|
---|
459 | begin
|
---|
460 | id := TFile(data.Field).LinkByIndex[i].DestID;
|
---|
461 | ConManager.Connection[FConnectionID].MetaData.InitFile(id);
|
---|
462 | newdata.Field := ConManager.Connection[FConnectionID].MetaData.FileById[id];
|
---|
463 | newnode := AddVSTEntry(filelist_meta, Node, newdata);
|
---|
464 | if ConManager.Connection[FConnectionID].MetaData.FileById[id].ChildCount > 0 then
|
---|
465 | filelist_meta.HasChildren[newnode] := True;
|
---|
466 | end;
|
---|
467 | ChildCount := filelist_meta.ChildCount[node];
|
---|
468 | end;
|
---|
469 | Self.Cursor := crDefault;
|
---|
470 | end;
|
---|
471 |
|
---|
472 | procedure TForm_TemplateFileList.filelist_metaPaintText(
|
---|
473 | Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode;
|
---|
474 | Column: TColumnIndex; TextType: TVSTTextType);
|
---|
475 | var
|
---|
476 | Data: PNodeData;
|
---|
477 | begin
|
---|
478 | Data := Sender.GetNodeData(Node);
|
---|
479 | if Data.Field is TFile then
|
---|
480 | begin
|
---|
481 | if Length(TFile(Data.Field).FileName) = 0 then
|
---|
482 | TargetCanvas.Font.Color := $C06060;
|
---|
483 | if TFile(Data.Field).FileSize = 0 then
|
---|
484 | TargetCanvas.Font.Color := $2020A0;
|
---|
485 | end;
|
---|
486 | end;
|
---|
487 |
|
---|
488 | end.
|
---|