public static ALanguageCtrlKeyState Instance(ITextView view) { if (!view.Properties.TryGetProperty(nameof(ALanguageCtrlKeyState), out ALanguageCtrlKeyState state)) { state = new ALanguageCtrlKeyState(); view.Properties.AddProperty(nameof(ALanguageCtrlKeyState), state); } return(state); }
public KeyProcessor GetAssociatedProcessor(IWpfTextView view) { if (!view.Properties.TryGetProperty(nameof(ALanguageGoToDefKeyProcessor), out ALanguageGoToDefKeyProcessor processor)) { processor = new ALanguageGoToDefKeyProcessor(ALanguageCtrlKeyState.Instance(view)); view.Properties.AddProperty(nameof(ALanguageGoToDefKeyProcessor), processor); } return(processor); }
public ALanguageGoToDefinitionMouseHandler(IWpfTextView view) { m_view = view; m_state = ALanguageCtrlKeyState.Instance(view); m_state.CtrlKeyStateChanged += (sender, args) => { if (m_state.Enabled) { this.TryHighlightItemUnderMouse(RelativeToView(Mouse.PrimaryDevice.GetPosition(m_view.VisualElement))); } else { this.TryHighlightItemUnderMouse(null); } }; // Some other points to clear the highlight span. m_view.LostAggregateFocus += (sender, args) => this.TryHighlightItemUnderMouse(null); m_view.VisualElement.MouseLeave += (sender, args) => this.TryHighlightItemUnderMouse(null); }
public ALanguageGoToDefKeyProcessor(ALanguageCtrlKeyState state) { m_state = state; }