Forum > Lazarus Extra Components

MPHexEditor, large files scrolling

<< < (2/4) > >>

korba812:

--- Quote from: Mastropiero on August 24, 2022, 03:35:20 pm ---I have recently faced this issue. It seems that the problem has been inherited from TCustomGrid. Is there any chance of having someday a new version of this component that is not based on TCustomGrid so the problem does not exist anymore?

--- End quote ---
As I wrote, it requires a lot of work. Unfortunately, this is not in my plans. But maybe someone will?

--- Quote from: Mastropiero on August 24, 2022, 03:35:20 pm ---Could the MPHexEditor component be redesigned so it only handles the rows that are actually shown on the screen instead of loading the whole file into RAM?

--- End quote ---
Theoretically yes - MPHexEdit uses TMemoryStream internally and theoretically could handle any stream. But it won't be easy, e.g. inserting or deleting data at the beginning of the file.

Mastropiero:
Thank you for your comments.

I have just wrote a small proof-of-concept of buffered reading that uses only 3MB of RAM and it keeps constant and fast even when scrolling >5GB sized files.  I use a simple TMemo to print the HEX data in read-only mode but I think the concept could be applied to any descendant of TCustomGrid.

This would solve the speed and memory consumption problem, but the own component's scrollbars wouldn't work anymore. I think this can be easily solved by disabling scrolling and adding an external TScrollBar component synced with the grid.

However, I'm wondering how to handle data selection, tracking of modified bytes, undo operations, etc. with this approach.

Tons of analysis and work to do...

korba812:
There is a component that can display (read only) huge files (> 2GB) in hex:
https://github.com/Alexey-T/ATBinHex-Lazarus
You can see how Alexey handled scroll bars in his component.

CNPack has a hex editor component which is based on TCustomControl:
https://github.com/cnpack/cnvcl/blob/master/Source/Graphics/CnHexEditor.pas

AlexTP:
If the problem is inside LCL Grids code, can you take the Grids file, rename it + rename its classes, and include changed file into MPHexEditor?

Mastropiero:

--- Quote from: korba812 on August 24, 2022, 09:02:44 pm ---Theoretically yes - MPHexEdit uses TMemoryStream internally and theoretically could handle any stream. But it won't be easy, e.g. inserting or deleting data at the beginning of the file.

--- End quote ---

WinHex (the best hex editor for Windows) does insert operations directly on a RAM buffer. If the file does not fit the buffer, it creates a temporary file. It also offers an in-place edit mode for big objects.



Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version