Search in sources :

Example 1 with RectangleObject

use of doc.mathobjects.RectangleObject in project OpenNotebook by jaltekruse.

the class DocMouseListener method mousePressed.

@Override
public void mousePressed(MouseEvent e) {
    docPanel.requestFocus();
    draggingDot = false;
    PointInDocument clickedPt = docPanel.panelPt2DocPt(e.getX(), e.getY());
    MathObject objToPlace = docPanel.getObjToPlace();
    if (docPanel.isPlacingObject()) {
        objToPlace.setxPos(clickedPt.getxPos());
        objToPlace.setyPos(clickedPt.getyPos());
        objToPlace.setWidth(1);
        objToPlace.setHeight(1);
        objToPlace.setParentContainer(docPanel.getDoc().getPage(clickedPt.getPage()));
        objToPlace.getParentContainer().addObject(objToPlace);
        docPanel.repaintDoc();
        docPanel.updateObjectToolFrame();
        objPlacementRequiresMouseDrag = true;
        docPanel.setFocusedObject(objToPlace);
        return;
    } else if (detectResizeOrMove(e)) {
        // resize dot or the selected object
        return;
    } else if (clickedPt.isOutSidePage()) {
        // click was outside of page
        if (docPanel.isPlacingObject()) {
            docPanel.getNotebookPanel().objHasBeenPlaced();
            docPanel.ungroupTempGroup();
        }
    } else {
        // create a box to select multiple objects
        if (!docPanel.isInStudentMode()) {
            docPanel.ungroupTempGroup();
            RectangleObject rect = new RectangleObject(docPanel.getDoc().getPage(clickedPt.getPage()));
            rect.setxPos(clickedPt.getxPos());
            rect.setyPos(clickedPt.getyPos());
            rect.setWidth(1);
            rect.setHeight(1);
            docPanel.setSelectionRect(rect);
            selectionRectRequiresMouseDrag = true;
        }
    }
}
Also used : RectangleObject(doc.mathobjects.RectangleObject) MathObject(doc.mathobjects.MathObject) PointInDocument(doc.PointInDocument)

Example 2 with RectangleObject

use of doc.mathobjects.RectangleObject in project OpenNotebook by jaltekruse.

the class OldReader method startElement.

@Override
public void startElement(String uri, String name, String qName, Attributes atts) {
    boolean justAddedObject = false;
    if (qName.equals("OpenNotebookDoc")) {
        doc = new Document(atts.getValue(Document.FILENAME));
        doc.setAuthor(atts.getValue(Document.AUTHOR));
    }
    if (doc != null) {
        if (qName.equals("Page")) {
            page = new Page(doc);
            doc.addPage(page);
            return;
        }
        if (page != null) {
            if (mObj != null) {
                readAttribute(uri, name, qName, atts);
            }
            if (qName.equals("AnswerBox")) {
                mObj = new AnswerBoxObject(page);
                justAddedObject = true;
            }
            if (qName.equals("CubeObject")) {
                mObj = new CubeObject(page);
                justAddedObject = true;
            } else if (qName.equals("ExpressionObject")) {
                mObj = new ExpressionObject(page);
                justAddedObject = true;
            } else if (qName.equals("GraphObject")) {
                mObj = new GraphObject(page);
                justAddedObject = true;
            } else if (qName.equals("NumberLineObject")) {
                mObj = new NumberLineObject(page);
                justAddedObject = true;
            } else if (qName.equals("OvalObject")) {
                mObj = new OvalObject(page);
                justAddedObject = true;
            } else if (qName.equals("ParallelogramObject")) {
                mObj = new ParallelogramObject(page);
                justAddedObject = true;
            } else if (qName.equals("RectangleObject")) {
                mObj = new RectangleObject(page);
                justAddedObject = true;
            } else if (qName.equals("TextObject")) {
                mObj = new TextObject(page);
                justAddedObject = true;
            } else if (qName.equals("TrapezoidObject")) {
                mObj = new TrapezoidObject(page);
                justAddedObject = true;
            } else if (qName.equals("TriangleObject")) {
                mObj = new TriangleObject(page);
                justAddedObject = true;
            }
            if (justAddedObject) {
                if (page != null) {
                    page.addObject(mObj);
                }
            }
        }
    }
}
Also used : NumberLineObject(doc.mathobjects.NumberLineObject) RectangleObject(doc.mathobjects.RectangleObject) Page(doc.Page) Document(doc.Document) GraphObject(doc.mathobjects.GraphObject) TrapezoidObject(doc.mathobjects.TrapezoidObject) TextObject(doc.mathobjects.TextObject) TriangleObject(doc.mathobjects.TriangleObject) ExpressionObject(doc.mathobjects.ExpressionObject) AnswerBoxObject(doc.mathobjects.AnswerBoxObject) CubeObject(doc.mathobjects.CubeObject) OvalObject(doc.mathobjects.OvalObject) ParallelogramObject(doc.mathobjects.ParallelogramObject)

Aggregations

RectangleObject (doc.mathobjects.RectangleObject)2 Document (doc.Document)1 Page (doc.Page)1 PointInDocument (doc.PointInDocument)1 AnswerBoxObject (doc.mathobjects.AnswerBoxObject)1 CubeObject (doc.mathobjects.CubeObject)1 ExpressionObject (doc.mathobjects.ExpressionObject)1 GraphObject (doc.mathobjects.GraphObject)1 MathObject (doc.mathobjects.MathObject)1 NumberLineObject (doc.mathobjects.NumberLineObject)1 OvalObject (doc.mathobjects.OvalObject)1 ParallelogramObject (doc.mathobjects.ParallelogramObject)1 TextObject (doc.mathobjects.TextObject)1 TrapezoidObject (doc.mathobjects.TrapezoidObject)1 TriangleObject (doc.mathobjects.TriangleObject)1