Exemple #1
0
 protected override void OnStartup(StartupEventArgs e)
 {
     Kit.WPF.Tools.Init().InitLoggin(AlertAfterCritical: true);
     SQLHelper.SQLHelper.Init(Kit.Tools.Instance.LibraryPath, Debugger.IsAttached);
     Highlighting.Init();
     base.OnStartup(e);
 }
        protected override Action <JetBrains.TextControl.ITextControl> ExecutePsiTransaction(JetBrains.ProjectModel.ISolution solution, JetBrains.Application.Progress.IProgressIndicator progress)
        {
            if (!Highlighting.IsValid())
            {
                return(null);
            }

            var node             = Highlighting.Node;
            var badWordTextRange = Highlighting.Range.TextRange;

            var newText = StringUtil.ReplaceSection(
                node.GetText(),
                Suggestion,
                badWordTextRange.StartOffset - node.GetDocumentRange().TextRange.StartOffset,
                badWordTextRange.Length
                );

            if (node is TreeElement)
            {
                var elementFactory = HtmlElementFactory.GetInstance(node.Language);
                var newElements    = elementFactory.CompileText(newText, node).ToList();
                if (newElements.Count > 0)
                {
                    var recentNode = ModificationUtil.ReplaceChild(node, newElements[0]);
                    for (int i = 1; i < newElements.Count; i++)
                    {
                        recentNode = ModificationUtil.AddChildAfter(recentNode.Parent, recentNode, newElements[i]);
                    }
                }
                return(null);
            }
            return(null);
        }
        internal static void Write(this IConsole console, Highlighting highlighting, object value)
        {
            var fgColor = console.ForegroundColor;
            var bgColor = console.BackgroundColor;

            switch (highlighting)
            {
            case Highlighting.None:
                console.ResetColor();
                break;

            case Highlighting.Emphasize:
                console.ForegroundColor = ConsoleColor.DarkYellow;
                break;

            case Highlighting.Warn:
                console.ForegroundColor = ConsoleColor.Red;
                break;

            default:
                break;
            }

            console.Write(value);
            console.ForegroundColor = fgColor;
            console.BackgroundColor = bgColor;
        }
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.MouseMove"/> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data.</param>
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (!Enabled)
            {
                return;
            }

            // Change cursor if required
            int value = GetValueAt(e.Location);

            Cursor = value == -1 ? Cursors.Arrow : Cursors.Hand;

            HighlightedValue = value;
            if (HighlightedValue >= 0 && HighlightedValue < m_baseValue)
            {
                HighlightedValue = m_baseValue;
            }

            Highlighting?.ThreadSafeInvoke(this, new AttributeHighlightingEventArgs(HighlightedValue));

            // To zero-based value
            HighlightedValue--;

            if (m_highlightedItem == HighlightedValue)
            {
                return;
            }

            ChangeHighlight(HighlightedValue);
        }
Exemple #5
0
    new void Start()
    {
        base.Start();

        instance = this;

        sourceCamera  = GetComponent <Camera>();
        interactables = new List <Interactable>();

        renderTexture = new RenderTexture(sourceCamera.pixelWidth, sourceCamera.pixelHeight, 16, RenderTextureFormat.Default);

        if (occlusionCamera == null)
        {
            GameObject cameraGameObject = new GameObject("Outline Camera");
            cameraGameObject.transform.parent = sourceCamera.transform;
            occlusionCamera         = cameraGameObject.AddComponent <Camera>();
            occlusionCamera.enabled = false;
        }

        UpdateOutlineCameraFromSource();

        occlusionBuffer = new CommandBuffer();
        occlusionCamera.AddCommandBuffer(CameraEvent.BeforeImageEffects, occlusionBuffer);

        sourceBuffer = new CommandBuffer();

        sourceCamera.AddCommandBuffer(CameraEvent.BeforeImageEffects, sourceBuffer);

        outlined = FindObjectsOfType <Outlined>();


        mat = CreateMaterial(highlightingShader, mat);
    }
