Examples of SketchDocument


Examples of org.joshy.sketch.model.SketchDocument

        @Override
        public void execute() {
            if(context instanceof VectorDocContext) {
                VectorDocContext vc = (VectorDocContext) context;
                vc.getSelection().clear();
                SketchDocument doc = (SketchDocument) context.getDocument();
                for(SNode node : clipboardNodes) {
                    SNode dupe = node.duplicate(null);
                    doc.getCurrentPage().add(dupe);
                    doc.setDirty(true);
                    vc.getSelection().addSelectedNode(dupe);
                }
            }
        }
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

    public void disable() {
        if(enabled) {
            setDefaultCursor();
            if(node != null) {
                if(!editingExisting) {
                    SketchDocument doc = context.getDocument();
                    doc.getCurrentPage().add(node);
                    context.getUndoManager().pushAction(new UndoableAddNodeAction(context,node,"path"));
                }
                node = null;
                clear();
                editingExisting = false;
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

        if(couldClose) {
            SPath.PathPoint start = hoverSubpath.getPoint(0);
            if(start.distance(start.x,start.y) < getPointThreshold()) {
                couldClose = false;
                hoverSubpath.doAutoclose();
                SketchDocument doc = context.getDocument();
                doc.getCurrentPage().add(node);
                //node already added at this point
                //context.getUndoManager().pushAction(new UndoableAddNodeAction(context,node,"path"));
                node.normalize();
                currentPoint = null;
                node = null;
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

                }
            } else if(spacePressed || couldMove) {
                //move a point uniformly
                double nx = curr.x;
                double ny = curr.y;
                SketchDocument doc = context.getDocument();
                if(doc.isSnapGrid()) {
                    nx = ((int)(nx/doc.getGridWidth()))*doc.getGridWidth();
                    ny = ((int)(ny/doc.getGridHeight()))*doc.getGridHeight();
                }

                boolean hsnap = false;
                boolean vsnap = false;
                //snap with guidelines next if not already snapped
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

    /*public UndoableAddNodeAction(SketchCanvas canvas, SShape node) {
        this(canvas,node,"node");
    }*/

    public void executeUndo() {
        SketchDocument doc = (SketchDocument) context.getDocument();
        doc.getCurrentPage().remove(node);
        context.getSelection().clear();
    }
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

        doc.getCurrentPage().remove(node);
        context.getSelection().clear();
    }

    public void executeRedo() {
        SketchDocument doc = (SketchDocument) context.getDocument();
        doc.getCurrentPage().add(node);
    }
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

    }

    @Override
    public void execute() {
        final List<SNode> shp = new ArrayList<SNode>();
        final SketchDocument doc = (SketchDocument) context.getDocument();
        for(SNode node : context.getSelection().items()) {
            doc.getCurrentPage().remove(node);
            shp.add(node);
        }
        context.getSelection().clear();
        context.redraw();

        context.getUndoManager().pushAction(new UndoManager.UndoableAction(){
            public void executeUndo() {
                for(SNode shape : shp) {
                    doc.getCurrentPage().add(shape);
                }
                context.redraw();
            }
            public void executeRedo() {
                for(SNode shape : shp) {
                    doc.getCurrentPage().remove(shape);
                }
                context.redraw();
            }
            public String getName() {
                return "delete";
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

*/
public class SVGImportTest {
    @Test
    public void loadTest1() throws Exception {
        URL url = SVGImportTest.class.getResource("import_01.svg");
        SketchDocument doc = ImportAction.importSVG(url);
    }
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

            Paint pt = ((SketchDocument) context.getDocument()).getBackgroundFill();
            picker.setSelectedFill(pt);
            EventBus.getSystem().addListener(picker,ChangedEvent.ObjectChanged, new Callback<ChangedEvent>() {
                public void call(ChangedEvent event) throws Exception {
                    Paint paint = (Paint) event.getValue();
                    SketchDocument doc = (SketchDocument) context.getDocument();
                    setBackgroundFill(paint, doc);
                    context.redraw();
                }
            });
            picker.setTranslateX(10);
View Full Code Here

Examples of org.joshy.sketch.model.SketchDocument

            this.context = context;
        }

        @Override
        public void execute() {
            SketchDocument doc = context.getDocument();
            SketchDocument.SketchPage page = doc.addPage();
            insertContents(page);
            context.pageList.listview.setSelectedIndex(doc.getCurrentPageIndex());
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.