Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (DesignMode)
            {
                return;
            }

            InitShortcuts();

            SpriteViewerConfig config = ConfigManager.Config.Debug.SpriteViewer;

            RestoreLocation(config.WindowLocation, config.WindowSize);

            _refreshManager                      = new WindowRefreshManager(this);
            _refreshManager.AutoRefresh          = config.AutoRefresh;
            _refreshManager.AutoRefreshSpeed     = config.AutoRefreshSpeed;
            mnuAutoRefreshLow.Click             += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Low;
            mnuAutoRefreshNormal.Click          += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Normal;
            mnuAutoRefreshHigh.Click            += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.High;
            mnuAutoRefreshSpeed.DropDownOpening += (s, evt) => UpdateRefreshSpeedMenu();

            mnuAutoRefresh.Checked              = config.AutoRefresh;
            ctrlImagePanel.ImageScale           = config.ImageScale;
            ctrlSplitContainer.SplitterDistance = config.SplitterDistance;
            ctrlScanlineCycleSelect.Initialize(config.RefreshScanline, config.RefreshCycle);
            ctrlSpriteList.HideOffscreenSprites = config.HideOffscreenSprites;

            RefreshData();
            RefreshViewer();
        }
Esempio n. 2
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            base.OnFormClosed(e);
            _notifListener?.Dispose();

            SpriteViewerConfig config = ConfigManager.Config.Debug.SpriteViewer;

            config.WindowSize           = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size;
            config.WindowLocation       = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location;
            config.AutoRefresh          = mnuAutoRefresh.Checked;
            config.HideOffscreenSprites = ctrlSpriteList.HideOffscreenSprites;
            config.RefreshScanline      = ctrlScanlineCycleSelect.Scanline;
            config.RefreshCycle         = ctrlScanlineCycleSelect.Cycle;
            config.ImageScale           = ctrlImagePanel.ImageScale;
            config.SplitterDistance     = ctrlSplitContainer.SplitterDistance;
            ConfigManager.ApplyChanges();
        }
Esempio n. 3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (DesignMode)
            {
                return;
            }

            _notifListener = new NotificationListener();
            _notifListener.OnNotification += OnNotificationReceived;

            _previewData             = new byte[256 * 240 * 4];
            _previewImage            = new Bitmap(256, 240, PixelFormat.Format32bppArgb);
            ctrlImagePanel.ImageSize = new Size(256, 240);
            ctrlImagePanel.Image     = _previewImage;

            InitShortcuts();

            SpriteViewerConfig config = ConfigManager.Config.Debug.SpriteViewer;

            if (!config.WindowSize.IsEmpty)
            {
                this.StartPosition = FormStartPosition.Manual;
                this.Size          = config.WindowSize;
                this.Location      = config.WindowLocation;
            }

            mnuAutoRefresh.Checked              = config.AutoRefresh;
            ctrlImagePanel.ImageScale           = config.ImageScale;
            ctrlSplitContainer.SplitterDistance = config.SplitterDistance;
            ctrlScanlineCycleSelect.Initialize(config.RefreshScanline, config.RefreshCycle);
            ctrlSpriteList.HideOffscreenSprites = config.HideOffscreenSprites;

            RefreshData();
            RefreshViewer();
        }