Exemple #6
0
 protected override void OnStartup(StartupEventArgs e)
 {
     Kit.WPF.Tools.Init();
     Highlighting.Init();
     base.OnStartup(e);
     //var boot = new Bootstrapper();
     //boot.Run();
 }
Exemple #7
0
 internal void Deselect()
 {
     if (_selected)
     {
         Highlighting.Unhighlight(this);
         _selected = false;
     }
 }
Exemple #8
0
 internal void Select()
 {
     if (!_selected)
     {
         Highlighting.Highlight(this);
         _selected = true;
     }
 }
Exemple #9
0
 private void EditCurrentStyle()
 {
     Highlighting.SetColor(styleList.SelectedItem.ToString(),
                           transparentCheckBox.Checked
                                 ? new HighlightColor(textColor.BackColor, boldCheckBox.Checked, italicCheckBox.Checked)
                                 : new HighlightColor(textColor.BackColor, backgroundColor.BackColor, boldCheckBox.Checked, italicCheckBox.Checked));
     editorPreview.Text = editorPreview.Text;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="HighlightingViewModel"/> class.
        /// </summary>
        public HighlightingViewModel()
        {
            highlighting = Session.Instance.Highlighting;
            RefreshColors();

            ExportClickCommand = new RelayCommand(Export);
            ImportClickCommand = new RelayCommand(Import);
            ApplyClickCommand  = new RelayCommand(Apply);
        }
Exemple #11
0
        public Highlight(IExpressionBuilderWindow builder, Highlighting highLighting)
        {
            this.Builder      = builder;
            this.HighLighting = highLighting;

            InitializeComponent();

            this.grid.Children.Add((UIElement)highLighting);
            this.HighLighting.Bind();
        }
Exemple #12
0
        private void Start()
        {
            highlighting = new Highlighting {
                front = false, back = false
            };

            if (!recordSliderData)
            {
                return;
            }

            saveData = new SaveData($"{Application.persistentDataPath}/{Testing.Utils.UniqueYamlName("stylus-output")}", null);
        }
        public void ResetHighlights()
        {
            lock (_providers)
            {
                Highlighting.SafeInvoke(this);

                foreach (var provider in _providers)
                {
                    provider.ResetHighlight();
                }

                Highlighted.SafeInvoke(this);
            }
        }
Exemple #14
0
        public SearchHighlighter(FilePath path, Highlighting.Highlighter highlighter)
        {
            _highlighter = highlighter;
            _path = path;
            _searchController = JadeCore.Services.Provider.SearchController;

            ((INotifyCollectionChanged)_searchController.Searches).CollectionChanged += Searchs_CollectionChanged;
            _ranges = new HashSet<Highlighting.IHighlightedRange>();
            
            if(_searchController.Current != null)
            {
                OnNewSearch(_searchController.Current);
            }
        }
Exemple #15
0
        public void ResetHighlights()
        {
            lock (_providers)
            {
                Highlighting?.Invoke(this, EventArgs.Empty);

                foreach (var provider in _providers)
                {
                    provider.ResetHighlight();
                }

                Highlighted?.Invoke(this, EventArgs.Empty);
            }
        }
Exemple #16
0
        protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            if (!Highlighting.IsValid())
            {
                return(null);
            }

            var node             = Highlighting.Node;
            var badWordTextRange = Highlighting.Range.TextRange;

            var newText = StringUtil.ReplaceSection(
                node.GetText(),
                Suggestion,
                badWordTextRange.StartOffset - node.GetDocumentRange().TextRange.StartOffset,
                badWordTextRange.Length
                );

            if (node is XmlValueToken)
            {
                var newElm = new XmlValueToken(
                    (node as XmlValueToken).GetTokenType(),
                    new StringBuffer(newText),
                    new TreeOffset(0),
                    new TreeOffset(newText.Length)
                    );
                ModificationUtil.ReplaceChild(node, newElm);
                return(null);
            }
            if (node is XmlFloatingTextToken)
            {
                var newElm = new XmlFloatingTextToken(
                    (node as XmlFloatingTextToken).GetTokenType(),
                    newText
                    );
                ModificationUtil.ReplaceChild(node, newElm);
                return(null);
            }
            if (node is XmlToken)
            {
                var newElm = new XmlToken(
                    (node as XmlToken).GetTokenType(),
                    new StringBuffer(newText),
                    new TreeOffset(0),
                    new TreeOffset(newText.Length)
                    );
                ModificationUtil.ReplaceChild(node, newElm);
                return(null);
            }
            return(null);
        }
