views:

393

answers:

1

Hi, does anyone know how to add "change markers" functionality to SynEdit? I mean those lines, green for modified & saved, yellow for modified & unsaved parts of document... here is an example from other editor:

+1  A: 

Yes, I've added it to my copy of SynEdit. I originally snagged the code from another project.

It is broken across (at least) two different units IIRC.

You need to modify SynEditTextBuffer.pas as well as SynEdit.pas.

The code is rather complex because you need to modify several spots in SynEditTextBuffer.pas as well as 1 or 2 spots in SynEdit.pas.

The original project I snagged the code from was being very ambitious in that they were trying to develop code folding and line blocking (as shown in your image) as well.

I couldn't get the code folding to work reliably so I dropped that mod and just used the line change code. I believe that dropping the code folding also dropped the line blocking.

The name of that project is SynEditSudio, it from a Chinese website, but I believe the Firefox translator plugins work pretty well in converting it.

EDIT: contact me directly if you want to get a copy of my changes.

HTH Ryan.

Ryan J. Mills
Does this code do the right thing also in the face of undo / redo? I.e. does it remove the lines as the changes are undone?
mghie
I had very bad experience with code-folding modification of synedit as well,however I used the "Mystix" version (see on SourceForge)... unfortunately both versions seems to be dead now.I guess I'll contact you in case I fail with modifying SynEditStudio on my own... I'd love however to see some plugin which does not require modifying SynEdit source *that* deeply :/
migajek
@mghie - Yes the undo/redo works. I'm currently using it in a small commercial product of mine. My version of SynEdit is heavily modified but still up to date with the last official release of the SynEdit project. I've got things like wrap at right margin, highlight all current token instances, the line modified indicators, token matching, sequential line numbers (a-la Delphi IDE), current line highlight as well as a highly customized options dialog.
Ryan J. Mills
@michal - SynEdit on sourceforge is still be developed. He's (lead developer) working on a branch called "utterly unstable" and he's still quite active there. For the most part SynEdit is quite stable and doesn't need a lot of extra maintenance. For feature enhancements you need to do something like add them yourself or borrow them from other projects like SynEditStudio. Take a look at my previous comment to see some of what my version contains/can do.
Ryan J. Mills
Ryan J. Mills
@Ryan: Thanks for the comments, they are very interesting for me as I maintained SynEdit once but completely lost touch with it. I'm still using 1.03 FWIW. Lately I toyed with the idea of checking out UniSynEdit for Delphi 2009, but what you write leads me to believe that many of the fundamental problems with SynEdit haven't been fixed. I will probably first investigate using the Scintilla control. Do you by chance have any experience with it in Delphi?
mghie
@Ryan, unfortunately I have no idea how to contact you. E-mail form on your website says it cannot send my email right now.I'd love to contact you somehow, please try mailing me at gmail.com. My account name is "migajek" (I'm not posting the whole email address for obvious reasons ;) )
migajek
@mghie I had some experience with Scintilla in Delphi. I believe its currently the best choice if you're looking for free solution, it has all you need - Unicode, Code Folding and so on. However as for my case it lacks advanced highlighter for web languages, thats why I'm still using SynEdit. If you want anything, contact me at my email (see comment above)
migajek
@mghie - I looked at Scintilla, but I don't have enough experience with C to try and compile it to object files for inclusion into my Delphi app with out the external DLL reference. I guess I'm a little funny that way, I would rather have little or no external (DLL) file requirements. I don't have that many problems with SynEdit, don't get me wrong, I really like it. But there are certain things, like code folding, that it just doesn't support that I would really like to have. From what I've found in my research I think scintilla requires a bit of a shift in thinking for Delphi developers.
Ryan J. Mills
@michal - I've sent you an email.
Ryan J. Mills
@Ryan as you know there is a wrapper for Scintilla, which implements quite standard component and does all the things related to communicating with DLL on its own. I don't like shipping any dlls as well, but sometimes its unavoidable ;)
migajek
@Ryan I wrote you a response...did you got it?
migajek
@michal - I know of the Scintilla wrapper. But I decided to go with the EControl component. It appears to be a better fit with my existing projects.
Ryan J. Mills