本文整理汇总了C#中Mono.TextEditor.LineSegment类的典型用法代码示例。如果您正苦于以下问题:C# LineSegment类的具体用法?C# LineSegment怎么用?C# LineSegment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LineSegment类属于Mono.TextEditor命名空间,在下文中一共展示了LineSegment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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 ();
}
示例3: RemoveLine
public bool RemoveLine (LineSegment line)
{
if (!lineWidthDictionary.ContainsKey (line))
return false;
lineWidthDictionary.Remove (line);
return true;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}
}
示例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);
}
示例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 ();
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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;
}
}
示例14: LineDescriptor
protected LineDescriptor (LineSegment line, int offset, int length)
{
this.Offset = offset;
this.Length = length;
this.MarkerLength = line.MarkerCount;
this.Spans = line.StartSpan;
}
示例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 ();
}
}