Ejemplo n.º 1
0
        private void ToggleZoom()
        {
            ICompactControl ctrl = ctrlEventViewerPpuView;

            if (!_isZoomed)
            {
                Size pictureSize = ctrl.GetCompactSize(false);
                ctrl.ScaleImage(2);
                _isZoomed = true;
            }
            else
            {
                Size pictureSize = ctrl.GetCompactSize(false);
                Size halfSize    = new Size(pictureSize.Width / 2, pictureSize.Height / 2);
                ctrl.ScaleImage(0.5);
                _isZoomed = false;
            }
            chkToggleZoom.Checked = _isZoomed;
            RefreshViewer();
        }
Ejemplo n.º 2
0
        private void ToggleZoom()
        {
            ICompactControl ctrl = null;

            if (_selectedTab == tpgChrViewer)
            {
                ctrl = ctrlChrViewer;
            }
            else if (_selectedTab == tpgPaletteViewer)
            {
                ctrl = ctrlPaletteViewer;
            }
            else if (_selectedTab == tpgSpriteViewer)
            {
                ctrl = ctrlSpriteViewer;
            }
            else if (_selectedTab == tpgNametableViewer)
            {
                ctrl = ctrlNametableViewer;
            }

            if (!_isZoomed)
            {
                Size pictureSize = ctrl.GetCompactSize(false);
                this.Size     += pictureSize;
                _originalSize += pictureSize;
                ctrl.ScaleImage(2);
                _isZoomed = true;
            }
            else
            {
                Size pictureSize = ctrl.GetCompactSize(false);
                Size halfSize    = new Size(pictureSize.Width / 2, pictureSize.Height / 2);
                this.Size     -= halfSize;
                _originalSize -= halfSize;
                ctrl.ScaleImage(0.5);
                _isZoomed = false;
            }
            chkToggleZoom.Checked = _isZoomed;
        }
Ejemplo n.º 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;
        }