开发者

Delphi. Analog of Memo/RichEdit

开发者 https://www.devze.com 2023-03-11 04:10 出处:网络
Does anybody know if there is an analog of Memo/RichEdit开发者_运维问答? Demand: to number lines, to load big files (more than 5 MB) from a stream.Developer Express have an extensive set of VCL compon

Does anybody know if there is an analog of Memo/RichEdit开发者_运维问答? Demand: to number lines, to load big files (more than 5 MB) from a stream.


Developer Express have an extensive set of VCL components, among them a Memo replacement (TcxMemo) and a RTF edit (I don't know about the feature set, though).


TMS Software has a very good TAdvMemo with a lot of syntax highlighters. And also has a TRichEdit "replacement". In addition to the syntax highlighting their memo supports line numbers. Don't know about large files, but 5MB doesn't sound like anywhere near any limits they c/would have.

TRichView is another highly recommended TRichEdit replacement with a large feature set.


Our SynMemoEx component was designed to be light and fast. It loads and handles 50 MB text content with no problem, including word wrap.

But it's only for Delphi 6 up to 2007 (not unicode yet). But it's free and Open Source.

We use this component in our SynProject tool, for both file versioning display and documentation edition. And you've highlighting for .pas .c .cs .h .xml .html .dfm files (and more).

It has line numbering, and other nice features. See some screenshots from here.


TRichView is a popular component specifically designed for displaying, editing and printing hypertext documents. There is also a TRichView addon providing WYSIWYG editing. It has Unicode, RTF import and export, HTML export, data aware versions and more.

I use it as a main component in my genealogy program and have used it to load very large files (e.g. 100 MB or more). It can read or write directly to/from streams.


Killer component : Synedit - http://sourceforge.net/apps/mediawiki/synedit/index.php?title=SynEdit_Home_Page

check it out :)


Does exist any component that can have content linked that looks like a TMemo?

Need (cosider it as a must be able to do):

  • Put two of them with a TSplitter between them
  • Load content only once, but show it on both (to be able to see two parts at the same time), not like TMemo that you must copy on ram all the content
  • Time to load a 100MiB TXT plain text file in less than a second (I/O time from read media excluded), in other words like if you have data on RAM and want to display it on both in less than one second
  • Application must be RunAble (so no component that requieres a separated dll, i know how to inyect dll to the exe and extract them on run) and must run form a read only media in a forensic way (no write anywhere).

Wanted:

  • Not limited to 3GiB on a 32Bits system (not the whole file loaded at once like on ugly ram demand TMemo, only the parts shown)
  • Unicode and UTF-8/UTF-16 with/without BOM header, etc
  • Choose font to show the text, better if could select for all fonts the boolean of mono spaced or normal
  • No limit on line length (TMemo is limited to 4KiB-1 per line), if you have a line with more than one million charcters, see it in one line with correct scroll bar scroll, etc.

Not needed:

  • Sintax, color, etc... just for plain text
  • WordWrap (each line is a line)

Ok, what i am pretending? short answer: simultaneous linked views of a plain text file.

Explained it a little more:

  • Imagine you have a GUI where user can add "separators"
  • Each separator divides the view (not the file) in two parts... so if you have N separators you can see N+1 parts of the file at the same time
  • Each view has its own vertical scrollbar, but there is only one horizontal scroll bar for all (all views are horizontally in sync when scrolling)
  • So user can see first lines on one view, while other parts at the same time without the need to scroll up and down each time

Why? Easy answer: imagine that the file is a log and has more than a million lines... again imagine it is like a historical log... and user wants to see some lines of day X and Day Y and Day # ... etc at the same time (to compare or whatever reason).

If you do it with TMemo, you need to copy all data on all of them... and also 32 bits app are limited to 2GiB of ram on a 32Bits processor and to 3GiB of ram on a 64Bits processor (f compiled with a special directive).

Remember, the app must run on both 32Bits and 64Bits processors without needing to compile different versions... and must be RunAble and need no write at all (anywhere) on run (forensic style).

I thought on a possible way to create it... based on TStringList, but again i am so limited... and it is so much work from scratch.

Maybe there is a component out there since i have seen some apps that can show you a big file without loading it, are all of them with its own implementation from scratch? or they use a component i do not know about?, most of them are for hex editing a big binary file, some can edit files of a lot of GiB, and just a few of them can insert and delete really fast till they save (I/O for copying the whole file while doing pending insert/delete operations can take a really long time, more than one hour, but doing the insert/delete on screen is pretty fast, less than a tenth of a second).

I can do all want i want if i found a component that:

  • Looks like a TMemo
  • By code can be simulated vertical & horizontal scrolls without touching selected text selection (i can hide scrollbar with a smaller TPanel container, so no need for the control to let hide the scrollbars)
  • Really Very Important: Do not load the whole file (only read the part shown)
  • Have LoadFromFile (but not really load the whole file, just internally store file reference)
  • Not needed but desired: user be able to edit like on a TMemo
  • Not needed but desired: have SaveToFile to save user changes

Is out there anyone?

Added: Free of Charge (for any use) and OpenSource is a must.

0

精彩评论

暂无评论...
验证码 换一张
取 消