Example #1
0
        // Token: 0x06007CE6 RID: 31974 RVA: 0x002322DC File Offset: 0x002304DC
        private void UpdateGeometry()
        {
            if (this.HighlightAnchor == null || this.HighlightAnchor == null)
            {
                throw new Exception(SR.Get("UndefinedHighlightAnchor"));
            }
            TextAnchor    range              = ((IHighlightRange)this.HighlightAnchor).Range;
            ITextPointer  textPointer        = range.Start.CreatePointer(LogicalDirection.Forward);
            ITextPointer  textPointer2       = range.End.CreatePointer(LogicalDirection.Backward);
            FlowDirection textFlowDirection  = MarkedHighlightComponent.GetTextFlowDirection(textPointer);
            FlowDirection textFlowDirection2 = MarkedHighlightComponent.GetTextFlowDirection(textPointer2);

            this.SetMarkerTransform(this._leftMarker, textPointer, null, (textFlowDirection == FlowDirection.LeftToRight) ? 1 : -1);
            this.SetMarkerTransform(this._rightMarker, textPointer2, textPointer, (textFlowDirection2 == FlowDirection.LeftToRight) ? -1 : 1);
            this.HighlightAnchor.IsDirty = true;
            this.IsDirty = false;
        }
Example #2
0
            // Token: 0x06008E64 RID: 36452 RVA: 0x0025C2B4 File Offset: 0x0025A4B4
            public void Remove(MarkedHighlightComponent component)
            {
                int i = 0;

                while (i < this._components.Count && this._components[i] != component)
                {
                    i++;
                }
                if (i < this._components.Count)
                {
                    this._components.RemoveAt(i);
                    while (i < this._components.Count)
                    {
                        this._components[i].SetTabIndex(i);
                        i++;
                    }
                }
            }
Example #3
0
        // Token: 0x06007CEF RID: 31983 RVA: 0x00232744 File Offset: 0x00230944
        private static void OnMouseMove(object sender, MouseEventArgs args)
        {
            IServiceProvider serviceProvider = sender as IServiceProvider;

            if (serviceProvider == null)
            {
                return;
            }
            ITextView textView = (ITextView)serviceProvider.GetService(typeof(ITextView));

            if (textView == null || !textView.IsValid)
            {
                return;
            }
            Point        position = Mouse.PrimaryDevice.GetPosition(textView.RenderScope);
            ITextPointer textPositionFromPoint = textView.GetTextPositionFromPoint(position, false);

            if (textPositionFromPoint != null)
            {
                MarkedHighlightComponent.CheckAllHighlightRanges(textPositionFromPoint);
            }
        }
Example #4
0
            // Token: 0x06008E63 RID: 36451 RVA: 0x0025C21C File Offset: 0x0025A41C
            public void Add(MarkedHighlightComponent component)
            {
                if (this._components.Count == 0)
                {
                    UIElement host = component.PresentationContext.Host;
                    if (host != null)
                    {
                        KeyboardNavigation.SetTabNavigation(host, KeyboardNavigationMode.Local);
                        KeyboardNavigation.SetControlTabNavigation(host, KeyboardNavigationMode.Local);
                    }
                }
                int i = 0;

                while (i < this._components.Count && this.Compare(this._components[i], component) <= 0)
                {
                    i++;
                }
                this._components.Insert(i, component);
                while (i < this._components.Count)
                {
                    this._components[i].SetTabIndex(i);
                    i++;
                }
            }
            /// <summary>
            /// Removes the component from the list and updates TabIndexes of the
            /// components after removed one.
            /// </summary> 
            /// <param name="component">component to be removed</param>
            public void Remove(MarkedHighlightComponent component) 
            { 
                Debug.Assert(component != null, "component is null");
                Debug.Assert(_components != null, "_components are null"); 

                int ind = 0;
                for (; ind < _components.Count; ind++)
                { 
                    if (_components[ind] == component)
                        break; 
                } 

                if (ind < _components.Count) 
                {
                    _components.RemoveAt(ind);

                    //update TabIndexes 
                    for (; ind < _components.Count; ind++)
                        _components[ind].SetTabIndex(ind); 
                } 
            }
            /// <summary>
            /// Adds the component to the list, sorted by the start point of the attachedAnchor.
            /// Sets its TabIndex and updates the TabIndexes of all components after this one.
            /// </summary> 
            /// <param name="component">Component to be added</param>
            public void Add(MarkedHighlightComponent component) 
            { 
                Debug.Assert(component != null, "component is null");
                Debug.Assert(_components != null, "_components are null"); 

                //if this is the first component set KeyboardNavigation mode of the host
                if (_components.Count == 0)
                { 
                    UIElement host = component.PresentationContext.Host;
                    if (host != null) 
                    { 
                        KeyboardNavigation.SetTabNavigation(host, KeyboardNavigationMode.Local);
                        KeyboardNavigation.SetControlTabNavigation(host, KeyboardNavigationMode.Local); 
                    }
                }

                int i = 0; 
                for (; i < _components.Count; i++)
                { 
                    if (Compare(_components[i], component) > 0) 
                        break;
                } 

                _components.Insert(i, component);

                //update TabStopIndexes 
                for (; i < _components.Count; i++)
                    _components[i].SetTabIndex(i); 
 
            }