Package org.lilypondbeans.jccparser

Examples of org.lilypondbeans.jccparser.ASTPitch


        }
        if (node.jjtGetParent().id == ParserTreeConstants.JJTFUNCTION && (node.jjtGetParent().jjtGetFirstToken().kind == ParserConstants.relative)
                || node.jjtGetParent().jjtGetFirstToken().kind == ParserConstants.transpose) {
            return false;
        }
        ASTPitch pitch = (ASTPitch) node;
        PitchLayout layout = new PitchLayout();
        layout.priority = 0;
        pitch.setLayoutObject(layout);
        layout.calcSignature(env);
        layout.calcDistance();
        layout.calcStemDirection();
        layout.calcBeam(env);
        env.lastPitch = pitch;
View Full Code Here


        return true;

    }

    void calcSignature(LayoutEnv env) {
        ASTPitch pitch = (ASTPitch) parent;
        int o = 0;
        if (pitch.isBreake()) {
            return;
        }

        if (env.lastSignatureReset != pitch.lastBar) {
            env.lastSignature = ASTKey.getPitchSignature(pitch.keySignature);
View Full Code Here

    }

    void calcDistance() {
        distanceRight = 20;
        ASTPitch pitch = (ASTPitch) parent;
        if (pitch.durationInteger == 4) {
            distanceRight = 20;
        } else if (pitch.durationInteger == 2) {
            distanceRight = 28;
        } else if (pitch.durationInteger == 1) {
View Full Code Here

            distanceLeft = distanceLeft + 10;
        }
    }

    public void calcStemDirection() {
        ASTPitch pitch = (ASTPitch) this.parent;
        //in chord stemmdirection from highest
        if (pitch.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
            pitch = ((ASTChord) pitch.jjtGetParent()).getLowestPitch();
        }

        if (pitch.stemDirection == 0) {
            if (pitch.absoluteHeight > 5) {
                stemDirection = -1;
View Full Code Here

            stemDirection = pitch.stemDirection;
        }
    }

    private void calcBeam(LayoutEnv env) {
        ASTPitch pitch = (ASTPitch) this.parent;
        if (pitch.duration >= 0.25 || pitch.isBreake()) {
            return;
        }
        int block = 0;
        for (block = 1; block < 30; block++) {
            if (pitch.getBeattime() >= pitch.lastBar.getBeattime() + env.beamUnit * (block - 1)
                    && pitch.getBeattime() < pitch.lastBar.getBeattime() + env.beamUnit * block) {
                break;
            }
            if (block > 25) {
                block = block;
            }
View Full Code Here

            beam.childs.add(pitch);
        }
    }

    private void drawFlag(Graphics g, int x, int y, int flagCount) {
        ASTPitch pitch = (ASTPitch) this.parent;
        if (pitch.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
            if (stemDirection == -1 && ((ASTChord) pitch.jjtGetParent()).getLowestPitch() != pitch) {
                return;
            }
            if (stemDirection == 1 && ((ASTChord) pitch.jjtGetParent()).getHighestPitch() != pitch) {
                return;
            }
        }
        if (hasBeam()) {
            return;
View Full Code Here

            g.drawString("\ue18C", x + 9, y - 30);//Flag1 oben 64.
        }
    }

    public void drawBreak(Graphics g, int x, int y) {
        ASTPitch pitch = (ASTPitch) this.parent;
        int ny = y - pitch.absoluteHeight * 4 + 40;
        if (pitch.jjtGetLastToken().kind == ParserConstants.rest) {
            ny = ny + ASTClef.getDiffToViolin(pitch.clef) * 4;
        }
        int nx = x + this.x;
        //Head
        if (pitch.durationInteger == 64) {
View Full Code Here

        }
        return false;
    }

    public void draw(int xpos, int ypos, Graphics g) {
        ASTPitch pitch = (ASTPitch) this.parent;
        int nhoehe = ypos - pitch.absoluteHeight * 4 + 40;
        nhoehe = nhoehe + ASTClef.getDiffToViolin(pitch.clef) * 4;

        int nbreite = xpos + this.x;

        if (pitch.getBreakType() == ASTPitch.BREAK_TYPE_VISIBLE) {
            drawBreak(g, xpos, ypos);
            return;
        }
        if (pitch.getBreakType() == ASTPitch.BREAK_TYPE_INVISIBLE) {
            return;
        }

        //Signature
        if (signatureToPaint == 1) {
            g.drawString("\ue10e", nbreite - 9, nhoehe);//Kopf kreuz
        }
        if (signatureToPaint == -1) {
            g.drawString("\ue112", nbreite - 9, nhoehe);//Kopf b
        }
        if (signatureToPaint == 10) {//?
            g.drawString("\ue111", nbreite - 9, nhoehe);//Kopf auflösungszeichen
        }        //Kopf
        if (pitch.durationInteger == 128) {
            g.drawString("\ue127", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 64) {
            g.drawString("\ue127", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 32) {
            g.drawString("\ue127", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 16) {
            g.drawString("\ue127", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 8) {
            g.drawString("\ue127", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 4) {
            g.drawString("\ue127", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 2) {
            g.drawString("\ue126", nbreite, nhoehe);//Kopf ausgef�llt
        } else if (pitch.durationInteger == 1) {
            g.drawString("\ue125", nbreite, nhoehe);//Kopf ausgef�llt
        }
        if (pitch.durationDots > 0) {
            g.drawString("\ue121", nbreite + 12, nhoehe);//Kopf ausgef�llt
        }


        int hhoehe = pitch.absoluteHeight;
        hhoehe = hhoehe - ASTClef.getDiffToViolin(pitch.clef);

        //Helplines top
        if (hhoehe <= 0) {
            g.drawLine(nbreite - 3, ypos + 40, nbreite + 11, ypos + 40);
        }
        if (hhoehe <= -2) {
            g.drawLine(nbreite - 3, ypos + 48, nbreite + 11, ypos + 48);
        }
        if (hhoehe <= -4) {
            g.drawLine(nbreite - 3, ypos + 56, nbreite + 11, ypos + 56);
        }
        if (hhoehe <= -6) {
            g.drawLine(nbreite - 3, ypos + 64, nbreite + 11, ypos + 64);
        }
        //Helplines down
        if (hhoehe >= 12) {
            g.drawLine(nbreite - 3, ypos - 8, nbreite + 11, ypos - 8);
        }
        if (hhoehe >= 14) {
            g.drawLine(nbreite - 3, ypos - 16, nbreite + 11, ypos - 16);
        }
        if (hhoehe >= 16) {
            g.drawLine(nbreite - 3, ypos - 24, nbreite + 11, ypos - 24);
        }
        if (pitch == null) {
            pitch = null;
        }
        //draw stem
        if (pitch.duration < 1 && !pitch.isBreake() && !hasBeam()) {//Ganze noten, Pausen und  ohne Hals
            //stem down
            if (stemDirection == -1) {
                g.drawLine(nbreite - 1, nhoehe + 26, nbreite - 1, nhoehe + 2);//Hals unten
            }
            //stem up
View Full Code Here

    public void oktaveUp() {
        SimpleNode el = UpdateNodeTask.getInstance().getLastCurrent();
        if (el == null || el.id != ParserTreeConstants.JJTPITCH) {
            return;
        }
        ASTPitch pitch = (ASTPitch) el;
        pitch.octave++;
        pitch.absoluteHeight += 7;
        play(pitch);
        NoteEditor ed = NoteEditor.create(pitch);
        ed.pitch.octave++;
View Full Code Here

    public void oktaveDown() {
        SimpleNode el = UpdateNodeTask.getInstance().getLastCurrent();
        if (el == null || el.id != ParserTreeConstants.JJTPITCH) {
            return;
        }
        ASTPitch pitch = (ASTPitch) el;
        pitch.octave--;
        pitch.absoluteHeight -= 7;
        play(pitch);
        NoteEditor ed = NoteEditor.create(pitch);
        ed.pitch.octave--;
View Full Code Here

TOP

Related Classes of org.lilypondbeans.jccparser.ASTPitch

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.