diff --git a/samples/AvalonEdit.Sample/article.html b/samples/AvalonEdit.Sample/article.html index ebeea77ff1..2d2cd9fc77 100644 --- a/samples/AvalonEdit.Sample/article.html +++ b/samples/AvalonEdit.Sample/article.html @@ -45,7 +45,7 @@ CODE { COLOR: #990000; FONT-FAMILY: "Courier New", Courier, mono; }

The latest version of AvalonEdit can be found as part of the SharpDevelop project. @@ -72,7 +72,7 @@ for ICSharpC For example, an AddIn should be able to allow inserting images into comments – this way you could put stuff like class diagrams right into the source code!

-With, Easy to use, I'm referring to the programming API. It should just work™. +With, Easy to use, I'm referring to the programming API. It should just work. For example, this means if you change the document text, the editor should automatically redraw without having to call Invalidate(). @@ -101,7 +101,7 @@ ASP.NET, Boo, Coco/R grammars, C++, C#, HTML, Java, JavaScript, Patch files, PHP

If you need more of AvalonEdit than a simple text box with syntax highlighting, you will first have to learn more about the architecture of AvalonEdit. -

Architecture

+

Architecture of AvalonEdit

Namespace Dependency Graph

As you can see in this dependency graph, AvalonEdit consists of a few sub-namespaces that have cleanly separated jobs. @@ -127,7 +127,7 @@ While the main control provides some convenience methods for common tasks, for m or textEditor.TextArea.TextView. -

Document (The Text Model)

+

The Text Model: Document

The main class of the model is ICSharpCode.AvalonEdit.Document.TextDocument. Basically, the document is a StringBuilder with events. @@ -179,7 +179,7 @@ Those are convenience methods built on top of the DocumentLine clas This collection is read-only to user code and is automatically updated to reflect the current document content. -

Rendering

+

Rendering: TextView

In the whole 'Document' section, there was no mention of extensibility. The text rendering infrastructure now has to compensate for that by being completely extensible. @@ -200,7 +200,7 @@ them to the TextView to implement additional features in the editor The extensibility features of the rendering namespace are discussed in detail in the article "AvalonEdit Rendering". (to be published soon) --> -

Editing

+

Editing: TextArea

The TextArea class is handling user input and executing the appropriate actions. Both the caret and the selection are controlled by the TextArea. @@ -236,7 +236,7 @@ Currently, only the XmlFoldingStrategy is built into AvalonEdit. The sample application to this article also contains the BraceFoldingStrategy that folds using { and }. However, it is a very simple implementation and does not handle { and } inside strings or comments correctly. -

Syntax highlighting

+

Syntax Highlighting

The highlighting engine in AvalonEdit is implemented in the class DocumentHighlighter. Highlighting is the process of taking a DocumentLine and constructing a HighlightedLine instance for it by assigning colors to different sections of the line. @@ -289,17 +289,17 @@ Here is a complete highlighting definition for a sub-set of C#: The highlighting engine works with "spans" and "rules" that each have a color assigned to them. In the XSHD format, colors can be both referenced (color="Comment") or directly specified (fontWeight="bold" foreground="Blue").

-Spans consist of two regular expressions (begin+end); while rules are simply a single regex with a color. The <Keywords> element is just a nice -syntax to define a highlighting rule that matches a set of words; internally a single regex will be used for the whole keyword list. +Spans consist of two regular expressions (begin+end), while rules are simply a single RegEx with a color. The <Keywords> element is just a nice +syntax to define a highlighting rule that matches a set of words; internally a single RegEx will be used for the whole keyword list.

-The highlighting engine works by first analyzing the spans: whenever a begin regex matches some text, that span is pushed onto a stack. -Whenever the end regex of the current span matches some text, the span is popped from the stack. +The highlighting engine works by first analyzing the spans: whenever a begin RegEx matches some text, that span is pushed onto a stack. +Whenever the end RegEx of the current span matches some text, the span is popped from the stack.

Each span has a nested rule set associated with it, which is empty by default. This is why keywords won't be highlighted inside comments: the span's empty ruleset is active there, so the keyword rule is not applied.

This feature is also used in the string span: the nested span will match when a backslash is encountered, and the character following the backslash -will be consumed by the end regex of the nested span (. matches any character). +will be consumed by the end RegEx of the nested span (. matches any character). This ensures that \" does not denote the end of the string span; but \\" still does.

What's great about the highlighting engine is that it highlights only on-demand, works incrementally, diff --git a/src/Libraries/AvalonEdit/Documentation/Architecture.aml b/src/Libraries/AvalonEdit/Documentation/Architecture.aml new file mode 100644 index 0000000000..31efc17415 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Architecture.aml @@ -0,0 +1,33 @@ + + + + + + + + + As you can see in this dependency graph, AvalonEdit consists of a few + sub-namespaces that have cleanly separated jobs. + Most of the namespaces have a kind of 'main' class. + Here is the visual tree of the TextEditor control: + + It's important to understand that AvalonEdit is a composite control + with the three layers: + T:ICSharpCode.AvalonEdit.TextEditor (main control), + T:ICSharpCode.AvalonEdit.Editing.TextArea (editing), + T:ICSharpCode.AvalonEdit.Rendering.TextView (rendering). + + While the main control provides some convenience methods for common tasks, + for most advanced features you have to work directly with the inner controls. + You can access them using textEditor.TextArea or + textEditor.TextArea.TextView. + + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/Code Completion.aml b/src/Libraries/AvalonEdit/Documentation/Code Completion.aml new file mode 100644 index 0000000000..62c7271a15 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Code Completion.aml @@ -0,0 +1,133 @@ + + + + + + AvalonEdit comes with a code completion drop down window. + You only have to handle the text entering events to determine + when you want to show the window; all the UI is already done for you. + + +

+ Usage of the Code Completion Window + + + // in the constructor: + textEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering; + textEditor.TextArea.TextEntered += textEditor_TextArea_TextEntered; +} + +CompletionWindow completionWindow; + +void textEditor_TextArea_TextEntered(object sender, TextCompositionEventArgs e) +{ + if (e.Text == ".") { + // Open code completion after the user has pressed dot: + completionWindow = new CompletionWindow(textEditor.TextArea); + IList<ICompletionData> data = completionWindow.CompletionList.CompletionData; + data.Add(new MyCompletionData("Item1")); + data.Add(new MyCompletionData("Item2")); + data.Add(new MyCompletionData("Item3")); + completionWindow.Show(); + completionWindow.Closed += delegate { + completionWindow = null; + }; + } +} + +void textEditor_TextArea_TextEntering(object sender, TextCompositionEventArgs e) +{ + if (e.Text.Length > 0 && completionWindow != null) { + if (!char.IsLetterOrDigit(e.Text[0])) { + // Whenever a non-letter is typed while the completion window is open, + // insert the currently selected element. + completionWindow.CompletionList.RequestInsertion(e); + } + } + // Do not set e.Handled=true. + // We still want to insert the character that was typed. +} + + + This code will open the code completion window whenever '.' is pressed. + By default, the + T:ICSharpCode.AvalonEdit.CodeCompletion.CompletionWindow + only handles key presses like Tab and Enter to insert the currently + selected item. To also make it complete when keys like '.' or ';' are pressed, + we attach another handler to the TextEntering event + and tell the completion window to insert the selected item. + + + The CompletionWindow will actually never have + focus - instead, it hijacks + the WPF keyboard input events on the text area and passes them through its + ListBox. + This allows selecting entries in the completion list using the + keyboard and normal typing in the editor at the same time. + + + Here is the implementation of the MyCompletionData class used in the code above: + +/// Implements AvalonEdit ICompletionData interface to provide the entries in the +/// completion drop down. +public class MyCompletionData : ICompletionData +{ + public MyCompletionData(string text) + { + this.Text = text; + } + + public System.Windows.Media.ImageSource Image { + get { return null; } + } + + public string Text { get; private set; } + + // Use this property if you want to show a fancy UIElement in the list. + public object Content { + get { return this.Text; } + } + + public object Description { + get { return "Description for " + this.Text; } + } + + public void Complete(TextArea textArea, ISegment completionSegment, + EventArgs insertionRequestEventArgs) + { + textArea.Document.Replace(completionSegment, this.Text); + } +} + + Both the content and the description shown may be any content acceptable in WPF, + including custom UIElements. + You may also implement custom logic in the Complete + method if you want to do more than simply inserting the text. + The insertionRequestEventArgs can help decide which + kind of insertion the user wants - depending on how the insertion was triggered, + it is an instance of TextCompositionEventArgs, + KeyEventArgs or MouseEventArgs. + + +
+
+ Code Completion for C# + + + Full C# code completion is not in the scope of AvalonEdit. + You will need a C# parser, a C# type system, and the ability + to resolve C# expressions in your type system. + + + If you want to learn how this is handled in SharpDevelop, please + see: + + Code Completion in SharpDevelop + http://wiki.sharpdevelop.net/CodeCompletion.ashx + _blank + + + +
+ + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/Coordinate Systems.aml b/src/Libraries/AvalonEdit/Documentation/Coordinate Systems.aml new file mode 100644 index 0000000000..f644c2ab74 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Coordinate Systems.aml @@ -0,0 +1,175 @@ + + + + + + + + The text editor makes use of several different coordinate systems. + Here's an explanation of them. + + +
+ Offset + + In AvalonEdit, an index into the document is called an offset. + + Offsets usually represent the position between two characters. + The first offset at the start of the document is 0; + the offset after the first char in the document is 1. + The last valid offset is document.TextLength, + representing the end of the document. + This is exactly the same as the index parameter + used by methods in the .NET String or StringBuilder classes. + + +
+
+ TextLocation + + The + T:ICSharpCode.AvalonEdit.Document.TextLocation + struct represents a Line/Column pair. Line and column are counted from 1. + The document provides the methods + M:ICSharpCode.AvalonEdit.Document.TextDocument.GetLocation(System.Int32) + and + M:ICSharpCode.AvalonEdit.Document.TextDocument.GetOffset(ICSharpCode.AvalonEdit.Document.TextLocation) + to convert between offsets and TextLocations. + +
+
+ TextAnchor + + If you are working with the text editor, you will likely run into the problem + that you need to store an offset, but want it to adjust automatically whenever + text is inserted prior to that offset. + Sure, you could listen to the TextDocument.Changed event and call + GetNewOffset on the DocumentChangeEventArgs to translate the offset, + but that gets tedious; especially when your object is short-lived and you + have to deal with deregistering the event handler at the correct point of time. + A text anchor object stores an Offset, but automatically + updates the offset when text is inserted/removed before the offset. + + + A much simpler solution is to use the + T:ICSharpCode.AvalonEdit.Document.TextAnchor + class. + Please take a look at the documentation for that class for more details. + + +
+
+ RelativeTextOffset + + An offset in the document, but relative to the start offset of a T:ICSharpCode.AvalonEdit.Rendering.VisualLine. + Relative text offsets are used to store document offsets in visual lines. + You can convert between relative text offsets and document offsets + by adding/subtracting + P:ICSharpCode.AvalonEdit.Rendering.VisualLine.FirstDocumentLine.P:ICSharpCode.AvalonEdit.Document.DocumentLine.Offset. + + +
+
+ VisualColumn + + An integer value that specifies a position inside a VisualLine. + + Not only text has a length in the visual line, but also other VisualLineElements. + VisualColumn is counting from 0 for each visual line. + + For example, tab markers take 2 visual columns (the marker and the tab space), + newline markers take 1 visual column; folding markers take just 1 visual column + even though they are longer in the document text. + Use the + M:ICSharpCode.AvalonEdit.Rendering.VisualLine.GetVisualColumn(System.Int32) + and + M:ICSharpCode.AvalonEdit.Rendering.VisualLine.GetRelativeOffset(System.Int32) + methods to convert between + visual columns and relative text offsets. + + Do not confuse VisualColumn with text columns. + VisualColumn starts at 0, text column at 1. Text may have different length + in the two coordinate systems (e.g. tab markers, foldings). + + +
+
+ TextViewPosition + + A Line,Column,VisualColumn triple. + The T:ICSharpCode.AvalonEdit.TextViewPosition + struct can be implicitly converted + to T:ICSharpCode.AvalonEdit.Document.TextLocation, + but has the additional VisualColumn information + that is necessary to accurately hold the caret position when + VisualLineElements with DocumentLength 0 are in use. + +
+
+ VisualTop + + A double value that specifies the distance from the top of + the document to the top of a line measured in device-independent pixels. + VisualTop is equivalent to the Y component of a VisualPosition. + +
+
+ VisualPosition + + A Point value (double X,Y) that specifies the position of an + element from the top left document corner measured in device-independent pixels. + To convert a VisualPosition to or from a (mouse) position inside + the TextView, simply subtract or add + P:ICSharpCode.AvalonEdit.Rendering.TextView.ScrollOffset + to it. + + +
+ + + +
+
\ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/Folding.aml b/src/Libraries/AvalonEdit/Documentation/Folding.aml new file mode 100644 index 0000000000..6756239928 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Folding.aml @@ -0,0 +1,58 @@ + + + + + + Introduction for 'Folding'. + + +
+ How to use Folding in your application + + + Folding (code collapsing) is implemented as an extension to the editor. + It could have been implemented in a separate assembly without having to + modify the AvalonEdit code. + A T:ICSharpCode.AvalonEdit.Rendering.VisualLineElementGenerator + takes care of the collapsed sections in the text document; and a custom + margin draws the plus and minus buttons. + + You could use the relevant classes separately; + but, to make it a bit easier to use, the static + M:ICSharpCode.AvalonEdit.Folding.FoldingManager.Install + method will create and register the necessary parts automatically. + All that's left for you is to regularly call + M:ICSharpCode.AvalonEdit.Folding.FoldingManager.UpdateFoldings + with the list of foldings you want to provide. + You could calculate that list yourself, or you could use a built-in + folding strategy to do it for you. + Here is the full code required to enable folding: +foldingManager = FoldingManager.Install(textEditor.TextArea); +foldingStrategy = new XmlFoldingStrategy(); +foldingStrategy.UpdateFoldings(foldingManager, textEditor.Document); + If you want the folding markers to update when the text is changed, + you have to repeat the foldingStrategy.UpdateFoldings call regularly. + + +
+
+ How the FoldingManager works + + + The FoldingManager maintains a list of foldings. The FoldMargin displays those foldings and provides + the UI for collapsing/expanding. + Folded foldings cause the FoldingElementGenerator to produce a line element that spans the whole folded + text section, causing the text generation for the visual line that contains the folding start to + continue after the folding end in another line. + To ensure scrolling works correctly in the presence of foldings, lines inside folded regions must not + be used as start lines for the visual line generation. This is done by setting the line height of all + such lines to 0. To efficiently set the height on a large number of lines and support reverting to the + old height when the folding is uncollapsed, a CollapsedLineSection is used. + + +
+ + T:ICSharpCode.AvalonEdit.Folding.FoldingManager + +
+
\ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.content b/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.content new file mode 100644 index 0000000000..82823d09b1 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.content @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj b/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj new file mode 100644 index 0000000000..29c6d97351 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/ICSharpCode.AvalonEdit.shfbproj @@ -0,0 +1,165 @@ + + + + Debug + AnyCPU + 2.0 + {850b6602-0a7f-413a-864a-e816b98d7407} + 1.8.0.0 + + Documentation + Documentation + Documentation + + .\Help\ + AvalonEdit Documentation + + + Summary, AutoDocumentCtors, Namespace + InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected + + + + + + + + + + + 3.5 + AvalonEdit + Copyright 2008-2009, Daniel Grunwald + Prototype + 4.0.0.0 + + + + + + + + + + + + + +{@CachedFrameworkCommentList} +{@CommentFileList} + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the main AvalonEdit namespace. + This namespace contains classes to show the code completion window. + This namespace contains the document model. +The most important class here is TextDocument, which represents document that can be displayed and edited in the text editor. + This namespace is the home of the TextArea class. It manages user input and handles the caret and the selection. + This namespace contains the folding (code collapsing) implementation. + This namespace contains the engine for highlighting text documents (DocumentHighlighter). +Additionally, the class HighlightingColorizer provides integration of the highlighting engine into the text editor GUI. + This namespace contains a document model for syntax highlighting definitions (.xshd files). + This namespace contains the logic for automatic indentation. + This namespace contains the text rendering infrastructure. + This namespace contains various utility classes. + + This namespace contains an error-tolerant XML parser with support for incremental parsing, only reparsing the changed regions of a TextDocument. + + True + Standard + + + + + + + + + + + + + + + + + + + + + + WelcomeScreenshot + + + VisualTree + Visual Tree + + + RenderingPipeline + + + NamespaceDependencies + Namespace Dependency Graph + + + + + + + + + \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/License.html b/src/Libraries/AvalonEdit/Documentation/License.html new file mode 100644 index 0000000000..76eba42dfb --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/License.html @@ -0,0 +1,566 @@ + + + + License + + + + + + + +

GNU LESSER GENERAL PUBLIC LICENSE

+

+Version 2.1, February 1999 +

+ +
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ + +

Preamble

+ +

+ The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. +

+

+ This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. +

+

+ When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. +

+

+ To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. +

+

+ For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. +

+

+ We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. +

+

+ To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. +

+

+ Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. +

+

+ Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. +

+

+ When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. +

+

+ We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. +

+

+ For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. +

+

+ In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. +

+

+ Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. +

+

+ The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. +

+ +

TERMS AND CONDITIONS FOR COPYING, +DISTRIBUTION AND MODIFICATION

+ + +

+0. +This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". +

+

+ A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. +

+

+ The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) +

