Ignore:
Timestamp:
06/20/08 16:48:33 (16 years ago)
Author:
ra33
Message:

Fixed rounding errors in Text class...
They caused a whole bunch of problems with small fonts and text items with several lines!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/actions/Simple.java

    r106 r107  
    11331133                                                context.getPrimitives().setValue(tokens[2],
    11341134                                                                new SString(currentFrame.getName()));
     1135                                        }
     1136                                } else if (tokens[0].equals("getcurrentitem")) {
     1137                                        assertMinParametreCount(tokens, 1);
     1138                                        assertVariableType(tokens[1], 1, SPointer.itemPrefix);
     1139
     1140                                        Item currentItem = FrameUtils.getCurrentItem();
     1141
     1142                                        context.getPointers().setObject(tokens[1], currentItem);
     1143
     1144                                        // check if the user is also after line position
     1145                                        if (currentItem != null && currentItem instanceof Text
     1146                                                        && tokens.length > 2) {
     1147                                                Text text = (Text) currentItem;
     1148                                                int cursorLinePos = text
     1149                                                                .getLinePosition(FrameMouseActions.getY());
     1150                                                context.getPrimitives().setValue(tokens[2],
     1151                                                                new SInteger(cursorLinePos + 1));
     1152                                                if (tokens.length > 3) {
     1153                                                        int cursorCharPos = text.getCharPosition(
     1154                                                                        cursorLinePos, DisplayIO.getMouseX())
     1155                                                                        .getCharIndex();
     1156                                                        context.getPrimitives().setValue(tokens[3],
     1157                                                                        new SInteger(cursorCharPos + 1));
     1158                                                }
    11351159                                        }
    11361160                                }
     
    17241748                        boolean success = fileContents != null;
    17251749                        if (!success)
    1726                                 FrameGraphics.WarningMessage("Error copying " + frameToCopy.getName());
     1750                                FrameGraphics.WarningMessage("Error copying "
     1751                                                + frameToCopy.getName());
    17271752                        FrameIO.ResumeCache();
    17281753                        if (tokens.length > 4) {
Note: See TracChangeset for help on using the changeset viewer.