Posted 18 years ago by Kevin Fournier
Avatar
I am currently evaluating the latest SyntaxEditor, and I must say, I'm very excited about it. I currently have an editor written in MFC and am looking into porting/updating to .NET. My current editor is based on the Scintilla open source component, but I daresay that SyntaxEditor looks far more flexible and professional.

Still, I have a couple questions about functionality that I hope might be answered here. I did search the forums, but haven't found a clear yes/no answer.

1. Can I custom draw characters or tokens? My current editor works with propietary delimiters, which are custom drawn in order to really distinguish them from code/data. I realize this could be accomplished with unique styles, but I feel a nice custom drawn delimiter will add a professionally polished look.

2. Can I customize which character(s) represent line breaks using a callback or override? Again, my editor deals with delimiters. Sometimes, it's better to break the data up into lines using the delimiters for increased readability. The line breaks change based on the user expanding/contracting chunks of data, much like a tree control.

These are my only two questions. It appears that this wonderful control already offers me the ability to meet all my other goals--and then some. Currently, I have to modify the Scintilla scource to achieve things like custom line numbers, which hinders my ability to incorporate updates.

Thank you all in advance for any information.

Comments (5)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Kevin,

Thanks for your interest in SyntaxEditor. Let me answer your questions...

1) You can do custom drawing by overriding our renderer. But what might be better is that v4.0 supports multiple fonts in the same document. So could you perhaps use a different font for your delimiters from the one used for normal text?

2) The line break characters are designated by the SyntaxEditor.WhitespaceHardLineEndCharacter and SyntaxEditor.WhitespaceSoftLineEndCharacter properties when the SyntaxEditor.WhitespaceLineEndsVisible property is set to true. Unfortunately those are designed to be used across the entire document.


Actipro Software Support

Posted 18 years ago by Kevin Fournier
Avatar
Thank you for your timely response. With regards to the custom text rendering, are you saying it's possible? I understand there would be a performance hit, and I'd gladly use a custom font should it meet my picky requirements. <g>

Here is a screenshot of my current editor:

The delimiters are white characters over a solid rounded rectangle. From my research, it appears that SyntaxEditor can do rounded rectangle borders, but I have not been able to determine if you can have a solid rounded rectangle. I understand that you can have a background color, but is it not the case that the background color is only a rectangle? And doesn't it extend to the top of the line, rather than tightly around the character as seen in my screenshot?

As for the line break, I am not all that disappointed in the answer. As a programmer, I have my share of users who want me to do all the work for them, and there are some things that are just too custom. My current editor performs expanding and contracting by converting delimiters into newlines and vice versa. So, I already have the logic to do this... I was just looking to see if there were better avenues.
Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
If possible, doing this with multiple fonts is the best way, if you are unable to use a single font. Of course you need to be able to parse out with a lexer where the symbols are. How are you doing that with your editor in the screenshot? Like what is on line 1 that makes them blue and on line 2 that makes them green?

SyntaxEditor can do 1-pixel rounded borders (I believe it's a corner style property on HighlightingStyle) but the backgrounds are rectangles and will fill the bounds of the character.


Actipro Software Support

Posted 18 years ago by Jared Phelps
Avatar
I also moved from scintilla and found the transition to be pretty smooth. Working just nights and weekends, it took me a couple of days to adapt my existing lexer, 2 weeks to get my existing semantic parser working outside of the object model, and about 4 more weeks to integrate my old semantic parser in to the syntaxeditor object model (mostly because I thought it was nicer than mine more than any necessity to do so). I figure it was around 50 hours total to port around 10k lines of code.

To do everything I wanted with scintilla would have been 5 or 6 times the amount of work, and my code wouldn't be nearly as clean or optimized, so this was $350 well spent.

Good luck,
Jared
Posted 18 years ago by Kevin Fournier
Avatar
Scintilla supports the ability to display certain ASCII characters in a very unique way as illustrated in this screenshot. The screenshot is showing a sample text file of sequentially inremented ASCII character, 1 - 255. Character 1 is displayed as a three character string, SOH. This three character string is treated like a single character in the way that it is deleted, copied, etc.

To achieve the colored delimiters, I modified the source code to check for special character values and display them utilizing the same logic used to display the aforementioned characters. My frustration with this approach is that, in modifying the Scintilla source, I am locked into that particular version. Incorporating new versions requires painstaking retrofitting or the complete loss of my customizations. It would have been nice if there was an override which allowed me to custom draw specific characters.

With that being said, I may be able to utilize the rounded border. Perhaps I can draw my value marks as a blue V surrounded by a border of the same color. It wouldn't stand out as much, but it may do the trick for now. However, if you guys are ever in the mood for enhancements, the ability to fill a rounded border would suit my needs perfectly.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.