- Timestamp:
- Jul 14, 2007, 6:50:55 PM (17 years ago)
- Location:
- oup/current
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/FileClasses/_EmptyFile.pas
r236 r238 8 8 type 9 9 TFile_Empty = class(TFile) 10 public11 procedure InitDataFields; override;12 10 end; 13 11 14 12 implementation 15 13 16 uses17 ConnectionManager, Math, Classes, TypeDefs, _DataTypes;18 19 procedure TFile_Empty.InitDataFields;20 begin21 inherited;22 FDataFields := TBlock.Create(Self, nil, 'Base', '', []);23 end;24 25 26 14 end. 27 15 -
oup/current/FileClasses/_FileTypes.pas
r237 r238 66 66 FChanged := False; 67 67 68 FDataFields := nil; 69 FEditor := nil; 70 68 71 if not (Self is TFile_Empty) then 69 begin70 FDataFields := nil;71 72 InitDataFields; 72 FEditor := nil;73 end74 else75 begin76 FEditor := nil;77 end;78 73 end; 79 74 … … 106 101 begin 107 102 if FDataFields <> nil then 108 Result := FDataFields.ChildCount; 103 Result := FDataFields.ChildCount 104 else 105 Result := 0; 109 106 end; 110 107 -
oup/current/FileClasses/_TreeElement.pas
r233 r238 11 11 private 12 12 public 13 property ConnectionID: Integer read FConnectionID; 13 14 property ChildCount: Integer read GetChildCount; 14 15 property Child[ID: Integer]: TTreeElement read GetChild; -
oup/current/Tools/MetaEditor.dfm
r237 r238 47 47 OnGetText = VSTGetText 48 48 OnPaintText = VSTPaintText 49 OnGetPopupMenu = VSTGetPopupMenu 49 50 OnInitChildren = VSTInitChildren 50 51 Columns = < … … 79 80 Caption = 'Meta Edit' 80 81 ImageIndex = 1 81 ExplicitLeft = 082 ExplicitTop = 083 ExplicitWidth = 084 ExplicitHeight = 085 82 end 86 83 object tab_hex: TTabSheet … … 313 310 Top = 340 314 311 end 312 object vst_popup: TPopupMenu 313 AutoHotkeys = maManual 314 Left = 80 315 Top = 204 316 object vst_newRoot: TMenuItem 317 Caption = 'Set as root element in new window' 318 end 319 object vst_setRoot: TMenuItem 320 Caption = 'Set as root element here' 321 OnClick = vst_setRootClick 322 end 323 end 315 324 end -
oup/current/Tools/MetaEditor.pas
r237 r238 31 31 btn_export: TButton; 32 32 btn_import: TButton; 33 vst_popup: TPopupMenu; 34 vst_newRoot: TMenuItem; 35 vst_setRoot: TMenuItem; 33 36 procedure FormCreate(Sender: TObject); 34 37 procedure VSTInitChildren(Sender: TBaseVirtualTree; Node: PVirtualNode; … … 45 48 const TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex; 46 49 TextType: TVSTTextType); 50 procedure VSTGetPopupMenu(Sender: TBaseVirtualTree; Node: PVirtualNode; 51 Column: TColumnIndex; const P: TPoint; var AskParent: Boolean; 52 var PopupMenu: TPopupMenu); 53 procedure vst_setRootClick(Sender: TObject); 47 54 private 48 55 root: TTreeElement; 49 56 procedure NewCon(ID: Integer); 50 57 public 58 procedure SetRoot(TreeElem: TTreeElement); 51 59 end; 52 60 … … 76 84 77 85 procedure TForm_Meta.NewCon(ID: Integer); 86 begin 87 if ID >= 0 then 88 SetRoot(ConManager.Connection[FConnectionID].MetaData.Root); 89 end; 90 91 92 procedure TForm_Meta.SetRoot(TreeElem: TTreeElement); 78 93 var 79 94 i: Integer; 80 95 data: TNodeData; 81 96 node: PVirtualNode; 82 Meta: TMetaManager; 83 root: TTreeElement; 84 begin 85 if ID >= 0 then 86 begin 87 //VST 88 VST.Clear; 89 VST.BeginUpdate; 90 // root := ConManager.Connection[FConnectionID].MetaData.Root; 91 root := ConManager.Connection[FConnectionID].MetaData.FileById[454]; 92 for i := 0 to root.ChildCount - 1 do 93 begin 94 data.Field := root.Child[i]; 95 node := AddVSTEntry(VST, nil, data); 97 begin 98 if FConnectionID <> TreeElem.ConnectionID then 99 SelectConnection(TreeElem.ConnectionID); 100 root := TreeElem; 101 VST.Clear; 102 VST.BeginUpdate; 103 for i := 0 to root.ChildCount - 1 do 104 begin 105 data.Field := root.Child[i]; 106 node := AddVSTEntry(VST, nil, data); 107 if data.Field.ChildCount > 0 then 96 108 VST.HasChildren[node] := True; 97 end; 98 VST.EndUpdate; 99 end; 100 end; 101 109 end; 110 VST.EndUpdate; 111 end; 102 112 103 113 procedure TForm_Meta.VSTInitChildren(Sender: TBaseVirtualTree; … … 239 249 240 250 251 procedure TForm_Meta.VSTGetPopupMenu(Sender: TBaseVirtualTree; 252 Node: PVirtualNode; Column: TColumnIndex; const P: TPoint; 253 var AskParent: Boolean; var PopupMenu: TPopupMenu); 254 var 255 data: PNodeData; 256 begin 257 inherited; 258 AskParent := False; 259 if Assigned(Node) then 260 begin 261 Sender.Selected[Node] := True; 262 Sender.FocusedNode := Node; 263 data := Sender.GetNodeData(Node); 264 if Column = 0 then 265 begin 266 if TTreeElement(data.Field).GetChildCount > 0 then 267 PopupMenu := vst_popup 268 else 269 PopupMenu := nil; 270 end; 271 end; 272 end; 273 274 procedure TForm_Meta.vst_setRootClick(Sender: TObject); 275 var 276 data: PNodeData; 277 begin 278 inherited; 279 data := VST.GetNodeData(VST.FocusedNode); 280 SetRoot(data.Field); 281 end; 282 241 283 procedure TForm_Meta.FormClose(Sender: TObject; var Action: TCloseAction); 242 284 begin
Note:
See TracChangeset
for help on using the changeset viewer.