public LinePlotterWin() { InitializeComponent(); channels = 0; linePlotter = null; FormClosing += LinePlotterWin_FormClosing; CanClose = false; timer = new Timer(); timer.Interval = 100; // ms timer.Tick += Timer_Tick; run = true; selectedChannel = -1; timer.Enabled = true; }
public void initLinePlotterWin(LinePlotter _linePlotter, int _channels) { linePlotter = _linePlotter; inputs = new FIFO[_channels]; line = new Line[_channels]; integrationCounter = (int)Math.Floor(0.1 * linePlotter.owner.sampleRate + 0.5); for (int i = 0; i < _channels; i++) { Color col = Color.Red; inputs[i] = new FIFO(linePlotter.owner.sampleRate / 4); switch (i % 4) { case 0: col = Color.Red; break; case 1: col = Color.Green; break; case 2: col = Color.Cyan; break; case 3: col = Color.Magenta; break; } line[i] = new Line(this, 1024, integrationCounter, col); line[i].averager = line[i].averagers[0]; } lpDisplays.Items.Add("1"); lpDisplays.Items.Add("2"); lpDisplays.Items.Add("3"); lpDisplays.Items.Add("4"); lpSelectDisplay.Items.Add("1"); lpSelectDisplay.Items.Add("2"); lpSelectDisplay.Items.Add("3"); lpSelectDisplay.Items.Add("4"); List <String> ls = line[0].averagers; for (int i = 0; i < ls.Count; i++) { LpVertMode.Items.Add(ls[i]); } LpVertMode.SelectedIndex = 0; LpVertMode.SelectedIndexChanged += LpVertMode_SelectedIndexChanged; LpHorzScale.Items.Add("1ms"); LpHorzScale.Items.Add("2ms"); LpHorzScale.Items.Add("5ms"); LpHorzScale.Items.Add("10ms"); LpHorzScale.Items.Add("20ms"); LpHorzScale.Items.Add("50ms"); LpHorzScale.Items.Add("100ms"); LpHorzScale.Items.Add("200ms"); LpHorzScale.Items.Add("500ms"); LpHorzScale.Items.Add("1000ms"); LpHorzScale.SelectedIndex = 6; _integrationTime = 0.1; LpHorzScale.SelectedIndexChanged += LpHorzScale_SelectedIndexChanged; LpHorzScaleP.Click += LpHorzScaleP_Click; LpHorzScaleM.Click += LpHorzScaleM_Click; LpChannelSelectA.Checked = true; LpChannelSelectA.CheckedChanged += LpChannelSelect_CheckedChanged; LpChannelSelectB.CheckedChanged += LpChannelSelect_CheckedChanged; LpChannelSelectC.CheckedChanged += LpChannelSelect_CheckedChanged; LpChannelSelectD.CheckedChanged += LpChannelSelect_CheckedChanged; LpChannelOnA.Checked = line[0].on; LpChannelOnB.Checked = line[1].on; LpChannelOnC.Checked = line[2].on; LpChannelOnD.Checked = line[3].on; lpRun.Checked = run; LpChannelOnA.CheckedChanged += LpChannelOnA_CheckedChanged; LpChannelOnB.CheckedChanged += LpChannelOnB_CheckedChanged; LpChannelOnC.CheckedChanged += LpChannelOnC_CheckedChanged; LpChannelOnD.CheckedChanged += LpChannelOnD_CheckedChanged; LpVertAC.CheckedChanged += LpVertAC_CheckedChanged; VertScalesD = new double[VertScales.Length]; for (int i = 0; i < VertScales.Length; i++) { LpVertScale.Items.Add(VertScales[i]); VertScalesD[i] = Convert.ToDouble(VertScales[i]); } LpVertScale.SelectedIndexChanged += LpVertScale_SelectedIndexChanged; LpVertScaleM.Click += LpVertScaleM_Click; LpVertScaleP.Click += LpVertScaleP_Click; LpVertOfs.ValueChanged += LpVertOfs_ValueChanged; LpVertOfs0.Click += LpVertOfs0_Click; LpVertOfsP.Click += LpVertOfsP_Click; LpVertOfsPP.Click += LpVertOfsPP_Click; LpVertOfsM.Click += LpVertOfsM_Click; LpVertOfsMM.Click += LpVertOfsMM_Click; LpOffsetDCremove.CheckedChanged += LpOffsetDCremove_CheckedChanged; lpAutoScale.Click += LpAutoScale_Click; selectedChannel = 0; updateChannelInfo(); channels = _channels; LpScreen.initLinePlotterScreen(this, channels, line); lpDisplays.SelectedIndex = LpScreen.useGrids - 1; lpScaleYMin.Value = Convert.ToDecimal(LpScreen.gridY[0].min); lpScaleYMax.Value = Convert.ToDecimal(LpScreen.gridY[0].max); lpDisplays.SelectedIndexChanged += LpDisplays_SelectedIndexChanged; lpSelectDisplay.SelectedIndexChanged += LpSelectDisplay_SelectedIndexChanged; lpScaleYMin.ValueChanged += LpScaleYMin_ValueChanged; lpScaleYMax.ValueChanged += LpScaleYMax_ValueChanged; lpAutoScaleY.CheckedChanged += LpAutoScaleY_CheckedChanged; }