Exemplo n.º 1
0
        private void ShowTooltip(string word, Dictionary <string, string> values)
        {
            if (_hoverLastWord != word || _codeTooltip == null)
            {
                if (!_preventCloseTooltip && _codeTooltip != null)
                {
                    _codeTooltip.Close();
                    _codeTooltip = null;
                }
                _codeTooltip      = new frmCodeTooltip(values);
                _codeTooltip.Left = Cursor.Position.X + 10;
                _codeTooltip.Top  = Cursor.Position.Y + 10;
                _codeTooltip.Show(this);
            }
            _codeTooltip.Left = Cursor.Position.X + 10;
            _codeTooltip.Top  = Cursor.Position.Y + 10;

            _preventCloseTooltip = true;
            _hoverLastWord       = word;
        }
Exemplo n.º 2
0
        private void ctrlHexViewer_ByteMouseHover(int address)
        {
            if (address < 0 || !mnuShowLabelInfoOnMouseOver.Checked)
            {
                if (_tooltip != null)
                {
                    _tooltip.Close();
                    _lastLabelTooltip = null;
                }
                return;
            }

            if (_lastTooltipAddress == address)
            {
                return;
            }

            _lastTooltipAddress = address;

            CodeLabel label = null;

            switch (_memoryType)
            {
            case DebugMemoryType.CpuMemory:
                AddressTypeInfo info = new AddressTypeInfo();
                InteropEmu.DebugGetAbsoluteAddressAndType((UInt32)address, ref info);
                if (info.Address >= 0)
                {
                    label = LabelManager.GetLabel((UInt32)info.Address, info.Type);
                }
                if (label == null)
                {
                    label = LabelManager.GetLabel((UInt32)address, AddressType.Register);
                }
                break;

            case DebugMemoryType.InternalRam:
                label = LabelManager.GetLabel((UInt32)address, AddressType.InternalRam);
                break;

            case DebugMemoryType.WorkRam:
                label = LabelManager.GetLabel((UInt32)address, AddressType.WorkRam);
                break;

            case DebugMemoryType.SaveRam:
                label = LabelManager.GetLabel((UInt32)address, AddressType.SaveRam);
                break;

            case DebugMemoryType.PrgRom:
                label = LabelManager.GetLabel((UInt32)address, AddressType.PrgRom);
                break;
            }

            if (label != null)
            {
                if (_lastLabelTooltip != label)
                {
                    if (_tooltip != null)
                    {
                        _tooltip.Close();
                    }

                    Dictionary <string, string> values = new Dictionary <string, string>();
                    if (!string.IsNullOrWhiteSpace(label.Label))
                    {
                        values["Label"] = label.Label;
                    }
                    values["Address"]      = "$" + label.Address.ToString("X4");
                    values["Address Type"] = label.AddressType.ToString();
                    if (!string.IsNullOrWhiteSpace(label.Comment))
                    {
                        values["Comment"] = label.Comment;
                    }
                    _tooltip      = new frmCodeTooltip(values);
                    _tooltip.Left = Cursor.Position.X + 10;
                    _tooltip.Top  = Cursor.Position.Y + 10;
                    _tooltip.Show(this);

                    _lastLabelTooltip = label;
                }
            }
            else
            {
                if (_tooltip != null)
                {
                    _tooltip.Close();
                    _lastLabelTooltip = null;
                }
            }
        }