Changeset 229 for oup/current/Tools
- Timestamp:
- Jun 20, 2007, 12:57:51 PM (18 years ago)
- Location:
- oup/current/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Tools/MetaEditor.dfm
r218 r229 4 4 PixelsPerInch = 96 5 5 TextHeight = 13 6 inherited panel_connection: TPanel7 ExplicitWidth = 5988 inherited combo_connection: TComboBox9 ExplicitWidth = 53210 end11 end12 6 inherited panel_basecontent: TPanel 13 7 ExplicitLeft = 0 -
oup/current/Tools/MetaEditor.pas
r218 r229 31 31 end; 32 32 33 var34 Form_Meta: TForm_Meta;35 33 36 34 implementation … … 64 62 node: PVirtualNode; 65 63 begin 64 { 66 65 if ID >= 0 then 67 66 begin … … 69 68 QueryPerformanceCounter(a); 70 69 if not Assigned(Meta) then 71 Meta := TMetaManager.Create(ID );70 Meta := TMetaManager.Create(ID, Self); 72 71 QueryPerformanceCounter(b); 73 72 ShowMessage('Loading Done - ' + FloatToStr((b-a)/c) + 's'); … … 87 86 VST.EndUpdate; 88 87 end; 88 } 89 89 end; 90 90 … … 99 99 id: Integer; 100 100 begin 101 { 101 102 data := VST.GetNodeData(node); 102 103 for i := 0 to Meta.FileById[TFile(data.Field).FileID].ChildCount - 1 do … … 110 111 end; 111 112 ChildCount := Meta.FileById[TFile(data.Field).FileID].ChildCount; 113 } 112 114 end; 113 115 … … 226 228 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); 227 229 begin 228 Meta.Free;230 // Meta.Free; 229 231 inherited; 230 232 end; -
oup/current/Tools/_TemplateFileList.dfm
r227 r229 33 33 Margins.Right = 1 34 34 Margins.Bottom = 0 35 ActivePage = tab_ files35 ActivePage = tab_meta 36 36 Align = alClient 37 37 TabOrder = 0 … … 284 284 Header.Options = [hoColumnResize, hoDrag] 285 285 TabOrder = 0 286 OnGetText = filelist_metaGetText 287 OnPaintText = filelist_metaPaintText 288 OnInitChildren = filelist_metaInitChildren 286 289 Columns = <> 287 290 end -
oup/current/Tools/_TemplateFileList.pas
r227 r229 55 55 procedure popup_linkshereClick(Sender: TObject); 56 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); 57 64 private 58 65 FSortBy: TSortType; … … 73 80 {$R *.dfm} 74 81 uses ConnectionManager, Exporters, Functions, StrUtils, WhatLinksHere, Main, 75 _BaseTemplate; 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 76 102 77 103 … … 108 134 pattern: String; 109 135 files: TStrings; 136 root: TExtensions; 137 i: Integer; 138 data: TNodeData; 139 node: PVirtualNode; 110 140 begin 111 141 if FConnectionID > -1 then … … 130 160 filelist.Items.AddStrings(files); 131 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; 132 174 end; 133 175 end; … … 217 259 end; 218 260 261 219 262 procedure TForm_TemplateFileList.filepopupPopup(Sender: TObject); 220 263 var … … 338 381 begin 339 382 inherited; 383 filelist_meta.NodeDataSize := SizeOf(TNodeData); 384 filelist_meta.Font.Charset := AppSettings.CharSet; 385 filelist_meta.Clear; 386 340 387 FAllowedExts := ''; 341 388 FAllowMultiSelect := False; … … 356 403 357 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 if data.Field is TExtension then 440 begin 441 if TExtension(data.Field).FileCount = 0 then 442 TExtension(data.Field).InitList; 443 for i := 0 to TExtension(data.Field).FileCount - 1 do 444 begin 445 id := TExtension(data.Field).Files[i]; 446 ConManager.Connection[FConnectionID].MetaData.InitFile(id); 447 newdata.Field := ConManager.Connection[FConnectionID].MetaData.FileById[id]; 448 newnode := AddVSTEntry(filelist_meta, Node, newdata); 449 if ConManager.Connection[FConnectionID].MetaData.FileById[id].ChildCount > 0 then 450 filelist_meta.HasChildren[newnode] := True; 451 ChildCount := filelist_meta.ChildCount[node]; 452 end; 453 end; 454 if data.Field is TFile then 455 begin 456 for i := 0 to TFile(data.Field).ChildCount - 1 do 457 begin 458 id := TFile(data.Field).LinkByIndex[i].DestID; 459 ConManager.Connection[FConnectionID].MetaData.InitFile(id); 460 newdata.Field := ConManager.Connection[FConnectionID].MetaData.FileById[id]; 461 newnode := AddVSTEntry(filelist_meta, Node, newdata); 462 if ConManager.Connection[FConnectionID].MetaData.FileById[id].ChildCount > 0 then 463 filelist_meta.HasChildren[newnode] := True; 464 end; 465 ChildCount := filelist_meta.ChildCount[node]; 466 end; 467 end; 468 469 procedure TForm_TemplateFileList.filelist_metaPaintText( 470 Sender: TBaseVirtualTree; const TargetCanvas: TCanvas; Node: PVirtualNode; 471 Column: TColumnIndex; TextType: TVSTTextType); 472 var 473 Data: PNodeData; 474 begin 475 Data := Sender.GetNodeData(Node); 476 if Data.Field is TFile then 477 begin 478 if Length(TFile(Data.Field).FileName) = 0 then 479 TargetCanvas.Font.Color := $C06060; 480 if TFile(Data.Field).FileSize = 0 then 481 TargetCanvas.Font.Color := $2020A0; 482 end; 483 end; 484 358 485 end.
Note:
See TracChangeset
for help on using the changeset viewer.