}
//create temporary Pitch
try {
//Hohe relativ zu Vorgänger
ASTPitch prev = (ASTPitch) node;
pitch.noteHeight=noteHeight;
pitch.absoluteHeight = noteHeight;
if (!prev.isBreake() && !pitch.isBreake()) {
int highPrev = prev.absoluteHeight;
if (prev.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
highPrev = ((ASTPitch) prev.jjtGetParent().jjtGetChild(0)).absoluteHeight;
}
while (Math.abs(highPrev - pitch.absoluteHeight) > 3) {
if (pitch.absoluteHeight > highPrev) {
pitch.absoluteHeight -= 7;
} else {
pitch.absoluteHeight += 7;
}
}
}
pitch.setBeattime(prev.getBeattime());
pitch.clef = prev.clef;
pitch.duration = prev.duration;
pitch.durationDots = prev.durationDots;
pitch.durationInteger = prev.durationInteger;
pitch.lastBar = prev.lastBar;
pitch.stemDirection = prev.stemDirection;
pitch.jjtSetParent(prev.jjtGetParent());
pitch.jjtGetParent().jjtAddChild(pitch, pitch.jjtGetParent().jjtGetNumChildren());
pitch.setParentContext(prev.getParentContext());
PitchLayout.testLayout(new LayoutEnv(), pitch);
if (chordMode) {
pitch.getlayoutObject().x = prev.getlayoutObject().x;
} else {
//move others
prev.getlayoutObject().moveAllXInSameGroup(prev.getlayoutObject().x, pitch.getlayoutObject().distanceRight);
pitch.getlayoutObject().x = prev.getlayoutObject().x + prev.getlayoutObject().distanceRight;
}
} catch (Exception exception) {
exception.printStackTrace();
}
NetbeansTextEditor.getInstance().selectPosition(pitch);//.getAst().getOffset() + 1 + note.getAst().getLen(), s.length());