Changeset 238 for oup/current/Tools
- Timestamp:
- Jul 14, 2007, 6:50:55 PM (17 years ago)
- Location:
- oup/current/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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.