Beispiel #1
0
 public TextView(ITextViewDocument document, ITextViewAppearance appearance, ITextViewAdornments adornments)
 {
     _appearance = appearance;
     _adornments = adornments;
     _document = document;
     _selection = new Selection(document.Caret);
     _document.Caret.Moved += EnsureCursorIsVisible;
 }
        public CodeViewCompletion(CodeView codeView, ITextView textView)
        {
            _codeView = codeView;
            _textView = textView;
            _document = textView.Document;
            _enabled = new BoolSetting("CompletionEnabled", false, textView.Settings);

            _document.Buffer.Changed += OnBufferChanged;
            _textView.TextViewEvent += OnTextViewEvent;
        }
Beispiel #3
0
        public CodeViewCompletion(CodeView codeView, ITextView textView)
        {
            _codeView = codeView;
            _textView = textView;
            _document = textView.Document;
            _enabled  = new BoolSetting("CompletionEnabled", false, textView.Settings);

            _document.Buffer.Changed += OnBufferChanged;
            _textView.TextViewEvent  += OnTextViewEvent;
        }
Beispiel #4
0
 public CodeView(CodeEditorWindow owner, ITextView textView)
 {
     m_Owner = owner;
     _textView = textView;
     _document = _textView.Document;
     var textFont = _textView.Appearance.Text.font;
     _font = textFont ? textFont : GUI.skin.font;
     _navigator = new DefaultTextStructureNavigator();
     Caret.Moved += EnsureCursorIsVisible;
     _textView.DoubleClicked = DoubleClickedDocument;
 }
		public CodeView(EditorWindow owner, ITextView textView)
		{
			m_Owner = owner;
			_textView = textView;
			_document = _textView.Document;
			var textFont = _textView.Appearance.Text.font;
			_font = textFont ? textFont : GUI.skin.font;
			_navigator = new DefaultTextStructureNavigator();
			_completion = new CodeViewCompletion(this, _textView);

			Caret.Moved += OnCaretMoved;
			_textView.Clicked = OnTextViewClicked;
		}
Beispiel #6
0
        public CodeView(EditorWindow owner, ITextView textView)
        {
            m_Owner   = owner;
            _textView = textView;
            _document = _textView.Document;
            var textFont = _textView.Appearance.Text.font;

            _font       = textFont ? textFont : GUI.skin.font;
            _navigator  = new DefaultTextStructureNavigator();
            _completion = new CodeViewCompletion(this, _textView);

            Caret.Moved      += OnCaretMoved;
            _textView.Clicked = OnTextViewClicked;
        }
		public ITextViewAppearance AppearanceFor(ITextViewDocument document, IFontManager fontManager)
		{
			GUISkin skin = UnityEditorCompositionContainer.GetExportedValue<IGUISkinProvider>().GetGUISkin();

			// Make a copy of guistyle to ensure we do not change the guistyle of the skin
			GUIStyle textStyle = new GUIStyle(skin.label)
			{
				richText = true,
				alignment = TextAnchor.UpperLeft,
				padding = { left = 0, right = 0 }
			};
			textStyle.normal.textColor = Color.white;

			GUIStyle backgroundStyle = skin.GetStyle("InnerShadowBg");
			Color lineNumberColor = new Color(1, 1, 1, 0.5f);
			Color selectionColor = new Color(80 / 255f, 80 / 255f, 80 / 255f, 1f);
			return new TextViewAppearance(fontManager, textStyle, backgroundStyle, lineNumberColor, selectionColor);
		}
        public ITextViewAppearance AppearanceFor(ITextViewDocument document, IFontManager fontManager)
        {
            GUISkin skin = UnityEditorCompositionContainer.GetExportedValue <IGUISkinProvider>().GetGUISkin();

            // Make a copy of guistyle to ensure we do not change the guistyle of the skin
            GUIStyle textStyle = new GUIStyle(skin.label)
            {
                richText  = true,
                alignment = TextAnchor.UpperLeft,
                padding   = { left = 0, right = 0 }
            };

            textStyle.normal.textColor = Color.white;

            GUIStyle backgroundStyle = skin.GetStyle("InnerShadowBg");
            Color    lineNumberColor = new Color(1, 1, 1, 0.5f);
            Color    selectionColor  = new Color(80 / 255f, 80 / 255f, 80 / 255f, 1f);

            return(new TextViewAppearance(fontManager, textStyle, backgroundStyle, lineNumberColor, selectionColor));
        }