+

+ "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. +

+

+ Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. +

+

+1. +You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. +

+

+ You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. +

+

+2. +You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: +

+ + + +

+These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be +reasonably considered independent and separate works in themselves, then +this License, and its terms, do not apply to those sections when you +distribute them as separate works. But when you distribute the same +sections as part of a whole which is a work based on the Library, the +distribution of the whole must be on the terms of this License, whose +permissions for other licensees extend to the entire whole, and thus to +each and every part regardless of who wrote it. +

+

+Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works +based on the Library. +

+

+In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of +this License. +

+

+3. +You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. +

+

+ Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. +

+

+ This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. +

+

+4. +You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. +

+

+ If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. +

+

+5. +A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. +

+

+ However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. +

+

+ When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. +

+

+ If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) +

+

+ Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. +

+

+6. +As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. +

+

+ You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: +

+ + + +

+ For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. +

+

+ It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. +

+

+7. You may place library facilities that are a work +based on the Library side-by-side in a single library together with +other library facilities not covered by this License, and distribute +such a combined library, provided that the separate distribution of +the work based on the Library and of the other library facilities is +otherwise permitted, and provided that you do these two things: +

+ + + +

+8. You may not copy, modify, sublicense, link with, +or distribute the Library except as expressly provided under this +License. Any attempt otherwise to copy, modify, sublicense, link +with, or distribute the Library is void, and will automatically +terminate your rights under this License. However, parties who have +received copies, or rights, from you under this License will not have +their licenses terminated so long as such parties remain in full +compliance. +

