Browse Source

Allow specifying movement type of text anchors.

Make ConsolePad read-only text marker invisible.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3206 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
9fae8aee0d
  1. 69
      data/templates/project/CSharp/WebService.xpt
  2. 1
      data/templates/project/CSharp/WebpageProject.xpt
  3. 1
      samples/TextEditorAnchors/MainForm.Designer.cs
  4. 15
      samples/TextEditorAnchors/MainForm.cs
  5. 2
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs
  6. 10
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/LineManager/LineSegment.cs
  7. 1
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/MarkerStrategy/TextMarker.cs
  8. 21
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/TextAnchor.cs

69
data/templates/project/CSharp/WebService.xpt

@ -1,41 +1,42 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<Template originator = "Jusin Dearing" <Template originator = "Jusin Dearing"
created = "06/09/2006" created = "06/09/2006"
lastModified = "06/09/2006"> lastModified = "06/09/2006">
<!-- Template Header --> <!-- Template Header -->
<TemplateConfiguration> <TemplateConfiguration>
<Name>${res:Templates.Project.WebService.Name}</Name> <Name>${res:Templates.Project.WebService.Name}</Name>
<Category>C#</Category> <Category>C#</Category>
<Subcategory>ASP.NET</Subcategory> <Subcategory>ASP.NET</Subcategory>
<Icon>C#.Project.Form</Icon> <Icon>C#.Project.Form</Icon>
<Description>${res:Templates.Project.WebService.Description}</Description> <Description>${res:Templates.Project.WebService.Description}</Description>
</TemplateConfiguration> </TemplateConfiguration>
<!-- Actions --> <!-- Actions -->
<Actions> <Actions>
<Open filename = "Default.asmx" /> <Open filename = "Default.asmx" />
<Open filename = "Soap.cs" /> <Open filename = "Soap.cs" />
</Actions> </Actions>
<Project language = "C#"> <Project language = "C#">
<ProjectItems> <ProjectItems>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Web" /> <Reference Include="System.Web" />
<Reference Include="System.Web.Services" /> <Reference Include="System.Web.Services" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ProjectItems> </ProjectItems>
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<OutputPath>bin\</OutputPath> <OutputPath>bin\</OutputPath>
</PropertyGroup> <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
</PropertyGroup>
<Files> <Files>
<File name="Soap.cs" DependentUpon="Default.asmx"><![CDATA[${StandardHeader.C#} <File name="Soap.cs" DependentUpon="Default.asmx"><![CDATA[${StandardHeader.C#}
using System; using System;
using System.Data; using System.Data;
using System.Web; using System.Web;
@ -82,7 +83,7 @@ namespace ${StandardNamespace}
]]></File> ]]></File>
<File name="Default.asmx" language="XML"><![CDATA[<%@ WebService Language="C#" Class="${StandardNamespace}.Soap,Soap" %>]]></File> <File name="Default.asmx" language="XML"><![CDATA[<%@ WebService Language="C#" Class="${StandardNamespace}.Soap,Soap" %>]]></File>
<!--*************************************************************************--> <!--*************************************************************************-->
<File name="Web.config" language="XML"><![CDATA[<?xml version="1.0"?> <File name="Web.config" language="XML"><![CDATA[<?xml version="1.0"?>
<configuration> <configuration>
<appSettings/> <appSettings/>
<connectionStrings/> <connectionStrings/>
@ -115,6 +116,6 @@ namespace ${StandardNamespace}
</system.web> </system.web>
</configuration>]]></File> </configuration>]]></File>
<File name="Properties\AssemblyInfo.cs" src="DefaultAssemblyInfo.cs" /> <File name="Properties\AssemblyInfo.cs" src="DefaultAssemblyInfo.cs" />
</Files> </Files>
</Project> </Project>
</Template> </Template>

1
data/templates/project/CSharp/WebpageProject.xpt

@ -31,6 +31,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<OutputPath>bin\</OutputPath> <OutputPath>bin\</OutputPath>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
</PropertyGroup> </PropertyGroup>
<Files> <Files>

1
samples/TextEditorAnchors/MainForm.Designer.cs generated

@ -66,6 +66,7 @@ namespace TextEditorAnchors
// textEditorControl // textEditorControl
// //
this.textEditorControl.Dock = System.Windows.Forms.DockStyle.Fill; this.textEditorControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.textEditorControl.IsReadOnly = false;
this.textEditorControl.Location = new System.Drawing.Point(0, 0); this.textEditorControl.Location = new System.Drawing.Point(0, 0);
this.textEditorControl.Name = "textEditorControl"; this.textEditorControl.Name = "textEditorControl";
this.textEditorControl.Size = new System.Drawing.Size(340, 322); this.textEditorControl.Size = new System.Drawing.Size(340, 322);

15
samples/TextEditorAnchors/MainForm.cs

