Unusual use of Outlining

SyntaxEditor for Windows Forms Forum

Posted 14 years ago by NSXDavid
Avatar
As part of our editing environ, we have a nice global file search like VS.NET. The results are put into a Find output window which is, of course, an Syntax editor control. We've gotten it to work great! Especially since we can apply syntax highlighting to the line as well.

We've just recently added the ability for the global find to return a user-defineable amount of "context" lines before and after the find hit. Wish VS did that. :)

What we want to do, though, is use the outlining mode to display the find results collapsed so each line of the output is the hit and clicking on the [+] would expand to show the before and after lines.

Some issues have arisen from this:

We tell the collapsed version what the text should be, but that's just a string and it seems there is no way for SyntaxEditor to SyntaxHighlight that text anymore. Can we make it do that or request that option for the future?

When the user expands the collapsed region, we have to play with the custom line numbers at that moment to make sure the line number shows up on the middle line, not the first anymore. But we can't find an event that fires when a user expands or collapses an outline. Is there one?

-- David

Comments (9)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi David,

Those sound like an excellent set of features!

Remember that span indicators can provide custom highlighting for a range of text. You should probably use those for custom highlighting of your outlined areas.

We do have an internal event that fires when a node is expanded/collapsed but it's not exposed publicly. I'll add that to the TODO list.

Maybe in the meantime, override the OnMouseDown method. Store the number of display lines before and after you call base.OnMouseDown. If they changed, you know a node change occurred.


Actipro Software Support

Posted 14 years ago by NSXDavid
Avatar
Hmmm... okay, thanks for exposing the events.

However, I'm not sure what a span indicator has to do with this exactly. I'm refering to the text that you see (by specifying it) when you collapse a region with the outlining feature. The text is not syntax highlighted. In otherwords it mimics what VS.NET does, but I'd argue that what VS.NET does isn't all that wonderful. In my case, I lose a big feature of my search result output window if I can't both collapse without outline (for context lines) and have syntax highlighting when collapsed.

-- David
Posted 14 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
Actually... even Visual Studio allows some syntax highlighting within collapsed text. This is a feature I requested a while back.

http://www.actiprosoftware.com/Support/Forums/ViewForumTopic.aspx?ForumTopicID=770#2545

[Modified at 10/03/2005 01:41 PM]
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
David, can you give a before/after collapse example of what you want to display highlighted and how it should appear? If you are collapsing text I don't follow exactly what you want to show up representing the collapsed text. Also remember that the tooltips when you hover over a collapsed node are syntax highlighted representing the contents of the collapsed node.


Actipro Software Support

Posted 14 years ago by NSXDavid
Avatar
When collapsed, I'd want a single line of text that is syntax highlighted just like the line would be if it wasn't collapsed. The other lines in the outline group won't be visible when collapsed, but will when expanded (as it does now).

In my particular use, I'm doing a global find for a string... for example: "foo" and telling it I want 2 context lines before and after each hit. So each result returns between 1 and 5 lines (the line with the "foo" hit, plus possibly one or two lines before and after). The reason it is not eactly five lines per is because the hit might be near the very top or very bottom of the file where there are no more contextual lines, right? :)

So, each hit is an outline group which starts collapsed. You see the hit line, just like you do in VS.NET except it'll be syntax highlighted and have an indicator underlining the hit string in the line. If you click the outline plus, it'll expand to show you the context lines around it, so typically that'd be 5 lines with the hit line in the middle.

I can do all of this except for maintaining syntax highlighting when it's collapsed because you just give it a string to display, which it shows plain in a tinted box (VS.NET style). What I'd like is an alternate form where you specify what line of the document to show. It collapsed to showing just the line you specified (specified by line index, whatever). It doesn't put it in a box, or try and do anything fancy. Just display the line in the same way it always does; syntax highlighting, indicators, and all.

-- David
Posted 14 years ago by Boyd - Automated Software Testing Consultant / Developer, Patterson Consulting, LLC
Avatar
An alternative to David's proposal would be to provide an offset range to use as the display text instead of an entire line. Then you could just display the text from that offset range with the highlighting that would have normally been used for the text in that offset range. If offsets create problems (since they could split tokens and create difficulties for the syntax highlighting to use), perhaps a Start Token and End Token instead.
Posted 14 years ago by NSXDavid
Avatar
Yeah, that'd be even more powerful.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I added this to the TODO list. We'll have to discuss it in detail in the future design of 4.0 since I don't think it's a straightforward thing and there might be multiple ways of handling it.


Actipro Software Support

Posted 14 years ago by NSXDavid
Avatar
Rats. :(
The latest build of this product (v2018.1 build 0341) was released 6 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.