예제 #1
0
 private void ctrlCodeViewer_ScrollPositionChanged(object sender, EventArgs e)
 {
     if (_codeTooltip != null)
     {
         _codeTooltip.Close();
         _codeTooltip = null;
     }
 }
예제 #2
0
 private void ctrlCodeViewer_MouseLeave(object sender, EventArgs e)
 {
     if (_codeTooltip != null)
     {
         _codeTooltip.Close();
         _codeTooltip = null;
     }
 }
예제 #3
0
        private void ctrlCodeViewer_MouseDown(object sender, MouseEventArgs e)
        {
            if (_codeTooltip != null)
            {
                _codeTooltip.Close();
                _codeTooltip = null;
            }

            int address = ctrlCodeViewer.GetLineNumberAtPosition(e.Y);

            _lineBreakpoint = BreakpointManager.GetMatchingBreakpoint(address);

            if (e.Button == MouseButtons.Left && e.Location.X < this.ctrlCodeViewer.CodeMargin / 4)
            {
                BreakpointManager.ToggleBreakpoint(address, false);
            }
        }
예제 #4
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;
        }
예제 #5
0
        private void ctrlHexViewer_ByteMouseHover(int address, Point position)
        {
            if (address < 0 || !mnuShowLabelInfoOnMouseOver.Checked)
            {
                if (_tooltip != null)
                {
                    _tooltip.Close();
                    _lastLabelTooltip   = null;
                    _lastTooltipAddress = -1;
                }
                return;
            }

            if (_lastTooltipAddress == address)
            {
                return;
            }

            _lastTooltipAddress = address;

            CodeLabel label = null;

            switch (_memoryType)
            {
            case DebugMemoryType.CpuMemory:
                AddressTypeInfo info = new AddressTypeInfo();
                InteropEmu.DebugGetAbsoluteAddressAndType((UInt32)address, 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(this, values);
                    _tooltip.FormClosed += (s, evt) => { _tooltip = null; };
                    _tooltip.SetFormLocation(new Point(position.X, position.Y), ctrlHexViewer);
                    _lastLabelTooltip = label;
                }
            }
            else
            {
                if (_tooltip != null)
                {
                    _tooltip.Close();
                    _lastLabelTooltip   = null;
                    _lastTooltipAddress = -1;
                }
            }
        }
예제 #6
0
        private void ctrlCodeViewer_MouseMove(object sender, MouseEventArgs e)
        {
            //Always enable to allow F2 shortcut
            mnuEditLabel.Enabled = true;

            if (e.Location.X < this.ctrlCodeViewer.CodeMargin / 4)
            {
                this.ctrlCodeViewer.ContextMenuStrip = contextMenuMargin;
            }
            else
            {
                this.ctrlCodeViewer.ContextMenuStrip = contextMenuCode;
            }

            if (_previousLocation != e.Location)
            {
                if (!_preventCloseTooltip && _codeTooltip != null)
                {
                    _codeTooltip.Close();
                    _codeTooltip = null;
                }
                _preventCloseTooltip = false;

                string word = GetWordUnderLocation(e.Location);
                if (word.StartsWith("$"))
                {
                    try {
                        UInt32 address = UInt32.Parse(word.Substring(1), System.Globalization.NumberStyles.AllowHexSpecifier);

                        AddressTypeInfo info = new AddressTypeInfo();
                        InteropEmu.DebugGetAbsoluteAddressAndType(address, ref info);

                        if (info.Address >= 0)
                        {
                            CodeLabel label = LabelManager.GetLabel((UInt32)info.Address, info.Type);
                            if (label == null)
                            {
                                DisplayAddressTooltip(word, address);
                            }
                            else
                            {
                                DisplayLabelTooltip(word, label);
                            }
                        }
                        else
                        {
                            DisplayAddressTooltip(word, address);
                        }
                    } catch { }
                }
                else
                {
                    CodeLabel label = LabelManager.GetLabel(word);

                    if (label != null)
                    {
                        DisplayLabelTooltip(word, label);
                    }
                }
                _previousLocation = e.Location;
            }
        }