Package com.lightcrafts.ui.editor

Examples of com.lightcrafts.ui.editor.Document


            catch (IOException e) {
                // Maybe it's an image:
                try {
                    ImageInfo info = ImageInfo.getInstanceFor(file);
                    ImageMetadata meta = info.getMetadata();
                    new Document(meta, null);
                }
                catch (BadImageFileException f) {
                    System.err.println(e.getMessage());
                }
                catch (IOException f) {
                    System.err.println(e.getMessage());
                }
                catch (UnsupportedColorProfileException f) {
                    System.err.println(e.getMessage());
                }
                return false;
            }
            new Document(xmlDoc, null);
        }
        catch (FileNotFoundException e) {
            System.err.println(e.getMessage());
            Error = true;
        }
View Full Code Here


            }
            System.loadLibrary("DCRaw");
            System.loadLibrary("Segment");
            // Other JNI libraries seem to get pulled in automatically.

            Document doc = null;
            try {
                // First try as a saved-document:
                InputStream in = new FileInputStream(file);
                XmlDocument xmlDoc = null;
                try {
                    xmlDoc = new XmlDocument(in);
                }
                catch (IOException e) {
                    // If xmlDoc is null, we fall back to image-import.
                }
                if (xmlDoc != null) {
                    doc = new Document(xmlDoc);
                }
                else {
                    // Maybe it's an image:
                    ImageInfo info = ImageInfo.getInstanceFor(file);
                    ImageMetadata meta = info.getMetadata();
                    doc = new Document(meta);
                }
            }
            catch (BadImageFileException e) {
                fail("Invalid image file", e);
            }
            catch (Document.MissingImageFileException e) {
                fail("Couldn't find the original image", e);
            }
            catch (XMLException e) {
                fail("Malformed LightZone file", e);
            }
            catch (IOException e) {
                fail("Error reading the file", e);
            }
            catch (OutOfMemoryError e) {
                fail("Insufficient memory to open this file", e);
            }
            catch (UnknownImageTypeException e) {
                fail("Unrecognized image format", e);
            }
            catch (UnsupportedColorProfileException e) {
                fail("Unsupported camera", e);
            }
            catch (Throwable e) {
                System.err.println("Unknown error opening this file:");
                e.printStackTrace();
                return;
            }
            editor = doc.getEditor();
        }
        EditorLayout layout = new EditorLayout(editor);

        JFrame frame = new JFrame("EditorLayout");
        frame.setContentPane(layout);
View Full Code Here

        }
    }

    void update() {
        final ComboFrame frame = getComboFrame();
        final Document newDoc = (frame != null) ? frame.getDocument() : null;
        final Document oldDoc = docRef.get();

        if (newDoc != oldDoc) {
            if (oldDoc != null) {
                final RegionManager oldRegions = oldDoc.getRegionManager();
                oldRegions.removeSelectionListener(CurveSelectionListener);
                remove("regions");
                Editor editor = oldDoc.getEditor();
                EditorControls controls = editor.getToolStack();
                controls.removeOpStackListener(ToolListener);
            }
            if (newDoc != null) {
                final RegionManager newRegions = newDoc.getRegionManager();
View Full Code Here

    }

    void update() {
        super.update();
        if (isEnabled()) {
            final Document doc = getDocument();
            if (OtherApplicationShim.shouldSaveDirectly(doc)) {
                final OtherApplication app = (OtherApplication) doc.getSource();
                final String appName = app.getName();
                final String appText = LOCALE.get("SaveToApp", appName);
                setText(appText);
            }
            else {
View Full Code Here

        super(frame, "Zoom11");
        setEnabled(false);
    }

    void update() {
        Document newDoc = getDocument();
        Document oldDoc = docRef.get();
        if (newDoc != oldDoc) {
            if (oldDoc != null) {
                ScaleModel model = oldDoc.getScaleModel();
                model.removeScaleListener(this);
            }
            if (newDoc != null) {
                ScaleModel model = newDoc.getScaleModel();
                model.addScaleListener(this);
View Full Code Here

        }
    }

    public void actionPerformed(ActionEvent event) {
        performPreAction( event );
        Document doc = getDocument();
        ScaleModel model = doc.getScaleModel();
        model.setScale(Unity);
    }
View Full Code Here

    ZoomFitMenuItem(ComboFrame frame) {
        super(frame, "ZoomFit");
    }

    public void actionPerformed(ActionEvent event) {
        Document doc = getDocument();
        doc.zoomToFit();
    }
View Full Code Here

        add(noneItem);
    }

    void update() {
        ComboFrame frame = getComboFrame();
        Document newDoc = (frame != null) ? frame.getDocument() : null;
        Document oldDoc = docRef.get();

        if (newDoc != oldDoc) {
            try {
                removeAll();
                if (newDoc != null) {
View Full Code Here

    RedoMenuItem(ComboFrame frame) {
        super(frame, "Redo");
    }

    Action getDocumentAction() {
        Document doc = getDocument();
        if (doc != null) {
            return doc.getRedoAction();
        }
        else {
            return null;
        }
    }
View Full Code Here

{
    WeakReference docRef = new WeakReference(null);

    RevertMenuItem(ComboFrame frame) {
        super(frame, "Revert");
        Document doc = getDocument();
        if (doc != null) {
            Action undo = doc.getUndoAction();
            undo.addPropertyChangeListener(this);
            setEnabled(undo.isEnabled());
        }
        else {
            setEnabled(false);
View Full Code Here

TOP

Related Classes of com.lightcrafts.ui.editor.Document

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.