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


C# TextEditor.LocationToPoint方法代码示例

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


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

示例1: ShowTooltipWindow

		public override Gtk.Window ShowTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
		{
			var titem = (ToolTipData)item.Item;
			if (lastNode != null && lastWindow != null && lastWindow.IsRealized && titem.Node != null && lastNode == titem.Node)
				return lastWindow;
			
			DestroyLastTooltipWindow ();

			var tipWindow = CreateTooltipWindow (editor, offset, modifierState, item) as TooltipInformationWindow;
			if (tipWindow == null)
				return null;

			var hoverNode = titem.Node.GetNodeAt (editor.OffsetToLocation (offset)) ?? titem.Node;
			var p1 = editor.LocationToPoint (hoverNode.StartLocation);
			var p2 = editor.LocationToPoint (hoverNode.EndLocation);
			var positionWidget = editor.TextArea;
			var caret = new Gdk.Rectangle ((int)p1.X - positionWidget.Allocation.X, (int)p2.Y - positionWidget.Allocation.Y, (int)(p2.X - p1.X), (int)editor.LineHeight);

			tipWindow.ShowPopup (positionWidget, caret, PopupPosition.Top);
			tipWindow.EnterNotifyEvent += delegate {
				editor.HideTooltip (false);
			};
			lastWindow = tipWindow;
			lastNode = titem.Node;
			return tipWindow;
		}
开发者ID:RainsSoft,项目名称:playscript-monodevelop,代码行数:26,代码来源:LanguageItemTooltipProvider.cs

示例2: GetDiffRectangles

		public static ICollection<Cairo.Rectangle> GetDiffRectangles (TextEditor editor, int startOffset, int endOffset)
		{
			ICollection<Cairo.Rectangle> rectangles = new List<Cairo.Rectangle> ();
			var startLine = editor.GetLineByOffset (startOffset);
			var endLine = editor.GetLineByOffset (endOffset);
			int lineCount = endLine.LineNumber - startLine.LineNumber;
			var line = startLine;
			for (int i = 0; i <= lineCount; i++) {
				Cairo.Point point = editor.LocationToPoint (editor.Document.OffsetToLocation (Math.Max (startOffset, line.Offset)), true);
				Cairo.Point point2 = editor.LocationToPoint (editor.Document.OffsetToLocation (Math.Min (line.EndOffset, endOffset)), true);
				rectangles.Add (new Cairo.Rectangle (point.X - editor.TextViewMargin.XOffset, point.Y, point2.X - point.X, editor.LineHeight));
				line = line.NextLine;
			}
			return rectangles;
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:15,代码来源:EditorCompareWidgetBase.cs

示例3: GetDiffRectangle

		public static Cairo.Rectangle GetDiffRectangle (TextEditor editor, int startOffset, int endOffset)
		{
			var point = editor.LocationToPoint (editor.Document.OffsetToLocation (startOffset), true);
			var point2 = editor.LocationToPoint (editor.Document.OffsetToLocation (endOffset), true);
			return new Cairo.Rectangle (point.X - editor.TextViewMargin.XOffset, point.Y, point2.X - point.X, editor.LineHeight);
		}
开发者ID:Shanto,项目名称:monodevelop,代码行数:6,代码来源:EditorCompareWidgetBase.cs

示例4: ShowPopup

		void ShowPopup (TextEditor editor, EventButton evt)
		{
			CommandEntrySet cset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/VersionControl/DiffView/ContextMenu");
			Gtk.Menu menu = IdeApp.CommandService.CreateMenu (cset);
			menu.Destroyed += delegate {
				this.QueueDraw ();
			};
			
			if (evt != null) {
				GtkWorkarounds.ShowContextMenu (menu, this, evt);
			} else {
				var pt = editor.LocationToPoint (editor.Caret.Location);
				GtkWorkarounds.ShowContextMenu (menu, editor, new Gdk.Rectangle (pt.X, pt.Y, 1, (int)editor.LineHeight));
			}
		}
开发者ID:telebovich,项目名称:monodevelop,代码行数:15,代码来源:EditorCompareWidgetBase.cs

示例5: GetDiffRectangle

		public static Cairo.Rectangle GetDiffRectangle (TextEditor editor, int startOffset, int endOffset)
		{
			var point = editor.LocationToPoint (editor.Document.OffsetToLocation (startOffset), true);
			Cairo.Point point2;
			var line = editor.GetLineByOffset (startOffset);
			if (line.Offset + line.Length < endOffset) {
				point2 = new Cairo.Point ((int)(point.X + editor.TextViewMargin.CharWidth * (endOffset - startOffset)), point.Y);
			} else {
				point2 = editor.LocationToPoint (editor.Document.OffsetToLocation (endOffset), true);
			}
			return new Cairo.Rectangle (point.X - editor.TextViewMargin.XOffset, point.Y, point2.X - point.X, editor.LineHeight);
		}
开发者ID:rajeshpillai,项目名称:monodevelop,代码行数:12,代码来源:EditorCompareWidgetBase.cs

示例6: ShowTipInfoWindow

		void ShowTipInfoWindow (TextEditor editor, TooltipInformationWindow tipWindow, TooltipItem item, Xwt.ModifierKeys modifierState, int mouseX, int mouseY)
		{
			Gtk.Widget editorWidget = editor;

			var startLoc = editor.OffsetToLocation (item.Offset);
			var endLoc = editor.OffsetToLocation (item.EndOffset);
			var p1 = editor.LocationToPoint (startLoc);
			var p2 = editor.LocationToPoint (endLoc);

			int w = (int)(p2.X - p1.X);

			var caret = new Gdk.Rectangle (
				(int)p1.X,
				(int)p1.Y,
				(int)w,
				(int)editor.LineHeight
			);

			tipWindow.ShowPopup (editorWidget, caret, PopupPosition.Top);
		}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:20,代码来源:TooltipProvider.cs

示例7: ShowTooltipWindow

		public override Window ShowTooltipWindow (TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
		{
			var titem = (item.Item as TTI).sr;
			DestroyLastTooltipWindow ();

			var tipWindow = CreateTooltipWindow (editor, offset, modifierState, item) as TooltipInformationWindow;
			if (tipWindow == null)
				return null;

			var positionWidget = editor.TextArea;

			Cairo.Point p1, p2;

			var dn = titem as INode;
			if (dn != null)
			{
				if (dn.NameLocation.IsEmpty)
					p1 = p2 = editor.LocationToPoint(dn.Location.Line, dn.Location.Column);
				else
				{
					p1 = editor.LocationToPoint(dn.NameLocation.Line, dn.NameLocation.Column);
					p2 = editor.LocationToPoint(dn.NameLocation.Line, dn.NameLocation.Column + (dn.Name ?? "").Length);
				}
			}
			else {
				p1 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.Offset));
				p2 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.EndOffset));
			}

			var caret = new Gdk.Rectangle (p1.X - positionWidget.Allocation.X, p2.Y - positionWidget.Allocation.Y, (p2.X - p1.X), (int)editor.LineHeight);
			tipWindow.ShowPopup (positionWidget, caret, PopupPosition.Top);
			

			lastWindow = tipWindow;

			tipWindow.EnterNotifyEvent += delegate {
				editor.HideTooltip (false);
			};

			//lastNode = titem.Result;
			return tipWindow;
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:42,代码来源:DToolTipProvider.cs

