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

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

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

1
samples/TextEditorAnchors/MainForm.Designer.cs generated

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

15
samples/TextEditorAnchors/MainForm.cs

@ -38,14 +38,20 @@ namespace TextEditorAnchors @@ -38,14 +38,20 @@ namespace TextEditorAnchors
void AnchorListBoxKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete) {
int index = anchorListBox.SelectedIndex;
if (index >= 0) {
int index = anchorListBox.SelectedIndex;
if (index >= 0) {
if (e.KeyCode == Keys.Delete) {
anchorListBox.Items.RemoveAt(index);
if (index < anchorListBox.Items.Count)
anchorListBox.SelectedIndex = index;
else
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 @@ -87,7 +93,8 @@ namespace TextEditorAnchors
return "Anchor deleted";
else
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 @@ -52,7 +52,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
SetHighlighting("C#");
this.TextEditorProperties.SupportReadOnlySegments = true;
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);
}

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

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

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

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

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

@ -9,8 +9,22 @@ using System; @@ -9,8 +9,22 @@ using System;
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>
/// Description of TextAnchor.
/// An anchor that can be put into a document and moves around when the document is changed.
/// </summary>
public sealed class TextAnchor
{
@ -66,6 +80,11 @@ namespace ICSharpCode.TextEditor.Document @@ -66,6 +80,11 @@ namespace ICSharpCode.TextEditor.Document
}
}
/// <summary>
/// Controls how the anchor moves.
/// </summary>
public AnchorMovementType MovementType { get; set; }
internal void Deleted()
{
lineSegment = null;

Loading…
Cancel
Save