• Products
  • Download
  • Purchase
  • Support
  • Company
Actipro Software company logo
Twitter Follow Actipro RSS Subscribe (RSS Feed)

The Actipro Blog

Tag Cloud

  • aero
  • blog
  • docking
  • editors
  • gauge
  • intelliprompt
  • navigation
  • propertygrid
  • ribbon
  • shared library
  • silverlight
  • syntaxeditor
  • themes
  • views
  • winforms
  • wpf

Latest Twitter News

November 21, 2011 at 11:14 AM
#WPF Studio 2011.2 is out now! Includes enhanced themes for native WPF conrtols and new SyntaxEditor features. http://t.co/uEMCaGPG

September 26, 2011 at 1:25 PM
If you'd like to see our #WPF / #Silverlight SyntaxEditor code editor control ported to Metro, provide feedback here: http://t.co/xXBNIDTi

September 15, 2011 at 8:31 PM
If you want to see SyntaxEditor eventually show up in Win8's #xaml UI, be sure to add your support to this MS thread: http://t.co/FBjz6TuC

August 15, 2011 at 1:47 PM
New SyntaxEditor IntelliPrompt parameter info feature docs/samples ready for the 2011.2 #WPF and #Silverlight releases. http://t.co/ezoYIjv

August 2, 2011 at 2:40 PM
First look at new automated IntelliPrompt parameter info coming to our C#/VB editor control in #WPF / #Silverlight http://t.co/CUz6O1T

Twitter Follow us on Twitter

Month List

  • 2012
    • February (3)
    • January (2)
  • 2011
    • December (2)
    • November (7)
    • October (2)
    • September (1)
    • August (5)
    • July (3)
    • June (6)
    • May (5)
    • April (8)
    • March (4)
    • February (5)
    • January (9)
  • 2010
    • December (9)
    • November (10)
    • October (4)
    • September (8)
    • August (12)
    • July (9)
    • June (7)
    • May (6)
    • April (7)
    • March (6)
    • February (6)
    • January (4)
  • 2009
    • December (2)
    • November (2)
    • October (12)
    • September (3)
    • August (11)
    • July (10)
    • June (6)
    • May (3)
    • April (7)
    • March (6)
    • February (8)
    • January (10)
  • 2008
    • December (10)
    • November (2)
    • October (3)
    • September (5)
    • August (5)
    • July (8)
    • June (4)
    • May (4)
    • April (10)
    • March (8)
    • February (1)
    • January (2)

Category List

  • RSS feed for ActiproActipro (289)
  • RSS feed for Blog SummaryBlog Summary (13)
  • RSS feed for GeneralGeneral (34)
  • RSS feed for In developmentIn development (150)
  • RSS feed for New featuresNew features (140)
  • RSS feed for New productNew product (30)
  • RSS feed for PromotionPromotion (2)
  • RSS feed for SilverlightSilverlight (71)
  • RSS feed for Tips and tricksTips and tricks (4)
  • RSS feed for Visual Studio 2008Visual Studio 2008 (2)
  • RSS feed for Windows FormsWindows Forms (20)
  • RSS feed for Windows VistaWindows Vista (10)
  • RSS feed for WPFWPF (235)
  • RSS feed for XAMLXAML (23)

About Us

Actipro Software is a leading provider of .NET user interface controls for the WPF, Silverlight, and WinForms frameworks, and is most well-known for their SyntaxEditor syntax-highlighting code editor control.

Please take some time to learn more about us and our product offerings.

Complete code outlining support added to SyntaxEditor for WPF

February 3, 2010 at 2:43 AM
by Bill Henning (Actipro)

We just published WPF Studio 2009.2 build 514 and some of its new features are the culmination of over a month of work on the SyntaxEditor product.  We’ve mentioned some of the new feature areas in our previous blog posts, but here is the list again:

  • Collapsed text
  • Intra-text spacers and intra-text adornment managers
  • Code outlining

Build 514 includes 7 new samples specifically related to the features mentioned above.  That brings our grand total to over 60 samples just for the SyntaxEditor product!

Our last blog post focused on a QuickStart included with build 514 that showed how to implement code reviewing right within the editor, via the use of intra-text adornments.  Today I’d like to discuss code outlining.

What is code outlining?

Code outlining, also known as code folding, is the ability for an outlining node hierarchy to be constructed based on the contents of the document.  The outlining node hierarchy is rendered visually within the new outlining margin as seen in the screenshot below:

CodeOutlining

A “+” or “-“ box in the margin shows where nodes start.  Clicking those boxes toggles the collapsed state of the node.  When a node is collapsed, its text is hidden and boxed-in collapsed text adornment is rendered in place of the hidden text.  In the screenshot above, the boxed-in “/**/” is a collapsed multi-line comment node. 

