Package org.joshy.sketch.model

Examples of org.joshy.sketch.model.CanvasDocument$DocumentEvent


    public DocContext setupNewDoc(DocModeHelper modeHelper, final CanvasDocument origDoc) throws Exception {
        final DocContext context = modeHelper.createDocContext(this);
        contexts.add(context);

        CanvasDocument doc = origDoc;
        //create a new doc if one wasn't passed in
        if(doc == null) {
            doc = modeHelper.createNewDoc();
        }

        context.setupActions();
        context.setupPalettes();
        context.stackPanel = new StackPanel();


        ScrollPane scrollPane = new ScrollPane(
            context.getCanvas()
                .setWidth(300)
                .setHeight(300)
        );
       
        final Ruler hruler = new Ruler(false,scrollPane,context);
        final Ruler vruler = new Ruler(true,scrollPane,context);

        final CanvasDocument fdoc = doc;
        context.stackPanel.add(
                new Panel() {
                    @Override
                    public void doLayout() {
                        hruler.setVisible(fdoc.isRulersVisible());
                        vruler.setVisible(fdoc.isRulersVisible());
                        super.doLayout();
                        for(Control c : controlChildren()) {
                            if(c == hruler && fdoc.isRulersVisible()) {
                                c.setWidth(getWidth()-30);
                                c.setHeight(30);
                                c.setTranslateX(30);
                                c.setTranslateY(0);
                            }
                            if(c == vruler && fdoc.isRulersVisible()) {
                                c.setWidth(30);
                                c.setHeight(getHeight()-30);
                                c.setTranslateX(0);
                                c.setTranslateY(30);
                            }
                            if(c instanceof ScrollPane) {
                                if(fdoc.isRulersVisible()) {
                                    c.setWidth(getWidth()-30);
                                    c.setHeight(getHeight()-30);
                                    c.setTranslateX(30);
                                    c.setTranslateY(30);
                                } else {
View Full Code Here


            public void call(ActionEvent actionEvent) throws Exception {
                stage.hide();
                final File file = File.createTempFile("foo", ".png");
                file.deleteOnExit();

                CanvasDocument doc = context.getDocument();
                if(doc instanceof SketchDocument) {
                    SketchDocument sdoc = (SketchDocument) doc;
                    SavePNGAction save = new SavePNGAction(null);
                    VectorDocContext vdc = (VectorDocContext) context;
                    save.includeBackground = true;
View Full Code Here

TOP

Related Classes of org.joshy.sketch.model.CanvasDocument$DocumentEvent

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.