private void getBoundsManually() { double X0, X1, Y0, Y1, nX0, nX1, nY0, nY1; plotCntrl.getBounds(out X0, out X1, out Y0, out Y1); if (!InputBoxForm.GetDouble("Leftmost x", X0, out nX0)) { return; } if (!InputBoxForm.GetDouble("Rightmost x", X1, out nX1)) { return; } if (!InputBoxForm.GetDouble("Lowest y", Y0, out nY0)) { return; } if (!InputBoxForm.GetDouble("Greatest y", Y1, out nY1)) { return; } if (!(nY1 > nY0 && nX1 > nX0)) { MessageBox.Show("Invalid bounds."); return; } this.plotCntrl.setBounds(nX0, nX1, nY0, nY1); this.plotCntrl.redraw(); }
private void button3_Click(object sender, EventArgs e) { double d = 0.0; if (!InputBoxForm.GetDouble("Enter speed:", 1.0, out d)) { return; } WaveAudio ww = new WaveAudio(PATH_BACKEND_WAV); this.curAudio = Effects.ScalePitchAndDuration(ww, d); this.aplayer.Play(this.curAudio, true); }
private void mnuAdvSetParamRange_Click(object sender, EventArgs e) { double v; double defaultRange = 2.0; if (!InputBoxForm.GetDouble("The trackbars allow c1 to be set to a value between -a to a. Choose value of a:", defaultRange, out v)) { return; } this.paramRange = v * 2.0; //so that 2.0 becomes range of 4 setSliderToValue(plotCntrl.param1, tbParam1, lblParam1); setSliderToValue(plotCntrl.param2, tbParam2, lblParam2); }
private void mnuAdvSetParamRange_Click(object sender, EventArgs e) { double v; double defaultRange = this.paramRange; if (!InputBoxForm.GetDouble("The trackbars allow to be set to a value between 0 and a. Choose value of a:", defaultRange, out v)) { return; } this.paramRange = v; //so that 2.0 becomes range of 4 setSliderToValue(0); setSliderToValue(1); setSliderToValue(2); setSliderToValue(3); }
private bool manSetValue(Label lbl, TrackBar tb, out double v) { double current; if (!double.TryParse(lbl.Text, out current)) { current = 0.0; } v = 0.0; if (!InputBoxForm.GetDouble("Value:", current, out v)) { return(false); } setSliderToValue(v, tb, lbl); return(true); }
private void mnuFileAnimate_Click(object sender, EventArgs e) { double c0_0, c0_1, c1_0, c1_1; int nframes; double param1 = plotCntrl.param1, param2 = plotCntrl.param2; if (!InputBoxForm.GetDouble("Initial c1:", param1, out c0_0)) { return; } if (!InputBoxForm.GetDouble("Final c1:", param1, out c0_1)) { return; } if (!InputBoxForm.GetDouble("Initial c2:", param2, out c1_0)) { return; } if (!InputBoxForm.GetDouble("Final c2:", param2, out c1_1)) { return; } if (!InputBoxForm.GetInt("Number of frames:", 50, out nframes)) { return; } SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.Filter = "png files (*.png)|*.png"; saveFileDialog1.RestoreDirectory = true; if (!(saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK && saveFileDialog1.FileName.Length > 0)) { return; } string sfilename = saveFileDialog1.FileName; double c0_inc = (c0_1 - c0_0) / nframes; double c1_inc = (c1_1 - c1_0) / nframes; for (int i = 0; i < nframes; i++) { plotCntrl.param1 = c0_0; plotCntrl.param2 = c1_0; plotCntrl.renderToDiskSave(400, 400, sfilename.Replace(".png", "_" + i.ToString("000") + ".png")); c0_0 += c0_inc; c1_0 += c1_inc; } }
private bool manSetValue(int i) { Label lbl = this.lblParamLabels[i]; TrackBar tb = this.tbParamTrackBars[i]; double current; if (!double.TryParse(lbl.Text, out current)) { current = 0.0; } double v = 0.0; if (!InputBoxForm.GetDouble("Value:", current, out v)) { return(false); } paramValues[i] = v; setSliderToValue(i); return(true); }