When a node is expanded, a vertical line in the outlining margin extends downward to show the lines that are encompassed by the node.  A small horizontal offshoot line indicates when the node ends.  You can double-click on the vertical line to collapse the node.

A neat feature added to Visual Studio 2010 is collapsed region highlights that render when moving the mouse over nodes in the outlining margin.  This feature is now in SyntaxEditor as well.  In the screenshot above, the mouse is over the outlining node that covers lines 7-14.  Thus a highlight visually shows the end user the line range that is covered by the node.  This is especially useful when there are multiple nested nodes since the highlight will show innermost node that the mouse is over.

An optional built-in service is provided that will show quick info tips when you hover over collapsed text adornments.  By double-clicking a collapsed text adornment, the related collapsed node expands.

Automatic and manual outlining modes

There are two main outlining modes that SyntaxEditor can be in: automatic and manual.

In automatic mode, a language defines a service that is capable of telling the SyntaxEditor outlining manager where nodes are within the document.  We include two built-in base classes to make it easy to add this functionality.  One simply generates nodes based on tokens, such as start/end curly brace tokens and executes in the main thread.  This is a good way to get started and works well for small to medium size documents.  The second way is a little more advanced and is where your outlining data is constructed in your language’s parser.  A lot of times you’ll want to use an AST (abstract syntax tree) to build the outlining data in this case.  But since the parser is executed in a worker thread, there is no real performance impact to supporting outlining with this way, even with relatively large documents.

Manual mode on the other hand leaves it up to the end user to define the outlining nodes.  The end user can make a selection and choose to collapse it.  They can also choose to remove existing nodes.

Built-in commands

We include built-in edit actions and WPF commands that tie directly to the common outlining functionality you’ll find in products like Visual Studio, such as:

  • Collapse to Definitions
  • Hide Selection
  • Toggle Outlining Expansion
  • Toggle All Outlining
  • Stop Outlining
  • Stop Hiding Current
  • Start Automatic Outlining

To allow your end users to access this functionality just wire up the commands we provide to your WPF buttons or menu items.

Outlining nodes and definitions

The entire outlining node hierarchy can be navigated through programmatically via the root node in the document’s outlining manager.  Each node tells you whether it is collapsed, its text snapshot range (which gives access to text content), and its node definition.

The node definition is an object the provides some characteristics about the node.  A node definition can be shared by multiple nodes.  The node definition has these capabilities:

  • Provide default content to display when the node is collapsed (instead of the standard “…” text)
  • Whether to collapse the node by default when the document is loaded, such as for #region nodes
  • Whether the node is an implementation, which when true will collapse the node when Collapse to Definitions is executed
  • Whether the node is collapsible and is rendered in the UI

We even allow collapsed text to be easily customized based on the nodes content.

CollapsedText

This screenshot shows how a collapsed multi-line comment node did an examination of its contained text and rendered the first line of text in the collapsed text adornment.

Summary

All of this functionality, along with collapsed regions independent of outlining, and intra-text adornments, is now available in the build 514 that was just released.  Head over to our main site and download an evaluation if you are not already a customer.  If you are a WPF Studio customer you can grab build 514 from your account.

Tags: wpf, syntaxeditor
Filed under: Actipro, New features, WPF
Submit to DotNetKicks...
Permalink | Comments (5)

Related posts

Code reviewing in SyntaxEditor for WPF, demoing upcoming intra-text adornments featuresAs mentioned in our previous blog post, we’ve been hard at work on some very major new features for ...SyntaxEditor for WPF - Adding syntactic/semantic parsing supportAs we move forward on new features for SyntaxEditor for WPF, the next feature area we’ve been ...Actipro SyntaxEditor for WPF and Editors for WPF are released SyntaxEditor for WPF with a custom theme loaded Yesterday evening we published WP...

Comments

January 30, 2010 at 08:45  

trackback

Code outlining (folding) added to syntax-highlighting editor control

You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetKicks.com

January 30, 2010 at 09:59  

Mike Strobel

Loving this implementation!  Nice work, guys.

Mike Strobel United States

February 1, 2010 at 03:43  

chadbr

Any plans for a silverlight version?

chadbr United States

February 1, 2010 at 18:36  

Bill Henning (Actipro)

Yes indeed.  We made some posts a bit back on the Silverlight version.  Now that outlining is done, we are likely going to work towards getting a Silverlight alpha version out in the coming weeks.

Bill Henning (Actipro) United States

March 30, 2010 at 09:39  

trackback

Actipro Blog 2010 Q1 posting summary

Actipro Blog 2010 Q1 posting summary

The Actipro Blog - WPF and WinForms Development

Comments are closed
Copyright © 1999-2012 Actipro Software LLC. All rights reserved.
Home Actipro Software | Products | Download | Contact Us