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


C# TextEditor类代码示例

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


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

示例1: FormatStatmentAt

		public static void FormatStatmentAt (TextEditor editor, DocumentContext context, MonoDevelop.Ide.Editor.DocumentLocation location, OptionSet optionSet = null)
		{
			var offset = editor.LocationToOffset (location);
			var policyParent = context.Project != null ? context.Project.Policies : PolicyService.DefaultPolicies;
			var mimeTypeChain = DesktopService.GetMimeTypeInheritanceChain (CSharpFormatter.MimeType);
			Format (policyParent, mimeTypeChain, editor, context, offset, offset, false, true, optionSet: optionSet);
		}
开发者ID:hbons,项目名称:monodevelop,代码行数:7,代码来源:OnTheFlyFormatter.cs

示例2: sendClick

	public void sendClick (GPSDefinition.GPSPoint point) { //Pass it on
		cameraObject.SendMessage("moveToObserve", point);
		TextEditor te = new TextEditor ();
		te.content = new GUIContent (point.originalGPS);
		te.SelectAll ();
		te.Copy ();
	}
开发者ID:Masterchef365,项目名称:RoidVisualizer,代码行数:7,代码来源:ButtonManager.cs

示例3: CopyText

 public void CopyText()
 {
     TextEditor te = new TextEditor();
     te.content = new GUIContent(ToCSV());
     te.SelectAll();
     te.Copy();
 }
开发者ID:CoryBerg,项目名称:drexelNeonatal,代码行数:7,代码来源:UILogger.cs