Exemple #17
0
        public void HighlightSearchables(IEnumerable <object> searchables)
        {
            lock (_providers)
            {
                Highlighting?.Invoke(this, EventArgs.Empty);

                foreach (var searchable in searchables)
                {
                    foreach (var provider in _providers)
                    {
                        provider.HighlightSearchable(searchable);
                    }
                }

                Highlighted?.Invoke(this, EventArgs.Empty);
            }
        }
        public void HighlightSearchables(IEnumerable <object> searchables)
        {
            lock (_providers)
            {
                Highlighting.SafeInvoke(this);

                foreach (var searchable in searchables)
                {
                    foreach (var provider in _providers)
                    {
                        provider.HighlightSearchable(searchable);
                    }
                }

                Highlighted.SafeInvoke(this);
            }
        }
        protected override Action <ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            if (!Highlighting.IsValid())
            {
                return(null);
            }

            var node             = Highlighting.Node;
            var badWordTextRange = Highlighting.Range.TextRange;

            var newText = StringUtil.ReplaceSection(
                node.GetText(),
                Suggestion,
                badWordTextRange.StartOffset - node.GetDocumentRange().TextRange.StartOffset,
                badWordTextRange.Length
                );

            if (node is IIdentifier)
            {
                return(textControl => {
                    var declaredIdentifier = TextControlToPsi.GetDeclaredElements(solution, textControl)
                                             .FirstOrDefault();
                    solution.GetComponent <RenameRefactoringExecutor>().Execute(declaredIdentifier, textControl, newText);
                });
            }
            if (node is IComment)
            {
                var newElement = CreateNode(node, newText);
                ModificationUtil.ReplaceChild(node, newElement);
                return(null);
            }
            if (JavaScriptUtil.IsStringLiteral(node))
            {
                var newElement = CreateNode(node, newText);
                ModificationUtil.ReplaceChild(node, newElement);
                return(null);
            }
            return(null);
        }
Exemple #20
0
 public SegmentHighlighting(int segmentIdentifier, Highlighting highlighting)
     : base(8, 5)
 {
     SegmentIdentifier = segmentIdentifier;
     Highlighting      = highlighting;
 }
Exemple #21
0
		/// <summary>
		/// Begin a highlighted span.
		/// </summary>
		public virtual void BeginSpan(Highlighting.HighlightingColor highlightingColor)
		{
			BeginUnhandledSpan();
		}
Exemple #22
0
 public ASTHighlighter(Cursor topLevelCursor, Highlighting.IHighlighter underliner, string path)
 {
     _underliner = underliner;
     _path = System.IO.Path.GetFullPath(path);
     Highlight(topLevelCursor);
 }
Exemple #23
0
 public IndexHighlighter(Highlighting.Highlighter underliner)
 {
     _underliner = underliner;
 }
 public static string GetPattern(Highlighting highlighting)
 {
     return(regexPatterns.TryGetValue(highlighting, out var patterns) ? string.Join("|", patterns) : null);
 }
Exemple #25
0
 public SegmentHighlighting(CgmFile container, int id, Highlighting value)
     : this(container)
 {
     Identifier = id;
     Value      = value;
 }
 internal static void WriteLine(this IConsole console, Highlighting highlighting, object value)
 {
     Write(console, highlighting, value);
     console.WriteLine();
 }
Exemple #27
0
 public override void ReadFromBinary(IBinaryReader reader)
 {
     Identifier = reader.ReadName();
     Value      = (Highlighting)reader.ReadEnum();
 }
Exemple #28
0
 public DiagnosticHighlighter(Highlighting.Highlighter highlighter)
 {
     _highlighter = highlighter;
 }