ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Tools/MetaEditor.pas
(Generate patch)

Comparing oup/current/Tools/MetaEditor.pas (file contents):
Revision 232 by alloc, Thu Jun 28 09:24:08 2007 UTC vs.
Revision 233 by alloc, Fri Jun 29 12:38:24 2007 UTC

# Line 5 | Line 5 | interface
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)
# Line 20 | Line 20 | type
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);
# Line 35 | Line 45 | type
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;
# Line 48 | Line 59 | type
59    PNodeData = ^TNodeData;
60  
61    TNodeData = record
62 <    Field: TObject;
62 >    Field: TTreeElement;
63    end;
64  
65   function AddVSTEntry(AVST: TCustomVirtualStringTree; ANode: PVirtualNode;
# Line 69 | Line 80 | var
80    data: TNodeData;
81    node: PVirtualNode;
82    Meta: TMetaManager;
83 <  root: TExtensions;
83 >  root: TTreeElement;
84   begin
85    if ID >= 0 then
86    begin
# Line 77 | Line 88 | 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;
# Line 95 | Line 106 | var
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;
# Line 204 | Line 192 | begin
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

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)