Changeset 92 for oup/current/Tools/RawEdit.pas
- Timestamp:
- Jan 16, 2007, 12:35:04 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/current/Tools/RawEdit.pas
r75 r92 39 39 procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 40 40 41 procedure panel_contentResize(Sender: TObject);42 43 41 function GetValue(datatype: Word; offset: LongWord): String; 44 42 procedure ClearValues; … … 58 56 fileid: Integer; 59 57 dat_offset: LongWord; 60 fileid_opened, dat_offset_opened: LongWord;58 fileid_opened, dat_offset_opened: Integer; 61 59 public 62 60 end; … … 74 72 i: Integer; 75 73 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 := 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; 86 99 list_offset.Items.Clear; 87 if Length(offsets) > 0 then88 for i := 0 to High(offsets) do89 list_offset.Items.Add('0x' + IntToHex(offsets[i].src_offset, 8) +90 ', ' + IntToStr(offsets[i].raw_size) + ' bytes');91 list_offset.Enabled := True;92 100 end; 93 101 end; … … 109 117 for i := 0 to filelist.Count - 1 do 110 118 begin 111 if OniDataConnection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then119 if Connection.ExtractFileID(filelist.Items.Strings[i]) = raw_info.src_id then 112 120 begin 113 121 filelist.ItemIndex := i; … … 126 134 end; 127 135 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]); 129 137 if Length(Data) > 0 then 130 138 begin … … 158 166 dat_offset := StrToInt('$' + MidStr( 159 167 list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); 160 LoadRaw( OniDataConnection.GetRawInfo(fileid, dat_offset));168 LoadRaw(Connection.GetRawInfo(fileid, dat_offset)); 161 169 end; 162 170 … … 391 399 } 392 400 value_viewer.FixedRows := 1; 401 value_viewer.FixedCols := 1; 393 402 value_viewer.Cells[0, 0] := 'Type'; 394 403 value_viewer.Cells[1, 0] := 'Value'; … … 400 409 value_viewer.Cells[0, 6] := 'String'; 401 410 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; 403 413 // 404 414 value_viewer.Font.Charset := AppSettings.CharSet; … … 416 426 begin 417 427 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...'), 419 429 MB_YESNOCANCEL) of 420 430 idYes: … … 426 436 mem.Read(Data[0], mem.Size); 427 437 mem.Free; 428 OniDataConnection.UpdateRawFile(fileid_opened, dat_offset_opened,438 Connection.UpdateRawFile(fileid_opened, dat_offset_opened, 429 439 Length(Data), @Data[0]); 430 440 hex.Modified := False; … … 452 462 CanClose := False; 453 463 end; 454 end;455 456 457 458 459 procedure TForm_RawEdit.panel_contentResize(Sender: TObject);460 begin461 if fileid >= 0 then462 value_viewer.ColWidths[1] := value_viewer.Width - value_viewer.ColWidths[0] - 50;463 464 end; 464 465 … … 546 547 fs: TFileStream; 547 548 begin 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 + 550 551 '|All files|*.*'; 551 saved.DefaultExt := OniDataConnection.GetFileInfo(fileid).Extension;552 saved.DefaultExt := Connection.GetFileInfo(fileid).Extension; 552 553 if saved.Execute then 553 554 begin … … 566 567 fs: TFileStream; 567 568 begin 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 + 570 571 '|All files|*.*'; 571 572 if opend.Execute then
Note:
See TracChangeset
for help on using the changeset viewer.