5 |
|
uses |
6 |
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
7 |
|
Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls, ComCtrls, Grids, |
8 |
< |
MPHexEditor, Wrapgrid; |
8 |
> |
MPHexEditor, Wrapgrid, VTHeaderPopup, Menus, _TreeElement; |
9 |
|
|
10 |
|
type |
11 |
|
TForm_Meta = class(TForm_BaseTemplate) |
20 |
|
value_viewer: TWrapGrid; |
21 |
|
splitter_hex_2: TSplitter; |
22 |
|
structviewer: TVirtualStringTree; |
23 |
+ |
value_viewer_context: TPopupMenu; |
24 |
+ |
value_viewer_context_copy: TMenuItem; |
25 |
+ |
value_viewer_context_copyasdec: TMenuItem; |
26 |
+ |
value_viewer_context_copyasfloat: TMenuItem; |
27 |
+ |
value_viewer_context_copyasbitset: TMenuItem; |
28 |
+ |
value_viewer_context_copyasstring: TMenuItem; |
29 |
+ |
value_viewer_context_copyashex: TMenuItem; |
30 |
+ |
VTHPopup: TVTHeaderPopupMenu; |
31 |
+ |
btn_export: TButton; |
32 |
+ |
btn_import: TButton; |
33 |
|
procedure FormCreate(Sender: TObject); |
34 |
|
procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; |
35 |
|
var ChildCount: Cardinal); |
45 |
|
const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; |
46 |
|
TextType: TVSTTextType); |
47 |
|
private |
48 |
+ |
root: TTreeElement; |
49 |
|
procedure NewCon(ID: Integer); |
50 |
|
public |
51 |
|
end; |
59 |
|
PNodeData = ^TNodeData; |
60 |
|
|
61 |
|
TNodeData = record |
62 |
< |
Field: TObject; |
62 |
> |
Field: TTreeElement; |
63 |
|
end; |
64 |
|
|
65 |
|
function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode; |
80 |
|
data: TNodeData; |
81 |
|
node: PVirtualNode; |
82 |
|
Meta: TMetaManager; |
83 |
< |
root: TExtensions; |
83 |
> |
root: TTreeElement; |
84 |
|
begin |
85 |
|
if ID >= 0 then |
86 |
|
begin |
88 |
|
VST.Clear; |
89 |
|
VST.BeginUpdate; |
90 |
|
root := ConManager.Connection[FConnectionID].MetaData.Root; |
91 |
< |
for i := 0 to High(root) do |
91 |
> |
for i := 0 to root.ChildCount - 1 do |
92 |
|
begin |
93 |
< |
data.Field := root[i]; |
93 |
> |
data.Field := root.Child[i]; |
94 |
|
node := AddVSTEntry(VST, nil, data); |
95 |
|
VST.HasChildren[node] := True; |
96 |
|
end; |
106 |
|
newdata: TNodeData; |
107 |
|
newnode: PVirtualNode; |
108 |
|
i: Integer; |
98 |
– |
id: Integer; |
109 |
|
Meta: TMetaManager; |
110 |
|
begin |
111 |
|
data := Sender.GetNodeData(node); |
112 |
|
Meta := ConManager.Connection[ConnectionID].MetaData; |
103 |
– |
if data.Field is TFile then |
104 |
– |
begin |
105 |
– |
if TFile(data.Field).ChildCount > 0 then |
106 |
– |
begin |
107 |
– |
for i := 0 to TFile(data.Field).ChildCount - 1 do |
108 |
– |
begin |
109 |
– |
id := TFile(data.Field).LinkByIndex[i].DestID; |
110 |
– |
Meta.InitFile(id); |
111 |
– |
newdata.Field := Meta.FileById[id]; |
112 |
– |
newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); |
113 |
– |
if Meta.FileById[id].ChildCount > 0 then |
114 |
– |
Sender.HasChildren[newnode] := True; |
115 |
– |
end; |
116 |
– |
end; |
117 |
– |
if TFile(data.Field).RawCount > 0 then |
118 |
– |
begin |
119 |
– |
for i := 0 to TFile(data.Field).RawCount - 1 do |
120 |
– |
begin |
121 |
– |
// Exit; |
122 |
– |
end; |
123 |
– |
end; |
124 |
– |
end; |
113 |
|
if data.Field is TExtension then |
114 |
< |
begin |
127 |
< |
if TExtension(data.Field).FileCount = 0 then |
114 |
> |
if TExtension(data.Field).ChildCount = 0 then |
115 |
|
TExtension(data.Field).InitList; |
116 |
< |
for i := 0 to TExtension(data.Field).FileCount - 1 do |
116 |
> |
|
117 |
> |
if data.Field.ChildCount > 0 then |
118 |
> |
begin |
119 |
> |
for i := 0 to data.Field.ChildCount - 1 do |
120 |
|
begin |
121 |
< |
id := TExtension(data.Field).Files[i]; |
132 |
< |
Meta.InitFile(id); |
133 |
< |
newdata.Field := Meta.FileById[id]; |
121 |
> |
newdata.Field := data.Field.Child[i]; |
122 |
|
newnode := AddVSTEntry(TCustomVirtualStringTree(Sender), Node, newdata); |
123 |
< |
if Meta.FileById[id].ChildCount > 0 then |
123 |
> |
if newdata.Field.ChildCount > 0 then |
124 |
|
Sender.HasChildren[newnode] := True; |
125 |
|
end; |
126 |
|
end; |
192 |
|
case Column of |
193 |
|
0: |
194 |
|
begin |
195 |
< |
if Data.Field is TFile then |
208 |
< |
begin |
209 |
< |
CellText := TFile(Data.Field).FileInfo.Name; |
210 |
< |
if CellText = '' then |
211 |
< |
CellText := 'Unnamed'; |
212 |
< |
end; |
213 |
< |
if Data.Field is TExtension then |
214 |
< |
CellText := TExtension(Data.Field).Ext; |
195 |
> |
CellText := Data.Field.GetCaption; |
196 |
|
end; |
197 |
|
1: |
198 |
|
begin |