Exemple #1
0
        public static frmPpuViewer OpenPpuViewer(PpuViewerMode mode)
        {
            frmPpuViewer frm = new frmPpuViewer(mode);

            frm.Icon = Properties.Resources.Video;
            _openedWindows.Add(frm);
            frm.FormClosed += Debugger_FormClosed;
            frm.Show();
            return(frm);
        }
Exemple #2
0
        public frmPpuViewer(PpuViewerMode mode = PpuViewerMode.Combined)
        {
            InitializeComponent();

            _ppuViewerId = GetNextPpuViewerId();
            _mode        = mode;

            if (Program.IsMono)
            {
                btnToggleView.Top -= 1;
                chkToggleZoom.Top -= 1;
            }

            this._selectedTab                      = this.tpgNametableViewer;
            this.mnuAutoRefresh.Checked            = ConfigManager.Config.DebugInfo.PpuAutoRefresh;
            this.mnuRefreshOnBreak.Checked         = ConfigManager.Config.DebugInfo.PpuRefreshOnBreak;
            this.mnuShowInformationOverlay.Checked = ConfigManager.Config.DebugInfo.PpuShowInformationOverlay;
            this.ctrlNametableViewer.Connect(this.ctrlChrViewer);

            Point?startupLocation;

            switch (_mode)
            {
            case PpuViewerMode.NametableViewer: startupLocation = ConfigManager.Config.DebugInfo.PpuNametableViewerLocation; break;

            case PpuViewerMode.ChrViewer: startupLocation = ConfigManager.Config.DebugInfo.PpuChrViewerLocation; break;

            case PpuViewerMode.SpriteViewer: startupLocation = ConfigManager.Config.DebugInfo.PpuSpriteViewerLocation; break;

            case PpuViewerMode.PaletteViewer: startupLocation = ConfigManager.Config.DebugInfo.PpuPaletteViewerLocation; break;

            default: startupLocation = ConfigManager.Config.DebugInfo.PpuWindowLocation; break;
            }

            if (startupLocation.HasValue)
            {
                this.StartPosition = FormStartPosition.Manual;
                this.Location      = startupLocation.Value;
            }
        }
Exemple #3
0
        private void ToggleCompactMode(PpuViewerMode mode, ICompactControl control, TabPage tab, string title)
        {
            if (!_isCompact)
            {
                Point tabTopLeft        = tabMain.PointToScreen(Point.Empty);
                Point tabContentTopLeft = tab.PointToScreen(Point.Empty);

                int heightGap = tabContentTopLeft.Y - tabTopLeft.Y + ctrlScanlineCycle.Height;

                _isCompact    = true;
                _originalSize = this.Size;
                Size size       = control.GetCompactSize(true);
                int  widthDiff  = ((Control)control).Width - size.Width;
                int  heightDiff = ((Control)control).Height - size.Height;

                this.Controls.Add((Control)control);
                ((Control)control).BringToFront();

                tabMain.Visible           = false;
                ctrlScanlineCycle.Visible = false;
                this.Text = title;

                this.Size = new Size(this.Width - widthDiff, this.Height - heightDiff - heightGap + 3);
            }
            else
            {
                _mode           = PpuViewerMode.Combined;
                _isCompact      = false;
                this.Size       = _originalSize;
                tabMain.Visible = true;
                tab.Controls.Add((Control)control);
                ctrlScanlineCycle.Visible = true;
                this.Text = "PPU Viewer";
            }

            btnToggleView.Image = _isCompact ? Properties.Resources.Expand : Properties.Resources.Collapse;
        }