Exemple #1
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            _notifListener?.Dispose();

            TilemapViewerConfig config = ConfigManager.Config.Debug.TilemapViewer;

            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.ShowTileGrid      = chkShowTileGrid.Checked;
            config.ShowScrollOverlay = chkShowScrollOverlay.Checked;
            config.RefreshScanline   = ctrlScanlineCycleSelect.Scanline;
            config.RefreshCycle      = ctrlScanlineCycleSelect.Cycle;
            config.ImageScale        = ctrlImagePanel.ImageScale;
            ConfigManager.ApplyChanges();
            base.OnFormClosed(e);
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (DesignMode)
            {
                return;
            }

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

            _tilemapData         = new byte[1024 * 1024 * 4];
            _tilemapImage        = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb);
            ctrlImagePanel.Image = _tilemapImage;

            InitShortcuts();

            TilemapViewerConfig config = ConfigManager.Config.Debug.TilemapViewer;

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

            mnuAutoRefresh.Checked       = config.AutoRefresh;
            chkShowTileGrid.Checked      = config.ShowTileGrid;
            chkShowScrollOverlay.Checked = config.ShowScrollOverlay;
            ctrlImagePanel.ImageScale    = config.ImageScale;
            ctrlScanlineCycleSelect.Initialize(config.RefreshScanline, config.RefreshCycle);

            _autoRefresh = config.AutoRefresh;

            _options.BgMode = 0;

            RefreshData();
            RefreshViewer();
        }
Exemple #3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            if (DesignMode)
            {
                return;
            }

            _tilemapData         = new byte[1024 * 1024 * 4];
            _tilemapImage        = new Bitmap(1024, 1024, PixelFormat.Format32bppPArgb);
            ctrlImagePanel.Image = _tilemapImage;

            InitShortcuts();

            TilemapViewerConfig config = ConfigManager.Config.Debug.TilemapViewer;

            RestoreLocation(config.WindowLocation, config.WindowSize);

            mnuAutoRefresh.Checked       = config.AutoRefresh;
            chkShowTileGrid.Checked      = config.ShowTileGrid;
            chkShowScrollOverlay.Checked = config.ShowScrollOverlay;
            ctrlImagePanel.ImageScale    = config.ImageScale;
            ctrlScanlineCycleSelect.Initialize(config.RefreshScanline, config.RefreshCycle);

            _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();

            RefreshData();
            RefreshViewer();
        }