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

Rev86 was first after multi-cons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.