@ -38,14 +38,20 @@ namespace TextEditorAnchors
void AnchorListBoxKeyDown(object sender, KeyEventArgs e) void AnchorListBoxKeyDown(object sender, KeyEventArgs e)
{ {
if (e.KeyCode == Keys.Delete) { int index = anchorListBox.SelectedIndex;
int index = anchorListBox.SelectedIndex; if (index >= 0) {
if (index >= 0) { if (e.KeyCode == Keys.Delete) {
anchorListBox.Items.RemoveAt(index); anchorListBox.Items.RemoveAt(index);
if (index < anchorListBox.Items.Count) if (index < anchorListBox.Items.Count)
anchorListBox.SelectedIndex = index; anchorListBox.SelectedIndex = index;
else else
anchorListBox.SelectedIndex = anchorListBox.Items.Count - 1; anchorListBox.SelectedIndex = anchorListBox.Items.Count - 1;
} else if (e.KeyCode == Keys.Left) {
((AnchorWrapper)anchorListBox.SelectedItem).Anchor.MovementType = AnchorMovementType.BeforeInsertion;
anchorListBox.Items[index] = anchorListBox.Items[index];
} else if (e.KeyCode == Keys.Right) {
((AnchorWrapper)anchorListBox.SelectedItem).Anchor.MovementType = AnchorMovementType.AfterInsertion;
anchorListBox.Items[index] = anchorListBox.Items[index];
} }
} }
} }
@ -87,7 +93,8 @@ namespace TextEditorAnchors
return "Anchor deleted"; return "Anchor deleted";
else else
return "Line " + (Anchor.LineNumber+1) + ", Column " + (Anchor.ColumnNumber+1) return "Line " + (Anchor.LineNumber+1) + ", Column " + (Anchor.ColumnNumber+1)
+ " (Offset " + Anchor.Offset + ")"; + " (Offset " + Anchor.Offset + ")"
+ " (" + Anchor.MovementType + ")";
} }
} }
} }

2
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/ConsolePad.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
SetHighlighting("C#"); SetHighlighting("C#");
this.TextEditorProperties.SupportReadOnlySegments = true; this.TextEditorProperties.SupportReadOnlySegments = true;
PrintPrompt(); PrintPrompt();
readOnlyMarker = new TextMarker(0, this.Document.TextLength, TextMarkerType.Underlined) { IsReadOnly = true }; readOnlyMarker = new TextMarker(0, this.Document.TextLength, TextMarkerType.Invisible) { IsReadOnly = true };
this.Document.MarkerStrategy.AddMarker(readOnlyMarker); this.Document.MarkerStrategy.AddMarker(readOnlyMarker);
} }

10
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/LineManager/LineSegment.cs

@ -191,7 +191,10 @@ namespace ICSharpCode.TextEditor.Document
//Console.WriteLine("InsertedLinePart " + startColumn + ", " + length); //Console.WriteLine("InsertedLinePart " + startColumn + ", " + length);
if (anchors != null) { if (anchors != null) {
foreach (TextAnchor a in anchors) { foreach (TextAnchor a in anchors) {
if (a.ColumnNumber >= startColumn) { if (a.MovementType == AnchorMovementType.BeforeInsertion
? a.ColumnNumber > startColumn
: a.ColumnNumber >= startColumn)
{
a.ColumnNumber += length; a.ColumnNumber += length;
} }
} }
@ -229,7 +232,10 @@ namespace ICSharpCode.TextEditor.Document
if (anchors != null) { if (anchors != null) {
List<TextAnchor> movedAnchors = null; List<TextAnchor> movedAnchors = null;
foreach (TextAnchor a in anchors) { foreach (TextAnchor a in anchors) {
if (a.ColumnNumber > this.Length) { if (a.MovementType == AnchorMovementType.BeforeInsertion
? a.ColumnNumber > this.Length
: a.ColumnNumber >= this.Length)
{
a.Line = followingLine; a.Line = followingLine;
followingLine.AddAnchor(a); followingLine.AddAnchor(a);
a.ColumnNumber -= this.Length; a.ColumnNumber -= this.Length;

1
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/MarkerStrategy/TextMarker.cs

@ -12,6 +12,7 @@ namespace ICSharpCode.TextEditor.Document
{ {
public enum TextMarkerType public enum TextMarkerType
{ {
Invisible,
SolidBlock, SolidBlock,
Underlined, Underlined,
WaveLine WaveLine

21
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/TextAnchor.cs

@ -9,8 +9,22 @@ using System;
namespace ICSharpCode.TextEditor.Document namespace ICSharpCode.TextEditor.Document
{ {
public enum AnchorMovementType
{
/// <summary>
/// Behaves like a start marker - when text is inserted at the anchor position, the anchor will stay
/// before the inserted text.
/// </summary>
BeforeInsertion,
/// <summary>
/// Behave like an end marker - when text is insered at the anchor position, the anchor will move
/// after the inserted text.
/// </summary>
AfterInsertion
}
/// <summary> /// <summary>
/// Description of TextAnchor. /// An anchor that can be put into a document and moves around when the document is changed.
/// </summary> /// </summary>
public sealed class TextAnchor public sealed class TextAnchor
{ {
@ -66,6 +80,11 @@ namespace ICSharpCode.TextEditor.Document
} }
} }
/// <summary>
/// Controls how the anchor moves.
/// </summary>
public AnchorMovementType MovementType { get; set; }
internal void Deleted() internal void Deleted()
{ {
lineSegment = null; lineSegment = null;

Loading…
Cancel
Save