use of blue.ui.core.score.undo.StartTimeEdit in project blue by kunstmusik.
the class QuickTimeDialog method handleWindowDeactivated.
private void handleWindowDeactivated() {
if (scoreObj != null) {
try {
double initialStart = scoreObj.getStartTime();
double initialSubjectiveDuration = scoreObj.getSubjectiveDuration();
double newStart = Double.parseDouble(startText.getText());
double newSubjectiveDuration = Double.parseDouble(durText.getText());
BlueUndoManager.setUndoManager("score");
StartTimeEdit edit = null;
if (initialStart != newStart) {
scoreObj.setStartTime(newStart);
edit = new StartTimeEdit(initialStart, newStart, scoreObj);
BlueUndoManager.addEdit(edit);
}
if (initialSubjectiveDuration != newSubjectiveDuration) {
scoreObj.setSubjectiveDuration(newSubjectiveDuration);
ResizeScoreObjectEdit resizeEdit = new ResizeScoreObjectEdit(scoreObj, initialSubjectiveDuration, newSubjectiveDuration);
if (edit != null) {
edit.addEdit(resizeEdit);
} else {
BlueUndoManager.addEdit(resizeEdit);
}
}
} catch (NumberFormatException nfe) {
JOptionPane.showMessageDialog(null, BlueSystem.getString("scoreGUI.quickTimeDialog.notDouble.message"), BlueSystem.getString("scoreGUI.quickTimeDialog.notDouble.title"), JOptionPane.ERROR_MESSAGE);
this.show();
startText.requestFocus();
return;
}
}
hide();
}
use of blue.ui.core.score.undo.StartTimeEdit in project blue by kunstmusik.
the class SoundObjectPropertiesTopComponent method updateStartTime.
protected void updateStartTime() {
double initialStart = sObj.getStartTime();
double newValue;
try {
newValue = Double.parseDouble(startTimeText.getText());
} catch (NumberFormatException nfe) {
startTimeText.setText(Double.toString(initialStart));
return;
}
if (newValue < 0.0f) {
newValue = 0.0f;
startTimeText.setText("0.0");
}
sObj.setStartTime(newValue);
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(new StartTimeEdit(initialStart, newValue, sObj));
}
Aggregations