示例8: ShowTooltipWindow

        public override Window ShowTooltipWindow(TextEditor editor, int offset, Gdk.ModifierType modifierState, int mouseX, int mouseY, TooltipItem item)
        {
            var titems = item.Item as AbstractType;/*
            if (lastNode != null && lastWindow != null && lastWindow.IsRealized && titem.Result != null && lastNode == titem.Result)
                return lastWindow;*/

            DestroyLastTooltipWindow ();

            var tipWindow = CreateTooltipWindow (editor, offset, modifierState, item) as TooltipInformationWindow;
            if (tipWindow == null)
                return null;

            var titem = titems.DeclarationOrExpressionBase;
            var positionWidget = editor.TextArea;

            Cairo.Point p1, p2;

            if (titem != null) {
                p1 = editor.LocationToPoint (titem.Location.Line, titem.Location.Column);
                p2 = editor.LocationToPoint (titem.EndLocation.Line, titem.EndLocation.Column);
            } else {
                p1 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.Offset));
                p2 = editor.LocationToPoint (editor.OffsetToLocation(item.ItemSegment.EndOffset));
            }

            var caret = new Gdk.Rectangle (p1.X - positionWidget.Allocation.X, p2.Y - positionWidget.Allocation.Y, (p2.X - p1.X), (int)editor.LineHeight);
            tipWindow.ShowPopup (positionWidget, caret, PopupPosition.Top);

            lastWindow = tipWindow;

            tipWindow.EnterNotifyEvent += delegate {
                editor.HideTooltip (false);
            };

            //lastNode = titem.Result;
            return tipWindow;
        }
开发者ID:Geod24,项目名称:Mono-D,代码行数:37,代码来源:DToolTipProvider.cs


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