Package org.lilypondbeans.jccparser

Examples of org.lilypondbeans.jccparser.ASTContext


    public static boolean testLayout(LayoutEnv env, SimpleNode node) {
        if (node.id != ParserTreeConstants.JJTCONTEXT) {
            return false;
        }
        ASTContext con = (ASTContext) node;
        if (con.type == con.TYPE_STAFFGROUP || con.type == 0) {//because getPos()->no staffnumber-> Exception
            return true;
        }
        if (con.type == con.TYPE_VOICE) {
            env.lastVoice = con;
        }
        ContextLayout layout = new ContextLayout();
        con.setLayoutObject(layout);
        return true;

    }
View Full Code Here


        return true;

    }

    public void draw(int xpos, int ypos, Graphics g) {
        ASTContext con = (ASTContext) parent;
        if (con.type == ASTContext.TYPE_STAFF) {
        }
    }
View Full Code Here

        ypos = ypos + linePosition[line][staffNumber - 1].y;
        return new Point(xpos, ypos);
    }

    public Point getPos(SimpleNode node) {
        ASTContext staff = node.getParentContext().staff;
        if (node.id == ParserTreeConstants.JJTCONTEXT && ((ASTContext) node).type == ASTContext.TYPE_STAFF) {
            staff = (ASTContext) node;
        }

        return getPos(node, staff == null ? 1 : staff.number);
View Full Code Here

                return;
            } else {
                el = el.jjtGetParent();
            }
        }
        ASTContext voice = el.getParentContext().getContext(ASTContext.TYPE_VOICE);
        ASTContext staff = voice.getContext(ASTContext.TYPE_STAFF);

        int v = staff.childContexts.indexOf(voice);
        int s = staff.number - 1;
        ASTContext toSearch = null;
        ASTScore score = (ASTScore) el.getParentContext().getContext(ASTContext.TYPE_SCORE);
        LayoutCalculator calc = score.layoutCalculator;
        int line = calc.getLine(el);
        if (v > 0) {
            toSearch = staff.childContexts.get(v - 1);
        } else if (s > 0) {
            toSearch = staff.getParentContext().childContexts.get(s - 1).childContexts.get(0);
        } else {//next Line



            //    Point pt = calc.getPos(el);

            if (line <= 1) {
                return;
            } else {
                line--;
                // int nx = calc.getLinePosition()[line - 1][0].x - calc.getLinePosition()[line - 2][0].x;
                // nx = UpdateNodeTask.getInstance().getLastCurrent().getlayoutObject().x - nx;
                int nx = (int) UpdateNodeTask.getInstance().getLastCurrent().getlayoutObject().centre.getX();
                ASTContext con = score.childContexts.lastElement().childContexts.lastElement();
                if (con.type == ASTContext.TYPE_STAFF)//STAFFGROUP beetween
                {
                    con = con.childContexts.lastElement();
                }
                selectNext(con, nx, line, true);
View Full Code Here

                return;
            } else {
                el = el.jjtGetParent();
            }
        }
        ASTContext voice = el.getParentContext().getContext(ASTContext.TYPE_VOICE);
        ASTContext staff = voice.getContext(ASTContext.TYPE_STAFF);

        int v = staff.childContexts.indexOf(voice);
        int s = staff.number - 1;
        LayoutCalculator calc = ((ASTScore) el.getParentContext().getContext(ASTContext.TYPE_SCORE)).layoutCalculator;

        int line = calc.getLine(el);
        ASTContext toSearch = null;
        if (v < staff.childContexts.size() - 1) {
            toSearch = staff.childContexts.get(v + 1);
        } else if (s < staff.getParentContext().childContexts.size() - 1) {
            toSearch = staff.getParentContext().childContexts.get(s + 1).childContexts.get(0);
        } else {//next Line


            if (line >= calc.getLinePosition().length) {
                return;
            } else {
                line++;
                ASTScore score = (ASTScore) el.getParentContext().getContext(ASTContext.TYPE_SCORE);

                //  int nx = calc.getLinePosition()[line][0].x - calc.getLinePosition()[line - 1][0].x;
                //  nx = UpdateNodeTask.getInstance().getLastCurrent().getlayoutObject().x + nx;
                int nx = (int) UpdateNodeTask.getInstance().getLastCurrent().getlayoutObject().centre.getX();
                ASTContext con = score.childContexts.get(0).childContexts.get(0);
                if (con.type == ASTContext.TYPE_STAFF)//STAFFGROUP beetween
                {
                    con = con.childContexts.get(0);
                }
                selectNext(con, nx, line, true);
View Full Code Here

    public static SimpleNode getNext(SimpleNode el) {
        if (el.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
            el = el.jjtGetParent();//ignore others in same chord
        }
        ASTContext voice = el.getParentContext().getContext(ASTContext.TYPE_VOICE);
        SimpleNode next = el;
        while (next.id != ParserTreeConstants.JJTPITCH || next.getBeattime() <= el.getBeattime()) {
            next = voice.findNext(next);
            if (next == null) {
                return null;
            }
        }
        if (next.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
View Full Code Here

    public static SimpleNode getPrev(SimpleNode el) {
        if (el.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
            el = el.jjtGetParent();//ignore others in same chord
        }
        ASTContext voice = el.getParentContext().getContext(ASTContext.TYPE_VOICE);
        if (voice == null) {
            return null;
        }
        SimpleNode next = el;
        while (next.id != ParserTreeConstants.JJTPITCH || next.getBeattime() >= el.getBeattime()) {
            next = voice.findPrev(next);
            if (next == null) {
                return null;
            }
        }
        if (next.jjtGetParent().id == ParserTreeConstants.JJTCHORD) {
View Full Code Here


    }

    void markFirstPitchBlock() {
        ASTContext toSearch = null;
        if (UpdateNodeTask.getInstance().getLastScore() == null) {
            toSearch = UpdateNodeTask.getInstance().lastRoot;
        } else {
            toSearch = UpdateNodeTask.getInstance().getLastScore();
        }
View Full Code Here

TOP

Related Classes of org.lilypondbeans.jccparser.ASTContext

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.