private void updateStatus() { this.ui.setDataPointClockText(m_point.getBase().getX() + ""); this.ui.setDataPointValueText(m_point.getBase().getY() + ""); this.ui.setLeftClockText(((int)(m_point.getBase().getX() + m_point.controlLeft.getX())) + ""); this.ui.setLeftValueText(((int)(m_point.getBase().getY() + m_point.controlLeft.getY())) + ""); this.ui.setRightClockText(((int)(m_point.getBase().getX() + m_point.controlRight.getX())) + ""); this.ui.setRightValueText(((int)(m_point.getBase().getY() + m_point.controlRight.getY())) + ""); bool smooth = (m_point.getControlLeftType() != BezierControlType.None) || (m_point.getControlRightType() != BezierControlType.None); this.ui.setEnableSmoothSelected(smooth); this.ui.setLeftButtonEnabled(smooth); this.ui.setRightButtonEnabled(smooth); m_min = m_curve_type.getMinimum(); m_max = m_curve_type.getMaximum(); }
private void applyValue(bool mode_clock) { if (!m_changed) { return; } int value = m_curve.getDefault(); try { value = int.Parse(txtDataPointValue.Text); } catch (Exception ex) { Logger.write(typeof(FormCurvePointEdit) + ".applyValue; ex=" + ex + "\n"); return; } if (value < m_curve.getMinimum()) { value = m_curve.getMinimum(); } else if (m_curve.getMaximum() < value) { value = m_curve.getMaximum(); } int clock = 0; try { clock = int.Parse(txtDataPointClock.Text); } catch (Exception ex) { Logger.write(typeof(FormCurvePointEdit) + ".applyValue; ex=" + ex + "\n"); return; } int selected = AppManager.getSelected(); VsqTrack vsq_track = AppManager.getVsqFile().Track[selected]; VsqBPList src = vsq_track.getCurve(m_curve.getName()); VsqBPList list = (VsqBPList)src.clone(); VsqBPPairSearchContext context = list.findElement(m_editing_id); list.move(context.clock, clock, value); CadenciiCommand run = new CadenciiCommand(VsqCommand.generateCommandTrackCurveReplace(selected, m_curve.getName(), list)); EditedZone zone = new EditedZone(); Utility.compareList(zone, new VsqBPListComparisonContext(list, src)); List <EditedZoneUnit> zoneUnits = new List <EditedZoneUnit>(); foreach (var item in zone.iterator()) { zoneUnits.Add(item); } AppManager.editHistory.register(AppManager.getVsqFile().executeCommand(run)); txtDataPointClock.Text = clock + ""; txtDataPointValue.Text = value + ""; if (mMainWindow != null) { mMainWindow.setEdited(true); mMainWindow.ensureVisible(clock); mMainWindow.refreshScreen(); } if (mode_clock) { txtDataPointClock.SelectAll(); } else { txtDataPointValue.SelectAll(); } btnUndo.Enabled = AppManager.editHistory.hasUndoHistory(); btnRedo.Enabled = AppManager.editHistory.hasRedoHistory(); m_changed = false; }