本文整理汇总了C#中Mono.TextEditor.LineSegment类的典型用法代码示例。如果您正苦于以下问题:C# LineSegment类的具体用法?C# LineSegment怎么用?C# LineSegment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineSegment类属于Mono.TextEditor命名空间,在下文中一共展示了LineSegment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RemoveTabInLine
public static int RemoveTabInLine (TextEditorData data, LineSegment line)
{
if (line.Length == 0)
return 0;
char ch = data.Document.GetCharAt (line.Offset);
if (ch == '\t') {
data.Remove (line.Offset, 1);
return 1;
} else if (ch == ' ') {
int removeCount = 0;
for (int i = 0; i < data.Options.IndentationSize;) {
ch = data.Document.GetCharAt (line.Offset + i);
if (ch == ' ') {
removeCount ++;
i++;
} else if (ch == '\t') {
removeCount ++;
i += data.Options.TabSize;
} else {
break;
}
}
data.Remove (line.Offset, removeCount);
return removeCount;
}
return 0;
}
开发者ID:acken,项目名称:monodevelop,代码行数:27,代码来源:DefaultEditActions.cs
示例2: Draw
internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, LineSegment lineSegment, int line, double x, double y, double lineHeight)
{
cr.MoveTo (x + 0.5, y);
cr.LineTo (x + 0.5, y + lineHeight);
cr.Color = color;
cr.Stroke ();
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:7,代码来源:DashedLineMargin.cs
示例3: RemoveLine
public bool RemoveLine (LineSegment line)
{
if (!lineWidthDictionary.ContainsKey (line))
return false;
lineWidthDictionary.Remove (line);
return true;
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:7,代码来源:MessageBubbleCache.cs
示例4: HoverMarker
//(MonoDevelop.Projects.Dom.Error info, LineSegment line)
//StyleTextMarker marker;
public HoverMarker(LineSegment line,int startOffset, int endOffset)
{
this.Line = line; // may be null if no line is assigned to the error.
//string underlineColor; = Mono.TextEditor.Highlighting.Style.WarningUnderlineString;
marker = new UsageMarker (startOffset,endOffset);
}
开发者ID:moscrif,项目名称:ide,代码行数:10,代码来源:HoverMarker.cs
示例5: DrawIcon
public void DrawIcon (Mono.TextEditor.TextEditor editor, Cairo.Context cr, LineSegment line, int lineNumber, double x, double y, double width, double height)
{
double size;
if (width > height) {
x += (width - height) / 2;
size = height;
} else {
y += (height - width) / 2;
size = width;
}
DrawIcon (cr, x, y, size);
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:13,代码来源:DebugTextMarker.cs
示例6: DrawIcon
public void DrawIcon (Mono.TextEditor.TextEditor editor, Gdk.Drawable win, LineSegment line, int lineNumber, int x, int y, int width, int height)
{
int size;
if (width > height) {
x += (width - height) / 2;
size = height;
} else {
y += (height - width) / 2;
size = width;
}
using (Cairo.Context cr = Gdk.CairoHelper.Create (win)) {
DrawIcon (cr, x, y, size);
}
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:15,代码来源:DebugTextMarker.cs
示例7: Analyze
public override void Analyze (Document doc, LineSegment line, Chunk startChunk, int startOffset, int endOffset)
{
if (endOffset <= startOffset || startOffset >= doc.Length)
return;
string text = doc.GetTextAt (startOffset, endOffset - startOffset);
int startColumn = startOffset - line.Offset;
line.RemoveMarker (typeof(UrlMarker));
foreach (System.Text.RegularExpressions.Match m in urlRegex.Matches (text)) {
line.AddMarker (new UrlMarker (line, m.Value, UrlType.Url, syntax, startColumn + m.Index, startColumn + m.Index + m.Length));
}
foreach (System.Text.RegularExpressions.Match m in mailRegex.Matches (text)) {
line.AddMarker (new UrlMarker (line, m.Value, UrlType.Email, syntax, startColumn + m.Index, startColumn + m.Index + m.Length));
}
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:15,代码来源:SemanticRule.cs
示例8: ErrorMarker
//(MonoDevelop.Projects.Dom.Error info, LineSegment line)
public ErrorMarker(LineSegment line)
{
//this.Info = info;
this.Line = line; // may be null if no line is assigned to the error.
string underlineColor;
//if (info.ErrorType == ErrorType.Warning)
// underlineColor = Mono.TextEditor.Highlighting.Style.WarningUnderlineString;
//else
underlineColor = Mono.TextEditor.Highlighting.Style.ErrorUnderlineString;
marker = new UnderlineMarker (underlineColor, - 1, line.Length-1);
//if (Info.Region.Start.Line == info.Region.End.Line)
// marker = new UnderlineMarker (underlineColor, Info.Region.Start.Column - 1, info.Region.End.Column - 1);
//else
// marker = new UnderlineMarker (underlineColor, - 1, - 1);
}
开发者ID:moscrif,项目名称:ide,代码行数:18,代码来源:ErrorMarker.cs
示例9: DrawIcon
public void DrawIcon (TextEditor editor, Cairo.Context cr, LineSegment lineSegment, int lineNumber, double x, double y, double width, double height)
{
if (lineSegment.IsBookmarked) {
Cairo.Color color1 = editor.ColorStyle.BookmarkColor1;
Cairo.Color color2 = editor.ColorStyle.BookmarkColor2;
DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);
Cairo.Gradient pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4);
pat.AddColorStop (0, color1);
pat.AddColorStop (1, color2);
cr.Pattern = pat;
cr.FillPreserve ();
pat = new Cairo.LinearGradient (x, y + height, x + width, y);
pat.AddColorStop (0, color2);
//pat.AddColorStop (1, color1);
cr.Pattern = pat;
cr.Stroke ();
}
}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:20,代码来源:BookmarkMarker.cs
示例10: Analyze
public override void Analyze (TextDocument doc, LineSegment line, Chunk startChunk, int startOffset, int endOffset)
{
if (endOffset <= startOffset || startOffset >= doc.TextLength || inUpdate)
return;
inUpdate = true;
try {
string text = doc.GetTextAt (startOffset, endOffset - startOffset);
int startColumn = startOffset - line.Offset;
var markers = new List <UrlMarker> (line.Markers.Where (m => m is UrlMarker).Cast<UrlMarker> ());
markers.ForEach (m => doc.RemoveMarker (m, false));
foreach (System.Text.RegularExpressions.Match m in UrlRegex.Matches (text)) {
doc.AddMarker (line, new UrlMarker (doc, line, m.Value, UrlType.Url, syntax, startColumn + m.Index, startColumn + m.Index + m.Length), false);
}
foreach (System.Text.RegularExpressions.Match m in MailRegex.Matches (text)) {
doc.AddMarker (line, new UrlMarker (doc, line, m.Value, UrlType.Email, syntax, startColumn + m.Index, startColumn + m.Index + m.Length), false);
}
} finally {
inUpdate = false;
}
}
开发者ID:txdv,项目名称:monodevelop,代码行数:20,代码来源:SemanticRule.cs
示例11: DrawIcon
public void DrawIcon (TextEditor editor, Gdk.Drawable win, LineSegment lineSegment, int lineNumber, int x, int y, int width, int height)
{
if (lineSegment.IsBookmarked) {
Cairo.Color color1 = Style.ToCairoColor (editor.ColorStyle.BookmarkColor1);
Cairo.Color color2 = Style.ToCairoColor (editor.ColorStyle.BookmarkColor2);
Cairo.Context cr = Gdk.CairoHelper.Create (win);
DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);
Cairo.Gradient pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4);
pat.AddColorStop (0, color1);
pat.AddColorStop (1, color2);
cr.Pattern = pat;
cr.FillPreserve ();
pat = new Cairo.LinearGradient (x, y + height, x + width, y);
pat.AddColorStop (0, color2);
//pat.AddColorStop (1, color1);
cr.Pattern = pat;
cr.Stroke ();
((IDisposable)cr).Dispose();
}
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:22,代码来源:BookmarkMarker.cs
示例12: Equals
public bool Equals (LineSegment line, int offset, int length, int selectionStart, int selectionEnd, out bool isInvalid)
{
int selStart = 0, selEnd = 0;
if (selectionEnd >= 0) {
selStart = selectionStart;
selEnd = selectionEnd;
}
return base.Equals (line, offset, length, out isInvalid) && selStart == this.SelectionStart && selEnd == this.SelectionEnd;
}
开发者ID:txdv,项目名称:monodevelop,代码行数:9,代码来源:TextViewMargin.cs
示例13: LayoutDescriptor
public LayoutDescriptor (LineSegment line, int offset, int length, LayoutWrapper layout, int selectionStart, int selectionEnd) : base(line, offset, length)
{
this.Layout = layout;
if (selectionEnd >= 0) {
this.SelectionStart = selectionStart;
this.SelectionEnd = selectionEnd;
}
}
开发者ID:txdv,项目名称:monodevelop,代码行数:8,代码来源:TextViewMargin.cs
示例14: LineDescriptor
protected LineDescriptor (LineSegment line, int offset, int length)
{
this.Offset = offset;
this.Length = length;
this.MarkerLength = line.MarkerCount;
this.Spans = line.StartSpan;
}
开发者ID:txdv,项目名称:monodevelop,代码行数:7,代码来源:TextViewMargin.cs
示例15: MouseHover
internal protected override void MouseHover (MarginMouseEventArgs args)
{
base.MouseHover (args);
LineSegment lineSegment = null;
if (args.LineSegment != null) {
lineSegment = args.LineSegment;
if (lineHover != lineSegment) {
lineHover = lineSegment;
editor.RedrawMargin (this);
}
}
lineHover = lineSegment;
bool found = false;
foreach (FoldSegment segment in editor.Document.GetFoldingContaining (lineSegment)) {
if (segment.StartLine.Offset == lineSegment.Offset) {
found = true;
break;
}
}
delayTimer.Stop ();
if (found) {
foldings = editor.Document.GetFoldingContaining (lineSegment);
if (editor.TextViewMargin.BackgroundRenderer == null) {
delayTimer.Start ();
} else {
DelayTimerElapsed (this, null);
}
} else {
RemoveBackgroundRenderer ();
}
}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:33,代码来源:FoldMarkerMargin.cs
示例16: RemoveDebugMarkers
void RemoveDebugMarkers ()
{
if (currentLineSegment != null) {
widget.TextEditor.Document.RemoveMarker (currentDebugLineMarker);
currentLineSegment = null;
}
if (debugStackSegment != null) {
widget.TextEditor.Document.RemoveMarker (debugStackLineMarker);
debugStackSegment = null;
}
}
开发者ID:stewartwhaley,项目名称:monodevelop,代码行数:11,代码来源:SourceEditorView.cs
示例17: DrawIcon
public void DrawIcon (Mono.TextEditor.TextEditor editor, Cairo.Context cr, LineSegment line, int lineNumber, double x, double y, double width, double height)
{
if (DebuggingService.IsDebugging)
return;
// TODO:
// win.DrawPixbuf (editor.Style.BaseGC (Gtk.StateType.Normal), errors.Any (e => e.IsError) ? errorPixbuf : warningPixbuf, 0, 0, x + (width - errorPixbuf.Width) / 2, y + (height - errorPixbuf.Height) / 2, errorPixbuf.Width, errorPixbuf.Height, Gdk.RgbDither.None, 0, 0);
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:7,代码来源:MessageBubbleTextMarker.cs
示例18: CalculateLineFit
void CalculateLineFit (TextEditor editor, LineSegment lineSegment)
{
KeyValuePair<int, int> textSize;
if (!lineWidthDictionary.TryGetValue (lineSegment, out textSize)) {
Pango.Layout textLayout = editor.TextViewMargin.GetLayout (lineSegment).Layout;
int textWidth, textHeight;
textLayout.GetPixelSize (out textWidth, out textHeight);
textSize = new KeyValuePair<int, int> (textWidth, textHeight);
if (textWidthDictionary.Count > 10000)
textWidthDictionary.Clear ();
lineWidthDictionary[lineSegment] = textSize;
}
EnsureLayoutCreated (editor);
fitsInSameLine = editor.TextViewMargin.XOffset + textSize.Key + LayoutWidth + errorPixbuf.Width + border + editor.LineHeight / 2 < editor.Allocation.Width;
}
开发者ID:pgoron,项目名称:monodevelop,代码行数:16,代码来源:MessageBubbleTextMarker.cs
示例19: CreateLinePartLayout
public LayoutWrapper CreateLinePartLayout (ISyntaxMode mode, LineSegment line, int logicalRulerColumn, int offset, int length, int selectionStart, int selectionEnd)
{
bool containsPreedit = textEditor.ContainsPreedit (offset, length);
LayoutDescriptor descriptor;
if (!containsPreedit && layoutDict.TryGetValue (line, out descriptor)) {
bool isInvalid;
if (descriptor.Equals (line, offset, length, selectionStart, selectionEnd, out isInvalid) && descriptor.Layout != null) {
return descriptor.Layout;
}
descriptor.Dispose ();
layoutDict.Remove (line);
}
var wrapper = new LayoutWrapper (PangoUtil.CreateLayout (textEditor));
wrapper.IsUncached = containsPreedit;
if (logicalRulerColumn < 0)
logicalRulerColumn = line.GetLogicalColumn (textEditor.GetTextEditorData (), textEditor.Options.RulerColumn);
var atts = new FastPangoAttrList ();
wrapper.Layout.Alignment = Pango.Alignment.Left;
wrapper.Layout.FontDescription = textEditor.Options.Font;
wrapper.Layout.Tabs = tabArray;
StringBuilder textBuilder = new StringBuilder ();
var chunks = GetCachedChunks (mode, Document, textEditor.ColorStyle, line, offset, length);
foreach (var chunk in chunks) {
try {
textBuilder.Append (Document.GetTextAt (chunk));
} catch {
Console.WriteLine (chunk);
}
}
var spanStack = line.StartSpan;
int lineOffset = line.Offset;
string lineText = textBuilder.ToString ();
uint preeditLength = 0;
if (containsPreedit) {
lineText = lineText.Insert (textEditor.preeditOffset - offset, textEditor.preeditString);
preeditLength = (uint)textEditor.preeditString.Length;
}
char[] lineChars = lineText.ToCharArray ();
//int startOffset = offset, endOffset = offset + length;
uint curIndex = 0, byteIndex = 0;
uint curChunkIndex = 0, byteChunkIndex = 0;
uint oldEndIndex = 0;
foreach (Chunk chunk in chunks) {
ChunkStyle chunkStyle = chunk != null ? textEditor.ColorStyle.GetChunkStyle (chunk) : null;
spanStack = chunk.SpanStack ?? spanStack;
foreach (TextMarker marker in line.Markers)
chunkStyle = marker.GetStyle (chunkStyle);
if (chunkStyle != null) {
//startOffset = chunk.Offset;
//endOffset = chunk.EndOffset;
uint startIndex = (uint)(oldEndIndex);
uint endIndex = (uint)(startIndex + chunk.Length);
oldEndIndex = endIndex;
HandleSelection (lineOffset, logicalRulerColumn, selectionStart, selectionEnd, chunk.Offset, chunk.EndOffset, delegate(int start, int end) {
if (containsPreedit) {
if (textEditor.preeditOffset < start)
start += (int)preeditLength;
if (textEditor.preeditOffset < end)
end += (int)preeditLength;
}
var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
atts.AddForegroundAttribute (chunkStyle.Color, si, ei);
if (!chunkStyle.TransparentBackround && GetPixel (ColorStyle.Default.BackgroundColor) != GetPixel (chunkStyle.BackgroundColor)) {
wrapper.AddBackground (chunkStyle.CairoBackgroundColor, (int)si, (int)ei);
} else if (chunk.SpanStack != null && ColorStyle != null) {
foreach (var span in chunk.SpanStack) {
if (span == null)
continue;
var spanStyle = ColorStyle.GetChunkStyle (span.Color);
if (!spanStyle.TransparentBackround && GetPixel (ColorStyle.Default.BackgroundColor) != GetPixel (spanStyle.BackgroundColor)) {
wrapper.AddBackground (spanStyle.CairoBackgroundColor, (int)si, (int)ei);
break;
}
}
}
}, delegate(int start, int end) {
if (containsPreedit) {
if (textEditor.preeditOffset < start)
start += (int)preeditLength;
if (textEditor.preeditOffset < end)
end += (int)preeditLength;
}
var si = TranslateToUTF8Index (lineChars, (uint)(startIndex + start - chunk.Offset), ref curIndex, ref byteIndex);
var ei = TranslateToUTF8Index (lineChars, (uint)(startIndex + end - chunk.Offset), ref curIndex, ref byteIndex);
atts.AddForegroundAttribute (SelectionColor.Color, si, ei);
if (!wrapper.StartSet)
wrapper.SelectionStartIndex = (int)si;
wrapper.SelectionEndIndex = (int)ei;
});
var translatedStartIndex = TranslateToUTF8Index (lineChars, (uint)startIndex, ref curChunkIndex, ref byteChunkIndex);
var translatedEndIndex = TranslateToUTF8Index (lineChars, (uint)endIndex, ref curChunkIndex, ref byteChunkIndex);
//.........这里部分代码省略.........
开发者ID:txdv,项目名称:monodevelop,代码行数:101,代码来源:TextViewMargin.cs
示例20: RemoveCachedLine
public void RemoveCachedLine (LineSegment line)
{
if (line == null)
return;
LayoutDescriptor descriptor;
if (layoutDict.TryGetValue (line, out descriptor)) {
descriptor.Dispose ();
layoutDict.Remove (line);
}
ChunkDescriptor chunkDesriptor;
if (chunkDict.TryGetValue (line, out chunkDesriptor)) {
chunkDict.Remove (line);
}
}
开发者ID:txdv,项目名称:monodevelop,代码行数:15,代码来源:TextViewMargin.cs
注:本文中的Mono.TextEditor.LineSegment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论