use of blue.ui.core.score.undo.ResizeScoreObjectEdit 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.ResizeScoreObjectEdit in project blue by kunstmusik.
the class SetSubjectiveToObjectiveTimeAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
if (soundObjects.size() > 0 && scoreObjects.size() == soundObjects.size()) {
ResizeScoreObjectEdit top = null;
for (SoundObject soundObject : soundObjects) {
if (soundObject.getObjectiveDuration() <= 0) {
JOptionPane.showMessageDialog(null, BlueSystem.getString("soundObjectPopup.setTime.error.text"), BlueSystem.getString("soundObjectPopup.setTime.error.title"), JOptionPane.ERROR_MESSAGE);
return;
}
double oldTime = soundObject.getSubjectiveDuration();
double newTime = soundObject.getObjectiveDuration();
if (oldTime != newTime) {
soundObject.setSubjectiveDuration(newTime);
ResizeScoreObjectEdit edit = new ResizeScoreObjectEdit(soundObject, oldTime, newTime);
if (top == null) {
top = edit;
} else {
top.addEdit(edit);
}
}
}
if (top != null) {
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(top);
}
}
}
use of blue.ui.core.score.undo.ResizeScoreObjectEdit in project blue by kunstmusik.
the class SoundObjectPropertiesTopComponent method updateSubjectiveDuration.
protected void updateSubjectiveDuration() {
double initialDuration = sObj.getSubjectiveDuration();
double newValue;
try {
newValue = Double.parseDouble(subjectiveDurationText.getText());
} catch (NumberFormatException nfe) {
subjectiveDurationText.setText(Double.toString(initialDuration));
return;
}
sObj.setSubjectiveDuration(newValue);
BlueUndoManager.setUndoManager("score");
BlueUndoManager.addEdit(new ResizeScoreObjectEdit(this.sObj, initialDuration, this.sObj.getSubjectiveDuration()));
}
Aggregations