当前位置: 首页>>代码示例>>C#>>正文


C# TextEditor.DocumentLine类代码示例

本文整理汇总了C#中Mono.TextEditor.DocumentLine的典型用法代码示例。如果您正苦于以下问题:C# DocumentLine类的具体用法?C# DocumentLine怎么用?C# DocumentLine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DocumentLine类属于Mono.TextEditor命名空间,在下文中一共展示了DocumentLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveTabInLine

		public static int RemoveTabInLine (TextEditorData data, DocumentLine line)
		{
			if (line.LengthIncludingDelimiter == 0)
				return 0;
			char ch = data.Document.GetCharAt (line.Offset); 
			if (ch == '\t') {
				data.Remove (line.Offset, 1);
				data.Document.CommitLineUpdate (line);
				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);
				data.Document.CommitLineUpdate (line);
				return removeCount;
			}
			return 0;
		}
开发者ID:OnorioCatenacci,项目名称:monodevelop,代码行数:29,代码来源:MiscActions.cs

示例2: Draw

		internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, DocumentLine lineSegment, int line, double x, double y, double lineHeight)
		{
			cr.MoveTo (x + 0.5, y);
			cr.LineTo (x + 0.5, y + lineHeight);
			cr.SetSourceColor (color);
			cr.Stroke ();
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:DashedLineMargin.cs

示例3: RemoveLine

		public bool RemoveLine (DocumentLine line)
		{
			if (!lineWidthDictionary.ContainsKey (line))
				return false;
			lineWidthDictionary.Remove (line);
			return true;
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:7,代码来源:MessageBubbleCache.cs

示例4: DrawIcon

		static void DrawIcon (MonoTextEditor editor, Cairo.Context cr, DocumentLine lineSegment, double x, double y, double width, double height)
		{
			if (lineSegment.IsBookmarked) {
				var color1 = editor.ColorStyle.Bookmarks.Color;
				var color2 = editor.ColorStyle.Bookmarks.SecondColor;
				
				DrawRoundRectangle (cr, x + 1, y + 1, 8, width - 4, height - 4);

				// FIXME: VV: Remove gradient features
				using (var pat = new Cairo.LinearGradient (x + width / 4, y, x + width / 2, y + height - 4)) {
					pat.AddColorStop (0, color1);
					pat.AddColorStop (1, color2);
					cr.SetSource (pat);
					cr.FillPreserve ();
				}

				// FIXME: VV: Remove gradient features
				using (var pat = new Cairo.LinearGradient (x, y + height, x + width, y)) {
					pat.AddColorStop (0, color2);
					//pat.AddColorStop (1, color1);
					cr.SetSource (pat);
					cr.Stroke ();
				}
			}
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:25,代码来源:BookmarkMarker.cs

示例5:

		bool IFoldMarginMarker.DrawBackground (TextEditor e, double marginWidth, Cairo.Context cr, Cairo.Rectangle area, DocumentLine documentLine, int line, double x, double y, double lineHeight)
		{
			if (cache.CurrentSelectedTextMarker != null && cache.CurrentSelectedTextMarker != this)
				return false;
			cr.Rectangle (x, y, marginWidth, lineHeight);
			cr.Color = LineColor.Color;
			cr.Fill ();
			return true;
		}
开发者ID:halleyxu,项目名称:monodevelop,代码行数:9,代码来源:MessageBubbleTextMarker_FoldMarker.cs

示例6: Draw

        protected internal override void Draw(Context cr, Xwt.Rectangle area, DocumentLine line, int lineNumber, double x, double y, double height)
        {
            if (line != null)
            {
                TextLayout layout;
                if (!layoutDict.TryGetValue(line, out layout))
                {
                    var mode = editor.Document.SyntaxMode;
                    var style = SyntaxModeService.DefaultColorStyle;
                    var chunks = GetCachedChunks(mode, editor.Document, style, line, line.Offset, line.Length);

                    layout = new TextLayout();
                    layout.Font = editor.Options.EditorFont;
                    string lineText = editor.Document.GetLineText(lineNumber);
                    var stringBuilder = new StringBuilder(lineText.Length);

                    int currentVisualColumn = 1;
                    for (int i = 0; i < lineText.Length; ++i)
                    {
                        char chr = lineText[i];
                        if (chr == '\t')
                        {
                            int length = GetNextTabstop(editor, currentVisualColumn) - currentVisualColumn;
                            stringBuilder.Append(' ', length);
                            currentVisualColumn += length;
                        }
                        else
                        {
                            stringBuilder.Append(chr);
                            if (!char.IsLowSurrogate(chr))
                            {
                                ++currentVisualColumn;
                            }
                        }
                    }
                    layout.Text = stringBuilder.ToString();

                    int visualOffset = 1;
                    foreach (var chunk in chunks)
                    {
                        var chunkStyle = style.GetChunkStyle(chunk);
                        visualOffset = DrawLinePortion(cr, chunkStyle, layout, line, visualOffset, chunk.Length);
                    }

                    //layoutDict[line] = layout;
                }

                cr.DrawTextLayout(layout, x, y);

                if (editor.CaretVisible && editor.Caret.Line == lineNumber)
                {
                    cr.SetColor(Colors.Black);
                    cr.Rectangle(x + ColumnToX(line, editor.Caret.Column), y, caretWidth, LineHeight);
                    cr.Fill();
                }
            }
        }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:57,代码来源:TextViewMargin.cs

示例7: UrlMarker

		public UrlMarker (TextDocument doc, DocumentLine line, string url, UrlType urlType, string style, int startColumn, int endColumn)
		{
			this.doc = doc;
			this.line = line;
			this.url = url;
			this.urlType = urlType;
			this.style = style;
			this.startColumn = startColumn;
			this.endColumn = endColumn;
			doc.LineChanged += HandleDocLineChanged;
		}
开发者ID:xiexin36,项目名称:monodevelop,代码行数:11,代码来源:UrlMarker.cs

示例8: Draw

		internal protected override void Draw (Cairo.Context cr, Cairo.Rectangle area, DocumentLine lineSegment, int line, double x, double y, double lineHeight)
		{
			var marker = lineSegment != null ? (MarginMarker)lineSegment.Markers.FirstOrDefault (m => m is MarginMarker && ((MarginMarker)m).CanDraw (this)) : null;
			bool drawBackground = true;
			if (marker != null && marker.CanDrawBackground (this))
				drawBackground = !marker.DrawBackground (editor, cr, new MarginDrawMetrics (this, area, lineSegment, line, x, y, lineHeight));

			if (drawBackground) 
				DrawMarginBackground (cr, line, x, y, lineHeight);

			if (marker != null && marker.CanDrawForeground (this))
				marker.DrawForeground (editor, cr, new MarginDrawMetrics (this, area, lineSegment, line, x, y, lineHeight));
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:13,代码来源:ActionMargin.cs

示例9: DrawIcon

		public void DrawIcon (Mono.TextEditor.TextEditor editor, Cairo.Context cr, DocumentLine 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:nocache,项目名称:monodevelop,代码行数:13,代码来源:DebugTextMarker.cs

示例10:

		void IIconBarMarker.DrawIcon (TextEditor ed, Cairo.Context cr, DocumentLine line, int lineNumber, double x, double y, double width, double height)
		{
			cr.Save ();
			cr.Translate (
				x + 0.5  + (width - cache.errorPixbuf.Width) / 2,
				y + 0.5 + (height - cache.errorPixbuf.Height) / 2
			);
			Gdk.CairoHelper.SetSourcePixbuf (
				cr,
				errors.Any (e => e.IsError) ? cache.errorPixbuf : cache.warningPixbuf, 0, 0);
			cr.Paint ();
			cr.Restore ();

		}
开发者ID:halleyxu,项目名称:monodevelop,代码行数:14,代码来源:MessageBubbleTextMarker_IconBar.cs

示例11: GetLineState

//		TextDocument baseDocument;

		public Mono.TextEditor.TextDocument.LineState GetLineState (DocumentLine line)
		{
			if (line != null && lineStates != null) {
				try {
					var info = lineStates [line.LineNumber];
					if (info != null) {
						return info.state;
					}
				} catch (Exception) {

				}
			}
			return Mono.TextEditor.TextDocument.LineState.Unchanged;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:16,代码来源:DiffTracker.cs

示例12: DrawIcon

		public void DrawIcon (Mono.TextEditor.TextEditor editor, Cairo.Context cr, DocumentLine line, int lineNumber, double x, double y, double width, double height)
		{
			double size;
			if (width > height) {
				size = height;
			} else {
				size = width;
			}
			double borderLineWidth = cr.LineWidth;
			x = Math.Floor (x + (width - borderLineWidth - size) / 2);
			y = Math.Floor (y + (height - size) / 2);

			DrawIcon (cr, x, y, size);
		}
开发者ID:wickedshimmy,项目名称:monodevelop,代码行数:14,代码来源:DebugTextMarker.cs

示例13: DrawLinePortion

        int DrawLinePortion(Context cr, ChunkStyle style, TextLayout layout, DocumentLine line, int visualOffset, int logicalLength)
        {
            int logicalColumn = line.GetLogicalColumn(editor, visualOffset);
            int logicalEndColumn = logicalColumn + logicalLength;
            int visualEndOffset = line.GetVisualColumn(editor, logicalEndColumn);

            int visualLength = visualEndOffset - visualOffset;

            int indexOffset = visualOffset - 1;

            layout.SetFontStyle(style.FontStyle, indexOffset, visualLength);
            layout.SetFontWeight(style.FontWeight, indexOffset, visualLength);
            if (style.Underline)
                layout.SetUnderline(indexOffset, visualLength);
            layout.SetForeground(style.Foreground, indexOffset, visualLength);

            return visualEndOffset;
        }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:18,代码来源:TextViewMargin.cs

示例14: removeTrailingWhitespace

        public static void removeTrailingWhitespace( TextEditorData data, DocumentLine line )
        {
            if( line != null )
            {
                int num = 0;
                for( int i = line.Length - 1; i >= 0; i-- )
                {
                    if( !char.IsWhiteSpace( data.Document.GetCharAt( line.Offset + i ) ) )
                        break;
                    num++;
                }

                if( num > 0 )
                {
                    int offset = line.Offset + line.Length - num;
                    data.Remove( offset, num );
                }
            }
        }
开发者ID:prime31,项目名称:MonoDevelopBetterFileSaver,代码行数:19,代码来源:RemoveTrailingWhitespace.cs

示例15: Analyze

			public override void Analyze(TextDocument doc, DocumentLine line, Chunk startChunk, int startOffset, int endOffset)
			{
				// Check line start
				int o = line.Offset;
				char c = '\0';
				for (; o < line.EndOffset && char.IsWhiteSpace(c = doc.GetCharAt(o)); o++) ;

				if (c != '-' && c != '#')
					return;

				DSyntax.Document = doc;
				var spanParser = new SpanParser(DSyntax, new CloneableStack<Span>());
				var chunkP = new ChunkParser(DSyntax, spanParser, Ide.IdeApp.Workbench.ActiveDocument.Editor.ColorStyle, line);

				var n = chunkP.GetChunks(startOffset, endOffset - startOffset);
				if (n == null)
					return;
				startChunk.Next = n;
				startChunk.Length = n.Offset - startChunk.Offset;
			}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:20,代码来源:DietTemplateSyntaxMode.cs


注:本文中的Mono.TextEditor.DocumentLine类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。