CVSROOT: /sources/classpath Module name: classpath Changes by: Sven de Marothy <smarothy> 06/06/18 02:22:17
Modified files: . : ChangeLog java/awt : GridBagLayout.java java/awt/font : TextMeasurer.java Log message: 2006-06-18 Sven de Marothy <[EMAIL PROTECTED]> * java/awt/GridBagLayout.java (AdjustForGravity): Implement. * java/awt/font/TextMeasurer.java: Fix copyright date, remove commented-out code. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7862&r2=1.7863 http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/GridBagLayout.java?cvsroot=classpath&r1=1.28&r2=1.29 http://cvs.savannah.gnu.org/viewcvs/classpath/java/awt/font/TextMeasurer.java?cvsroot=classpath&r1=1.4&r2=1.5 Patches: Index: ChangeLog =================================================================== RCS file: /sources/classpath/classpath/ChangeLog,v retrieving revision 1.7862 retrieving revision 1.7863 diff -u -b -r1.7862 -r1.7863 --- ChangeLog 18 Jun 2006 00:54:46 -0000 1.7862 +++ ChangeLog 18 Jun 2006 02:22:16 -0000 1.7863 @@ -1,5 +1,11 @@ 2006-06-18 Sven de Marothy <[EMAIL PROTECTED]> + * java/awt/GridBagLayout.java (AdjustForGravity): Implement. + * java/awt/font/TextMeasurer.java: Fix copyright date, + remove commented-out code. + +2006-06-18 Sven de Marothy <[EMAIL PROTECTED]> + * gnu/java/awt/peer/gtk/FreetypeGlyphVector.java (FreetypeGlyphVector, clone): Implement cloning. (getGlyphLogicalBounds): Bounds should be offset to the glyph position. Index: java/awt/GridBagLayout.java =================================================================== RCS file: /sources/classpath/classpath/java/awt/GridBagLayout.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -b -r1.28 -r1.29 --- java/awt/GridBagLayout.java 22 Mar 2006 19:15:24 -0000 1.28 +++ java/awt/GridBagLayout.java 18 Jun 2006 02:22:17 -0000 1.29 @@ -324,11 +324,17 @@ /** * Obsolete. */ - protected void AdjustForGravity (GridBagConstraints gbc, Rectangle rect) - throws NotImplementedException + protected void AdjustForGravity (GridBagConstraints constraints, + Rectangle rect) { - // FIXME - throw new Error ("Not implemented"); + Insets insets = constraints.insets; + if (insets != null) + { + rect.x += insets.left; + rect.y += insets.top; + rect.width -= insets.left + insets.right; + rect.height -= insets.top + insets.bottom; + } } /** @@ -353,10 +359,9 @@ // layoutInfo. So we wait until after this for loop to set // layoutInfo. Component lastComp = null; - int cellx = 0; - int celly = 0; - int cellw = 0; - int cellh = 0; + + Rectangle cell = new Rectangle(); + for (int i = 0; i < components.length; i++) { Component component = components[i]; @@ -370,29 +375,23 @@ if (lastComp != null && constraints.gridheight == GridBagConstraints.REMAINDER) - celly += cellh; + cell.y += cell.height; else - celly = sumIntArray(info.rowHeights, constraints.gridy); + cell.y = sumIntArray(info.rowHeights, constraints.gridy); if (lastComp != null && constraints.gridwidth == GridBagConstraints.REMAINDER) - cellx += cellw; + cell.x += cell.width; else - cellx = sumIntArray(info.colWidths, constraints.gridx); + cell.x = sumIntArray(info.colWidths, constraints.gridx); - cellw = sumIntArray(info.colWidths, constraints.gridx - + constraints.gridwidth) - cellx; - cellh = sumIntArray(info.rowHeights, constraints.gridy - + constraints.gridheight) - celly; + cell.width = sumIntArray(info.colWidths, constraints.gridx + + constraints.gridwidth) - cell.x; + cell.height = sumIntArray(info.rowHeights, constraints.gridy + + constraints.gridheight) - cell.y; - Insets insets = constraints.insets; - if (insets != null) - { - cellx += insets.left; - celly += insets.top; - cellw -= insets.left + insets.right; - cellh -= insets.top + insets.bottom; - } + // Adjust for insets. + AdjustForGravity( constraints, cell ); // Note: Documentation says that padding is added on both sides, but // visual inspection shows that the Sun implementation only adds it @@ -403,14 +402,14 @@ switch (constraints.fill) { case GridBagConstraints.HORIZONTAL: - dim.width = cellw; + dim.width = cell.width; break; case GridBagConstraints.VERTICAL: - dim.height = cellh; + dim.height = cell.height; break; case GridBagConstraints.BOTH: - dim.width = cellw; - dim.height = cellh; + dim.width = cell.width; + dim.height = cell.height; break; } @@ -420,40 +419,40 @@ switch (constraints.anchor) { case GridBagConstraints.NORTH: - x = cellx + (cellw - dim.width) / 2; - y = celly; + x = cell.x + (cell.width - dim.width) / 2; + y = cell.y; break; case GridBagConstraints.SOUTH: - x = cellx + (cellw - dim.width) / 2; - y = celly + cellh - dim.height; + x = cell.x + (cell.width - dim.width) / 2; + y = cell.y + cell.height - dim.height; break; case GridBagConstraints.WEST: - x = cellx; - y = celly + (cellh - dim.height) / 2; + x = cell.x; + y = cell.y + (cell.height - dim.height) / 2; break; case GridBagConstraints.EAST: - x = cellx + cellw - dim.width; - y = celly + (cellh - dim.height) / 2; + x = cell.x + cell.width - dim.width; + y = cell.y + (cell.height - dim.height) / 2; break; case GridBagConstraints.NORTHEAST: - x = cellx + cellw - dim.width; - y = celly; + x = cell.x + cell.width - dim.width; + y = cell.y; break; case GridBagConstraints.NORTHWEST: - x = cellx; - y = celly; + x = cell.x; + y = cell.y; break; case GridBagConstraints.SOUTHEAST: - x = cellx + cellw - dim.width; - y = celly + cellh - dim.height; + x = cell.x + cell.width - dim.width; + y = cell.y + cell.height - dim.height; break; case GridBagConstraints.SOUTHWEST: - x = cellx; - y = celly + cellh - dim.height; + x = cell.x; + y = cell.y + cell.height - dim.height; break; default: - x = cellx + (cellw - dim.width) / 2; - y = celly + (cellh - dim.height) / 2; + x = cell.x + (cell.width - dim.width) / 2; + y = cell.y + (cell.height - dim.height) / 2; break; } component.setBounds(info.pos_x + x, info.pos_y + y, dim.width, Index: java/awt/font/TextMeasurer.java =================================================================== RCS file: /sources/classpath/classpath/java/awt/font/TextMeasurer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -b -r1.4 -r1.5 --- java/awt/font/TextMeasurer.java 18 Jun 2006 00:54:47 -0000 1.4 +++ java/awt/font/TextMeasurer.java 18 Jun 2006 02:22:17 -0000 1.5 @@ -1,5 +1,5 @@ /* TextMeasurer.java - Copyright (C) 2003 Free Software Foundation, Inc. + Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -128,10 +128,6 @@ */ public TextLayout getLayout (int start, int limit) { -// AttributedCharacterIterator aci = (new AttributedString( text, -// start, limit -// ) ).getIterator(); -// return new TextLayout( aci, frc ); return new TextLayout( totalLayout, start, limit ); }