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


C# MonoTextEditor类代码示例

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


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

示例1: ShowTooltipWindow

		public virtual Gtk.Window ShowTooltipWindow (MonoTextEditor editor, Gtk.Window tipWindow, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
		{
			int ox = 0, oy = 0;
			if (editor.GdkWindow != null)
				editor.GdkWindow.GetOrigin (out ox, out oy);
			
			int w;
			double xalign;
			GetRequiredPosition (editor, tipWindow, out w, out xalign);
			w += 10;

			int x = mouseX + ox + editor.Allocation.X;
			int y = mouseY + oy + editor.Allocation.Y;
			Gdk.Rectangle geometry = editor.Screen.GetUsableMonitorGeometry (editor.Screen.GetMonitorAtPoint (x, y));
			
			x -= (int) ((double) w * xalign);
			y += 10;
			
			if (x + w >= geometry.X + geometry.Width)
				x = geometry.X + geometry.Width - w;
			if (x < geometry.Left)
				x = geometry.Left;
			
			int h = tipWindow.SizeRequest ().Height;
			if (y + h >= geometry.Y + geometry.Height)
				y = geometry.Y + geometry.Height - h;
			if (y < geometry.Top)
				y = geometry.Top;
			
			tipWindow.Move (x, y);
			
			tipWindow.ShowAll ();

			return tipWindow;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:35,代码来源:TooltipProvider.cs

示例2: GetLineHeight

		public double GetLineHeight (MonoTextEditor 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:ArsenShnurkov,项目名称:monodevelop,代码行数:28,代码来源:MessageBubbleTextMarker.cs

示例3: BounceFadePopupWindow

		public BounceFadePopupWindow (MonoTextEditor editor) : base (Gtk.WindowType.Popup)
		{
			if (!IsComposited)
				throw new InvalidOperationException ("Only works with composited screen. Check Widget.IsComposited.");
			if (editor == null)
				throw new ArgumentNullException ("Editor");
			DoubleBuffered = true;
			Decorated = false;
			BorderWidth = 0;
			HasFrame = true;
			this.editor = editor;
			Events = Gdk.EventMask.ExposureMask;
			Duration = 500;
			ExpandWidth = 12;
			ExpandHeight = 2;
			BounceEasing = Easing.Sine;
			
			var rgbaColormap = Screen.RgbaColormap;
			if (rgbaColormap == null)
				return;
			Colormap = rgbaColormap;

			stage.ActorStep += OnAnimationActorStep;
			stage.Iteration += OnAnimationIteration;
			stage.UpdateFrequency = 10;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:26,代码来源:BounceFadePopupWindow.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: GetItem

		public override async Task<TooltipItem> GetItem (MonoTextEditor editor, int offset, CancellationToken token = default(CancellationToken))
		{
			var wrappedEditor = WrapEditor (editor);
			if (wrappedEditor == null)
				return null;
			var doc = IdeApp.Workbench.ActiveDocument;
			if (doc == null)
				return null;
			var task = provider.GetItem (wrappedEditor, doc, offset, token);
			if (task == null) {
				LoggingService.LogWarning ("Tooltip provider " + provider + " gave back null on GetItem (should always return a non null task).");
				return null;
			}
			var item = await task;
			if (item == null)
				return null;
			if (lastUnwrappedItem != null) {
				if (lastUnwrappedItem.Offset == item.Offset &&
					lastUnwrappedItem.Length == item.Length &&
					lastUnwrappedItem.Item.Equals (item.Item)) {
					return lastWrappedItem;
				}
			}
			lastUnwrappedItem = item;
			return lastWrappedItem = new TooltipItem (item.Item, item.Offset, item.Length);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:26,代码来源:TooltipProviderWrapper.cs

示例6: ColorShemeEditor

		public ColorShemeEditor (HighlightingPanel panel)
		{
			this.panel = panel;
			this.Build ();
			textEditor = new MonoTextEditor ();
			textEditor.Options = new StyledSourceEditorOptions (MonoDevelop.Ide.Editor.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.SearchColumn = -1; // disable the interactive search
			this.treeviewColors.Selection.Changed += HandleTreeviewColorsSelectionChanged;
			this.hpaned1.Position = 250;
			this.SetSizeRequest (1024, 768);

			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:sushihangover,项目名称:monodevelop,代码行数:30,代码来源:ColorShemeEditor.cs

示例7: GutterMargin

		public GutterMargin (MonoTextEditor editor)
		{
			this.editor = editor;

			this.editor.Document.LineChanged += UpdateWidth;
			this.editor.Document.TextSet += HandleEditorDocumenthandleTextSet;
			this.editor.Caret.PositionChanged += EditorCarethandlePositionChanged;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:GutterMargin.cs

示例8: WrapEditor

		static MonoDevelop.Ide.Editor.TextEditor WrapEditor (MonoTextEditor editor)
		{
			foreach (var doc in IdeApp.Workbench.Documents) {
				if (doc.FileName == editor.FileName)
					return doc.Editor;
			}
			return null;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:TooltipProviderWrapper.cs

示例9: FoldMarkerMargin

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

示例10: DrawBackground

		public override bool DrawBackground (MonoTextEditor editor, Cairo.Context cr, LineMetrics metrics)
		{
			if (metrics.SelectionStart > 0)
				return true;
			cr.SetSourceColor (color);
			cr.Rectangle (metrics.TextRenderStartPosition, metrics.LineYRenderStartPosition, metrics.TextRenderEndPosition - metrics.TextRenderStartPosition, editor.LineHeight);
			cr.Fill ();
			return true;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:9,代码来源:LineBackgroundMarker.cs

示例11: ActionMargin

		public ActionMargin (MonoTextEditor editor)
		{
			if (editor == null)
				throw new ArgumentNullException ("editor");
			this.editor = editor;
			marginWidth = 20;
			IsVisible = false;
			this.editor.Caret.PositionChanged += HandlePositionChanged;;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:ActionMargin.cs

示例12: TextEventArgsWrapper

		void IActionTextLineMarker.MouseHover (MonoTextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
		{
			MouseHover?.Invoke (this, new TextEventArgsWrapper (args));
			result.Cursor = textLinkCursor;
			if (OnlyShowLinkOnHover) {
				editor.GetTextEditorData ().Document.CommitLineUpdate (args.LineSegment);
				editor.TextViewMargin.HoveredLineChanged += new UpdateOldLine (editor, args.LineSegment).TextViewMargin_HoveredLineChanged;
			}
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:9,代码来源:LinkMarker.cs

示例13:

		bool IActionTextLineMarker.MouseReleased (MonoTextEditor editor, MarginMouseEventArgs args)
		{
			if ((Platform.IsMac && (args.ModifierState & Gdk.ModifierType.Mod2Mask) == Gdk.ModifierType.Mod2Mask) ||
			    (!Platform.IsMac && (args.ModifierState & Gdk.ModifierType.ControlMask) == Gdk.ModifierType.ControlMask))
				activateLink?.Invoke (LinkRequest.RequestNewView);
			else
				activateLink?.Invoke (LinkRequest.SameView);
			
			return false;
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:10,代码来源:LinkMarker.cs

示例14: ViStatusArea

		public ViStatusArea (MonoTextEditor editor)
		{
			this.editor = editor;
			editor.TextViewMargin.CaretBlink += HandleCaretBlink;
			editor.Caret.PositionChanged += HandlePositionChanged;

			editor.AddTopLevelWidget (this, 0, 0);
			((MonoTextEditor.EditorContainerChild)editor[this]).FixedPosition = true;
			Show ();
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:10,代码来源:ViStatusArea.cs

示例15: GotoLineNumberWidget

		public GotoLineNumberWidget (MonoTextEditor textEditor, Widget frame)
		{
			this.textEditor = textEditor;
			this.frame = frame;
			this.Build ();
			
			StoreWidgetState ();
			textEditor.Parent.SizeAllocated += HandleViewTextEditorhandleSizeAllocated;
			
			//HACK: GTK rendering issue on Mac, images don't repaint unless we put them in visible eventboxes
			if (MonoDevelop.Core.Platform.IsMac) {
				foreach (var eb in new [] { eventbox1, eventbox2 }) {
					eb.VisibleWindow = true;
					eb.ModifyBg (StateType.Normal, new Gdk.Color (230, 230, 230));
				}
			}
			this.closeButton.Clicked += delegate {
				RestoreWidgetState ();
				CloseWidget ();
			};
			
			this.buttonGoToLine.Clicked += delegate {
				cleanExit = true;
				GotoLine ();
				CloseWidget ();
			};
			
			foreach (Gtk.Widget child in this.Children) {
				child.KeyPressEvent += delegate (object sender, Gtk.KeyPressEventArgs args) {
					if (args.Event.Key == Gdk.Key.Escape) {
						RestoreWidgetState ();
						CloseWidget ();
					}
				};
			}
			
			Gtk.Widget oldWidget = null;
			this.FocusChildSet += delegate (object sender, Gtk.FocusChildSetArgs args) {
				// only store state when the focus comes from a non child widget
				if (args.Widget != null && oldWidget == null)
					StoreWidgetState ();
				oldWidget = args.Widget;
			};
			
			this.entryLineNumber.Changed += delegate {
				PreviewLine ();
			};
				
			this.entryLineNumber.Activated += delegate {
				cleanExit = true;
				GotoLine ();
				CloseWidget ();
			};
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:54,代码来源:GotoLineNumberWidget.cs


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