Ignore:
Timestamp:
Feb 26, 2007, 11:52:09 PM (18 years ago)
Author:
alloc
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Helper/WhatLinksHere.pas

    r107 r114  
    33uses
    44  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    5   Dialogs, StdCtrls, Template;
     5  Dialogs, StdCtrls, Template, ExtCtrls;
    66
    77type
    88  TForm_WhatLinksHere = class(TForm)
    9     list: TListBox;
     9    Panel1: TPanel;
     10    list_from: TListBox;
    1011    label_what: TLabel;
     12    Panel2: TPanel;
     13    label_to: TLabel;
     14    list_to: TListBox;
     15    Splitter1: TSplitter;
    1116    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    1217    procedure FormShow(Sender: TObject);
    13     procedure listDblClick(Sender: TObject);
     18    procedure list_fromDblClick(Sender: TObject);
    1419  private
    1520  public
     
    4247  i: Integer;
    4348  fullname: String;
     49  links_to: TDatLinkList;
    4450begin
    4551  Form_Main.Enabled := False;
    46   list.Items.Clear;
     52  list_from.Items.Clear;
     53  list_to.Items.Clear;
    4754  fileinfo := ConManager.Connection[ConID].GetFileInfo(FileID);
    4855  label_what.Caption := FormatNumber(fileinfo.ID, 5, '0') + '-' +
    4956      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
     57  links_to := ConManager.Connection[ConID].GetDatLinks(fileinfo.ID);
     58  if ConManager.Connection[ConID] is TAccess_OUP_ADB then begin
     59    links := TAccess_OUP_ADB(ConManager.Connection[ConID]).GetLinksToFile(fileinfo.ID);
     60    if Length(links.ByID) > 0 then
     61      for i := 0 to High(links.ByID) do
     62      begin
     63        fileinfo := ConManager.Connection[ConID].GetFileInfo(links.ByID[i].Destination);
     64        fullname := FormatNumber(fileinfo.ID, 5, '0') + '-' + fileinfo.Name + '.' + fileinfo.Extension;
     65        list_from.Items.Add(fullname + ' (Offset 0x' + IntToHex(links.ByID[i].SrcOffset, 8) + ')');
     66      end;
     67  end;
     68  if Length(links_to) > 0 then
     69  begin
     70    for i := 0 to High(links_to) do
    5371    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) + ')');
     72      if links_to[i].DestID >= 0 then
     73      begin
     74        fileinfo := ConManager.Connection[ConID].GetFileInfo(links_to[i].DestID);
     75        fullname := FormatNumber(fileinfo.ID, 5, '0') + '-' + fileinfo.Name + '.' + fileinfo.Extension;
     76      end else
     77        fullname := 'no link';
     78      list_to.Items.Add(fullname + ' (Offset 0x' + IntToHex(links_to[i].SrcOffset, 8) + ')');
    5779    end;
     80  end;
    5881end;
    5982
    60 procedure TForm_WhatLinksHere.listDblClick(Sender: TObject);
     83procedure TForm_WhatLinksHere.list_fromDblClick(Sender: TObject);
    6184var
    6285  id: Integer;
     86  box: TListBox;
     87  name: String;
    6388begin
    64   id := ConManager.Connection[ConID].ExtractFileIDOfName(list.Items.Strings[list.ItemIndex]);
     89  box := TListBox(Sender);
     90  name := box.Items.Strings[box.ItemIndex];
     91  if Pos('no link', name) > 0 then
     92    Exit
     93  else
     94    id := ConManager.Connection[ConID].ExtractFileIDOfName(name);
    6595  SenderForm.SelectFileID(ConID, id);
    6696  Form_Main.Enabled := True;
Note: See TracChangeset for help on using the changeset viewer.