Package com.lightcrafts.ui.editor

Examples of com.lightcrafts.ui.editor.RegionManager


        // Enable "paste" after "cut":

        cutItem.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    RegionManager regions = (RegionManager) get("regions");
                    CurveIterator selection = (CurveIterator) get("selection");
                    regions.unShareShapes(selection);
                    put("clipboard", selection);
                    updatePasteEnabled();
                }
            }
        );
        // Enable "paste" after "copy":

        copyItem.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    final Object selection = get("selection");
                    put("clipboard", selection);
                    updatePasteEnabled();
                }
            }
        );

        // And "paste" does the deed:

        pasteItem.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    CurveIterator selection = (CurveIterator) get("clipboard");
                    RegionManager regions = (RegionManager) get("regions");
                    regions.shareShapes(selection, true);
                }
            }
        );

        pasteRefItem.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    CurveIterator selection = (CurveIterator) get("clipboard");
                    RegionManager regions = (RegionManager) get("regions");
                    regions.shareShapes(selection, false);
                }
            }
        );
        if (Platform.getType() != Platform.MacOSX) {
            // On the Mac, the "Preferences" item lies under the app menu.
View Full Code Here


        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();
                newRegions.addSelectionListener(CurveSelectionListener);
                put("regions", newRegions);
                Editor editor = newDoc.getEditor();
                EditorControls controls = editor.getToolStack();
                controls.addOpStackListener(ToolListener);
            }
View Full Code Here

        endAdvice = new RegionEndAdvice(frame);
        emptyFolderAdvice = new EmptyFolderAdvice(frame);

        Document doc = frame.getDocument();
        if (doc != null) {
            RegionManager regions = doc.getRegionManager();
            regions.addRegionListener(this);

            regionsAction = regions.getShowHideAction();
            regionsAction.addPropertyChangeListener(this);
        }
    }
View Full Code Here

    // will remain in memory for the life of the frame.
    // See ComboFrame.dispose().
    public void dispose() {
        Document doc = frame.getDocument();
        if (doc != null) {
            RegionManager regions = doc.getRegionManager();
            regions.removeRegionListener(this);
            regionsAction.removePropertyChangeListener(this);
        }
    }
View Full Code Here

        // UnShare the selected SharedShapes:
       
        deleteItem.addActionListener(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    RegionManager regions = (RegionManager) get("regions");
                    CurveIterator selection = (CurveIterator) get("selection");
                    regions.unShareShapes(selection);
                }
            }
        );

        // Sync up menu items with the actual settings when the menu shows,
        // in case they get altered by some other controls:
        addMenuListener(
            new MenuListener() {
                public void menuCanceled(MenuEvent e) {
                }
                public void menuDeselected(MenuEvent e) {
                }
                public void menuSelected(MenuEvent e) {
                    RegionManager regions = (RegionManager) get("regions");
                    if (regions != null) {
                        int curveType = regions.getCurveType();
                        switch (curveType) {
                            case CurveFactory.Polygon:
                                polygonItem.setSelected(true);
                                break;
                            case CurveFactory.CubicBezier:
View Full Code Here

            basisItem.setEnabled(hasDoc);

            remove("selection");

            if (oldDoc != null) {
                RegionManager regions = oldDoc.getRegionManager();
                regions.removeSelectionListener(CurveSelectionListener);
                remove("regions");
            }

            if (newDoc != null) {
                RegionManager regions = newDoc.getRegionManager();
                regions.addSelectionListener(CurveSelectionListener);
                put("regions", regions);
            }
            docRef = new WeakReference<Document>(newDoc);
        }
        super.update();
View Full Code Here

TOP

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

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.