Beispiel #9
0
 public TextView(
     ITextViewDocument document,
     ITextViewAppearance appearance,
     ITextViewAdornments adornments,
     IMouseCursors mouseCursors,
     IMouseCursorRegions mouseCursorRegions,
     ITextViewWhitespace whitespace,
     ISettings settings,
     IFontManager fontManager)
 {
     _appearance            = appearance;
     _adornments            = adornments;
     _document              = document;
     _mouseCursors          = mouseCursors;
     _mouseCursorsRegions   = mouseCursorRegions;
     _whitespace            = whitespace;
     _settings              = settings;
     _fontManager           = fontManager;
     _selection             = new Selection(document.Caret);
     _document.Caret.Moved += EnsureCursorIsVisible;
 }
		public TextView(
			ITextViewDocument document,
			ITextViewAppearance appearance,
			ITextViewAdornments adornments,
			IMouseCursors mouseCursors,
			IMouseCursorRegions mouseCursorRegions,
			ITextViewWhitespace whitespace,
			ISettings settings, 
			IFontManager fontManager)
		{
			_appearance = appearance;
			_adornments = adornments;
			_document = document;
			_mouseCursors = mouseCursors;
			_mouseCursorsRegions = mouseCursorRegions;
			_whitespace = whitespace;
			_settings = settings;
			_fontManager = fontManager;
			_selection = new Selection(document.Caret);
			_document.Caret.Moved += EnsureCursorIsVisible;
		}
 public static void AppendLine(this ITextViewDocument document, string text)
 {
     document.Append(text + "\n");
 }
Beispiel #12
0
 private ITextViewAppearance AppearanceFor(ITextViewDocument document, IFontManager fontManager)
 {
     return(AppearanceProvider.AppearanceFor(document, fontManager));
 }
 public ITextViewAppearance AppearanceFor(ITextViewDocument document)
 {
     return(new TextViewAppearance());
 }
 public ITextViewAppearance AppearanceFor(ITextViewDocument document)
 {
     return new TextViewAppearance();
 }
		public void SetUp()
		{
			_document = TextViewDocumentFor("\nfunction Update() {\tprint('foo'); }");
		}
 public static ITextViewLine LastLine(this ITextViewDocument document)
 {
     return(document.Line(document.LastLineIndex()));
 }
 public static int LastLineIndex(this ITextViewDocument document)
 {
     return(document.LineCount - 1);
 }
 public static void DeleteLine(this ITextViewDocument document, int lineNumber)
 {
     document.Delete(document.Buffer.CurrentSnapshot.Lines[lineNumber].ExtentIncludingLineBreak.Span);
 }
 public static void Delete(this ITextViewDocument document, Span span)
 {
     document.Buffer.Delete(span.Start, span.Length);
 }
 public static void Insert(this ITextViewDocument document, int start, string text)
 {
     document.Buffer.Insert(start, text);
 }
		private ITextViewAppearance AppearanceFor(ITextViewDocument document, IFontManager fontManager)
		{
			return AppearanceProvider.AppearanceFor(document, fontManager);
		}
 public static void Append(this ITextViewDocument document, string text)
 {
     document.Buffer.Append(text);
 }
 public static void Delete(this ITextViewDocument document, int start, int length)
 {
     document.Buffer.Delete(start, length);
 }
Beispiel #24
0
 public void SetUp()
 {
     _document = TextViewDocumentFor("\nfunction Update() {\tprint('foo'); }");
 }