Changeset 86 for oup/current/Tools


Ignore:
Timestamp:
Jan 14, 2007, 9:19:08 PM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/current/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Tools/Extractor.dfm

    r74 r86  
    22  Caption = 'Extractor'
    33  ClientHeight = 491
    4   ExplicitWidth = 500
    54  ExplicitHeight = 518
    65  PixelsPerInch = 96
     
    2221    inherited filelist: TListBox
    2322      Width = 333
    24       Height = 362
     23      Height = 338
     24      ExplicitTop = 153
    2525      ExplicitWidth = 333
    26       ExplicitHeight = 362
     26      ExplicitHeight = 338
    2727    end
    2828    inherited panel_extension: TPanel
  • oup/current/Tools/Extractor.pas

    r74 r86  
    108108      filename := GetWinFilename(filelist.Items.Strings[i]);
    109109      if check_dat.Checked then
    110         ExportDatFile(fileid, path + filename);
     110        ExportDatFile(Connection, fileid, path + filename);
    111111      if check_raw.Checked then
    112         ExportRawFiles(fileid, path + filename);
     112        ExportRawFiles(Connection, fileid, path + filename);
    113113      if check_convert.Checked then
    114         ExportConverted(fileid, path + filename);
     114        ExportConverted(Connection, fileid, path + filename);
    115115      Inc(done);
    116116    end;
  • oup/current/Tools/Preview.pas

    r46 r86  
    8080begin
    8181  OniImage := TOniImage.Create;
    82   OniImage.Load(fileid);
     82  OniImage.Load(Connection, fileid);
    8383  Data := OniImage.GetAsBMP;
    8484  OniImage.Free;
     
    137137  i:    Byte;
    138138begin
    139   OniDataConnection.LoadDatFilePart(_fileid, $14, SizeOf(loop_speed), @loop_speed);
    140   OniDataConnection.LoadDatFilePart(_fileid, $1C, SizeOf(linkcount), @linkcount);
     139  Connection.LoadDatFilePart(_fileid, $14, SizeOf(loop_speed), @loop_speed);
     140  Connection.LoadDatFilePart(_fileid, $1C, SizeOf(linkcount), @linkcount);
    141141  SetBitmapCount(linkcount);
    142142  for i := 0 to linkcount - 1 do
    143143  begin
    144     OniDataConnection.LoadDatFilePart(_fileid, $20 + i * 4, SizeOf(link), @link);
     144    Connection.LoadDatFilePart(_fileid, $20 + i * 4, SizeOf(link), @link);
    145145    link := link div 256;
    146146    if link = 0 then
     
    180180  else
    181181    actualimg := High(bitmaps);
    182   Self.Caption := 'Preview ' + OniDataConnection.GetFileInfo(_fileid).FileName +
     182  Self.Caption := 'Preview ' + Connection.GetFileInfo(_fileid).FileName +
    183183    ' (' + IntToStr(actualimg + 1) + '/' + IntToStr(Length(bitmaps)) + ')';
    184184  DrawImage(actualimg);
     
    192192  else
    193193    actualimg := 0;
    194   Self.Caption := 'Preview ' + OniDataConnection.GetFileInfo(_fileid).FileName +
     194  Self.Caption := 'Preview ' + Connection.GetFileInfo(_fileid).FileName +
    195195    ' (' + IntToStr(actualimg + 1) + '/' + IntToStr(Length(bitmaps)) + ')';
    196196  DrawImage(actualimg);
  • oup/current/Tools/Template.dfm

    r58 r86  
    4343    object filelist: TListBox
    4444      Left = 0
    45       Top = 129
     45      Top = 153
    4646      Width = 200
    47       Height = 294
     47      Height = 270
    4848      Align = alClient
    4949      ItemHeight = 13
     
    5252      OnClick = listClick
    5353      OnMouseDown = listMouseDown
     54      ExplicitTop = 129
     55      ExplicitHeight = 294
    5456    end
    5557    object panel_extension: TPanel
     
    5759      Top = 0
    5860      Width = 200
    59       Height = 129
     61      Height = 153
    6062      Align = alTop
    6163      BevelOuter = bvNone
     
    6365      DesignSize = (
    6466        200
    65         129)
     67        153)
    6668      object Label2: TLabel
    6769        Left = 100
    68         Top = 105
     70        Top = 129
    6971        Width = 17
    7072        Height = 18
     
    8082      object Label1: TLabel
    8183        Left = 47
    82         Top = 105
     84        Top = 129
    8385        Width = 17
    8486        Height = 18
     
    9496      object label_ext: TLabel
    9597        Left = 2
    96         Top = 62
     98        Top = 86
    9799        Width = 100
    98100        Height = 17
     
    103105      object btn_sort_id_asc: TSpeedButton
    104106        Left = 3
    105         Top = 101
     107        Top = 125
    106108        Width = 20
    107109        Height = 22
     
    124126      object btn_sort_id_desc: TSpeedButton
    125127        Left = 23
    126         Top = 101
     128        Top = 125
    127129        Width = 20
    128130        Height = 22
     
    144146      object btn_sort_name_asc: TSpeedButton
    145147        Left = 58
    146         Top = 101
     148        Top = 125
    147149        Width = 20
    148150        Height = 22
     
    164166      object btn_sort_name_desc: TSpeedButton
    165167        Left = 78
    166         Top = 101
     168        Top = 125
    167169        Width = 20
    168170        Height = 22
     
    184186      object btn_sort_ext_asc: TSpeedButton
    185187        Left = 108
    186         Top = 101
     188        Top = 125
    187189        Width = 20
    188190        Height = 22
     
    204206      object btn_sort_ext_desc: TSpeedButton
    205207        Left = 128
    206         Top = 101
     208        Top = 125
    207209        Width = 20
    208210        Height = 22
     
    222224        OnClick = btn_sortClick
    223225      end
     226      object Label3: TLabel
     227        Left = 3
     228        Top = 6
     229        Width = 61
     230        Height = 13
     231        Caption = 'Connection: '
     232      end
     233      object Bevel1: TBevel
     234        Left = 0
     235        Top = 25
     236        Width = 199
     237        Height = 3
     238        Anchors = [akLeft, akTop, akRight]
     239        Style = bsRaised
     240      end
    224241      object combo_extension: TComboBox
    225242        Left = 2
    226         Top = 76
    227         Width = 192
     243        Top = 100
     244        Width = 196
    228245        Height = 21
    229246        Style = csDropDownList
     
    243260      object check_zerobyte: TCheckBox
    244261        Left = 2
    245         Top = 44
     262        Top = 68
    246263        Width = 130
    247264        Height = 13
     
    252269      object edit_filtername: TEdit
    253270        Left = 2
    254         Top = 20
    255         Width = 192
     271        Top = 44
     272        Width = 196
    256273        Height = 18
    257274        Anchors = [akLeft, akTop, akRight]
     
    261278      object check_filtername: TCheckBox
    262279        Left = 2
    263         Top = 5
     280        Top = 29
    264281        Width = 130
    265282        Height = 15
     
    267284        TabOrder = 0
    268285        OnClick = check_filternameClick
     286      end
     287      object combo_connection: TComboBox
     288        Left = 64
     289        Top = 3
     290        Width = 134
     291        Height = 21
     292        Style = csDropDownList
     293        Anchors = [akLeft, akTop, akRight]
     294        ItemHeight = 13
     295        TabOrder = 4
     296        OnChange = combo_connectionChange
    269297      end
    270298    end
  • oup/current/Tools/Template.pas

    r83 r86  
    1010type
    1111  TNewFileSelectedEvent = procedure(fileinfo: TFileInfo) of object;
     12  TNewConnectionEvent = procedure(connection: TOniData) of object;
    1213
    1314  TForm_ToolTemplate = class(TForm)
     
    3637    Label1: TLabel;
    3738    Label2: TLabel;
     39    Label3: TLabel;
     40    combo_connection: TComboBox;
     41    Bevel1: TBevel;
    3842    procedure RecreateList;
     43    procedure UpdateList;
     44    procedure RecreateExtList;
    3945    procedure LoadFileNames;
    4046    procedure SelectFileName(filename: String);
     
    5662    procedure btn_sortClick(Sender: TObject);
    5763    procedure FormActivate(Sender: TObject);
     64    procedure combo_connectionChange(Sender: TObject);
    5865  private
    5966    FSortBy: TSortType;
    6067    FOnNewFileSelected: TNewFileSelectedEvent;
     68    FOnNewConnection: TNewConnectionEvent;
    6169    FAllowedExts: String;
    6270    FAllowMultiSelect: Boolean;
    6371    FSelectedFile: TFileInfo;
     72    FConnection: TOniData;
    6473    procedure SetAllowedExts(exts: String);
    6574    procedure SetMultiSelect(allow: Boolean);
     
    6978  published
    7079    property OnNewFileSelected: TNewFileSelectedEvent read FOnNewFileSelected write FOnNewFileSelected;
     80    property OnNewConnection: TNewConnectionEvent read FOnNewConnection write FOnNewConnection;
    7181    property AllowedExts: String read FAllowedExts write SetAllowedExts;
    7282    property AllowMultiSelect: Boolean read FAllowMultiSelect write SetMultiSelect;
    7383    property SelectedFile: TFileInfo read FSelectedFile;
     84    property Connection: TOniData read FConnection;
    7485  end;
    7586
     
    8394
    8495
     96procedure TForm_ToolTemplate.UpdateList;
     97var
     98  i: Integer;
     99  fn, datatype, boxstring: String;
     100  level: Integer;
     101  oldcon: String;
     102begin
     103  oldcon := combo_connection.Items.Strings[combo_connection.ItemIndex];
     104  combo_connection.Items.Clear;
     105  for i := 0 to High(DataConnections) do
     106  begin
     107    level := DataConnections[i].LevelInfo.LevelNumber;
     108    fn := ExtractFileName(DataConnections[i].FileName);
     109    if DataConnections[i].Backend = ODB_Dat then
     110      datatype := 'ONI-.dat: '
     111    else if DataConnections[i].Backend = ODB_ADB then
     112      datatype := 'OUP-DB: '
     113    else
     114      datatype := 'Unknown: ';
     115    boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')';
     116    combo_connection.Items.Add(boxstring);
     117    if oldcon = boxstring then
     118      combo_connection.ItemIndex := combo_connection.Items.Count - 1;
     119  end;
     120end;
     121
    85122procedure TForm_ToolTemplate.RecreateList;
     123var
     124  i: Integer;
     125  fn, datatype: String;
     126  level: Integer;
     127begin
     128  combo_connection.Items.Clear;
     129  for i := 0 to High(DataConnections) do
     130  begin
     131    level := DataConnections[i].LevelInfo.LevelNumber;
     132    fn := ExtractFileName(DataConnections[i].FileName);
     133    if DataConnections[i].Backend = ODB_Dat then
     134      datatype := 'ONI-.dat: '
     135    else if DataConnections[i].Backend = ODB_ADB then
     136      datatype := 'OUP-DB: '
     137    else
     138      datatype := 'Unknown: ';
     139    combo_connection.Items.Add(datatype + fn + ' (Level: ' + IntToStr(level) + ')');
     140  end;
     141  FConnection := DataConnections[0];
     142  combo_connection.ItemIndex := 0;
     143  combo_connectionChange(Self);
     144end;
     145
     146procedure TForm_ToolTemplate.RecreateExtList;
    86147var
    87148  i:    LongWord;
     
    90151  combo_extension.Items.Clear;
    91152  combo_extension.Items.Add('_All files_ (' +
    92     IntToStr(OniDataConnection.GetFilesCount) + ')');
    93   exts := OniDataConnection.GetExtensionsList;
     153    IntToStr(FConnection.GetFilesCount) + ')');
     154  exts := FConnection.GetExtensionsList;
    94155  for i := 0 to High(exts) do
    95156    if Length(FAllowedExts) > 0 then
     
    127188      Extension := '';
    128189
    129   files := OniDataConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy);
     190  files := FConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy);
    130191
    131192  filelist.Visible := False;
     
    143204  ext: String;
    144205begin
    145   id := OniDataConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
     206  id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
    146207  ext := RightStr(filelist.Items.Strings[filelist.ItemIndex], 4);
    147208  exportd.Filter := 'Files of matching extension (*.' + ext + ')|*.' + ext + '|All files|*.*';
    148209  exportd.DefaultExt := ext;
    149210  if exportd.Execute then
    150     ExportDatFile(id, exportd.FileName);
     211    ExportDatFile(FConnection, id, exportd.FileName);
    151212end;
    152213
     
    158219  data: TData;
    159220begin
    160   id := OniDataConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
    161   finfo := OniDataConnection.GetFileInfo(id);
     221  id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
     222  finfo := FConnection.GetFileInfo(id);
    162223
    163224  importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' +
     
    174235      SetLength(data, fs.Size);
    175236      fs.Read(data[0], fs.Size);
    176       OniDataConnection.UpdateDatFile(id, data);
     237      FConnection.UpdateDatFile(id, data);
    177238      Self.listClick(Self);
    178239    end;
     
    187248begin
    188249  sender_name := TComponent(Sender).Name;
    189   id := OniDataConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
     250  id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
    190251  context := MidStr(sender_name, Pos('_', sender_name) + 1, Length(sender_name) - Pos('_', sender_name));
    191252  Form_Main.open_child(context, id);
    192253end;
    193254
     255procedure TForm_ToolTemplate.combo_connectionChange(Sender: TObject);
     256var
     257  name: String;
     258  nstart, nend: Integer;
     259  i: Integer;
     260begin
     261  if combo_connection.ItemIndex >= 0 then
     262  begin
     263    name := combo_connection.Items.Strings[combo_connection.ItemIndex];
     264    nstart := Pos(' ', name) + 1;
     265    nend := Pos('(', name) - 1;
     266    name := MidStr(name, nstart, nend - nstart);
     267
     268    for i := 0 to High(DataConnections) do
     269    begin
     270      if ExtractFileName(DataConnections[i].FileName) = name then
     271      begin
     272        FConnection := DataConnections[i];
     273        Break;
     274      end;
     275    end;
     276    if i = Length(DataConnections) then
     277      FConnection := nil;
     278
     279    RecreateExtList;
     280    if Assigned(FOnNewConnection) then
     281      FOnNewConnection(FConnection);
     282  end;
     283end;
     284
    194285procedure TForm_ToolTemplate.combo_extensionClick(Sender: TObject);
    195286begin
     
    205296  inherited;
    206297  RecreateList;
     298  FConnection := nil;
    207299  FSelectedFile.ID := -1;
    208300  FSelectedFile.FileName := '';
     
    270362  if filelist.ItemIndex > -1 then
    271363  begin
    272     fileid := OniDataConnection.ExtractFileID(
     364    fileid := FConnection.ExtractFileID(
    273365          filelist.Items.Strings[filelist.ItemIndex]);
    274     FSelectedFile := OniDataConnection.GetFileInfo(fileid);
     366    FSelectedFile := FConnection.GetFileInfo(fileid);
    275367    if Assigned(FOnNewFileSelected) then
    276368      FOnNewFileSelected(FSelectedFile);
     
    298390  if filelist.Items.Count > 0 then
    299391    for i := 0 to filelist.Items.Count - 1 do
    300       if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = id then
     392      if FConnection.ExtractFileID(filelist.Items.Strings[i]) = id then
    301393      begin
    302394        filelist.ItemIndex := i;
     
    321413begin
    322414  FAllowedExts := exts;
    323   RecreateList;
     415  RecreateExtList;
    324416end;
    325417
     
    368460  Self.Height := 300;
    369461  FOnNewFileSelected := nil;
     462  FOnNewConnection := nil;
    370463  FAllowedExts := '';
    371464  FAllowMultiSelect := False;
  • oup/current/Tools/TxmpReplace.dfm

    r46 r86  
    11inherited Form_TxmpReplace: TForm_TxmpReplace
    22  Caption = 'TxmpReplace'
     3  ExplicitWidth = 320
     4  ExplicitHeight = 240
    35  PixelsPerInch = 96
    46  TextHeight = 13
     
    1214    object image_txmppreview: TImage [0]
    1315      Left = 0
    14       Top = 283
     16      Top = 307
    1517      Width = 200
    16       Height = 31
     18      Height = 7
    1719      Align = alClient
    1820      ExplicitTop = 111
     
    2123    object splitter_txmp: TSplitter [1]
    2224      Left = 0
    23       Top = 275
     25      Top = 299
    2426      Width = 200
    2527      Height = 8
     
    3537      Height = 146
    3638      Align = alTop
     39      ExplicitTop = 153
    3740      ExplicitHeight = 146
    3841    end
  • oup/current/Tools/TxmpReplace.pas

    r54 r86  
    5858  check_transparency.Checked := (depthbyte and $04) > 0;
    5959
    60   OniImage_Old.LoadFromTXMP(fileid);
     60  OniImage_Old.LoadFromTXMP(connection, fileid);
    6161  old_size := OniImage_Old.GetImageDataSize((fadingbyte and $01) > 0);
    6262  Data := OniImage_Old.GetAsBMP;
Note: See TracChangeset for help on using the changeset viewer.