Changeset 106


Ignore:
Timestamp:
Feb 21, 2007, 4:09:30 AM (15 years ago)
Author:
alloc
Message:
 
Location:
oup/rewrite
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • oup/rewrite/DataAccess/Access_OUP_ADB.pas

    r105 r106  
    1717
    1818    procedure UpdateListCache;
     19
     20    function GetLinksToFile(FileID: Integer): TLinks;
     21    function GetLinksFromFile(FileID: Integer): TLinks;
    1922
    2023    function GetFileInfo(FileID: Integer): TFileInfo; override;
     
    167170  FQuery.Close;
    168171end;
     172
     173
     174
     175function TAccess_OUP_ADB.GetLinksToFile(FileID: Integer): TLinks;
     176var
     177  i: Integer;
     178begin
     179  SetLength(Result.ByName, 0);
     180  FQuery.SQL.Text := 'SELECT src_link_offset, src_id FROM linkmap WHERE target_id = ' + IntToStr(FileID) + ' ORDER BY src_id ASC;';
     181  FQuery.Open;
     182  SetLength(Result.ByID, FQuery.RecordCount);
     183  if FQuery.RecordCount > 0 then
     184  begin
     185    i := 0;
     186    repeat
     187      Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
     188      Result.ByID[i].Destination := FQuery.FieldByName('src_id').AsInteger;
     189      Inc(i);
     190      FQuery.Next;
     191    until FQuery.EOF;
     192  end;
     193  FQuery.Close;
     194end;
     195
     196function TAccess_OUP_ADB.GetLinksFromFile(FileID: Integer): TLinks;
     197var
     198  i: Integer;
     199begin
     200  SetLength(Result.ByName, 0);
     201  FQuery.SQL.Text := 'SELECT src_link_offset, target_id FROM linkmap WHERE src_id = ' + IntToStr(FileID) + ' ORDER BY target_id ASC;';
     202  FQuery.Open;
     203  SetLength(Result.ByID, FQuery.RecordCount);
     204  if FQuery.RecordCount > 0 then
     205  begin
     206    i := 0;
     207    repeat
     208      Result.ByID[i].SrcOffset := FQuery.FieldByName('src_link_offset').AsInteger;
     209      Result.ByID[i].Destination := FQuery.FieldByName('target_id').AsInteger;
     210      Inc(i);
     211      FQuery.Next;
     212    until FQuery.EOF;
     213  end;
     214  FQuery.Close;
     215end;
     216
    169217
    170218
  • oup/rewrite/Global/TypeDefs.pas

    r101 r106  
    7373
    7474  TToolList = array of record
    75     context: String;
    76     name: String;
    77     exts: String;
     75      context: String;
     76      name: String;
     77      exts: String;
     78  end;
     79
     80  TLinkByName = record
     81      SrcOffset: Integer;
     82      Destination: String;
     83  end;
     84  TLinkByID = record
     85      SrcOffset: Integer;
     86      Destination: Integer;
     87  end;
     88  TLinks = record
     89      ByName: array of TLinkByName;
     90      ByID: array of TLinkByID;
    7891  end;
    7992
  • oup/rewrite/OniUnPacker.bdsproj

    r105 r106  
    178178                </Language> 
    179179   
     180   
    180181    <Excluded_Packages>
    181182      <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages>
  • oup/rewrite/OniUnPacker.dpr

    r105 r106  
    2525  RawEdit in 'Tools\RawEdit.pas' {Form_RawEdit},
    2626  Extractor in 'Tools\Extractor.pas' {Form_Extractor},
    27   TxmpReplace in 'Tools\TxmpReplace.pas' {Form_TxmpReplace};
     27  TxmpReplace in 'Tools\TxmpReplace.pas' {Form_TxmpReplace},
     28  WhatLinksHere in 'Helper\WhatLinksHere.pas' {Form1};
    2829
    2930{$R *.res}
     
    3637  Application.CreateForm(TForm_Settings, Form_Settings);
    3738  Application.CreateForm(TForm_ValueEdit, Form_ValueEdit);
     39  Application.CreateForm(TForm1, Form1);
    3840  Application.Run;
    3941end.
  • oup/rewrite/Tools/Template.dfm

    r105 r106  
    308308    Left = 72
    309309    Top = 216
     310    object popup_separator2: TMenuItem
     311      Caption = '-'
     312    end
     313    object popup_linkshere: TMenuItem
     314      Caption = 'What links here?'
     315      Enabled = False
     316      OnClick = popup_linkshereClick
     317    end
    310318    object popup_separator: TMenuItem
    311319      Caption = '-'
  • oup/rewrite/Tools/Template.pas

    r105 r106  
    4141    combo_connection: TComboBox;
    4242    Bevel1: TBevel;
     43    popup_linkshere: TMenuItem;
     44    popup_separator2: TMenuItem;
    4345    procedure RecreateExtList;
    4446    procedure UpdateConList;
     
    6264    procedure FormActivate(Sender: TObject);
    6365    procedure combo_connectionChange(Sender: TObject);
     66    procedure popup_linkshereClick(Sender: TObject);
    6467  private
    6568    FSortBy: TSortType;
     
    9497implementation
    9598{$R *.dfm}
    96 uses Main, ConnectionManager, Exporters, Functions;
     99uses Main, ConnectionManager, Exporters, Functions, WhatLinksHere;
    97100
    98101
     
    258261end;
    259262
     263procedure TForm_ToolTemplate.popup_linkshereClick(Sender: TObject);
     264begin
     265  Form_WhatLinksHere.ConID := FConnectionID;
     266  Form_WhatLinksHere.FileID := FSelectedFile.ID;
     267  Form_WhatLinksHere.SenderForm := Self;
     268  Form_WhatLinksHere.Show;
     269end;
     270
    260271procedure TForm_ToolTemplate.popup_opentool(Sender: TObject);
    261272var
     
    335346        filepopup.Items.Items[i].Enabled := False;
    336347  end;
     348  filepopup.Items.Find('What links here?').Enabled :=
     349      ConManager.Connection[FConnectionID].Backend = DB_ADB;
    337350end;
    338351
     
    386399  pt.X := x;
    387400  pt.Y := y;
    388 //  filelist.ItemIndex := filelist.ItemAtPos(pt, true);
    389 //  Self.listClick(Self);
     401  if Shift = [ssRight] then
     402  begin
     403    filelist.ItemIndex := filelist.ItemAtPos(pt, true);
     404    Self.listClick(Self);
     405  end;
    390406end;
    391407
Note: See TracChangeset for help on using the changeset viewer.