當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。