本文整理汇总了C#中TextEditor类的典型用法代码示例。如果您正苦于以下问题:C# TextEditor类的具体用法?C# TextEditor怎么用?C# TextEditor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextEditor类属于命名空间,在下文中一共展示了TextEditor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Update
//Switches the GUI on and off
//*******************************************************
void Update()
{
if (atWall)
{
if (Input.GetKeyDown("e"))
{
// Screen.lockCursor = false; //Cursor is free to move when user goes into terminal
if (guiEnabled)
{
resume();
}
else
{
StartCoroutine(jackin ());
}
}
}
else
{
//Screen.showCursor = false;
//Screen.lockCursor = true; //Hiding Cursor means redoing the way the crosshair was implemented -Josephs
//Screen.lockCursor = false; //Cursor remains locked if not in terminal
}
editor = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
editor.MoveLineStart();
}
开发者ID:eledezma,项目名称:CodeEscape,代码行数:28,代码来源:Indentation.cs
示例17: CopySettingsFrom
/// <summary>
/// Copies editor options and default element customizations.
/// Does not copy the syntax highlighting.
/// </summary>
public static void CopySettingsFrom(this TextEditor editor, TextEditor source)
{
editor.Options = source.Options;
string language = source.SyntaxHighlighting != null ? source.SyntaxHighlighting.Name : null;
CustomizingHighlighter.ApplyCustomizationsToDefaultElements(editor, CustomizedHighlightingColor.FetchCustomizations(language));
HighlightingOptions.ApplyToRendering(editor, CustomizedHighlightingColor.FetchCustomizations(language));
}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:11,代码来源:Utils.cs
示例18: CopyToClipboard
public static void CopyToClipboard(string str)
{
TextEditor te = new TextEditor();
te.text = str;
te.OnFocus();
te.Copy();
}
开发者ID:Ribosome2,项目名称:UnityTricksAndCodeSpippet,代码行数:7,代码来源:UnityMenuExtension.cs
示例19: BounceFadePopupWindow
public BounceFadePopupWindow (TextEditor 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:yayanyang,项目名称:monodevelop,代码行数:26,代码来源:BounceFadePopupWindow.cs
示例20: CorrectIndentingImplementation
protected override void CorrectIndentingImplementation (PolicyContainer policyParent, TextEditor editor, int line)
{
var lineSegment = editor.GetLine (line);
if (lineSegment == null)
return;
try {
var policy = policyParent.Get<CSharpFormattingPolicy> (MimeType);
var textpolicy = policyParent.Get<TextStylePolicy> (MimeType);
var tracker = new CSharpIndentEngine (policy.CreateOptions (textpolicy));
tracker.Update (IdeApp.Workbench.ActiveDocument.Editor, lineSegment.Offset);
for (int i = lineSegment.Offset; i < lineSegment.Offset + lineSegment.Length; i++) {
tracker.Push (editor.GetCharAt (i));
}
string curIndent = lineSegment.GetIndentation (editor);
int nlwsp = curIndent.Length;
if (!tracker.LineBeganInsideMultiLineComment || (nlwsp < lineSegment.LengthIncludingDelimiter && editor.GetCharAt (lineSegment.Offset + nlwsp) == '*')) {
// Possibly replace the indent
string newIndent = tracker.ThisLineIndent;
if (newIndent != curIndent)
editor.ReplaceText (lineSegment.Offset, nlwsp, newIndent);
}
} catch (Exception e) {
LoggingService.LogError ("Error while indenting", e);
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:29,代码来源:CSharpFormatter.cs
注:本文中的TextEditor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论