Package com.agifans.picedit.picture

Examples of com.agifans.picedit.picture.PictureCode


            if (selectedIndex > 0) {
                int selectedPicturePosition = selectedIndex - 1;
               
                // If an action code is selected in isolation then auto-select the associated data codes.
                List<PictureCode> pictureCodes = picture.getPictureCodes();
                PictureCode pictureCode = pictureCodes.get(selectedPicturePosition);
                if (pictureCode.isActionCode() && (getMinSelectionIndex() == getMaxSelectionIndex())) {
                    // Find the end of the data codes.
                    int position = selectedPicturePosition + 1;
                    do {
                        pictureCode = pictureCodes.get(position++);
                    } while ((pictureCode != null) && pictureCode.isDataCode());
                   
                    // Only if there is at least one data code do we auto-select them.
                    int dataCodeCount = ((position - selectedIndex) - 1);
                    if (dataCodeCount > 0) {
                        setSelectionInterval(selectedIndex, position - 1);
View Full Code Here


            if (index == 0) {
                return "Start";
            }
           
            LinkedList<PictureCode> pictureCodes = picture.getPictureCodes();
            PictureCode pictureCode = pictureCodes.get(index - 1);
            PictureCode previousPictureCode = null;
           
            String displayText = null;
            if (pictureCode.isActionCode()) {
                PictureCodeType actionCodeType = pictureCode.getType();
                StringBuilder displayTextBuf = new StringBuilder("  ");
                displayTextBuf.append(actionCodeType.getDisplayableText());
                displayText = displayTextBuf.toString();
            } else {
                StringBuilder displayTextBuf = null;
                int code = pictureCode.getCode();
                switch (pictureCode.getType()) {
                    case FILL_POINT_DATA:
                        displayTextBuf = new StringBuilder("    Fill ");
                        displayTextBuf.append((code & 0xFF00) >> 8);
                        displayTextBuf.append(" ");
                        displayTextBuf.append(code & 0x00FF);
                        displayText = displayTextBuf.toString();
                        break;
                    case BRUSH_POINT_DATA:
                        displayTextBuf = new StringBuilder("    Plot ");
                        displayTextBuf.append((code & 0xFF00) >> 8);
                        displayTextBuf.append(" ");
                        displayTextBuf.append(code & 0x00FF);
                        displayText = displayTextBuf.toString();
                        break;
                    case ABSOLUTE_POINT_DATA:
                        previousPictureCode = pictureCodes.get(index  - 2);
                        if (previousPictureCode.isActionCode()) {
                            displayTextBuf = new StringBuilder("    MoveTo ");
                        } else {
                            displayTextBuf = new StringBuilder("    LineTo ");
                        }
                        displayTextBuf.append((code & 0xFF00) >> 8);
View Full Code Here

            PopupMenuAction action = PopupMenuAction.valueOf(e.getActionCommand().toUpperCase());
            switch (action) {
                case DELETE:
                    // Store some details about what is being deleted so we can decide what to do after it has been deleted.
                    int minSelectionIndex = getMinSelectionIndex();
                    PictureCode codeToDelete = picture.getCurrentPictureCode();

                    // Allow any code other than the end code to be deleted. There must always be an end code.
                    if (!codeToDelete.isEndCode()) {
                        // Remember, picture position is always one less than the JList index.
                        picture.deletePictureCodes(getMinSelectionIndex() - 1, getMaxSelectionIndex() - 1);
                    }
                   
                    // Reselect the current picture position after delete since JList will have lowered index by 1.
View Full Code Here

        int lastSelectedPosition = picture.getLastSelectedPosition();
       
        if ((firstSelectedPosition > -1) && (lastSelectedPosition > -1)) {
            List<PictureCode> pictureCodes = picture.getPictureCodes();
            for (int picturePosition = firstSelectedPosition; picturePosition <= lastSelectedPosition; picturePosition++) {
                PictureCode pictureCode = pictureCodes.get(picturePosition);
                // It only makes sense to do something for data codes, and only if they're points.
                if (pictureCode.isDataCode()) {
                    Point point = pictureCode.getPoint();

                    if (point != null) {
                        // Calculate the x and y position of the point, scaling for zoom factor.
                        // TODO: Need to adjust this code for SCI0.
                        int x = (point.x << 1) * editStatus.getZoomFactor();
 
View Full Code Here

TOP

Related Classes of com.agifans.picedit.picture.PictureCode

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.