@@ -292,16 +292,16 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
292292 /* Column widths */
293293 int availableWidth = width - horizontalSpacing * (columnCount - 1 ) - (marginLeft + marginWidth * 2 + marginRight );
294294 int expandCount = 0 ;
295- int [] widths = new int [columnCount ];
296- int [] minWidths = new int [columnCount ];
295+ float [] widths = new float [columnCount ];
296+ float [] minWidths = new float [columnCount ];
297297 boolean [] expandColumn = new boolean [columnCount ];
298298 for (int j =0 ; j <columnCount ; j ++) {
299299 for (int i =0 ; i <rowCount ; i ++) {
300300 GridData data = getData (grid , i , j , rowCount , columnCount , true );
301301 if (data != null ) {
302302 int hSpan = Math .max (1 , Math .min (data .horizontalSpan , columnCount ));
303303 if (hSpan == 1 ) {
304- int w = data .cacheWidth + data .horizontalIndent ;
304+ float w = data .cacheWidth + data .horizontalIndent ;
305305 widths [j ] = Math .max (widths [j ], w );
306306 if (data .grabExcessHorizontalSpace ) {
307307 if (!expandColumn [j ]) expandCount ++;
@@ -330,27 +330,23 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
330330 expandCount ++;
331331 expandColumn [j ] = true ;
332332 }
333- int w = data .cacheWidth + data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
333+ float w = data .cacheWidth + data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
334334 if (w > 0 ) {
335335 if (makeColumnsEqualWidth ) {
336- int equalWidth = (w + spanWidth ) / hSpan ;
337- int remainder = (w + spanWidth ) % hSpan , last = -1 ;
336+ float equalWidth = (w + spanWidth ) / hSpan ;
338337 for (int k = 0 ; k < hSpan ; k ++) {
339- widths [last = j -k ] = Math .max (equalWidth , widths [j -k ]);
338+ widths [j -k ] = Math .max (equalWidth , widths [j -k ]);
340339 }
341- if (last > -1 ) widths [last ] += remainder ;
342340 } else {
343341 if (spanExpandCount == 0 ) {
344342 widths [j ] += w ;
345343 } else {
346- int delta = w / spanExpandCount ;
347- int remainder = w % spanExpandCount , last = -1 ;
344+ float delta = w / spanExpandCount ;
348345 for (int k = 0 ; k < hSpan ; k ++) {
349346 if (expandColumn [j -k ]) {
350- widths [last = j -k ] += delta ;
347+ widths [j -k ] += delta ;
351348 }
352349 }
353- if (last > -1 ) widths [last ] += remainder ;
354350 }
355351 }
356352 }
@@ -361,14 +357,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
361357 if (spanExpandCount == 0 ) {
362358 minWidths [j ] += w ;
363359 } else {
364- int delta = w / spanExpandCount ;
365- int remainder = w % spanExpandCount , last = -1 ;
360+ float delta = w / spanExpandCount ;
366361 for (int k = 0 ; k < hSpan ; k ++) {
367362 if (expandColumn [j -k ]) {
368- minWidths [last = j -k ] += delta ;
363+ minWidths [j -k ] += delta ;
369364 }
370365 }
371- if (last > -1 ) minWidths [last ] += remainder ;
372366 }
373367 }
374368 }
@@ -377,8 +371,8 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
377371 }
378372 }
379373 if (makeColumnsEqualWidth ) {
380- int minColumnWidth = 0 ;
381- int columnWidth = 0 ;
374+ float minColumnWidth = 0 ;
375+ float columnWidth = 0 ;
382376 for (int i =0 ; i <columnCount ; i ++) {
383377 minColumnWidth = Math .max (minColumnWidth , minWidths [i ]);
384378 columnWidth = Math .max (columnWidth , widths [i ]);
@@ -424,20 +418,18 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
424418 spanWidth += widths [j -k ];
425419 if (expandColumn [j -k ]) spanExpandCount ++;
426420 }
427- int w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheWidth : data .minimumWidth ;
421+ float w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheWidth : data .minimumWidth ;
428422 w += data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
429423 if (w > 0 ) {
430424 if (spanExpandCount == 0 ) {
431425 widths [j ] += w ;
432426 } else {
433- int delta2 = w / spanExpandCount ;
434- int remainder2 = w % spanExpandCount , last2 = -1 ;
427+ float delta2 = w / spanExpandCount ;
435428 for (int k = 0 ; k < hSpan ; k ++) {
436429 if (expandColumn [j -k ]) {
437- widths [last2 = j -k ] += delta2 ;
430+ widths [j -k ] += delta2 ;
438431 }
439432 }
440- if (last2 > -1 ) widths [last2 ] += remainder2 ;
441433 }
442434 }
443435 }
@@ -499,16 +491,16 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
499491 /* Row heights */
500492 int availableHeight = height - verticalSpacing * (rowCount - 1 ) - (marginTop + marginHeight * 2 + marginBottom );
501493 expandCount = 0 ;
502- int [] heights = new int [rowCount ];
503- int [] minHeights = new int [rowCount ];
494+ float [] heights = new float [rowCount ];
495+ float [] minHeights = new float [rowCount ];
504496 boolean [] expandRow = new boolean [rowCount ];
505497 for (int i =0 ; i <rowCount ; i ++) {
506498 for (int j =0 ; j <columnCount ; j ++) {
507499 GridData data = getData (grid , i , j , rowCount , columnCount , true );
508500 if (data != null ) {
509501 int vSpan = Math .max (1 , Math .min (data .verticalSpan , rowCount ));
510502 if (vSpan == 1 ) {
511- int h = data .cacheHeight + data .verticalIndent ;
503+ float h = data .cacheHeight + data .verticalIndent ;
512504 heights [i ] = Math .max (heights [i ], h );
513505 if (data .grabExcessVerticalSpace ) {
514506 if (!expandRow [i ]) expandCount ++;
@@ -537,19 +529,17 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
537529 expandCount ++;
538530 expandRow [i ] = true ;
539531 }
540- int h = data .cacheHeight + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
532+ float h = data .cacheHeight + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
541533 if (h > 0 ) {
542534 if (spanExpandCount == 0 ) {
543535 heights [i ] += h ;
544536 } else {
545- int delta = h / spanExpandCount ;
546- int remainder = h % spanExpandCount , last = -1 ;
537+ float delta = h / spanExpandCount ;
547538 for (int k = 0 ; k < vSpan ; k ++) {
548539 if (expandRow [i -k ]) {
549- heights [last = i -k ] += delta ;
540+ heights [i -k ] += delta ;
550541 }
551542 }
552- if (last > -1 ) heights [last ] += remainder ;
553543 }
554544 }
555545 if (!data .grabExcessVerticalSpace || data .minimumHeight != 0 ) {
@@ -559,14 +549,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
559549 if (spanExpandCount == 0 ) {
560550 minHeights [i ] += h ;
561551 } else {
562- int delta = h / spanExpandCount ;
563- int remainder = h % spanExpandCount , last = -1 ;
552+ float delta = h / spanExpandCount ;
564553 for (int k = 0 ; k < vSpan ; k ++) {
565554 if (expandRow [i -k ]) {
566- minHeights [last = i -k ] += delta ;
555+ minHeights [i -k ] += delta ;
567556 }
568557 }
569- if (last > -1 ) minHeights [last ] += remainder ;
570558 }
571559 }
572560 }
@@ -609,20 +597,18 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
609597 spanHeight += heights [i -k ];
610598 if (expandRow [i -k ]) spanExpandCount ++;
611599 }
612- int h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheHeight : data .minimumHeight ;
600+ float h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheHeight : data .minimumHeight ;
613601 h += data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
614602 if (h > 0 ) {
615603 if (spanExpandCount == 0 ) {
616604 heights [i ] += h ;
617605 } else {
618- int delta2 = h / spanExpandCount ;
619- int remainder2 = h % spanExpandCount , last2 = -1 ;
606+ float delta2 = h / spanExpandCount ;
620607 for (int k = 0 ; k < vSpan ; k ++) {
621608 if (expandRow [i -k ]) {
622- heights [last2 = i -k ] += delta2 ;
609+ heights [i -k ] += delta2 ;
623610 }
624611 }
625- if (last2 > -1 ) heights [last2 ] += remainder2 ;
626612 }
627613 }
628614 }
@@ -651,7 +637,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
651637 if (data != null ) {
652638 int hSpan = Math .max (1 , Math .min (data .horizontalSpan , columnCount ));
653639 int vSpan = Math .max (1 , data .verticalSpan );
654- int cellWidth = 0 , cellHeight = 0 ;
640+ float cellWidth = 0 , cellHeight = 0 ;
655641 for (int k =0 ; k <hSpan ; k ++) {
656642 cellWidth += widths [j +k ];
657643 }
@@ -660,7 +646,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
660646 }
661647 cellWidth += horizontalSpacing * (hSpan - 1 );
662648 int childX = gridX + data .horizontalIndent ;
663- int childWidth = Math .min (data .cacheWidth , cellWidth );
649+ float childWidth = Math .min (data .cacheWidth , cellWidth );
664650 switch (data .horizontalAlignment ) {
665651 case SWT .CENTER :
666652 case GridData .CENTER :
@@ -677,7 +663,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
677663 }
678664 cellHeight += verticalSpacing * (vSpan - 1 );
679665 int childY = gridY + data .verticalIndent ;
680- int childHeight = Math .min (data .cacheHeight , cellHeight );
666+ float childHeight = Math .min (data .cacheHeight , cellHeight );
681667 switch (data .verticalAlignment ) {
682668 case SWT .CENTER :
683669 case GridData .CENTER :
@@ -694,7 +680,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
694680 }
695681 Control child = grid [i ][j ];
696682 if (child != null ) {
697- child .setBounds (childX , childY , childWidth , childHeight );
683+ child .setBounds (new Rectangle . OfFloat ( childX , childY , childWidth , childHeight ) );
698684 }
699685 }
700686 gridX += widths [j ] + horizontalSpacing ;
@@ -708,8 +694,8 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
708694 flush [i ].cacheWidth = flush [i ].cacheHeight = -1 ;
709695 }
710696
711- int totalDefaultWidth = 0 ;
712- int totalDefaultHeight = 0 ;
697+ float totalDefaultWidth = 0 ;
698+ float totalDefaultHeight = 0 ;
713699 for (int i =0 ; i <columnCount ; i ++) {
714700 totalDefaultWidth += widths [i ];
715701 }
@@ -718,7 +704,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
718704 }
719705 totalDefaultWidth += horizontalSpacing * (columnCount - 1 ) + marginLeft + marginWidth * 2 + marginRight ;
720706 totalDefaultHeight += verticalSpacing * (rowCount - 1 ) + marginTop + marginHeight * 2 + marginBottom ;
721- return new Point (totalDefaultWidth , totalDefaultHeight );
707+ return new Point . OfFloat (totalDefaultWidth , totalDefaultHeight );
722708}
723709
724710String getName () {
0 commit comments