source: oup/rewrite/Helper/WhatLinksHere.pas@ 107

Last change on this file since 107 was 107, checked in by alloc, 18 years ago
File size: 2.0 KB
Line 
1unit WhatLinksHere;
2interface
3uses
4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
5 Dialogs, StdCtrls, Template;
6
7type
8 TForm_WhatLinksHere = class(TForm)
9 list: TListBox;
10 label_what: TLabel;
11 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
12 procedure FormShow(Sender: TObject);
13 procedure listDblClick(Sender: TObject);
14 private
15 public
16 SenderForm: TForm_ToolTemplate;
17 ConID: Integer;
18 FileID: Integer;
19 end;
20
21var
22 Form_WhatLinksHere: TForm_WhatLinksHere;
23
24implementation
25{$R *.dfm}
26uses ConnectionManager, Access_OUP_ADB, TypeDefs, Functions, Main;
27
28{ TForm_WhatLinksHere }
29
30procedure TForm_WhatLinksHere.FormCloseQuery(Sender: TObject;
31 var CanClose: Boolean);
32begin
33 Form_Main.Enabled := True;
34 Visible := False;
35 CanClose := False;
36end;
37
38procedure TForm_WhatLinksHere.FormShow(Sender: TObject);
39var
40 fileinfo: TFileInfo;
41 links: TLinks;
42 i: Integer;
43 fullname: String;
44begin
45 Form_Main.Enabled := False;
46 list.Items.Clear;
47 fileinfo := ConManager.Connection[ConID].GetFileInfo(FileID);
48 label_what.Caption := FormatNumber(fileinfo.ID, 5, '0') + '-' +
49 fileinfo.Name + '.' + fileinfo.Extension;
50 links := TAccess_OUP_ADB(ConManager.Connection[ConID]).GetLinksToFile(fileinfo.ID);
51 if Length(links.ByID) > 0 then
52 for i := 0 to High(links.ByID) do
53 begin
54 fileinfo := ConManager.Connection[ConID].GetFileInfo(links.ByID[i].Destination);
55 fullname := FormatNumber(fileinfo.ID, 5, '0') + '-' + fileinfo.Name + '.' + fileinfo.Extension;
56 list.Items.Add(fullname + ' (Offset 0x' + IntToHex(links.ByID[i].SrcOffset, 8) + ')');
57 end;
58end;
59
60procedure TForm_WhatLinksHere.listDblClick(Sender: TObject);
61var
62 id: Integer;
63begin
64 id := ConManager.Connection[ConID].ExtractFileIDOfName(list.Items.Strings[list.ItemIndex]);
65 SenderForm.SelectFileID(ConID, id);
66 Form_Main.Enabled := True;
67 Visible := False;
68end;
69
70end.
Note: See TracBrowser for help on using the repository browser.