Changeset 92 for oup/current/Tools


Ignore:
Timestamp:
Jan 16, 2007, 12:35:04 AM (18 years ago)
Author:
alloc
Message:

Rev86 was first after multi-cons

Location:
oup/current/Tools
Files:
10 edited

Legend:

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

    r87 r92  
    44  OnCloseQuery = FormCloseQuery
    55  OnKeyUp = FormKeyUp
     6  ExplicitWidth = 500
     7  ExplicitHeight = 450
    68  PixelsPerInch = 96
    79  TextHeight = 13
    8   inherited panel_files: TPanel
    9     inherited filelist: TListBox
    10       ExplicitTop = 153
    11       ExplicitHeight = 270
    12     end
    13   end
    1410  inherited content: TPanel
    1511    object Splitter2: TSplitter
     
    9389      Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goColSizing]
    9490      PopupMenu = value_viewer_context
     91      ScrollBars = ssVertical
    9592      TabOrder = 1
    9693      OnDblClick = value_viewerDblClick
     
    194191  object value_viewer_context: TPopupMenu [3]
    195192    AutoHotkeys = maManual
     193    AutoLineReduction = maManual
    196194    OnPopup = value_viewer_contextPopup
    197195    Left = 280
  • oup/current/Tools/BinEdit.pas

    r87 r92  
    3232    procedure hexChange(Sender: TObject);
    3333
    34     procedure LoadDat(_fileid: LongWord);
     34    procedure LoadDat(_fileid: Integer);
    3535    function Save: Boolean;
    3636    function GetValue(datatype: Word; offset: LongWord): String;
     
    5757    procedure value_viewer_contextPopup(Sender: TObject);
    5858  private
     59    con: TOniData;
    5960    fileid: Integer;
    6061  public
     
    9394  value_viewer.RowCount := 8;
    9495  value_viewer.FixedRows := 1;
     96  value_viewer.FixedCols := 1;
    9597  value_viewer.Cells[0, 0] := 'Type';
    9698  value_viewer.Cells[1, 0] := 'Value';
     
    102104  value_viewer.Cells[0, 6] := 'String';
    103105  value_viewer.Cells[0, 7] := 'Selected length';
    104 //  value_viewer.ColWidths[0] := 100;
    105 //  value_viewer.ColWidths[1] := value_viewer.Width - 150;
     106  value_viewer.ColWidths[0] := 120;
     107  value_viewer.ColWidths[1] := 1000;
    106108//  hex.Height := content.Height - 215;
    107109  //
     
    135137
    136138
    137 procedure TForm_BinEdit.LoadDat(_fileid: LongWord);
     139procedure TForm_BinEdit.LoadDat(_fileid: Integer);
    138140var
    139141  mem:  TMemoryStream;
    140142  Data: Tdata;
    141143begin
    142   if hex.Modified then
    143   begin
    144     if not Save then
    145     begin
    146       Self.SelectFileID(fileid);
    147       Exit;
    148     end;
    149   end;
    150   fileid := _fileid;
    151   if OniDataConnection.ExtractFileID(
    152         filelist.Items.Strings[filelist.ItemIndex]) <> fileid then
    153     Self.SelectFileID(fileid);
    154   Self.ClearStructViewer;
    155   Data := OniDataConnection.LoadDatFile(fileid);
    156   if Length(Data) > 0 then
    157   begin
    158     mem := TMemoryStream.Create;
    159     mem.Write(Data[0], Length(Data));
    160     mem.Seek(0, soFromBeginning);
    161     hex.LoadFromStream(mem);
    162     mem.Free;
    163     WriteStructureInfos;
     144  if con <> nil then
     145  begin
     146    if hex.Modified then
     147    begin
     148      if not Save then
     149      begin
     150        Self.SelectFileID(Connection, fileid);
     151        Exit;
     152      end;
     153    end;
     154  end;
     155  if _fileid >= 0 then
     156  begin
     157    fileid := _fileid;
     158    con := Connection;
     159    if con.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]) <> fileid then
     160      Self.SelectFileID(Connection, fileid);
     161    Self.ClearStructViewer;
     162    Data := con.LoadDatFile(fileid);
     163    if Length(Data) > 0 then
     164    begin
     165      mem := TMemoryStream.Create;
     166      mem.Write(Data[0], Length(Data));
     167      mem.Seek(0, soFromBeginning);
     168      hex.LoadFromStream(mem);
     169      mem.Free;
     170      WriteStructureInfos;
     171    end
     172    else
     173    begin
     174      ClearValues;
     175      hex.DataSize := 0;
     176    end;
    164177  end
    165178  else
    166179  begin
     180    fileid := _fileid;
     181    con := nil;
     182    Self.ClearStructViewer;
    167183    ClearValues;
    168184    hex.DataSize := 0;
     
    226242      Result := IntToBin(hex.Data[offset]);
    227243    11:
    228       Result := '0x' + IntToHex(OniDataConnection.GetRawInfo(fileid, offset).raw_addr, 8);
     244      Result := '0x' + IntToHex(con.GetRawInfo(fileid, offset).raw_addr, 8);
    229245    12:
    230246      Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 +
     
    291307  if VST.RootNodeCount = 0 then
    292308  begin
    293     structs := LoadStructureDefinition(Connection, fileid);
     309    structs := LoadStructureDefinition(con, fileid);
    294310    if structs.Data then
    295311    begin
     
    501517begin
    502518  case MessageBox(Self.Handle, PChar('Save changes to file ' +
    503       OniDataConnection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'),
     519      con.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'),
    504520      MB_YESNOCANCEL) of
    505521    idYes:
     
    511527      mem.Read(Data[0], mem.Size);
    512528      mem.Free;
    513       OniDataConnection.UpdateDatFile(fileid, Data);
     529      con.UpdateDatFile(fileid, Data);
    514530      hex.Modified := False;
    515531      for i := 0 to hex.Datasize - 1 do
     
    762778      if nodedata.DataType = 11 then
    763779      begin
    764         if OniDataConnection.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then
    765           Form_Main.open_child('rawedit', fileid);
     780        if con.GetRawInfo(fileid, nodedata.offset).raw_size > 0 then
     781          Form_Main.open_child('rawedit', Connection, fileid);
    766782      end;
    767783      if nodedata.DataType = 12 then
    768784      begin
    769         if (StrToInt(nodedata.Value) < OniDataConnection.GetFilesCount) and
     785        if (StrToInt(nodedata.Value) < con.GetFilesCount) and
    770786          (StrToInt(nodedata.Value) > 0) and
    771787          (StrToInt(nodedata.Value) <> fileid) then
    772788        begin
    773           if OniDataConnection.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then
    774             Form_Main.open_child('binedit', StrToInt(nodedata.Value))
     789          if con.GetFileInfo(StrToInt(nodedata.Value)).Size > 0 then
     790            Form_Main.open_child('binedit', Connection, StrToInt(nodedata.Value))
    775791          else
    776792            ShowMessage('Linked filed is a zero-byte-file');
     
    779795      if (nodedata.DataType >= 100) and (nodedata.DataType <= 300) then
    780796      begin
    781         form := Form_Main.open_child('binedit', -1);
     797        form := Form_Main.open_child('binedit', Connection, -1);
    782798        if Assigned(form) then
    783799          form.SetFileFilters(nodedata.Value, '', False);
  • oup/current/Tools/Extractor.dfm

    r86 r92  
    2222      Width = 333
    2323      Height = 338
    24       ExplicitTop = 153
    2524      ExplicitWidth = 333
    2625      ExplicitHeight = 338
     
    2928      Width = 333
    3029      ExplicitWidth = 333
     30      inherited Bevel1: TBevel
     31        Width = 327
     32        ExplicitWidth = 327
     33      end
    3134      inherited combo_extension: TComboBox
    3235        Width = 325
     
    3942        Width = 325
    4043        ExplicitWidth = 325
     44      end
     45      inherited combo_connection: TComboBox
     46        Width = 263
     47        ExplicitWidth = 263
    4148      end
    4249    end
  • oup/current/Tools/Extractor.pas

    r86 r92  
    105105    if (selonly and filelist.Selected[i]) or not selonly then
    106106    begin
    107       fileid := OniDataConnection.ExtractFileID(filelist.Items.Strings[i]);
     107      fileid := Connection.ExtractFileID(filelist.Items.Strings[i]);
    108108      filename := GetWinFilename(filelist.Items.Strings[i]);
    109109      if check_dat.Checked then
  • oup/current/Tools/RawEdit.dfm

    r75 r92  
    2323    end
    2424    inherited filelist: TListBox
    25       Height = 76
    26       ExplicitHeight = 76
     25      Height = 52
     26      ExplicitHeight = 52
    2727    end
    2828    object panel_imexport: TPanel
     
    7979  end
    8080  inherited content: TPanel
    81     OnResize = panel_contentResize
    8281    object Splitter2: TSplitter
    8382      Left = 0
     
    152151      ParentFont = False
    153152      PopupMenu = value_viewer_context
     153      ScrollBars = ssVertical
    154154      TabOrder = 1
    155155      OnDblClick = value_viewerDblClick
  • oup/current/Tools/RawEdit.pas

    r75 r92  
    3939    procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    4040
    41     procedure panel_contentResize(Sender: TObject);
    42 
    4341    function GetValue(datatype: Word; offset: LongWord): String;
    4442    procedure ClearValues;
     
    5856    fileid:     Integer;
    5957    dat_offset: LongWord;
    60     fileid_opened, dat_offset_opened: LongWord;
     58    fileid_opened, dat_offset_opened: Integer;
    6159  public
    6260  end;
     
    7472  i: Integer;
    7573begin
    76   if hex.Modified then
    77     if not Save then
    78       Exit;
    79   ClearValues;
    80   hex.DataSize := 0;
    81   fileid := fileinfo.ID;
    82   list_offset.Enabled := False;
    83   if fileinfo.size > 0 then
    84   begin
    85     offsets := OniDataConnection.GetRawList(fileid);
     74  if fileinfo.ID >= 0 then
     75  begin
     76    if hex.Modified then
     77      if not Save then
     78        Exit;
     79    ClearValues;
     80    hex.DataSize := 0;
     81    fileid := fileinfo.ID;
     82    list_offset.Enabled := False;
     83    if fileinfo.size > 0 then
     84    begin
     85      offsets := Connection.GetRawList(fileid);
     86      list_offset.Items.Clear;
     87      if Length(offsets) > 0 then
     88        for i := 0 to High(offsets) do
     89          list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) +
     90                ', ' + IntToStr(offsets[i].raw_size) + ' bytes');
     91      list_offset.Enabled := True;
     92    end;
     93  end
     94  else
     95  begin
     96    ClearValues;
     97    hex.DataSize := 0;
     98    fileid := -1;
    8699    list_offset.Items.Clear;
    87     if Length(offsets) > 0 then
    88       for i := 0 to High(offsets) do
    89         list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) +
    90               ', ' + IntToStr(offsets[i].raw_size) + ' bytes');
    91     list_offset.Enabled := True;
    92100  end;
    93101end;
     
    109117    for i := 0 to filelist.Count - 1 do
    110118    begin
    111       if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then
     119      if Connection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then
    112120      begin
    113121        filelist.ItemIndex := i;
     
    126134  end;
    127135  SetLength(Data, raw_info.raw_size);
    128   OniDataConnection.LoadRawFile(raw_info.src_id, raw_info.src_offset, @Data[0]);
     136  Connection.LoadRawFile(raw_info.src_id, raw_info.src_offset, @Data[0]);
    129137  if Length(Data) > 0 then
    130138  begin
     
    158166  dat_offset := StrToInt('$' + MidStr(
    159167    list_offset.Items.Strings[list_offset.ItemIndex], 3, 8));
    160   LoadRaw(OniDataConnection.GetRawInfo(fileid, dat_offset));
     168  LoadRaw(Connection.GetRawInfo(fileid, dat_offset));
    161169end;
    162170
     
    391399}
    392400  value_viewer.FixedRows := 1;
     401  value_viewer.FixedCols := 1;
    393402  value_viewer.Cells[0, 0] := 'Type';
    394403  value_viewer.Cells[1, 0] := 'Value';
     
    400409  value_viewer.Cells[0, 6] := 'String';
    401410  value_viewer.Cells[0, 7] := 'Selected length';
    402   value_viewer.ColWidths[0] := 100;
     411  value_viewer.ColWidths[0] := 125;
     412  value_viewer.ColWidths[1] := 1000;
    403413  //
    404414  value_viewer.Font.Charset := AppSettings.CharSet;
     
    416426begin
    417427  case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' +
    418       OniDataConnection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'),
     428      Connection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'),
    419429      MB_YESNOCANCEL) of
    420430    idYes:
     
    426436      mem.Read(Data[0], mem.Size);
    427437      mem.Free;
    428       OniDataConnection.UpdateRawFile(fileid_opened, dat_offset_opened,
     438      Connection.UpdateRawFile(fileid_opened, dat_offset_opened,
    429439        Length(Data), @Data[0]);
    430440      hex.Modified := False;
     
    452462      CanClose := False;
    453463  end;
    454 end;
    455 
    456 
    457 
    458 
    459 procedure TForm_RawEdit.panel_contentResize(Sender: TObject);
    460 begin
    461   if fileid >= 0 then
    462     value_viewer.ColWidths[1] := value_viewer.Width - value_viewer.ColWidths[0] - 50;
    463464end;
    464465
     
    546547  fs: TFileStream;
    547548begin
    548   saved.Filter     := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo(
    549     fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension +
     549  saved.Filter     := 'Files of matching extension (*.' + Connection.GetFileInfo(
     550    fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension +
    550551    '|All files|*.*';
    551   saved.DefaultExt := OniDataConnection.GetFileInfo(fileid).Extension;
     552  saved.DefaultExt := Connection.GetFileInfo(fileid).Extension;
    552553  if saved.Execute then
    553554  begin
     
    566567  fs:   TFileStream;
    567568begin
    568   opend.Filter := 'Files of matching extension (*.' + OniDataConnection.GetFileInfo(
    569     fileid).Extension + ')|*.' + OniDataConnection.GetFileInfo(fileid).Extension +
     569  opend.Filter := 'Files of matching extension (*.' + Connection.GetFileInfo(
     570    fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension +
    570571    '|All files|*.*';
    571572  if opend.Execute then
  • oup/current/Tools/Template.dfm

    r86 r92  
    5252      OnClick = listClick
    5353      OnMouseDown = listMouseDown
    54       ExplicitTop = 129
    55       ExplicitHeight = 294
    5654    end
    5755    object panel_extension: TPanel
  • oup/current/Tools/Template.pas

    r87 r92  
    4444    procedure RecreateExtList;
    4545    procedure LoadFileNames;
    46     procedure SelectFileName(filename: String);
    47     procedure SelectFileID(id: Integer);
     46    procedure SelectFileName(connection: TOniData; filename: String);
     47    procedure SelectFileID(connection: TOniData; id: Integer);
    4848    procedure check_filternameClick(Sender: TObject);
    4949    procedure check_zerobyteClick(Sender: TObject);
     
    285285  id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);
    286286  context := MidStr(sender_name, Pos('_', sender_name) + 1, Length(sender_name) - Pos('_', sender_name));
    287   Form_Main.open_child(context, id);
     287  Form_Main.open_child(context, FConnection, id);
    288288end;
    289289
     
    415415
    416416
    417 procedure TForm_ToolTemplate.SelectFileID(id: Integer);
    418 var
    419   i: Integer;
    420 begin
     417procedure TForm_ToolTemplate.SelectFileID(connection: TOniData; id: Integer);
     418var
     419  i: Integer;
     420  name: String;
     421  nstart, nend: Integer;
     422begin
     423  for i := 0 to combo_connection.Items.Count - 1 do
     424  begin
     425    name := combo_connection.Items.Strings[i];
     426    nstart := Pos(' ', name) + 1;
     427    nend := Pos('(', name) - 1;
     428    name := MidStr(name, nstart, nend - nstart);
     429
     430    if ExtractFileName(connection.FileName) = name then
     431    begin
     432      combo_connection.ItemIndex := i;
     433      combo_connectionChange(Self);
     434    end;
     435  end;
     436
    421437  filelist.ItemIndex := -1;
    422438  if filelist.Items.Count > 0 then
     
    430446end;
    431447
    432 procedure TForm_ToolTemplate.SelectFileName(filename: String);
    433 var
    434   i: Integer;
    435 begin
     448procedure TForm_ToolTemplate.SelectFileName(connection: TOniData; filename: String);
     449var
     450  i: Integer;
     451  name: String;
     452  nstart, nend: Integer;
     453begin
     454  for i := 0 to combo_connection.Items.Count - 1 do
     455  begin
     456    name := combo_connection.Items.Strings[i];
     457    nstart := Pos(' ', name) + 1;
     458    nend := Pos('(', name) - 1;
     459    name := MidStr(name, nstart, nend - nstart);
     460
     461    if ExtractFileName(connection.FileName) = name then
     462    begin
     463      combo_connection.ItemIndex := i;
     464      combo_connectionChange(Self);
     465    end;
     466  end;
     467
    436468  filelist.ItemIndex := -1;
    437469  if filelist.Items.Count > 0 then
  • oup/current/Tools/TxmpReplace.dfm

    r86 r92  
    11inherited Form_TxmpReplace: TForm_TxmpReplace
    22  Caption = 'TxmpReplace'
    3   ExplicitWidth = 320
    4   ExplicitHeight = 240
    53  PixelsPerInch = 96
    64  TextHeight = 13
     
    3735      Height = 146
    3836      Align = alTop
    39       ExplicitTop = 153
    4037      ExplicitHeight = 146
    4138    end
  • oup/current/Tools/TxmpReplace.pas

    r86 r92  
    5252begin
    5353  fileid := fileinfo.ID;
    54   OniDataConnection.LoadDatFilePart(fileid, $88, SizeOf(fadingbyte), @fadingbyte);
    55   OniDataConnection.LoadDatFilePart(fileid, $89, SizeOf(depthbyte), @depthbyte);
    56   OniDataConnection.LoadDatFilePart(fileid, $90, SizeOf(storebyte), @storebyte);
     54  Connection.LoadDatFilePart(fileid, $88, SizeOf(fadingbyte), @fadingbyte);
     55  Connection.LoadDatFilePart(fileid, $89, SizeOf(depthbyte), @depthbyte);
     56  Connection.LoadDatFilePart(fileid, $90, SizeOf(storebyte), @storebyte);
    5757  check_fading.Checked := (fadingbyte and $01) > 0;
    5858  check_transparency.Checked := (depthbyte and $04) > 0;
     
    103103  if filelist.ItemIndex >= 0 then
    104104  begin
    105     OniDataConnection.LoadDatFilePart(fileid, $88, 1, @oldfading);
    106     if OniDataConnection.OSisMac then
    107       OniDataConnection.UpdateDatFilePart(fileid, $A0, 4, @old_rawaddr)
     105    Connection.LoadDatFilePart(fileid, $88, 1, @oldfading);
     106    if Connection.OSisMac then
     107      Connection.UpdateDatFilePart(fileid, $A0, 4, @old_rawaddr)
    108108    else
    109       OniDataConnection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
     109      Connection.LoadDatFilePart(fileid, $9C, 4, @old_rawaddr);
    110110
    111111    if (OniImage_Old.Width <> OniImage_New.Width) or
     
    138138    newsize := OniImage_New.GetImageDataSize(check_fading.Checked);
    139139
    140     if (newsize > old_size) and (OniDataConnection.Backend = ODB_Dat) then
    141       new_rawaddr := OniDataConnection.AppendRawFile(
    142         OniDataConnection.OSisMac, Length(tempd), tempd)
     140    if (newsize > old_size) and (Connection.Backend = ODB_Dat) then
     141      new_rawaddr := Connection.AppendRawFile(
     142        Connection.OSisMac, Length(tempd), tempd)
    143143    else
    144144    begin
    145145      new_rawaddr := old_rawaddr;
    146       OniDataConnection.UpdateRawFile(fileid, $9C, Length(tempd), tempd);
     146      Connection.UpdateRawFile(fileid, $9C, Length(tempd), tempd);
    147147    end;
    148148
     
    150150    if check_fading.Checked then
    151151      datbyte := datbyte or $01;
    152     OniDataConnection.UpdateDatFilePart(fileid, $88, 1, @datbyte);
     152    Connection.UpdateDatFilePart(fileid, $88, 1, @datbyte);
    153153    datbyte := $10;
    154154    if check_transparency.Checked then
    155155      datbyte := datbyte or $04;
    156     OniDataConnection.UpdateDatFilePart(fileid, $89, 1, @datbyte);
    157     OniDataConnection.UpdateDatFilePart(fileid, $8C, 2, @OniImage_New.Width);
    158     OniDataConnection.UpdateDatFilePart(fileid, $8E, 2, @OniImage_New.Height);
     156    Connection.UpdateDatFilePart(fileid, $89, 1, @datbyte);
     157    Connection.UpdateDatFilePart(fileid, $8C, 2, @OniImage_New.Width);
     158    Connection.UpdateDatFilePart(fileid, $8E, 2, @OniImage_New.Height);
    159159    datbyte := $08;
    160     OniDataConnection.UpdateDatFilePart(fileid, $90, 1, @datbyte);
    161     if OniDataConnection.OSisMac then
    162       OniDataConnection.UpdateDatFilePart(fileid, $A0, 4, @new_rawaddr)
     160    Connection.UpdateDatFilePart(fileid, $90, 1, @datbyte);
     161    if Connection.OSisMac then
     162      Connection.UpdateDatFilePart(fileid, $A0, 4, @new_rawaddr)
    163163    else
    164       OniDataConnection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr);
     164      Connection.UpdateDatFilePart(fileid, $9C, 4, @new_rawaddr);
    165165
    166166    ShowMessage('TXMP-image replaced');
Note: See TracChangeset for help on using the changeset viewer.