Changeset 217 for oup/current
- Timestamp:
- Jun 15, 2007, 5:12:11 PM (17 years ago)
- Location:
- oup/current/Tools
- Files:
-
- 6 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Tools/BinEdit.pas
r204 r217 3 3 uses 4 4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 Dialogs, Template, StdCtrls, ExtCtrls, VirtualTrees, Grids, Wrapgrid, 6 MPHexEditor, VTHeaderPopup, Menus, StrUtils, Clipbrd, 7 Data, TypeDefs, ConnectionManager, Buttons; 5 Dialogs, VirtualTrees, Grids, Wrapgrid, MPHexEditor, StdCtrls, 6 Menus, VTHeaderPopup, ExtCtrls, Buttons, StrUtils, Clipbrd, 7 Data, TypeDefs, ConnectionManager, Template, 8 _BaseTemplate, _TemplateFile, _TemplateFileList; 8 9 9 10 type … … 760 761 nodedata: PNodeData; 761 762 rawinfo: TRawDataInfo; 762 form: TForm_T oolTemplate;763 form: TForm_TemplateFileList; 763 764 begin 764 765 if VST.FocusedColumn = 3 then … … 781 782 begin 782 783 form := nil; 783 form := Form_Main.open_child('rawedit', ConID, fileid);784 form := TForm_TemplateFileList(Form_Main.open_child('rawedit', ConID, fileid)); 784 785 if Assigned(form) then 785 786 TForm_RawEdit(form).LoadRaw(rawinfo); … … 800 801 if (nodedata.DataType >= 100) and (nodedata.DataType <= 300) then 801 802 begin 802 form := Form_Main.open_child('binedit', ConID, -1);803 form := TForm_TemplateFileList(Form_Main.open_child('binedit', ConID)); 803 804 if Assigned(form) then 804 805 form.SetFileFilters(nodedata.Value, '', False); -
oup/current/Tools/MetaEditor.dfm
r216 r217 1 object Form_Meta: TForm_Meta 2 Left = 0 3 Top = 0 1 inherited Form_Meta: TForm_Meta 4 2 Caption = 'Form_Meta' 5 ClientHeight = 3936 ClientWidth = 4727 Color = clBtnFace8 Constraints.MinHeight = 1009 Constraints.MinWidth = 20010 Font.Charset = DEFAULT_CHARSET11 Font.Color = clWindowText12 Font.Height = -1113 Font.Name = 'Tahoma'14 Font.Style = []15 FormStyle = fsMDIChild16 OldCreateOrder = False17 Visible = True18 WindowState = wsMaximized19 OnClose = FormClose20 3 OnCreate = FormCreate 21 4 PixelsPerInch = 96 22 5 TextHeight = 13 23 object Splitter1: TSplitter 24 Left = 384 25 Top = 29 26 Width = 8 27 Height = 364 28 Align = alRight 29 AutoSnap = False 30 Beveled = True 31 MinSize = 75 32 ExplicitLeft = 301 33 ExplicitHeight = 336 34 end 35 object VST: TVirtualStringTree 36 Left = 0 37 Top = 29 38 Width = 384 39 Height = 364 40 Align = alClient 41 AnimationDuration = 0 42 Header.AutoSizeIndex = 0 43 Header.Font.Charset = DEFAULT_CHARSET 44 Header.Font.Color = clWindowText 45 Header.Font.Height = -11 46 Header.Font.Name = 'Tahoma' 47 Header.Font.Style = [] 48 Header.Options = [hoColumnResize, hoDrag, hoVisible] 49 TabOrder = 0 50 TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoDeleteMovedNodes] 51 TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning] 52 OnFocusChanged = VSTFocusChanged 53 OnFocusChanging = VSTFocusChanging 54 OnGetText = VSTGetText 55 OnPaintText = VSTPaintText 56 OnInitChildren = VSTInitChildren 57 Columns = < 58 item 59 Position = 0 60 Width = 250 61 WideText = 'FName' 62 end 63 item 64 Position = 1 65 WideText = 'FType' 66 end 67 item 68 Position = 2 69 WideText = 'FID' 70 end 71 item 72 Position = 3 73 WideText = 'Data' 74 end> 75 end 76 object Panel1: TPanel 77 Left = 0 78 Top = 0 79 Width = 472 80 Height = 29 81 Align = alTop 82 BevelOuter = bvNone 83 TabOrder = 1 84 ExplicitWidth = 446 85 DesignSize = ( 86 472 87 29) 88 object Label3: TLabel 89 Left = 3 90 Top = 6 91 Width = 61 92 Height = 13 93 Caption = 'Connection: ' 94 end 95 object Button1: TButton 96 Left = 379 97 Top = 1 98 Width = 75 99 Height = 25 100 Anchors = [akTop, akRight] 101 Caption = 'Load' 102 Default = True 103 TabOrder = 0 104 OnClick = Button1Click 105 ExplicitLeft = 196 106 end 107 object combo_connection: TComboBox 108 Left = 64 109 Top = 3 110 Width = 309 111 Height = 21 112 Style = csDropDownList 113 Anchors = [akLeft, akTop, akRight] 114 DropDownCount = 12 115 ItemHeight = 13 116 TabOrder = 1 117 ExplicitWidth = 126 6 inherited panel_connection: TPanel 7 ExplicitWidth = 598 8 inherited combo_connection: TComboBox 9 ExplicitWidth = 532 118 10 end 119 11 end 120 object Panel2: TPanel 121 Left = 392 122 Top = 29 123 Width = 80 124 Height = 364 125 Align = alRight 126 BevelOuter = bvNone 127 Caption = 'Panel2' 128 TabOrder = 2 129 ExplicitLeft = 329 130 ExplicitHeight = 336 12 inherited panel_basecontent: TPanel 13 ExplicitLeft = 0 14 ExplicitTop = 25 15 ExplicitWidth = 598 16 ExplicitHeight = 532 17 object splitter: TSplitter 18 Left = 502 19 Top = 0 20 Width = 8 21 Height = 532 22 Align = alRight 23 AutoSnap = False 24 Beveled = True 25 MinSize = 200 26 ExplicitLeft = 353 27 end 28 object VST: TVirtualStringTree 29 Left = 0 30 Top = 0 31 Width = 502 32 Height = 532 33 Align = alClient 34 AnimationDuration = 0 35 Header.AutoSizeIndex = 0 36 Header.Font.Charset = DEFAULT_CHARSET 37 Header.Font.Color = clWindowText 38 Header.Font.Height = -11 39 Header.Font.Name = 'Tahoma' 40 Header.Font.Style = [] 41 Header.Options = [hoColumnResize, hoDrag, hoVisible] 42 TabOrder = 0 43 TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScrollOnExpand, toAutoDeleteMovedNodes] 44 TreeOptions.MiscOptions = [toFullRepaintOnResize, toInitOnSave, toToggleOnDblClick, toWheelPanning] 45 OnFocusChanged = VSTFocusChanged 46 OnFocusChanging = VSTFocusChanging 47 OnGetText = VSTGetText 48 OnPaintText = VSTPaintText 49 OnInitChildren = VSTInitChildren 50 ExplicitLeft = 8 51 ExplicitTop = 60 52 ExplicitWidth = 353 53 ExplicitHeight = 325 54 Columns = < 55 item 56 Position = 0 57 Width = 250 58 WideText = 'FName' 59 end 60 item 61 Position = 1 62 WideText = 'FType' 63 end 64 item 65 Position = 2 66 WideText = 'FID' 67 end 68 item 69 Position = 3 70 WideText = 'Data' 71 end> 72 end 73 object Panel2: TPanel 74 Left = 510 75 Top = 0 76 Width = 88 77 Height = 532 78 Align = alRight 79 BevelOuter = bvNone 80 Caption = 'Panel2' 81 TabOrder = 1 82 ExplicitLeft = 376 83 ExplicitTop = 92 84 ExplicitHeight = 285 85 end 131 86 end 132 87 end -
oup/current/Tools/MetaEditor.pas
r214 r217 1 1 unit MetaEditor; 2 2 3 interface 4 3 5 uses 4 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 Dialogs, VirtualTrees, _MetaManager, StdCtrls, ExtCtrls;7 Dialogs, _BaseTemplate, ExtCtrls, VirtualTrees, StdCtrls; 6 8 7 9 type 8 TForm_Meta = class(TForm )10 TForm_Meta = class(TForm_BaseTemplate) 9 11 VST: TVirtualStringTree; 10 Panel1: TPanel;11 Button1: TButton;12 combo_connection: TComboBox;13 Label3: TLabel;14 Splitter1: TSplitter;15 12 Panel2: TPanel; 16 procedure FormClose(Sender: TObject; var Action: TCloseAction);13 splitter: TSplitter; 17 14 procedure FormCreate(Sender: TObject); 18 procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;19 Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString);20 procedure Button1Click(Sender: TObject);21 15 procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; 22 16 var ChildCount: Cardinal); 23 procedure VSTPaintText(Sender: TBaseVirtualTree; 24 const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; 25 TextType: TVSTTextType); 17 procedure FormClose(Sender: TObject; var Action: TCloseAction); 26 18 procedure VSTFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode; 27 19 Column: TColumnIndex); … … 29 21 NewNode: PVirtualNode; OldColumn, NewColumn: TColumnIndex; 30 22 var Allowed: Boolean); 23 procedure VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; 24 Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); 25 procedure VSTPaintText(Sender: TBaseVirtualTree; 26 const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; 27 TextType: TVSTTextType); 31 28 private 29 procedure NewCon(ID: Integer); 32 30 public 33 31 end; … … 37 35 38 36 implementation 39 uses40 Data, _DataTypes, _FileTypes, ConnectionManager, TypeDefs, StrUtils;41 37 {$R *.dfm} 38 uses _MetaManager, _FileTypes, Data; 42 39 43 40 type … … 60 57 61 58 62 63 procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; 64 Node: PVirtualNode; var ChildCount: Cardinal); 65 var 66 data: PNodeData; 67 newdata: TNodeData; 68 newnode: PVirtualNode; 69 i: Integer; 70 id: Integer; 71 begin 72 data := VST.GetNodeData(node); 73 for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do 74 begin 75 id := Meta.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID; 76 Meta.InitFile(id); 77 newdata.Field := Meta.FileById[id]; 78 newnode := AddVSTEntry(VST, Node, newdata); 79 if Meta.FileById[id].ChildCount > 0 then 80 VST.HasChildren[newnode] := True; 81 end; 82 ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount; 83 end; 84 85 86 procedure TForm_Meta.Button1Click(Sender: TObject); 87 var 88 name: String; 89 conid: Integer; 90 59 procedure TForm_Meta.NewCon(ID: Integer); 60 var 91 61 a,b,c: Int64; 92 62 i: Integer; … … 94 64 node: PVirtualNode; 95 65 begin 96 if combo_connection.ItemIndex >= 0 then 97 begin 98 name := combo_connection.Items.Strings[combo_connection.ItemIndex]; 99 conid := StrToInt(MidStr(name, Pos('[', name) + 1, Pos(']', name) - Pos('[', name) - 1)); 100 66 if ID >= 0 then 67 begin 101 68 QueryPerformanceFrequency(c); 102 69 QueryPerformanceCounter(a); 103 70 if not Assigned(Meta) then 104 Meta := TMetaManager.Create( conid);71 Meta := TMetaManager.Create(ID); 105 72 QueryPerformanceCounter(b); 106 73 ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's'); … … 122 89 end; 123 90 124 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); 125 begin 126 Meta.Free; 127 Action := caFree; 128 end; 129 130 131 procedure TForm_Meta.FormCreate(Sender: TObject); 132 var 91 92 procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; 93 Node: PVirtualNode; var ChildCount: Cardinal); 94 var 95 data: PNodeData; 96 newdata: TNodeData; 97 newnode: PVirtualNode; 133 98 i: Integer; 134 135 fn, datatype, boxstring: String; 136 level: Integer; 137 begin 138 combo_connection.ItemIndex := -1; 139 combo_connection.Items.Clear; 140 if ConManager.Count > 0 then 141 begin 142 for i := 0 to ConManager.Count - 1 do 143 begin 144 level := ConManager.ConnectionByIndex[i].LevelNumber; 145 fn := ExtractFileName(ConManager.ConnectionByIndex[i].FileName); 146 if ConManager.ConnectionByIndex[i].Backend = DB_ONI then 147 datatype := 'ONI-.dat: ' 148 else if ConManager.ConnectionByIndex[i].Backend = DB_ADB then 149 datatype := 'OUP-DB: ' 150 else 151 datatype := 'Unknown: '; 152 boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ') [' + IntToStr(ConManager.ConnectionByIndex[i].ConnectionID) + ']'; 153 combo_connection.Items.Add(boxstring); 154 end; 155 if combo_connection.ItemIndex = -1 then 156 begin 157 combo_connection.ItemIndex := 0; 158 end; 159 end; 160 161 162 VST.NodeDataSize := SizeOf(TNodeData); 163 VST.Font.Charset := AppSettings.CharSet; 164 VST.Clear; 165 end; 166 99 id: Integer; 100 begin 101 data := VST.GetNodeData(node); 102 for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do 103 begin 104 id := Meta.FileById[TFile(data.Field).FileID].LinkByIndex[i].DestID; 105 Meta.InitFile(id); 106 newdata.Field := Meta.FileById[id]; 107 newnode := AddVSTEntry(VST, Node, newdata); 108 if Meta.FileById[id].ChildCount > 0 then 109 VST.HasChildren[newnode] := True; 110 end; 111 ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount; 112 end; 167 113 168 114 … … 183 129 end; 184 130 end; 131 185 132 186 133 procedure TForm_Meta.VSTFocusChanging(Sender: TBaseVirtualTree; OldNode, … … 216 163 end; 217 164 165 218 166 procedure TForm_Meta.VSTGetText(Sender: TBaseVirtualTree; Node: PVirtualNode; 219 167 Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); … … 248 196 end; 249 197 end; 198 250 199 251 200 procedure TForm_Meta.VSTPaintText(Sender: TBaseVirtualTree; … … 273 222 end; 274 223 275 { 276 277 procedure WriteStructureInfos; 278 var 279 i, j: Integer; 280 pdata: PNodeData; 281 Data: TNodeData; 282 node: PVirtualNode; 283 begin 284 VST.BeginUpdate; 285 if VST.RootNodeCount = 0 then 286 begin 287 structs := LoadStructureDefinition(ConID, fileid); 288 if structs.Data then 289 begin 290 if Length(structs.Global) > 0 then 291 begin 292 for i := 0 to High(structs.Global) do 293 begin 294 Data.Caption := structs.Global[i].Name; 295 Data.Offset := structs.Global[i].offset; 296 Data.DataType := structs.Global[i].datatype; 297 Data.Value := GetValue(structs.Global[i].datatype, structs.Global[i].offset); 298 Data.Description := structs.Global[i].description; 299 AddVSTEntry(VST, nil, Data); 300 end; 301 end; 302 if Length(structs.Subs) > 0 then 303 begin 304 for i := 0 to High(structs.Subs) do 305 begin 306 with structs.Subs[i] do 307 begin 308 if Length(Entries) > 0 then 309 begin 310 if Pos('#', SubName) > 0 then 311 begin 312 Data.Offset := StrToInt('$'+MidStr(SubName, Pos('#', SubName) + 1, 8)); 313 Data.Value := '$' + 314 MidStr(SubName, PosEx('#', SubName, Pos('#', SubName) + 1) + 1, 8); 315 Data.Caption := MidStr(SubName, 1, Pos('#', SubName) - 1); 316 Data.Description := SubDesc; 317 end 318 else 319 begin 320 Data.Caption := SubName; 321 Data.Description := SubDesc; 322 Data.Offset := 0; 323 Data.Value := ''; 324 end; 325 Data.DataType := 0; 326 node := AddVSTEntry(VST, nil, Data); 327 Data.Description := ''; 328 for j := 0 to High(Entries) do 329 begin 330 Data.Caption := Entries[j].Name; 331 Data.Offset := Entries[j].offset; 332 Data.DataType := Entries[j].datatype; 333 Data.Value := GetValue(Entries[j].datatype, Entries[j].offset); 334 Data.Description := Entries[j].description; 335 AddVSTEntry(VST, node, Data); 336 end; 337 end; 338 end; 339 end; 340 end; 341 end; 342 if VST.RootNodeCount > 0 then 343 VST.FocusedNode := VST.GetFirst; 344 end 345 else 346 begin 347 Node := VST.GetFirst; 348 while Assigned(Node) do 349 begin 350 pdata := VST.GetNodeData(Node); 351 if pdata.DataType > 0 then 352 pdata.Value := GetValue(pdata.Datatype, pdata.Offset); 353 Node := VST.GetNext(Node); 354 end; 355 end; 356 VST.EndUpdate; 357 end; 358 } 224 225 226 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); 227 begin 228 Meta.Free; 229 inherited; 230 end; 231 232 procedure TForm_Meta.FormCreate(Sender: TObject); 233 begin 234 inherited; 235 OnNewConnection := NewCon; 236 FConnectionID := -1; 237 238 VST.NodeDataSize := SizeOf(TNodeData); 239 VST.Font.Charset := AppSettings.CharSet; 240 VST.Clear; 241 242 UpdateConList; 243 end; 244 359 245 end. -
oup/current/Tools/Template.pas
r117 r217 266 266 Form_WhatLinksHere.ConID := FConnectionID; 267 267 Form_WhatLinksHere.FileID := FSelectedFile.ID; 268 Form_WhatLinksHere.SenderForm := Self;268 // Form_WhatLinksHere.SenderForm := Self; 269 269 Form_WhatLinksHere.Show; 270 270 end;
Note:
See TracChangeset
for help on using the changeset viewer.