+

+9. +You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. +

+

+10. +Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. +

+

+11. +If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. +

+

+If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. +

+

+It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. +

+

+This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. +

+

+12. +If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. +

+

+13. +The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. +

+

+Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. +

+

+14. +If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. +

+

+NO WARRANTY +

+

+15. +BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. +

+

+16. +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. +

+ +

END OF TERMS AND CONDITIONS

+ + + diff --git a/src/Libraries/AvalonEdit/Documentation/Media/NamespaceDependencies.png b/src/Libraries/AvalonEdit/Documentation/Media/NamespaceDependencies.png new file mode 100644 index 0000000000..6655f805eb Binary files /dev/null and b/src/Libraries/AvalonEdit/Documentation/Media/NamespaceDependencies.png differ diff --git a/src/Libraries/AvalonEdit/Documentation/Media/RenderingPipeline.png b/src/Libraries/AvalonEdit/Documentation/Media/RenderingPipeline.png new file mode 100644 index 0000000000..9e7b7e308d Binary files /dev/null and b/src/Libraries/AvalonEdit/Documentation/Media/RenderingPipeline.png differ diff --git a/src/Libraries/AvalonEdit/Documentation/Media/VisualTree.png b/src/Libraries/AvalonEdit/Documentation/Media/VisualTree.png new file mode 100644 index 0000000000..616f68a328 Binary files /dev/null and b/src/Libraries/AvalonEdit/Documentation/Media/VisualTree.png differ diff --git a/src/Libraries/AvalonEdit/Documentation/Media/WelcomeScreenshot.png b/src/Libraries/AvalonEdit/Documentation/Media/WelcomeScreenshot.png new file mode 100644 index 0000000000..524f91fd88 Binary files /dev/null and b/src/Libraries/AvalonEdit/Documentation/Media/WelcomeScreenshot.png differ diff --git a/src/Libraries/AvalonEdit/Documentation/Sample Application.aml b/src/Libraries/AvalonEdit/Documentation/Sample Application.aml new file mode 100644 index 0000000000..d028e5695f --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Sample Application.aml @@ -0,0 +1,78 @@ + + + + + + + + In the SharpDevelop source code download, you will find a small sample + application in SharpDevelop\samples\AvalonEdit.Sample. + + + + + + + + +
+ The Code Project article + + + There is a Code Project article based on the sample application: + + http://www.codeproject.com/KB/edit/AvalonEdit.aspx + http://www.codeproject.com/KB/edit/AvalonEdit.aspx + _blank + + + + However, most of the material from that article has been included in this help file. + + +
+ + + + +
+
\ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/Syntax Highlighting.aml b/src/Libraries/AvalonEdit/Documentation/Syntax Highlighting.aml new file mode 100644 index 0000000000..a67731c1f7 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Syntax Highlighting.aml @@ -0,0 +1,187 @@ + + + + + Probably the most important feature for any text editor is syntax highlighting. + AvalonEdit has a flexible text rendering model, see + . Among the + text rendering extension points is the support for "visual line transformers" that + can change the display of a visual line after it has been constructed by the "visual element generators". + A useful base class implementing IVisualLineTransformer for the purpose of syntax highlighting + is T:ICSharpCode.AvalonEdit.Rendering.DocumentColorizingTransformer. + Take a look at that class' documentation to see + how to write fully custom syntax highlighters. This article only discusses the XML-driven built-in + highlighting engine. + + +
+ The highlighting engine + + + The highlighting engine in AvalonEdit is implemented in the class + T:ICSharpCode.AvalonEdit.Highlighting.DocumentHighlighter. + Highlighting is the process of taking a DocumentLine and constructing + a T:ICSharpCode.AvalonEdit.Highlighting.HighlightedLine + instance for it by assigning colors to different sections of the line. + A HighlightedLine is simply a list of + (possibly nested) highlighted text sections. + + The HighlightingColorizer class is the only + link between highlighting and rendering. + It uses a DocumentHighlighter to implement + a line transformer that applies the + highlighting to the visual lines in the rendering process. + + Except for this single call, syntax highlighting is independent from the + rendering namespace. To help with other potential uses of the highlighting + engine, the HighlightedLine class has the + method ToHtml() + to produce syntax highlighted HTML source code. + + The highlighting rules used by the highlighting engine to highlight + the document are described by the following classes: + + + + HighlightingRuleSet + Describes a set of highlighting spans and rules. + HighlightingSpan + A span consists of two regular expressions (Start and End), a color, + and a child ruleset. + The region between Start and End expressions will be assigned the + given color, and inside that span, the rules of the child + ruleset apply. + If the child ruleset also has HighlightingSpans, + they can be nested, allowing highlighting constructs like nested comments or one language + embedded in another. + HighlightingRule + A highlighting rule is regular expression with a color. + It will matches of the regular expression using that color. + HighlightingColor + A highlighting color isn't just a color: it consists of a foreground + color, font weight and font style. + + + The highlighting engine works by first analyzing the spans: whenever a + begin RegEx matches some text, that span is pushed onto a stack. + Whenever the end RegEx of the current span matches some text, + the span is popped from the stack. + + Each span has a nested rule set associated with it, which is empty + by default. This is why keywords won't be highlighted inside comments: + the span's empty ruleset is active there, so the keyword rule is not applied. + + This feature is also used in the string span: the nested span will match + when a backslash is encountered, and the character following the backslash + will be consumed by the end RegEx of the nested span + (. matches any character). + This ensures that \" does not denote the end of the string span; + but \\" still does. + + What's great about the highlighting engine is that it highlights only + on-demand, works incrementally, and yet usually requires only a + few KB of memory even for large code files. + + On-demand means that when a document is opened, only the lines initially + visible will be highlighted. When the user scrolls down, highlighting will continue + from the point where it stopped the last time. If the user scrolls quickly, + so that the first visible line is far below the last highlighted line, + then the highlighting engine still has to process all the lines in between + – there might be comment starts in them. However, it will only scan that region + for changes in the span stack; highlighting rules will not be tested. + + The stack of active spans is stored at the beginning of every line. + If the user scrolls back up, the lines getting into view can be highlighted + immediately because the necessary context (the span stack) is still available. + + Incrementally means that even if the document is changed, the stored span stacks + will be reused as far as possible. If the user types /*, + that would theoretically cause the whole remainder of the file to become + highlighted in the comment color. + However, because the engine works on-demand, it will only update the span + stacks within the currently visible region and keep a notice + 'the highlighting state is not consistent between line X and line X+1', + where X is the last line in the visible region. + Now, if the user would scroll down, + the highlighting state would be updated and the 'not consistent' notice + would be moved down. But usually, the user will continue typing + and type */ only a few lines later. + Now the highlighting state in the visible region will revert to the normal + 'only the main ruleset is on the stack of active spans'. + When the user now scrolls down below the line with the 'not consistent' marker; + the engine will notice that the old stack and the new stack are identical; + and will remove the 'not consistent' marker. + This allows reusing the stored span stacks cached from before the user typed + /*. + + While the stack of active spans might change frequently inside the lines, + it rarely changes from the beginning of one line to the beginning of the next line. + With most languages, such changes happen only at the start and end of multiline comments. + The highlighting engine exploits this property by storing the list of + span stacks in a special data structure + (T:ICSharpCode.AvalonEdit.Utils.CompressingTreeList{T}). + The memory usage of the highlighting engine is linear to the number of span stack changes; + not to the total number of lines. + This allows the highlighting engine to store the span stacks for big code + files using only a tiny amount of memory, especially in languages like + C# where sequences of // or /// + are more popular than /* */ comments. + + +
+
+ XML highlighting definitions + + AvalonEdit supports XML syntax highlighting definitions (.xshd files). + In the AvalonEdit source code, you can find the file + ICSharpCode.AvalonEdit\Highlighting\Resources\ModeV2.xsd. + This is an XML schema for the .xshd file format; you can use it to + code completion for .xshd files in XML editors. + + Here is an example highlighting definition for a sub-set of C#: + + + + + + + + + + + " + " + + + + + + + + if + else + + + + + + \b0[xX][0-9a-fA-F]+ # hex number + | \b + ( \d+(\.[0-9]+)? #number with optional floating point + | \.[0-9]+ #or just starting with floating point + ) + ([eE][+-]?[0-9]+)? # optional exponent + + + +]]> + + +
+ + N:ICSharpCode.AvalonEdit.Highlighting + +
+
\ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/TextRendering.xml b/src/Libraries/AvalonEdit/Documentation/Text Rendering.aml similarity index 60% rename from src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/TextRendering.xml rename to src/Libraries/AvalonEdit/Documentation/Text Rendering.aml index fa112240e2..1ef17f9a49 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/TextRendering.xml +++ b/src/Libraries/AvalonEdit/Documentation/Text Rendering.aml @@ -1,26 +1,33 @@ - - - - - This document describes how the TextView class renders the text, and + + + + + This document describes how the TextView class renders the text, and how you can extend the text rendering process to add new features to the text editor. - - - - The text rendering in AvalonEdit involves creating VisualLines for the visible document - part. - - - -
- Lifetime of VisualLines - - +
+ Lifetime of VisualLines + + VisualLines are only created for the visible part of the document. Lots of actions can trigger their creation, but most commonly the creation will be caused by the MeasureOverride method of TextView. @@ -29,31 +36,24 @@ for that first line, and repeats that with the following lines until the visible region is filled. - + The TextView caches VisualLines - when the user scrolls down, only the VisualLines coming into view are created, the rest is reused. The VisualLine cache can be manually invalidated using the Redraw method family; moreover, lots of actions cause automatic invalidation: - - any change in the document will invalidate the affected VisualLines - changing the width of the TextView invalidates all VisualLines if word-wrap is enabled - changing any text editor settings (word-wrap, font size, etc.) will invalidate all VisualLines - VisualLines leaving the visible area after scrolling will be disposed - + any change in the document will invalidate the affected VisualLineschanging the width of the TextView invalidates all VisualLines if word-wrap is enabledchanging any text editor settings (word-wrap, font size, etc.) will invalidate all VisualLinesVisualLines leaving the visible area after scrolling will be disposed In general, manual invalidation is required only if you have written a text editor extension (BackgroundRenderer, VisualLineElementGenerator or VisualLineTransformer) that also consumes external data - in that case, you'll have to notify the text editor that VisualLines need to be recreated when your external data changes. - - - If external data used by your text editor extension changes, call - TextView.M:ICSharpCode.AvalonEdit.Rendering.TextView.Redraw + + If external data used by your text editor extension changes, call + M:ICSharpCode.AvalonEdit.Rendering.TextView.Redraw to invalidate the VisualLine. - - - + + Invalidating VisualLines does not cause immediate recreation of the lines! Rather, the VisualLines are recreated when the text view is next re-measured. While measurement in WPF normally happens with DispatcherPriority.Render, @@ -62,66 +62,66 @@ in case the user types faster than the text view can redraw, there will be only one redraw for multiple input actions. - - + + The TextView will never return invalid lines to you, but you may run into the case that the valid visual lines are not available. - + What happens in this case depends on the method you are calling - the new visual line might get created automatically, null could be returned, or you may get a T:ICSharpCode.AvalonEdit.Rendering.VisualLinesInvalidException. - + You can call - M:ICSharpCode.AvalonEdit.Rendering.TextView.EnsureVisualLines + M:ICSharpCode.AvalonEdit.Rendering.TextView.EnsureVisualLines to make the text view create all VisualLines in the visible region. - - -
-
- Building visual line elements - - + + +
+
+ Building visual line elements + + As a first step, the VisualLineElementGenerators are used to produce elements. The room in between the elements returned from the generators is filled with text elements. Then, the VisualLine assigns the VisualColumn and RelativeTextOffset properties of the line elements. - + For example, a line contains the text "Hello, World". The user has enabled "ShowSpaces", so the text editor should show a little dot instead of the space. In this case, the SingleCharacterElementGenerator, which is responsible for ShowSpaces, will produce a "SpaceTextElement" for the space character. Because no other generators are interested in the line, the remaining strings "Hello," and "World" will be represented by VisualLineText elements. - -
-
- Transforming visual line elements - - + +
+
+ Transforming visual line elements + + After that, the IVisualLineTransformers are used to modify the produced line elements. Transformers must not add elements, but they may split existing elements, e.g. to colorize only parts of an element. When splitting elements (or somehow modifying the elements collection), care must be taken that the VisualColumn,VisualLine,RelativeTextOffset and DocumentLength properties stay correct. - + The ColorizingTransformer base class provides helper methods for splitting, so the derived class can simply say "color this section in that color". - + The DocumentColorizingTransformer extends the ColorizingTransformer and additionally allows highlighting on per DocumentLine, coloring text segments (instead of directly working with visual line elements). - -
-
- Constructing TextLines - - + +
+
+ Constructing TextLines + + After building the visual line elements, the TextLines for the visual line are constructed. A visual line may result in multiple text lines when word wrapping is active or when special visual line elements force a line break. @@ -132,44 +132,40 @@ VisualLineElements are requested to produce TextRuns for their full or a partial length. The TextView will take care to measure any inline UI elements in the visual lines. - -
-
- Rest of the Rendering - - + +
+
+ Rest of the Rendering + + After the visible region is filled, the TextView updates the heights stored in the document lines to the measured heights. This way, scrolling takes account for word-wrapping. The constructed text lines are stored for the arrange and render steps. Now, finally, the measure step is complete. - + The WPF arrange step doesn't have much work to do: It just arranges inline UI elements at their position inside the text. - + The actual rendering does not happen directly in the TextView, but in its various layers. - + These are the predefined layers: - - Background layer: renders the background colors associated with the visual elements - Selection layer: renders the background of the selection - Text layer: renders the TextLines that were constructed during the Measure step. + Background layer: renders the background colors associated with the visual elementsSelection layer: renders the background of the selectionText layer: renders the TextLines that were constructed during the Measure step. The text layer also serves as container for any inline UI elements. - - Caret layer: renders a blinking caret - + Caret layer: renders a blinking caret It's also possible to insert new layers into the TextView using the - M:ICSharpCode.AvalonEdit.Rendering.TextView.InsertLayer + M:ICSharpCode.AvalonEdit.Rendering.TextView.InsertLayer method. This allows adding custom interactive components to the editor while being in full control of the Z-Order. - -
- - T:ICSharpCode.AvalonEdit.Rendering.TextView - - +
+
+ + T:ICSharpCode.AvalonEdit.Rendering.TextView + +
+
\ No newline at end of file diff --git a/src/Libraries/AvalonEdit/Documentation/Welcome.aml b/src/Libraries/AvalonEdit/Documentation/Welcome.aml new file mode 100644 index 0000000000..822e4357a8 --- /dev/null +++ b/src/Libraries/AvalonEdit/Documentation/Welcome.aml @@ -0,0 +1,50 @@ + + + + + AvalonEdit is a WPF-based extensible text editor. + + + While the WPF RichTextBox is quite powerful, you quickly run into its limits + when trying to use it as a code editor: it's hard to write efficient syntax highlighting for it, + and you cannot really implement features like code folding with the standard RichTextBox. + The problem is: the RichTextBox edits a rich document. + In contrast, AvalonEdit simply edits text. + However, AvalonEdit offers lots of possibilities on how the text document is + displayed - so it is much more suitable for a code editor where things like the text color + are not controlled by the user, but instead depend on the text (syntax highlighting). + + + + + +
+ System requirements + + AvalonEdit requires the + + .NET Framework 3.5 SP1 + http://www.microsoft.com/downloads/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7&DisplayLang=en + _blank + . + For compiling AvalonEdit inside Visual Studio 2008, VS08 SP1 is required. + + AvalonEdit requires FullTrust and will not run as XBAP. + +
+ + + T:ICSharpCode.AvalonEdit.TextEditor + + www.avalonedit.net + http://www.avalonedit.net + _blank + + + www.icsharpcode.net + http://www.icsharpcode.net + _blank + + +
+
\ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs index fec3efdaab..646d116ace 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ChangeTrackingCheckpoint.cs @@ -14,10 +14,16 @@ using System.Linq; namespace ICSharpCode.AvalonEdit.Document { /// - /// A checkpoint that allows tracking changes to a TextDocument. - /// + /// A checkpoint that allows tracking changes to a TextDocument. + /// /// Use to create a checkpoint. + /// /// + /// + /// The class allows tracking document changes, even from background threads. + /// Once you have two checkpoints, you can call to retrieve the complete list + /// of document changes that happened between those versions of the document. + /// public sealed class ChangeTrackingCheckpoint { // Object that is unique per document. diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs index f6d58cbd38..a573beee26 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentLine.cs @@ -14,6 +14,18 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Represents a line inside a . /// + /// + /// + /// The collection contains one DocumentLine instance + /// for every line in the document. This collection is read-only to user code and is automatically + /// updated to reflect the current document content. + /// + /// + /// Internally, the DocumentLine instances are arranged in a binary tree that allows for both efficient updates and lookup. + /// Converting between offset and line number is possible in O(lg N) time, + /// and the data structure also updates all offsets in O(lg N) whenever a line is inserted or removed. + /// + /// public sealed partial class DocumentLine : ISegment { #region Constructor @@ -120,7 +132,7 @@ namespace ICSharpCode.AvalonEdit.Document } /// - /// Gets the end offset of the line in the document's text (the offset before the newline character). + /// Gets the end offset of the line in the document's text (the offset before the line delimiter). /// Runtime: O(log n) /// /// The line was deleted. @@ -135,7 +147,7 @@ namespace ICSharpCode.AvalonEdit.Document byte delimiterLength; /// - /// Gets the length of this line. O(1) + /// Gets the length of this line. The length does not include the line delimiter. O(1) /// /// This property is still available even if the line was deleted; /// in that case, it contains the line's length before the deletion. @@ -163,10 +175,12 @@ namespace ICSharpCode.AvalonEdit.Document } /// - /// Gets the length of the newline. + /// Gets the length of the line delimiter. + /// The value is 1 for single "\r" or "\n", 2 for the "\r\n" sequence; + /// and 0 for the last line in the document. /// /// This property is still available even if the line was deleted; - /// in that case, it contains the line's length before the deletion. + /// in that case, it contains the line delimiter's length before the deletion. public int DelimiterLength { get { document.DebugVerifyAccess(); @@ -229,7 +243,8 @@ namespace ICSharpCode.AvalonEdit.Document #region ToString /// - /// Gets a string representation of the line. + /// Gets a string with debug output showing the line number and offset. + /// Does not include the line's text. /// public override string ToString() { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ILineTracker.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ILineTracker.cs index c1d7a0a3da..0db20a1b4a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ILineTracker.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ILineTracker.cs @@ -11,13 +11,15 @@ namespace ICSharpCode.AvalonEdit.Document { /// /// Allows for low-level line tracking. + /// + /// /// The methods on this interface are called by the TextDocument's LineManager immediately after the document /// has changed, *while* the DocumentLineTree is updating. /// Thus, the DocumentLineTree may be in an invalid state when these methods are called. /// This interface should only be used to update per-line data structures like the HeightTree. /// Line trackers must not cause any events to be raised during an update to prevent other code from seeing /// the invalid state. - ///
+ /// public interface ILineTracker { /// diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs index ded6db69da..9d631ac145 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/ISegment.cs @@ -15,6 +15,8 @@ namespace ICSharpCode.AvalonEdit.Document /// /// An (Offset,Length)-pair. /// + /// + /// public interface ISegment { /// @@ -137,12 +139,16 @@ namespace ICSharpCode.AvalonEdit.Document } /// - /// A segment using text anchors as start and end positions. + /// A segment using s as start and end positions. /// /// + /// /// For the constructors creating new anchors, the start position will be AfterInsertion and the end position will be BeforeInsertion. /// Should the end position move before the start position, the segment will have length 0. + /// /// + /// + /// public sealed class AnchorSegment : ISegment { readonly TextAnchor start, end; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs index e6f688121b..94c7c3800f 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextAnchor.cs @@ -11,9 +11,32 @@ using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Document { /// - /// The TextAnchor class references a text location - a position between two characters. - /// It automatically updates its offset when text is inserted/removed in front of the anchor. + /// The TextAnchor class references an offset (a position between two characters). + /// It automatically updates the offset when text is inserted/removed in front of the anchor. /// + /// + /// Use the property to get the offset from a text anchor. + /// Use the to create an anchor from an offset. + /// + /// + /// The document will automatically update all text anchors; and because it uses weak references to do so, + /// the garbage collector can simply collect the anchor object when you don't need it anymore. + /// + /// Moreover, the document is able to efficiently update a large number of anchors without having to look + /// at each anchor object individually. Updating the offsets of all anchors usually only takes time logarithmic + /// to the number of anchors. Retrieving the property also runs in O(lg N). + /// + /// + /// If you want to track a segment, you can use the class which + /// implements using two text anchors. + /// + /// + /// Usage: + /// TextAnchor anchor = document.CreateAnchor(offset); + /// ChangeMyDocument(); + /// int newOffset = anchor.Offset; + /// + /// public sealed class TextAnchor { readonly TextDocument document; @@ -34,18 +57,34 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Controls how the anchor moves. /// + /// Anchor movement is ambiguous if text is inserted exactly at the anchor's location. + /// Does the anchor stay before the inserted text, or does it move after it? + /// The property will be used to determine which of these two options the anchor will choose. + /// The default value is . public AnchorMovementType MovementType { get; set; } /// + /// /// Specifies whether the anchor survives deletion of the text containing it. + /// /// false: The anchor is deleted when the a selection that includes the anchor is deleted. /// true: The anchor is not deleted. + /// /// + /// public bool SurviveDeletion { get; set; } /// /// Gets whether the anchor was deleted. /// + /// + /// When a piece of text containing an anchor is removed, then that anchor will be deleted. + /// First, the property is set to true on all deleted anchors, + /// then the events are raised. + /// You cannot retrieve the offset from an anchor that has been deleted. + /// This deletion behavior might be useful when using anchors for building a bookmark feature, + /// but in other cases you want to still be able to use the anchor. For those cases, set = true. + /// public bool IsDeleted { get { document.DebugVerifyAccess(); @@ -56,6 +95,11 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Occurs after the anchor was deleted. /// + /// + /// + /// Due to the 'weak reference' nature of TextAnchor, you will receive the Deleted event only + /// while your code holds a reference to the TextAnchor object. + /// public event EventHandler Deleted; internal void OnDeleted(DelayedEvents delayedEvents) diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs index 83c37e6147..3f7ba59571 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocument.cs @@ -18,9 +18,13 @@ using ICSharpCode.AvalonEdit.Utils; namespace ICSharpCode.AvalonEdit.Document { /// - /// Runtimes: - /// n = number of lines in the document + /// This class is the main class of the text model. Basically, it is a with events. /// + /// + /// Thread safety: + /// + /// However, there is a single method that is thread-safe: (and its overloads). + /// public sealed class TextDocument : ITextSource { #region Thread ownership @@ -31,6 +35,11 @@ namespace ICSharpCode.AvalonEdit.Document /// Verifies that the current thread is the documents owner thread. /// Throws an if the wrong thread accesses the TextDocument. /// + /// + /// The TextDocument class is not thread-safe. A document instance expects to have a single owner thread + /// and will throw an when accessed from another thread. + /// It is possible to change the owner thread using the method. + /// public void VerifyAccess() { if (Thread.CurrentThread != owner) @@ -43,8 +52,11 @@ namespace ICSharpCode.AvalonEdit.Document /// for displaying the document. /// /// + /// + /// /// The owner can be set to null, which means that no thread can access the document. But, if the document - /// has no owner thread, any thread may take ownership by calling SetOwnerThread. + /// has no owner thread, any thread may take ownership by calling . + /// /// public void SetOwnerThread(Thread newOwner) { @@ -162,6 +174,7 @@ namespace ICSharpCode.AvalonEdit.Document } /// + /// public event EventHandler TextChanged; /// @@ -175,26 +188,64 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Is raised when the TextLength property changes. /// + /// public event EventHandler TextLengthChanged; /// /// Is raised before the document changes. /// + /// + /// Here is the order in which events are raised during a document update: + /// + /// BeginUpdate() + /// + /// event is raised + /// + /// Insert() / Remove() / Replace() + /// + /// event is raised + /// The document is changed + /// TextAnchor.Deleted event is raised if anchors were + /// in the deleted text portion + /// event is raised + /// + /// EndUpdate() + /// + /// event is raised + /// event is raised + /// event is raised + /// event is raised + /// + /// + /// + /// If the insert/remove/replace methods are called without a call to BeginUpdate(), + /// they will call BeginUpdate() and EndUpdate() to ensure no change happens outside of UpdateStarted/UpdateFinished. + /// + /// There can be multiple document changes between the BeginUpdate() and EndUpdate() calls. + /// In this case, the events associated with EndUpdate will be raised only once after the whole document update is done. + /// + /// The listens to the UpdateStarted and UpdateFinished events to group all changes into a single undo step. + /// + /// public event EventHandler Changing; /// /// Is raised after the document has changed. /// + /// public event EventHandler Changed; /// /// Creates a snapshot of the current text. /// /// - /// Unlike all other TextDocument methods, this method may be called from any thread; even when the owning thread - /// is concurrently writing to the document. + /// This method returns an immutable snapshot of the document, and may be safely called even when + /// the document's owner thread is concurrently modifying the document. + /// /// This special thread-safety guarantee is valid only for TextDocument.CreateSnapshot(), not necessarily for other /// classes implementing ITextSource.CreateSnapshot(). + /// + /// /// public ITextSource CreateSnapshot() { @@ -207,12 +258,7 @@ namespace ICSharpCode.AvalonEdit.Document /// Creates a snapshot of the current text. /// Additionally, creates a checkpoint that allows tracking document changes. /// - /// - /// Unlike all other TextDocument methods, this method may be called from any thread; even when the owning thread - /// is concurrently writing to the document. - /// This special thread-safety guarantee is valid only for TextDocument.CreateSnapshot(), not necessarily for other - /// classes implementing ITextSource.CreateSnapshot(). - /// + /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", Justification = "Need to return snapshot and checkpoint together to ensure thread-safety")] public ITextSource CreateSnapshot(out ChangeTrackingCheckpoint checkpoint) { @@ -236,12 +282,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Creates a snapshot of a part of the current text. /// - /// - /// Unlike all other TextDocument methods, this method may be called from any thread; even when the owning thread - /// is concurrently writing to the document. - /// This special thread-safety guarantee is valid only for TextDocument.CreateSnapshot(), not necessarily for other - /// classes implementing ITextSource.CreateSnapshot(). - /// + /// public ITextSource CreateSnapshot(int offset, int length) { lock (lockObject) { @@ -264,6 +305,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Gets if an update is running. /// + /// public bool IsInUpdate { get { VerifyAccess(); @@ -275,6 +317,7 @@ namespace ICSharpCode.AvalonEdit.Document /// Immediately calls , /// and returns an IDisposable that calls . /// + /// public IDisposable RunUpdate() { BeginUpdate(); @@ -282,12 +325,13 @@ namespace ICSharpCode.AvalonEdit.Document } /// - /// Begins a group of document changes. - /// Some events are suspended until EndUpdate is called, and the will - /// group all changes into a single action. - /// Calling BeginUpdate several times increments a counter, only after the appropriate number - /// of EndUpdate calls the events resume their work. + /// Begins a group of document changes. + /// Some events are suspended until EndUpdate is called, and the will + /// group all changes into a single action. + /// Calling BeginUpdate several times increments a counter, only after the appropriate number + /// of EndUpdate calls the events resume their work. /// + /// public void BeginUpdate() { VerifyAccess(); @@ -303,6 +347,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Ends a group of document changes. /// + /// public void EndUpdate() { VerifyAccess(); @@ -321,11 +366,13 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Occurs when a document change starts. /// + /// public event EventHandler UpdateStarted; /// /// Occurs when a document change is finished. /// + /// public event EventHandler UpdateFinished; #endregion @@ -573,6 +620,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Gets a read-only list of lines. /// + /// public IList Lines { get { return lineTree; } } @@ -606,6 +654,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Gets the offset from a text location. /// + /// public int GetOffset(TextLocation location) { return GetOffset(location.Line, location.Column); @@ -614,6 +663,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Gets the offset from a text location. /// + /// public int GetOffset(int line, int column) { DocumentLine docLine = GetLineByNumber(line); @@ -627,6 +677,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Gets the location from an offset. /// + /// public TextLocation GetLocation(int offset) { DocumentLine line = GetLineByOffset(offset); @@ -637,6 +688,7 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Gets the list of s attached to this document. + /// You can add custom line trackers to this list. /// public IList LineTrackers { get { @@ -655,8 +707,9 @@ namespace ICSharpCode.AvalonEdit.Document } /// - /// Creates a new text anchor at the specified offset. + /// Creates a new at the specified offset. /// + /// public TextAnchor CreateAnchor(int offset) { VerifyAccess(); diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs index e8fc176af9..ddb26e9c9a 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextLocation.cs @@ -12,8 +12,12 @@ namespace ICSharpCode.AvalonEdit.Document { /// /// A line/column position. - /// Text editor lines/columns are counting from one. + /// Text editor lines/columns are counted started from one. /// + /// + /// The document provides the methods and + /// to convert between offsets and TextLocations. + /// public struct TextLocation : IComparable, IEquatable { /// @@ -23,8 +27,10 @@ namespace ICSharpCode.AvalonEdit.Document /// /// Creates a TextLocation instance. + /// /// Warning: the parameters are (line, column). /// Not (column, line) as in ICSharpCode.TextEditor! + /// /// public TextLocation(int line, int column) { diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs index abdc0b1d42..3815adf1c6 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegment.cs @@ -11,13 +11,33 @@ using System.Diagnostics; namespace ICSharpCode.AvalonEdit.Document { /// - /// A segment that can be put into a TextSegmentCollection. + /// A segment that can be put into a . /// /// - /// On insertions at the start or end offset of the text segment, a TextSegmentCollection handling the document - /// changes will keep the TextSegment small; - /// i.e. use AfterInsertion for the start position and BeforeInsertion for the end position. + /// + /// A can be stand-alone or part of a . + /// If the segment is stored inside a TextSegmentCollection, its Offset and Length will be updated by that collection. + /// + /// + /// When the document changes, the offsets of all text segments in the TextSegmentCollection will be adjusted accordingly. + /// Start offsets move like AnchorMovementType.AfterInsertion, + /// end offsets move like AnchorMovementType.BeforeInsertion + /// (i.e. the segment will always stay as small as possible). + /// + /// If a document change causes a segment to be deleted completely, it will be reduced to length 0, but segments are + /// never automatically removed from the collection. + /// Segments with length 0 will never expand due to document changes, and they move as AfterInsertion. + /// + /// + /// Thread-safety: a TextSegmentCollection that is connected to a may only be used on that document's owner thread. + /// A disconnected TextSegmentCollection is safe for concurrent reads, but concurrent access is not safe when there are writes. + /// Keep in mind that reading the Offset properties of a text segment inside the collection is a read access on the + /// collection; and setting an Offset property of a text segment is a write access on the collection. + /// /// + /// + /// + /// public class TextSegment : ISegment { internal ISegmentTree ownerTree; diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs index a54743dc7b..6821ca7124 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextSegmentCollection.cs @@ -28,21 +28,13 @@ namespace ICSharpCode.AvalonEdit.Document } /// + /// /// A collection of text segments that supports efficient lookup of segments /// intersecting with another segment. - /// - /// When the document changes, the offsets of all text segments in the collection will be adjusted accordingly. - /// Start offsets move like AnchorMovementType.AfterInsertion, end offsets move like AnchorMovementType.BeforeInsertion - /// (i.e. the segment will always stay as small as possible). - /// If a document change causes a segment to be deleted completely, it will be reduced to length 0, but segments are - /// never automatically removed. Segments with length 0 will never expand due to document changes and move as AfterInsertion. + /// /// - /// - /// Thread-safety: a TextSegmentCollection that is connected to a TextDocument may only be used on that document's owner thread. - /// A disconnected TextSegmentCollection is safe for concurrent reads, but concurrent access is not safe when there are writes. - /// Keep in mind that reading the Offset properties of a inside the collection is a read access on the - /// collection; and setting an Offset property of a is a write access on the collection. - /// + /// + /// public sealed class TextSegmentCollection : ICollection, ISegmentTree, IWeakEventListener where T : TextSegment { // Implementation: this is basically a mixture of an augmented interval tree diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj index 6a1ab1d08e..6ddf84438b 100644 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj +++ b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj @@ -370,18 +370,9 @@ - - - - - - - PreserveNewest - - diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.shfb b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.shfb deleted file mode 100644 index b4b0a89940..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.shfb +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - This is the main AvalonEdit namespace. - This namespace contains classes to show the code completion window. - This namespace contains the document model. -The most important class here is TextDocument, which represents document that can be displayed and edited in the text editor. - This namespace is the home of the TextArea class. It manages user input and handles the caret and the selection. - This namespace contains the folding implementation. - This namespace contains the engine for highlighting text documents (DocumentHighlighter). -Additionally, the class HighlightingColorizer provides integration of the highlighting engine into the text editor GUI. - This namespace contains a document model for syntax highlighting definitions (.xshd files). - This namespace contains the logic for automatic indentation. - This namespace contains the text rendering infrastructure. - This namespace contains various utility classes - - - - - - - - - - - - - - - - - - - Summary, AutoDocumentCtors, Namespace - InheritedMembers, InheritedFrameworkMembers, Protected, ProtectedInternalAsProtected - - - .\Help\ - - - True - True - - HtmlHelp1x - False - 3.5 - False - False - False - - AvalonEdit - AvalonEdit Documentation - en-US - - Copyright 2008-2009, Daniel Grunwald - - - - - Local - Msdn - Blank - Prototype - Guid - Standard - False - True - False - Hierarchical - True - ms.vsipcc+, ms.vsexpresscc+ - 4.0.0.5048 - AboveNamespaces - \ No newline at end of file diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Coordinate Systems.xml b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Coordinate Systems.xml deleted file mode 100644 index ac6cec565c..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Coordinate Systems.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - - - - The text editor makes use of several different coordinate systems. - Here's an explanation of them. - - - -
- Offset - - The number of characters from the start of the text, counting from 0. - Same as used by String.IndexOf() etc. - -
-
- TextLocation - - A Line,Column pair. Line and column count from 1. - Use the - TextDocument.M:ICSharpCode.AvalonEdit.Document.TextDocument.GetLocation(System.Int32) - and - TextDocument.M:ICSharpCode.AvalonEdit.Document.TextDocument.GetOffset(ICSharpCode.AvalonEdit.Document.TextLocation) - methods to convert between TextLocation and Offset. - -
-
- TextAnchor - - A text anchor object stores an Offset, but automatically - updates the offset when text is inserted/removed before the offset. - - - The document keeps weak references to anchors for updating them, - so you don't have to worry about memory leaks using text anchors. - - Use the - P:ICSharpCode.AvalonEdit.Document.TextAnchor.Offset - property to get the offset from a text anchor. - Use the - M:ICSharpCode.AvalonEdit.Document.TextDocument.CreateAnchor(System.Int32) - method to create an anchor from an offset. - - -
-
- RelativeTextOffset - - An offset in the document, but relative to the start offset of a VisualLine. - Relative text offsets are used to store document offsets in visual lines. - You can convert between relative text offsets and document offsets - by adding/subtracting - T:ICSharpCode.AvalonEdit.Rendering.VisualLine.P:ICSharpCode.AvalonEdit.Rendering.VisualLine.FirstDocumentLine.P:ICSharpCode.AvalonEdit.Document.DocumentLine.Offset. - - -
-
- VisualColumn - - An integer value that specifies a position inside a VisualLine. - - Not only text has a length in the visual line, but also other VisualLineElements. - VisualColumn is counting from 0 for each visual line. - - For example, tab markers take 2 visual columns (the marker and the tab space), - newline markers take 1 visual column; folding markers take just 1 visual column - even though they are longer in the document text. - Use the - M:ICSharpCode.AvalonEdit.Rendering.VisualLine.GetVisualColumn(System.Int32) - and - M:ICSharpCode.AvalonEdit.Rendering.VisualLine.GetRelativeOffset(System.Int32) - methods to convert between - visual columns and relative text offsets. - - - Do not confuse VisualColumn with text columns. - VisualColumn starts at 0, text column at 1. Text may have different length - in the two coordinate systems (e.g. tab markers, foldings). - - -
-
- TextViewPosition - - A Line,Column,VisualColumn triple. - Can be implicitly converted - to TextLocation, but has the additional VisualColumn information - that is necessary to accurately hold the caret position when - VisualLineElements with DocumentLength 0 are in use. - -
-
- VisualTop - - A double value that specifies the distance from the top of - the document to the top of a line measured in device-independent pixels. - VisualTop is equivalent to the Y component of a VisualPosition. - -
-
- VisualPosition - - A Point value (double X,Y) that specifies the position of an - element from the top left document corner measured in device-independent pixels. - To convert a VisualPosition to or from a (mouse) position inside - the TextView, simply subtract or add - TextView.P:ICSharpCode.AvalonEdit.Rendering.TextView.ScrollOffset - to it. - - -
- - - - -
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Folding.xml b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Folding.xml deleted file mode 100644 index bf9af0d62d..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Folding.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - Introduction for 'Folding'. - - - -
- How the FoldingManager works - - - The FoldingManager maintains a list of foldings. The FoldMargin displays those foldings and provides - the UI for collapsing/expanding. - Folded foldings cause the FoldingElementGenerator to produce a line element that spans the whole folded - text section, causing the text generation for the visual line that contains the folding start to - continue after the folding end in another line. - To ensure scrolling works correctly in the presence of foldings, lines inside folded regions must not - be used as start lines for the visual line generation. This is done by setting the line height of all - such lines to 0. To efficiently set the height on a large number of lines and support reverting to the - old height when the folding is uncollapsed, a CollapsedLineSection is used. - - -
- - - T:ICSharpCode.AvalonEdit.Folding.FoldingManager - -
diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Introduction.xml b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Introduction.xml deleted file mode 100644 index 99b844f874..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/Introduction.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - AvalonEdit is a WPF-based extensible text editor. - - - - While the WPF RichTextBox is quite powerful, you quickly run into its limits - when trying to use it as a code editor: it's hard to write efficient syntax highlighting for it, - and you cannot really implement features like code folding with the standard RichTextBox. - The problem is: the RichTextBox edits a rich document. - In contrast, AvalonEdit simply edits text. - However, AvalonEdit offers lots of possibilities on how the text document is - displayed - so it is much more suitable for a code editor where things like the text color - are not controlled by the user, but instead depend on the text (syntax highlighting). - - - - - - T:ICSharpCode.AvalonEdit.TextEditor - - - www.avalonedit.net - http://www.avalonedit.net - - - - www.icsharpcode.net - http://www.icsharpcode.net - - - - - diff --git a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/SyntaxHighlighting.xml b/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/SyntaxHighlighting.xml deleted file mode 100644 index 42c9f55b5e..0000000000 --- a/src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/documentation/SyntaxHighlighting.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - Probably the most important feature for any text editor is syntax highlighting. - AvalonEdit has a flexible text rendering model, see "Text Rendering". Among the - Text Rendering extension points is the support for "visual line transformers" that - can change the display of a visual line after it has been constructed by the "visual element generators". - A useful base class implementing IVisualLineTransformer for the purpose of syntax highlighting - is DocumentColorizingTransformer. Take a look at that class' documentation to see - how to write fully custom syntax highlighters. This article only discusses the XML-driven built-in - highlighting engine. - - - -
- The highlighting engine - - - The core engine of the higlighting is the class DocumentHighlighter. It tracks changes - to a TextDocument and can produce HighlightedLines from DocumentLines. - A HighlightedLine is simply a list of (possibly nested) highlighted text sections. - - The highlighting rules used by the highlighting engine to highlight - the document are described by the following classes: - - HighlightingRuleSet: describes a set of highlighting spans and rules - - HighlightingSpan: consists of Start and End regular expressions, a color, and a - child ruleset. The region between Start and End expressions will be - assigned the given color, and inside that span, the rules of the child - ruleset apply (instead of the default rules). - If the child ruleset also has HighlightingSpans, they can be nested, - allowing highlighting constructs like nested comments or one language - embedded in another. - - HighlightingRule: A regular expression with a color. Highlights matches of the - regular expression using that color. - - HighlightingColor: - A highlighting color isn't just a color: it consists of a foreground - color, font weight and font style. - - -
- -
- XML highlighting definitions - - AvalonEdit supports XML syntax highlighting definitions (.xshd files). - -
- - - N:ICSharpCode.AvalonEdit.Highlighting - -