本文整理汇总了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);
}
示例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 ();
}
示例3: CopyText
public void CopyText()
{
TextEditor te = new TextEditor();
te.content = new GUIContent(ToCSV());
te.SelectAll();
te.Copy();
}
示例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;
}
示例5: copyText
public void copyText()
{
TextEditor text = new TextEditor();
text.content = new GUIContent(custom.exportSong());
text.SelectAll();
text.Copy();
}
示例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 ();
}
示例7: FoldMarkerMargin
public FoldMarkerMargin (TextEditor editor)
{
this.editor = editor;
layout = PangoUtil.CreateLayout (editor);
editor.Caret.PositionChanged += HandleEditorCaretPositionChanged;
editor.Document.FoldTreeUpdated += HandleEditorDocumentFoldTreeUpdated;
}
示例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;*/
}
示例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);
}
示例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;
}
示例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 ();
}
}
示例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;
}
示例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;
}
示例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);
}
示例15: CopyToClipBoard
public void CopyToClipBoard()
{
TextEditor te = new TextEditor();
te.text = seedValue.Seed;
te.SelectAll();
te.Copy();
}