本文整理汇总了C#中TextEditor.LineToY方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.LineToY方法的具体用法?C# TextEditor.LineToY怎么用?C# TextEditor.LineToY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEditor
的用法示例。
在下文中一共展示了TextEditor.LineToY方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseIsOverError
int MouseIsOverError (TextEditor editor, MarginMouseEventArgs args)
{
if (layouts == null)
return -1;
int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
double y = editor.LineToY (lineNumber) - editor.VAdjustment.Value;
double height = editor.LineHeight * errors.Count;
if (!fitsInSameLine)
y += editor.LineHeight;
// Console.WriteLine (lineNumber + ": height={0}, y={1}, args={2}", height, y, args.Y);
if (y > args.Y || args.Y > y + height)
return -1;
int error = (int)((args.Y - y) / editor.LineHeight);
// Console.WriteLine ("error:" + error);
if (error >= layouts.Count)
return -1;
int errorCounterWidth = 0;
int ew = 0, eh = 0;
if (error == 0 && errors.Count > 1 && errorCountLayout != null) {
errorCountLayout.GetPixelSize (out ew, out eh);
errorCounterWidth = ew + 10;
}
double labelWidth = LayoutWidth + border + (ShowIconsInBubble ? errorPixbuf.Width : 0) + errorCounterWidth + editor.LineHeight / 2;
if (editor.Allocation.Width - editor.TextViewMargin.XOffset - args.X < labelWidth)
return error;
return -1;
}
示例2:
void IActionTextLineMarker.MouseHover (TextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
{
if (args.Button != 0)
return;
var line = editor.GetLine (loc.Line);
var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value;
var y = editor.LineToY (line.LineNumber) - editor.VAdjustment.Value;
if (args.X - x >= 0 * editor.Options.Zoom &&
args.X - x < tagMarkerWidth * editor.Options.Zoom &&
y - args.Y < (tagMarkerHeight) * editor.Options.Zoom) {
result.Cursor = arrowCursor;
Popup ();
} else {
codeActionEditorExtension.CancelSmartTagPopupTimeout ();
}
}
示例3: MouseIsOverMarker
bool MouseIsOverMarker (TextEditor editor, MarginMouseEventArgs args)
{
int ew = 0, eh = 0;
int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
double y = editor.LineToY (lineNumber) - editor.VAdjustment.Value;
if (fitsInSameLine) {
if (args.Y < y + 2 || args.Y > y + editor.LineHeight - 2)
return false;
} else {
if (args.Y < y + editor.LineHeight + 2 || args.Y > y + editor.LineHeight * 2 - 2)
return false;
}
if (errors.Count > 1 && errorCountLayout != null) {
errorCountLayout.GetPixelSize (out ew, out eh);
int errorCounterWidth = ew + 10;
if (editor.Allocation.Width - args.X - editor.TextViewMargin.XOffset <= errorCounterWidth)
return true;
}
return false;
}
示例4: MouseIsOverError
int MouseIsOverError (TextEditor editor, MarginMouseEventArgs args)
{
if (layouts == null)
return -1;
int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
double y = editor.LineToY (lineNumber) - editor.VAdjustment.Value;
double height = editor.LineHeight * errors.Count;
if (!fitsInSameLine)
y += editor.LineHeight;
// Console.WriteLine (lineNumber + ": height={0}, y={1}, args={2}", height, y, args.Y);
if (y > args.Y || args.Y > y + height)
return -1;
int error = (int)((args.Y - y) / editor.LineHeight);
// Console.WriteLine ("error:" + error);
if (error >= layouts.Count)
return -1;
int errorCounterWidth = GetErrorCountBounds ().Item1;
double labelWidth = LayoutWidth + border + (ShowIconsInBubble ? cache.errorPixbuf.Width : 0) + errorCounterWidth + editor.LineHeight / 2;
var layout = editor.TextViewMargin.GetLayout (lineSegment);
var lineTextPx = editor.TextViewMargin.XOffset + editor.TextViewMargin.TextStartPosition + layout.PangoWidth / Pango.Scale.PangoScale;
labelWidth = Math.Min (editor.Allocation.Width - lineTextPx - editor.TextViewMargin.TextStartPosition, labelWidth);
if (editor.Allocation.Width - editor.TextViewMargin.XOffset - labelWidth < args.X)
return error;
return -1;
}
示例5: MouseIsOverMarker
bool MouseIsOverMarker (TextEditor editor, MarginMouseEventArgs args)
{
int lineNumber = editor.Document.OffsetToLineNumber (lineSegment.Offset);
double y = editor.LineToY (lineNumber) - editor.VAdjustment.Value;
if (fitsInSameLine) {
if (args.Y < y + 2 || args.Y > y + editor.LineHeight - 2)
return false;
} else {
if (args.Y < y + editor.LineHeight + 2 || args.Y > y + editor.LineHeight * 2 - 2)
return false;
}
int errorCounterWidth = GetErrorCountBounds ().Item1;
if (errorCounterWidth > 0)
return editor.Allocation.Width - editor.TextViewMargin.XOffset - 2 - errorCounterWidth <= args.X;
return false;
}
示例6: PaintEditorOverlay
void PaintEditorOverlay (TextEditor editor, PaintEventArgs args, List<Mono.TextEditor.Utils.Hunk> diff, bool paintRemoveSide)
{
if (diff == null)
return;
var cr = args.Context;
foreach (var hunk in diff) {
double y1 = editor.LineToY (paintRemoveSide ? hunk.RemoveStart : hunk.InsertStart) - editor.VAdjustment.Value;
double y2 = editor.LineToY (paintRemoveSide ? hunk.RemoveStart + hunk.Removed : hunk.InsertStart + hunk.Inserted) - editor.VAdjustment.Value;
if (y1 == y2)
y2 = y1 + 1;
cr.Rectangle (0, y1, editor.Allocation.Width, y2 - y1);
cr.Color = GetColor (hunk, paintRemoveSide, false, 0.15);
cr.Fill ();
var paths = GetDiffPaths (diff, editors[0], hunk);
cr.Save ();
cr.Translate (-editor.HAdjustment.Value + editor.TextViewMargin.XOffset, -editor.VAdjustment.Value);
foreach (var rect in (paintRemoveSide ? paths.Item1 : paths.Item2)) {
cr.Rectangle (rect);
}
cr.Color = GetColor (hunk, paintRemoveSide, false, 0.3);
cr.Fill ();
cr.Restore ();
cr.Color = GetColor (hunk, paintRemoveSide, true, 0.15);
cr.MoveTo (0, y1);
cr.LineTo (editor.Allocation.Width, y1);
cr.Stroke ();
cr.MoveTo (0, y2);
cr.LineTo (editor.Allocation.Width, y2);
cr.Stroke ();
}
}
示例7:
void IActionTextLineMarker.MouseHover (TextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
{
if (args.Button != 0)
return;
var line = editor.GetLine (loc.Line);
if (line == null)
return;
var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value + editor.TextViewMargin.TextStartPosition;
var y = editor.LineToY (line.LineNumber + 1) - editor.VAdjustment.Value;
if (args.X - x >= 0 * editor.Options.Zoom &&
args.X - x < tagMarkerWidth * editor.Options.Zoom &&
args.Y - y < (editor.LineHeight / 2) * editor.Options.Zoom) {
result.Cursor = null;
Popup ();
} else {
codeActionEditorExtension.CancelSmartTagPopupTimeout ();
}
}
示例8:
void IActionTextLineMarker.MouseHover (TextEditor editor, MarginMouseEventArgs args, TextLineMarkerHoverResult result)
{
if (args.Button != 0)
return;
var line = editor.GetLine (loc.Line);
var x = editor.ColumnToX (line, loc.Column) - editor.HAdjustment.Value;
var y = editor.LineToY (line.LineNumber) - editor.VAdjustment.Value;
if (args.X - x >= 0 * editor.Options.Zoom &&
args.X - x < tagMarkerWidth * editor.Options.Zoom &&
y - args.Y < (tagMarkerHeight) * editor.Options.Zoom) {
Popup ();
}
}