1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Threading.Tasks;
9 using System.Windows.Forms;
10 using Mesen.GUI.Config;
11 
12 namespace Mesen.GUI.Debugger.Controls
13 {
14 	public partial class ctrlScanlineCycleSelect : UserControl
15 	{
16 		private int _ppuViewerId = 0;
17 		private int _scanline = 241;
18 		private int _cycle = 0;
19 
20 		public int Scanline { get { return _scanline; } }
21 		public int Cycle { get { return _cycle; } }
22 
ctrlScanlineCycleSelect()23 		public ctrlScanlineCycleSelect()
24 		{
25 			InitializeComponent();
26 		}
27 
Initialize(int ppuViewerId, int scanline, int cycle)28 		public void Initialize(int ppuViewerId, int scanline, int cycle)
29 		{
30 			_ppuViewerId = ppuViewerId;
31 			_scanline = scanline;
32 			_cycle = cycle;
33 
34 			this.nudScanline.Value = _scanline;
35 			this.nudCycle.Value = _cycle;
36 
37 			InteropEmu.DebugSetPpuViewerScanlineCycle(_ppuViewerId, _scanline, _cycle);
38 		}
39 
RefreshSettings()40 		public void RefreshSettings()
41 		{
42 			InteropEmu.DebugSetPpuViewerScanlineCycle(_ppuViewerId, _scanline, _cycle);
43 		}
44 
SetUpdateScanlineCycle(int scanline, int cycle)45 		private void SetUpdateScanlineCycle(int scanline, int cycle)
46 		{
47 			_scanline = scanline;
48 			_cycle = cycle;
49 			RefreshSettings();
50 		}
51 
nudScanlineCycle_ValueChanged(object sender, EventArgs e)52 		private void nudScanlineCycle_ValueChanged(object sender, EventArgs e)
53 		{
54 			SetUpdateScanlineCycle((int)this.nudScanline.Value, (int)this.nudCycle.Value);
55 		}
56 
btnReset_Click(object sender, EventArgs e)57 		private void btnReset_Click(object sender, EventArgs e)
58 		{
59 			this.nudScanline.Value = 241;
60 			this.nudCycle.Value = 0;
61 		}
62 	}
63 }
64