public void ShowTooltip(string word, Dictionary <string, string> values, int lineAddress, AddressTypeInfo previewAddress) { if (ConfigManager.Config.DebugInfo.OnlyShowTooltipsOnShift && Control.ModifierKeys != Keys.Shift) { return; } Form parentForm = _owner.FindForm(); if (_hoverLastWord != word || _hoverLastLineAddress != lineAddress || _codeTooltip == null) { if (_codeTooltip != null) { _codeTooltip.Close(); _codeTooltip = null; } if (ConfigManager.Config.DebugInfo.ShowOpCodeTooltips && frmOpCodeTooltip.IsOpCode(word)) { _codeTooltip = new frmOpCodeTooltip(parentForm, word, lineAddress); } else { _codeTooltip = new frmCodeTooltip(parentForm, values, previewAddress != null && previewAddress.Type == AddressType.PrgRom ? previewAddress : null, Code, SymbolProvider); } _codeTooltip.FormClosed += (s, e) => { _codeTooltip = null; }; } _codeTooltip.SetFormLocation(new Point(Cursor.Position.X + 10, Cursor.Position.Y + 10), _owner); _hoverLastWord = word; _hoverLastLineAddress = lineAddress; }
public void Close() { if (_codeTooltip != null) { bool restoreFocus = _codeTooltip.NeedRestoreFocus; _codeTooltip.Close(); if (restoreFocus) { _owner.Focus(); } _codeTooltip = null; } }