Changeset 106
- Timestamp:
- 06/20/08 13:33:11 (16 years ago)
- Location:
- trunk/src/org/expeditee
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Simple.java
r105 r106 348 348 * @param pause 349 349 */ 350 public static void DebugFrame(Item current, doublepause, Color color) {351 RunFrame(current, false, true, (int) (pause * 1000 + 0.5), color);350 public static void DebugFrame(Item current, float pause, Color color) { 351 RunFrame(current, false, true, Math.round(pause * 1000), color); 352 352 } 353 353 … … 359 359 * the time to pause between 360 360 */ 361 public static void DebugFrame(Item current, doublepause) {361 public static void DebugFrame(Item current, float pause) { 362 362 DebugFrame(current, pause, null); 363 363 } 364 364 365 365 public static void DebugFrame(Item current) { 366 DebugFrame(current, -1.0 , null);366 DebugFrame(current, -1.0F, null); 367 367 } 368 368 -
trunk/src/org/expeditee/gui/DisplayIO.java
r105 r106 213 213 int mouseX = (int) _Browser.getContentPane().getLocationOnScreen() 214 214 .getX() 215 + (int) (x + 0.5);215 + Math.round(x); 216 216 int mouseY = (int) _Browser.getContentPane().getLocationOnScreen() 217 217 .getY() 218 + (int) (y + 0.5);218 + Math.round(y); 219 219 _Robot.mouseMove(mouseX, mouseY); 220 220 // System.out.println("MouseMoved: " + x + "," + y); -
trunk/src/org/expeditee/gui/FrameGraphics.java
r105 r106 279 279 i.setActionMark(false); 280 280 if (!(i instanceof Line)) { 281 i.setXY( (int) (i.getX() * scale + dx + 0.5), (int)(i.getY()282 * scale + dy + 0.5));283 i.setThickness( (int) (i.getThickness() * scale + 0.5));281 i.setXY(Math.round(i.getX() * scale + dx), Math.round(i.getY() 282 * scale + dy)); 283 i.setThickness(Math.round(i.getThickness() * scale)); 284 284 i 285 .setArrowheadLength( (int)(i.getArrowheadLength()286 * scale + 0.5));285 .setArrowheadLength(Math.round(i.getArrowheadLength() 286 * scale)); 287 287 if (i.getColor() == null) { 288 288 i.setColor(defaultForeground); … … 296 296 } 297 297 if (i instanceof Text) 298 i.setSize( (int) (i.getSize() * scale + 0.5));298 i.setSize(Math.round(i.getSize() * scale)); 299 299 items.add(i); 300 300 } -
trunk/src/org/expeditee/gui/FrameMouseActions.java
r105 r106 335 335 _lastRanged = (Text) on; 336 336 // set start-drag point 337 _lastRanged.setSelectionStart(DisplayIO.getMouseX(), FrameMouseActions.getY()); 337 _lastRanged.setSelectionStart(DisplayIO.getMouseX(), 338 FrameMouseActions.getY()); 338 339 } 339 340 … … 342 343 _lastCropped = (Picture) on; 343 344 // set start crop point 344 _lastCropped.setStartCrop(DisplayIO.getMouseX(), FrameMouseActions.getY()); 345 _lastCropped.setStartCrop(DisplayIO.getMouseX(), FrameMouseActions 346 .getY()); 345 347 _lastCropped.setShowCrop(true); 346 348 } … … 844 846 // otherwise the user is creating a line 845 847 } else { 846 Item on = FrameUtils.onItem(DisplayIO.getCurrentFrame(), Math .round(MouseX),847 Math.round(MouseY));848 Item on = FrameUtils.onItem(DisplayIO.getCurrentFrame(), Math 849 .round(MouseX), Math.round(MouseY)); 848 850 // If we have permission to copy this item then pick it up 849 851 if (on != null && on.isLineEnd() … … 862 864 Item newPoint = oldLine.getStartItem().copy(); 863 865 newPoint.setPosition(MouseX, MouseY); 864 866 865 867 Item end = oldLine.getEndItem(); 866 868 // create the Line … … 1175 1177 && on.Permission >= Item.PERMISSION_FULL) { 1176 1178 1177 Line onLine = (Line) on;1179 Line onLine = (Line) on; 1178 1180 Line newLine = onLine.copy(); 1179 1181 Item end = newLine.getEndItem(); … … 1186 1188 // attach the line to the cursor 1187 1189 pickup(end); 1188 1190 1189 1191 List<Item> toMerge = new LinkedList<Item>(); 1190 1192 toMerge.add(newLine.getStartItem()); … … 1321 1323 } else { 1322 1324 // update the ranged section 1323 _lastRanged.setSelectionEnd(DisplayIO.getMouseX(), FrameMouseActions.getY()); 1325 _lastRanged.setSelectionEnd(DisplayIO.getMouseX(), 1326 FrameMouseActions.getY()); 1324 1327 _isNoOp = false; 1325 1328 } … … 1349 1352 } 1350 1353 // update the ranged section 1351 _lastCropped.setEndCrop(DisplayIO.getMouseX(), FrameMouseActions.getY()); 1354 _lastCropped.setEndCrop(DisplayIO.getMouseX(), FrameMouseActions 1355 .getY()); 1352 1356 1353 1357 FrameGraphics.Repaint(); … … 1414 1418 // System.out.println("MouseMoved: " + MouseX + "," + MouseY + " " + 1415 1419 // System.currentTimeMillis()); 1416 LastRobotX = (int) (x + 0.5);1417 LastRobotY = (int) (y + 0.5);1420 LastRobotX = Math.round(x); 1421 LastRobotY = Math.round(y); 1418 1422 _RobotTimer.start(); 1419 1423 } … … 1537 1541 1538 1542 if (vLength > hLength) { 1539 MouseX = (int)(hOtherEnd.getX() + vLength1540 * (MouseX > hOtherEnd.getX() ? 1 : -1) + 0.5);1543 MouseX = Math.round(hOtherEnd.getX() + vLength 1544 * (MouseX > hOtherEnd.getX() ? 1 : -1)); 1541 1545 } else /* if (hLength > vLength) */{ 1542 MouseY = (int)(vOtherEnd.getY() + hLength1543 * (MouseY > vOtherEnd.getY() ? 1 : -1) + 0.5);1546 MouseY = Math.round(vOtherEnd.getY() + hLength 1547 * (MouseY > vOtherEnd.getY() ? 1 : -1)); 1544 1548 } 1545 1549 } … … 1574 1578 double l_new = l3 / (2 * cosTheta); 1575 1579 double ratio = l_new / l1; 1576 MouseX = (int) ((e.getX() - lineEnd1.getX()) * ratio + 0.5) 1580 MouseX = Math.round((e.getX() - lineEnd1.getX()) 1581 * ratio) 1577 1582 + lineEnd1.getX(); 1578 MouseY = (int) ((e.getY() - lineEnd1.getY()) * ratio + 0.5) 1583 MouseY = Math.round((e.getY() - lineEnd1.getY()) 1584 * ratio) 1579 1585 + lineEnd1.getY(); 1580 1586 … … 1638 1644 // Checks that we are actually pointing on a character 1639 1645 // not just space in the text box's bounding box 1640 if (((Item) on).contains(DisplayIO.getMouseX(), FrameMouseActions.getY())) { 1646 if (((Item) on).contains(DisplayIO.getMouseX(), 1647 FrameMouseActions.getY())) { 1641 1648 _context = CONTEXT_AT_TEXT; 1642 1649 } else { … … 1788 1795 return; 1789 1796 } 1790 //This is to make sure the TEXT_CURSOR doesnt get inadvertantly turned off! 1797 // This is to make sure the TEXT_CURSOR doesnt get inadvertantly turned 1798 // off! 1791 1799 Item on = FrameUtils.getCurrentItem(); 1792 if (on != null && on instanceof Text){1800 if (on != null && on instanceof Text) { 1793 1801 return; 1794 1802 } … … 1820 1828 1821 1829 for (Item move : toMove) { 1822 move.setPosition(move.getX() - deltax, move.getY() - deltay); 1830 if (!(move instanceof Line)) 1831 move.setPosition(move.getX() - deltax, move.getY() - deltay); 1823 1832 1824 1833 if (move instanceof Text) { … … 2597 2606 2598 2607 public static int getX() { 2599 return (int)(MouseX + 0.5);2600 } 2601 2608 return Math.round(MouseX); 2609 } 2610 2602 2611 public static int getY() { 2603 return (int)(MouseY + 0.5);2612 return Math.round(MouseY); 2604 2613 } 2605 2614 } -
trunk/src/org/expeditee/items/FrameBitmap.java
r98 r106 59 59 // Space is transparent as is 0 60 60 if (Character.isDigit(currentPixel)) { 61 int alpha = (int)((currentPixel - '0') * 25.5F + 0.5F);61 int alpha = Math.round((currentPixel - '0') * 25.5F); 62 62 currentColor = new Color(c.getRed(), c.getGreen(), c 63 63 .getBlue(), alpha).getRGB(); -
trunk/src/org/expeditee/items/Item.java
r105 r106 785 785 */ 786 786 public int getX() { 787 return (int) (_x + 0.5);787 return Math.round(_x); 788 788 } 789 789 … … 794 794 */ 795 795 public int getY() { 796 return (int) (_y + 0.5);796 return Math.round(_y); 797 797 } 798 798 -
trunk/src/org/expeditee/items/Picture.java
r105 r106 481 481 482 482 int multiplier = 1000 + (diff) * 40; 483 _scale = ( (int)(_scale * multiplier + 0.5)) / 1000F;483 _scale = (Math.round(_scale * multiplier)) / 1000F; 484 484 485 485 //If the above formula didnt change stuff due to rounding -
trunk/src/org/expeditee/items/Text.java
r105 r106 396 396 float y = getLineDrop(last) * line; 397 397 398 int x = ( (int) (getX() + caret[0] + 0.5) + getJustOffset(last));398 int x = (Math.round(getX() + caret[0]) + getJustOffset(last)); 399 399 x = Math 400 400 .min( 401 401 x, 402 402 (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 403 return new Point(x, (int) (getY() + y + caret[1] + 0.5));403 return new Point(x, Math.round(getY() + y + caret[1])); 404 404 } 405 405 … … 617 617 float y = getLineDrop(current) * line; 618 618 619 int x = (int) (getX() + caret[0] + 0.5) + getJustOffset(current);619 int x = Math.round(getX() + caret[0]) + getJustOffset(current); 620 620 x = Math 621 621 .min( 622 622 x, 623 623 (getX() - Item.MARGIN_RIGHT - (2 * getGravity()) + getBoundsWidth())); 624 return new Point(x, (int) (getY() + y + caret[1] + 0.5));624 return new Point(x, Math.round(getY() + y + caret[1])); 625 625 } 626 626 … … 701 701 float y = getLineDrop(current) * line; 702 702 703 return new Point( (int) (getX() + caret[0] + 0.5)704 + getJustOffset(current), (int) (getY() + y + caret[1] + 0.5));703 return new Point(Math.round(getX() + caret[0]) 704 + getJustOffset(current), Math.round(getY() + y + caret[1])); 705 705 } 706 706 -
trunk/src/org/expeditee/stats/SessionStats.java
r105 r106 115 115 long elapsedTime = currentTime.getTime() - _StartTime.getTime(); 116 116 String time = "" 117 + (int) ((double) elapsedTime / MILLISECONDS_PER_MINUTE + 0.5); // (new 118 // SimpleDateFormat("m").format(elapsedTime)); 119 117 + Math.round((float) elapsedTime / MILLISECONDS_PER_MINUTE ); 120 118 return time; 121 119 }
Note:
See TracChangeset
for help on using the changeset viewer.