示例4: ColorShemeEditor

		public ColorShemeEditor (HighlightingPanel panel)
		{
			this.panel = panel;
			this.Build ();
			textEditor = new TextEditor ();
			textEditor.Options = DefaultSourceEditorOptions.Instance;
			this.scrolledwindowTextEditor.Child = textEditor;
			textEditor.ShowAll ();
			
			this.treeviewColors.AppendColumn (GettextCatalog.GetString ("Name"), new Gtk.CellRendererText (), new CellLayoutDataFunc (SyntaxCellRenderer));
			this.treeviewColors.HeadersVisible = false;
			this.treeviewColors.Model = colorStore;
			this.treeviewColors.Selection.Changed += HandleTreeviewColorsSelectionChanged;
			this.colorbuttonFg.ColorSet += Stylechanged;
			this.colorbuttonBg.ColorSet += Stylechanged;
			this.colorbuttonPrimary.ColorSet += Stylechanged;
			this.colorbuttonSecondary.ColorSet += Stylechanged;
			this.colorbuttonBorder.ColorSet += Stylechanged;
			colorbuttonBg.UseAlpha = true;
			this.checkbuttonBold.Toggled += Stylechanged;
			this.checkbuttonItalic.Toggled += Stylechanged;
			
			this.buttonOk.Clicked += HandleButtonOkClicked;
			HandleTreeviewColorsSelectionChanged (null, null);
			notebookColorChooser.ShowTabs = false;
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:26,代码来源:ColorShemeEditor.cs

示例5: copyText

 public void copyText()
 {
     TextEditor text = new TextEditor();
     text.content = new GUIContent(custom.exportSong());
     text.SelectAll();
     text.Copy();
 }
开发者ID:AlexMaskill,项目名称:DissertationGame,代码行数:7,代码来源:SongExportMenu.cs

示例6: CodeSegmentPreviewWindow

		public CodeSegmentPreviewWindow (TextEditor editor, bool hideCodeSegmentPreviewInformString, ISegment segment, int width, int height) : base (Gtk.WindowType.Popup)
		{
			this.HideCodeSegmentPreviewInformString = hideCodeSegmentPreviewInformString;
			this.editor = editor;
			this.AppPaintable = true;
			layout = PangoUtil.CreateLayout (this);
			informLayout = PangoUtil.CreateLayout (this);
			informLayout.SetText (CodeSegmentPreviewInformString);
			
			fontDescription = Pango.FontDescription.FromString (editor.Options.FontName);
			fontDescription.Size = (int)(fontDescription.Size * 0.8f);
			layout.FontDescription = fontDescription;
			layout.Ellipsize = Pango.EllipsizeMode.End;
			// setting a max size for the segment (40 lines should be enough), 
			// no need to markup thousands of lines for a preview window
			int startLine = editor.Document.OffsetToLineNumber (segment.Offset);
			int endLine = editor.Document.OffsetToLineNumber (segment.EndOffset);
			const int maxLines = 40;
			bool pushedLineLimit = endLine - startLine > maxLines;
			if (pushedLineLimit)
				segment = new Segment (segment.Offset, editor.Document.GetLine (startLine + maxLines).Offset - segment.Offset);
			layout.Ellipsize = Pango.EllipsizeMode.End;
			layout.SetMarkup (editor.Document.SyntaxMode.GetMarkup (editor.Document,
			                                                        editor.Options,
			                                                        editor.ColorStyle,
			                                                        segment.Offset,
			                                                        segment.Length,
			                                                        true) + (pushedLineLimit ? Environment.NewLine + "..." : ""));
			CalculateSize ();
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:30,代码来源:CodeSegmentPreviewWindow.cs

示例7: FoldMarkerMargin

		public FoldMarkerMargin (TextEditor editor)
		{
			this.editor = editor;
			layout = PangoUtil.CreateLayout (editor);
			editor.Caret.PositionChanged += HandleEditorCaretPositionChanged;
			editor.Document.FoldTreeUpdated += HandleEditorDocumentFoldTreeUpdated;
		}
开发者ID:txdv,项目名称:monodevelop,代码行数:7,代码来源:FoldMarkerMargin.cs

示例8: GetLineHeight

		public double GetLineHeight (TextEditor editor)
		{
			return editor.LineHeight;
			/*
			if (!IsVisible || DebuggingService.IsDebugging)
				return editor.LineHeight;
			
			if (editorAllocHeight == editor.Allocation.Width && lastLineLength == lineSegment.EditableLength)
				return lastHeight;
			
			CalculateLineFit (editor, lineSegment);
			double height;
			if (CollapseExtendedErrors) {
				height = editor.LineHeight;
			} else {
				// TODO: Insert virtual lines, if required
				height = UseVirtualLines ? editor.LineHeight * errors.Count : editor.LineHeight;
			}
			
			if (!fitsInSameLine)
				height += editor.LineHeight;
			
			editorAllocHeight = editor.Allocation.Height;
			lastLineLength = lineSegment.EditableLength;
			lastHeight = height;
			
			return height;*/
		}
开发者ID:llucenic,项目名称:monodevelop,代码行数:28,代码来源:MessageBubbleTextMarker.cs

示例9: IsContext

		public static bool IsContext(TextEditor editor, DocumentContext ctx, int position, CancellationToken cancellationToken)
		{
			// Check to see if we're to the right of an $ or an @$
			var start = position - 1;
			if (start < 0)
			{
				return false;
			}

			if (editor[start] == '@')
			{
				start--;

				if (start < 0)
				{
					return false;
				}
			}

			if (editor[start] != '$')
			{
				return false;
			}

			var tree = ctx.AnalysisDocument.GetSyntaxTreeAsync (cancellationToken).WaitAndGetResult(cancellationToken);
			var token = tree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition(start);

			return tree.IsExpressionContext(start, token, attributes: false, cancellationToken: cancellationToken)
				       || tree.IsStatementContext(start, token, cancellationToken);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:30,代码来源:InterpolatedStringCompletionSession.cs

示例10: CreateTooltipWindow

		public override Control CreateTooltipWindow (TextEditor editor, DocumentContext ctx, TooltipItem item, int offset, Xwt.ModifierKeys modifierState)
		{
			var result = new LanguageItemWindow (GetExtensibleTextEditor (editor), modifierState, null, (string)item.Item, null);
			if (result.IsEmpty)
				return null;
			return result;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:CompileErrorTooltipProvider.cs

示例11: Draw

		public override void Draw (TextEditor editor, Cairo.Context cr, Pango.Layout layout, bool selected, int startOffset, int endOffset, double y, double startXPos, double endXPos)
		{
			int markerStart = LineSegment.Offset + System.Math.Max (StartCol - 1, 0);
			int markerEnd = LineSegment.Offset + (EndCol < 1 ? LineSegment.Length : EndCol - 1);
			if (markerEnd < startOffset || markerStart > endOffset) 
				return;
			
			bool drawOverlay = result.InspectionMark == IssueMarker.GrayOut;
			
			if (drawOverlay && editor.IsSomethingSelected) {
				var selectionRange = editor.SelectionRange;
				if (selectionRange.Contains (markerStart) && selectionRange.Contains (markerEnd))
					return;
				if (selectionRange.Contains (markerEnd))
					markerEnd = selectionRange.Offset;
				if (selectionRange.Contains (markerStart))
					markerStart = selectionRange.EndOffset;
				if (markerEnd <= markerStart)
					return;
			}
			
			double drawFrom;
			double drawTo;
				
			if (markerStart < startOffset && endOffset < markerEnd) {
				drawFrom = startXPos;
				drawTo = endXPos;
			} else {
				int start = startOffset < markerStart ? markerStart : startOffset;
				int end = endOffset < markerEnd ? endOffset : markerEnd;
				int /*lineNr,*/ x_pos;
				
				x_pos = layout.IndexToPos (start - startOffset).X;
				drawFrom = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
				x_pos = layout.IndexToPos (end - startOffset).X;
	
				drawTo = startXPos + (int)(x_pos / Pango.Scale.PangoScale);
			}
			
			drawFrom = System.Math.Max (drawFrom, editor.TextViewMargin.XOffset);
			drawTo = System.Math.Max (drawTo, editor.TextViewMargin.XOffset);
			if (drawFrom >= drawTo)
				return;
			
			double height = editor.LineHeight / 5;
			cr.Color = ColorName == null ? Color : editor.ColorStyle.GetColorFromDefinition (ColorName);
			if (drawOverlay) {
				cr.Rectangle (drawFrom, y, drawTo - drawFrom, editor.LineHeight);
				var color = editor.ColorStyle.Default.CairoBackgroundColor;
				color.A = 0.6;
				cr.Color = color;
				cr.Fill ();
			} else if (Wave) {	
				Pango.CairoHelper.ShowErrorUnderline (cr, drawFrom, y + editor.LineHeight - height, drawTo - drawFrom, height);
			} else {
				cr.MoveTo (drawFrom, y + editor.LineHeight - 1);
				cr.LineTo (drawTo, y + editor.LineHeight - 1);
				cr.Stroke ();
			}
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:60,代码来源:ResultMarker.cs

示例12: PinnedWatchWidget

		public PinnedWatchWidget (TextEditor editor, PinnedWatch watch)
		{
			objectValue = watch.Value;
			Editor = editor;
			Watch = watch;

			valueTree = new ObjectValueTreeView ();
			valueTree.AllowAdding = false;
			valueTree.AllowEditing = true;
			valueTree.AllowPinning = true;
			valueTree.HeadersVisible = false;
			valueTree.CompactView = true;
			valueTree.PinnedWatch = watch;
			if (objectValue != null)
				valueTree.AddValue (objectValue);
			
			valueTree.ButtonPressEvent += HandleValueTreeButtonPressEvent;
			valueTree.ButtonReleaseEvent += HandleValueTreeButtonReleaseEvent;
			valueTree.MotionNotifyEvent += HandleValueTreeMotionNotifyEvent;
			
			Gtk.Frame fr = new Gtk.Frame ();
			fr.ShadowType = Gtk.ShadowType.Out;
			fr.Add (valueTree);
			Add (fr);
			HandleEditorOptionsChanged (null, null);
			ShowAll ();
			//unpin.Hide ();
			Editor.EditorOptionsChanged += HandleEditorOptionsChanged;
			
			DebuggingService.PausedEvent += HandleDebuggingServicePausedEvent;
			DebuggingService.ResumedEvent += HandleDebuggingServiceResumedEvent;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:32,代码来源:PinnedWatchWidget.cs

示例13: CreateTooltipWindow

		protected override Window CreateTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, TooltipItem item)
		{
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return null;

			var titem = item.Item as TTI;

			if (titem == null)
				return null;

			var result = new TooltipInformationWindow ();
			result.ShowArrow = true;

			foreach(var i in AmbiguousType.TryDissolve(titem.t))
			{
				if (i == null)
					continue;
				var tooltipInformation = TooltipInfoGen.Create(i, editor.ColorStyle);
				if (tooltipInformation != null && !string.IsNullOrEmpty(tooltipInformation.SignatureMarkup))
					result.AddOverload(tooltipInformation);
			}

			if (result.Overloads < 1) {
				result.Dispose ();
				return null;
			}

			result.RepositionWindow ();
			return result;
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:31,代码来源:DToolTipProvider.cs

示例14: GetItem

		public override async Task<TooltipItem> GetItem (TextEditor editor, DocumentContext ctx, int offset, CancellationToken token = default(CancellationToken))
		{
			if (ctx == null)
				return null;
			var analysisDocument = ctx.ParsedDocument;
			if (analysisDocument == null)
				return null;
			var unit = analysisDocument.GetAst<SemanticModel> ();
			if (unit == null)
				return null;
			
			var root = unit.SyntaxTree.GetRoot (token);
			SyntaxToken syntaxToken;
			try {
				syntaxToken = root.FindToken (offset);
			} catch (ArgumentOutOfRangeException) {
				return null;
			}
			if (!syntaxToken.Span.IntersectsWith (offset))
				return null;
			var symbolInfo = unit.GetSymbolInfo (syntaxToken.Parent, token);
			var symbol = symbolInfo.Symbol ?? unit.GetDeclaredSymbol (syntaxToken.Parent, token);
			var tooltipInformation = await CreateTooltip (symbol, syntaxToken, editor, ctx, offset);
			if (tooltipInformation == null || string.IsNullOrEmpty (tooltipInformation.SignatureMarkup))
				return null;
			return new TooltipItem (tooltipInformation, syntaxToken.Span.Start, syntaxToken.Span.Length);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:27,代码来源:LanguageItemTooltipProvider.cs

示例15: CopyToClipBoard

 public void CopyToClipBoard()
 {
     TextEditor te = new TextEditor();
     te.text = seedValue.Seed;
     te.SelectAll();
     te.Copy();
 }
开发者ID:Daniel95,项目名称:Mythe,代码行数:7,代码来源:CopySeed.cs


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