Changeset 1415 for trunk/src/org/expeditee/items/Text.java
- Timestamp:
- 07/24/19 11:23:45 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/items/Text.java
r1414 r1415 409 409 Item primary = getPrimary(); 410 410 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.WIDTH_TO_SAVE_STR)) { 411 primary.primaryPropertyEncryption.put(DefaultFrameWriter.WIDTH_TO_SAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 411 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 412 primary.primaryPropertyEncryption.put(DefaultFrameWriter.WIDTH_TO_SAVE_STR, inheritanceCheckOnSave); 412 413 } 413 414 } … … 432 433 Item primary = getPrimary(); 433 434 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR)) { 434 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 435 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 436 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MIN_WIDTH_TO_SAVE_STR, inheritanceCheckOnSave); 435 437 } 436 438 } … … 453 455 return this.getPrimary().getWidth(); 454 456 } else { 457 if (_width == null || _width <= 0) 458 return null; 455 459 return _width; 456 460 } … … 458 462 459 463 public Integer getAbsoluteWidth() { 460 if (_width == null) { 464 if (_width == null || _width == Integer.MIN_VALUE) { 465 // When absoluting Integer.MIN_VALUE, the java API is defined to give you back Integer.MIN_VALUE!!?! 466 // This is because of the asymmetry of two's complement integer representation. 467 // We would prefer to use Integer.MAX_VALUE in this circumstance. 461 468 return Integer.MAX_VALUE; 462 469 } 463 470 464 471 return Math.abs(_width); 465 472 } … … 469 476 return this.getPrimary().getMinWidth(); 470 477 } else { 478 if (_minWidth == null || _minWidth <= 0) 479 return null; 471 480 return _minWidth; 472 481 } … … 513 522 Item primary = getPrimary(); 514 523 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.JUSTIFICATION_STR)) { 515 primary.primaryPropertyEncryption.put(DefaultFrameWriter.JUSTIFICATION_STR, EncryptionDetail.InheritanceCheckOnSave); 524 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 525 primary.primaryPropertyEncryption.put(DefaultFrameWriter.JUSTIFICATION_STR, inheritanceCheckOnSave); 516 526 } 517 527 } … … 694 704 Item primary = getPrimary(); 695 705 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TEXT_STR)) { 696 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TEXT_STR, EncryptionDetail.InheritanceCheckOnSave); 706 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 707 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TEXT_STR, inheritanceCheckOnSave); 697 708 } 698 709 } … … 1327 1338 1328 1339 invalidateAll(); 1329 1340 1330 1341 if (isSurrogate()) { 1331 1342 surrogatePropertyInheritance.put(DefaultFrameWriter.FONT_STR, false); 1332 1343 Item primary = getPrimary(); 1333 1344 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.FONT_STR)) { 1334 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FONT_STR, EncryptionDetail.InheritanceCheckOnSave); 1345 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1346 primary.primaryPropertyEncryption.put(DefaultFrameWriter.FONT_STR, inheritanceCheckOnSave); 1335 1347 } 1336 1348 } … … 1554 1566 Item primary = getPrimary(); 1555 1567 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.SPACING_STR)) { 1556 primary.primaryPropertyEncryption.put(DefaultFrameWriter.SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1568 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1569 primary.primaryPropertyEncryption.put(DefaultFrameWriter.SPACING_STR, inheritanceCheckOnSave); 1557 1570 } 1558 1571 } … … 1595 1608 Item primary = getPrimary(); 1596 1609 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.WORD_SPACING_STR)) { 1597 primary.primaryPropertyEncryption.put(DefaultFrameWriter.WORD_SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1610 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1611 primary.primaryPropertyEncryption.put(DefaultFrameWriter.WORD_SPACING_STR, inheritanceCheckOnSave); 1598 1612 } 1599 1613 } … … 1626 1640 Item primary = getPrimary(); 1627 1641 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.LETTER_SPACING_STR)) { 1628 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LETTER_SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1642 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1643 primary.primaryPropertyEncryption.put(DefaultFrameWriter.LETTER_SPACING_STR, inheritanceCheckOnSave); 1629 1644 } 1630 1645 } … … 1650 1665 Item primary = getPrimary(); 1651 1666 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.INITIAL_SPACING_STR)) { 1652 primary.primaryPropertyEncryption.put(DefaultFrameWriter.INITIAL_SPACING_STR, EncryptionDetail.InheritanceCheckOnSave); 1667 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 1668 primary.primaryPropertyEncryption.put(DefaultFrameWriter.INITIAL_SPACING_STR, inheritanceCheckOnSave); 1653 1669 } 1654 1670 } … … 1777 1793 1778 1794 int minX = Integer.MAX_VALUE; 1779 int maxX = Integer.MIN_VALUE ;1795 int maxX = Integer.MIN_VALUE + 1; // +1 makes it safe to do math.abs on 1780 1796 1781 1797 int minY = Integer.MAX_VALUE; 1782 int maxY = Integer.MIN_VALUE ;1798 int maxY = Integer.MIN_VALUE + 1; // +1 makes it safe to do math.abs on 1783 1799 1784 1800 float y = -1; … … 1892 1908 return; 1893 1909 } 1894 for (Item item : DisplayController.getCurrentFrame().get Items()) {1910 for (Item item : DisplayController.getCurrentFrame().getSortedItems()) { 1895 1911 if (item instanceof Line) { 1896 1912 lines.add(new org.expeditee.core.Line(((Line) item).getStartItem().getPosition(), … … 1914 1930 } 1915 1931 1916 float width = Float.MAX_VALUE;1932 float width = (float) Integer.MAX_VALUE; 1917 1933 if (limitWidth) { 1918 1934 if (_width == null) { … … 1945 1961 paintFont, 1946 1962 new Point(getX(), getY()), lines != null ? lines.toArray(new org.expeditee.core.Line[1]) : null, 1947 paintFont.getSize() > MINIMUM_FONT_SIZE ? (int) width : (int) Float.MAX_VALUE,1963 paintFont.getSize() > MINIMUM_FONT_SIZE ? (int) width : Integer.MAX_VALUE, 1948 1964 (int) getSpacing(), 1949 1965 true, … … 2553 2569 Integer width = getWidth(); 2554 2570 if (width == null || width < 0) { 2555 setWidth(Integer.MIN_VALUE + 1); 2571 setWidth(Integer.MIN_VALUE + 1); // +1 makes it safe to do math.abs on 2556 2572 } 2557 2573 } else if (frameWidth - getX() > ADJUST_WIDTH_THRESHOLD) { … … 2866 2882 Item primary = getPrimary(); 2867 2883 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_LEFT_STR)) { 2868 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_LEFT_STR, EncryptionDetail.InheritanceCheckOnSave); 2884 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2885 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_LEFT_STR, inheritanceCheckOnSave); 2869 2886 } 2870 2887 } … … 2900 2917 Item primary = getPrimary(); 2901 2918 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_RIGHT_STR)) { 2902 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, EncryptionDetail.InheritanceCheckOnSave); 2919 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2920 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_RIGHT_STR, inheritanceCheckOnSave); 2903 2921 } 2904 2922 } … … 2941 2959 Item primary = getPrimary(); 2942 2960 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_TOP_STR)) { 2943 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_TOP_STR, EncryptionDetail.InheritanceCheckOnSave); 2961 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 2962 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_TOP_STR, inheritanceCheckOnSave); 2944 2963 } 2945 2964 } … … 2987 3006 Item primary = getPrimary(); 2988 3007 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.ANCHOR_BOTTOM_STR)) { 2989 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, EncryptionDetail.InheritanceCheckOnSave); 3008 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3009 primary.primaryPropertyEncryption.put(DefaultFrameWriter.ANCHOR_BOTTOM_STR, inheritanceCheckOnSave); 2990 3010 } 2991 3011 } … … 3101 3121 // 3102 3122 // int min_xl = Integer.MAX_VALUE; 3103 // int max_xr = Integer.MIN_VALUE ;3123 // int max_xr = Integer.MIN_VALUE + 1; // +1 makes it safe to do math.abs on 3104 3124 // 3105 3125 // int min_yt = Integer.MAX_VALUE; 3106 // int max_yb = Integer.MIN_VALUE ;3126 // int max_yb = Integer.MIN_VALUE + 1; // +1 makes it safe to do math.abs on 3107 3127 // 3108 3128 // … … 3168 3188 Item primary = getPrimary(); 3169 3189 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR)) { 3170 primary.primaryPropertyEncryption.put(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR, EncryptionDetail.InheritanceCheckOnSave); 3190 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3191 primary.primaryPropertyEncryption.put(DefaultFrameWriter.AUTO_WRAP_TO_SAVE_STR, inheritanceCheckOnSave); 3171 3192 } 3172 3193 } … … 3307 3328 Item primary = getPrimary(); 3308 3329 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.MASK_STR)) { 3309 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MASK_STR, EncryptionDetail.InheritanceCheckOnSave); 3330 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3331 primary.primaryPropertyEncryption.put(DefaultFrameWriter.MASK_STR, inheritanceCheckOnSave); 3310 3332 } 3311 3333 } … … 3330 3352 Item primary = getPrimary(); 3331 3353 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.PLACEHOLDER_STR)) { 3332 primary.primaryPropertyEncryption.put(DefaultFrameWriter.PLACEHOLDER_STR, EncryptionDetail.InheritanceCheckOnSave); 3354 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3355 primary.primaryPropertyEncryption.put(DefaultFrameWriter.PLACEHOLDER_STR, inheritanceCheckOnSave); 3333 3356 } 3334 3357 } … … 3360 3383 Item primary = getPrimary(); 3361 3384 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.SINGLE_LINE_ONLY_STR)) { 3362 primary.primaryPropertyEncryption.put(DefaultFrameWriter.SINGLE_LINE_ONLY_STR, EncryptionDetail.InheritanceCheckOnSave); 3385 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3386 primary.primaryPropertyEncryption.put(DefaultFrameWriter.SINGLE_LINE_ONLY_STR, inheritanceCheckOnSave); 3363 3387 } 3364 3388 } … … 3380 3404 Item primary = getPrimary(); 3381 3405 if (subjectToInheritanceCheckOnSave(DefaultFrameWriter.TAB_INDEX_STR)) { 3382 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TAB_INDEX_STR, EncryptionDetail.InheritanceCheckOnSave); 3406 EncryptionDetail inheritanceCheckOnSave = new EncryptionDetail(EncryptionDetail.Type.InheritanceCheckOnSave); 3407 primary.primaryPropertyEncryption.put(DefaultFrameWriter.TAB_INDEX_STR, inheritanceCheckOnSave); 3383 3408 } 3384 3409 }
Note:
See TracChangeset
for help on using the changeset viewer.