@@ -224,7 +224,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
224224 if (flushCache ) data .flushCache ();
225225 data .computeSize (child , data .widthHint , data .heightHint , flushCache );
226226 if (data .grabExcessHorizontalSpace && data .minimumWidth > 0 ) {
227- if (data .cacheWidth < data .minimumWidth ) {
227+ if (data .cacheSize . getX () < data .minimumWidth ) {
228228 int trim = 0 ;
229229 //TEMPORARY CODE
230230 if (child instanceof Scrollable ) {
@@ -233,12 +233,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
233233 } else {
234234 trim = child .getBorderWidth () * 2 ;
235235 }
236- data .cacheWidth = data . cacheHeight = SWT .DEFAULT ;
236+ data .cacheSize = new Point . OfFloat ( SWT . DEFAULT , SWT .DEFAULT ) ;
237237 data .computeSize (child , Math .max (0 , data .minimumWidth - trim ), data .heightHint , false );
238238 }
239239 }
240240 if (data .grabExcessVerticalSpace && data .minimumHeight > 0 ) {
241- data .cacheHeight = Math .max (data .cacheHeight , data .minimumHeight );
241+ data .cacheSize . setY ( Math .max (data .cacheSize . getY () , data .minimumHeight ) );
242242 }
243243 }
244244
@@ -292,23 +292,23 @@ 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 .cacheSize . getX () + data .horizontalIndent ;
305305 widths [j ] = Math .max (widths [j ], w );
306306 if (data .grabExcessHorizontalSpace ) {
307307 if (!expandColumn [j ]) expandCount ++;
308308 expandColumn [j ] = true ;
309309 }
310310 if (!data .grabExcessHorizontalSpace || data .minimumWidth != 0 ) {
311- w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheWidth : data .minimumWidth ;
311+ w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheSize . getX () : data .minimumWidth ;
312312 w += data .horizontalIndent ;
313313 minWidths [j ] = Math .max (minWidths [j ], w );
314314 }
@@ -330,11 +330,12 @@ 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 .cacheSize . getX () + 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 ;
337+ float remainder = (w + spanWidth ) % hSpan ;
338+ int last = -1 ;
338339 for (int k = 0 ; k < hSpan ; k ++) {
339340 widths [last =j -k ] = Math .max (equalWidth , widths [j -k ]);
340341 }
@@ -343,8 +344,9 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
343344 if (spanExpandCount == 0 ) {
344345 widths [j ] += w ;
345346 } else {
346- int delta = w / spanExpandCount ;
347- int remainder = w % spanExpandCount , last = -1 ;
347+ float delta = w / spanExpandCount ;
348+ float remainder = w % spanExpandCount ;
349+ int last = -1 ;
348350 for (int k = 0 ; k < hSpan ; k ++) {
349351 if (expandColumn [j -k ]) {
350352 widths [last =j -k ] += delta ;
@@ -355,14 +357,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
355357 }
356358 }
357359 if (!data .grabExcessHorizontalSpace || data .minimumWidth != 0 ) {
358- w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheWidth : data .minimumWidth ;
360+ w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheSize . getX () : data .minimumWidth ;
359361 w += data .horizontalIndent - spanMinWidth - (hSpan - 1 ) * horizontalSpacing ;
360362 if (w > 0 ) {
361363 if (spanExpandCount == 0 ) {
362364 minWidths [j ] += w ;
363365 } else {
364- int delta = w / spanExpandCount ;
365- int remainder = w % spanExpandCount , last = -1 ;
366+ float delta = w / spanExpandCount ;
367+ float remainder = w % spanExpandCount ;
368+ int last = -1 ;
366369 for (int k = 0 ; k < hSpan ; k ++) {
367370 if (expandColumn [j -k ]) {
368371 minWidths [last =j -k ] += delta ;
@@ -377,8 +380,8 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
377380 }
378381 }
379382 if (makeColumnsEqualWidth ) {
380- int minColumnWidth = 0 ;
381- int columnWidth = 0 ;
383+ float minColumnWidth = 0 ;
384+ float columnWidth = 0 ;
382385 for (int i =0 ; i <columnCount ; i ++) {
383386 minColumnWidth = Math .max (minColumnWidth , minWidths [i ]);
384387 columnWidth = Math .max (columnWidth , widths [i ]);
@@ -424,14 +427,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
424427 spanWidth += widths [j -k ];
425428 if (expandColumn [j -k ]) spanExpandCount ++;
426429 }
427- int w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheWidth : data .minimumWidth ;
430+ float w = !data .grabExcessHorizontalSpace || data .minimumWidth == SWT .DEFAULT ? data .cacheSize . getX () : data .minimumWidth ;
428431 w += data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
429432 if (w > 0 ) {
430433 if (spanExpandCount == 0 ) {
431434 widths [j ] += w ;
432435 } else {
433- int delta2 = w / spanExpandCount ;
434- int remainder2 = w % spanExpandCount , last2 = -1 ;
436+ float delta2 = w / spanExpandCount ;
437+ float remainder2 = w % spanExpandCount ;
438+ int last2 = -1 ;
435439 for (int k = 0 ; k < hSpan ; k ++) {
436440 if (expandColumn [j -k ]) {
437441 widths [last2 =j -k ] += delta2 ;
@@ -474,18 +478,18 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
474478 currentWidth += widths [j -k ];
475479 }
476480 currentWidth += (hSpan - 1 ) * horizontalSpacing - data .horizontalIndent ;
477- if ((currentWidth != data .cacheWidth && data .horizontalAlignment == SWT .FILL ) || (data .cacheWidth > currentWidth )) {
481+ if ((currentWidth != data .cacheSize . getX () && data .horizontalAlignment == SWT .FILL ) || (data .cacheSize . getX () > currentWidth )) {
478482 int trim = 0 ;
479483 if (child instanceof Scrollable ) {
480484 Rectangle rect = ((Scrollable ) child ).computeTrim (0 , 0 , 0 , 0 );
481485 trim = rect .width ;
482486 } else {
483487 trim = child .getBorderWidth () * 2 ;
484488 }
485- data .cacheWidth = data . cacheHeight = SWT .DEFAULT ;
489+ data .cacheSize = new Point . OfFloat ( SWT . DEFAULT , SWT .DEFAULT ) ;
486490 data .computeSize (child , Math .max (0 , currentWidth - trim ), data .heightHint , false );
487491 if (data .grabExcessVerticalSpace && data .minimumHeight > 0 ) {
488- data .cacheHeight = Math .max (data .cacheHeight , data .minimumHeight );
492+ data .cacheSize . setY ( Math .max (data .cacheSize . getY () , data .minimumHeight ) );
489493 }
490494 if (flush == null ) flush = new GridData [count ];
491495 flush [flushLength ++] = data ;
@@ -499,23 +503,23 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
499503 /* Row heights */
500504 int availableHeight = height - verticalSpacing * (rowCount - 1 ) - (marginTop + marginHeight * 2 + marginBottom );
501505 expandCount = 0 ;
502- int [] heights = new int [rowCount ];
503- int [] minHeights = new int [rowCount ];
506+ float [] heights = new float [rowCount ];
507+ float [] minHeights = new float [rowCount ];
504508 boolean [] expandRow = new boolean [rowCount ];
505509 for (int i =0 ; i <rowCount ; i ++) {
506510 for (int j =0 ; j <columnCount ; j ++) {
507511 GridData data = getData (grid , i , j , rowCount , columnCount , true );
508512 if (data != null ) {
509513 int vSpan = Math .max (1 , Math .min (data .verticalSpan , rowCount ));
510514 if (vSpan == 1 ) {
511- int h = data .cacheHeight + data .verticalIndent ;
515+ float h = data .cacheSize . getY () + data .verticalIndent ;
512516 heights [i ] = Math .max (heights [i ], h );
513517 if (data .grabExcessVerticalSpace ) {
514518 if (!expandRow [i ]) expandCount ++;
515519 expandRow [i ] = true ;
516520 }
517521 if (!data .grabExcessVerticalSpace || data .minimumHeight != 0 ) {
518- h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheHeight : data .minimumHeight ;
522+ h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheSize . getY () : data .minimumHeight ;
519523 h += data .verticalIndent ;
520524 minHeights [i ] = Math .max (minHeights [i ], h );
521525 }
@@ -537,13 +541,14 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
537541 expandCount ++;
538542 expandRow [i ] = true ;
539543 }
540- int h = data .cacheHeight + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
544+ float h = data .cacheSize . getY () + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
541545 if (h > 0 ) {
542546 if (spanExpandCount == 0 ) {
543547 heights [i ] += h ;
544548 } else {
545- int delta = h / spanExpandCount ;
546- int remainder = h % spanExpandCount , last = -1 ;
549+ float delta = h / spanExpandCount ;
550+ float remainder = h % spanExpandCount ;
551+ int last = -1 ;
547552 for (int k = 0 ; k < vSpan ; k ++) {
548553 if (expandRow [i -k ]) {
549554 heights [last =i -k ] += delta ;
@@ -553,14 +558,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
553558 }
554559 }
555560 if (!data .grabExcessVerticalSpace || data .minimumHeight != 0 ) {
556- h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheHeight : data .minimumHeight ;
561+ h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheSize . getY () : data .minimumHeight ;
557562 h += data .verticalIndent - spanMinHeight - (vSpan - 1 ) * verticalSpacing ;
558563 if (h > 0 ) {
559564 if (spanExpandCount == 0 ) {
560565 minHeights [i ] += h ;
561566 } else {
562- int delta = h / spanExpandCount ;
563- int remainder = h % spanExpandCount , last = -1 ;
567+ float delta = h / spanExpandCount ;
568+ float remainder = h % spanExpandCount ;
569+ int last = -1 ;
564570 for (int k = 0 ; k < vSpan ; k ++) {
565571 if (expandRow [i -k ]) {
566572 minHeights [last =i -k ] += delta ;
@@ -609,14 +615,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
609615 spanHeight += heights [i -k ];
610616 if (expandRow [i -k ]) spanExpandCount ++;
611617 }
612- int h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheHeight : data .minimumHeight ;
618+ float h = !data .grabExcessVerticalSpace || data .minimumHeight == SWT .DEFAULT ? data .cacheSize . getY () : data .minimumHeight ;
613619 h += data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
614620 if (h > 0 ) {
615621 if (spanExpandCount == 0 ) {
616622 heights [i ] += h ;
617623 } else {
618- int delta2 = h / spanExpandCount ;
619- int remainder2 = h % spanExpandCount , last2 = -1 ;
624+ float delta2 = h / spanExpandCount ;
625+ float remainder2 = h % spanExpandCount ;
626+ int last2 = -1 ;
620627 for (int k = 0 ; k < vSpan ; k ++) {
621628 if (expandRow [i -k ]) {
622629 heights [last2 =i -k ] += delta2 ;
@@ -660,7 +667,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
660667 }
661668 cellWidth += horizontalSpacing * (hSpan - 1 );
662669 int childX = gridX + data .horizontalIndent ;
663- int childWidth = Math .min (data .cacheWidth , cellWidth );
670+ float childWidth = Math .min (data .cacheSize . getX () , cellWidth );
664671 switch (data .horizontalAlignment ) {
665672 case SWT .CENTER :
666673 case GridData .CENTER :
@@ -677,7 +684,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
677684 }
678685 cellHeight += verticalSpacing * (vSpan - 1 );
679686 int childY = gridY + data .verticalIndent ;
680- int childHeight = Math .min (data .cacheHeight , cellHeight );
687+ float childHeight = Math .min (data .cacheSize . getY () , cellHeight );
681688 switch (data .verticalAlignment ) {
682689 case SWT .CENTER :
683690 case GridData .CENTER :
@@ -694,7 +701,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
694701 }
695702 Control child = grid [i ][j ];
696703 if (child != null ) {
697- child .setBounds (childX , childY , childWidth , childHeight );
704+ child .setBounds (new Rectangle . OfFloat ( childX , childY , childWidth , childHeight ) );
698705 }
699706 }
700707 gridX += widths [j ] + horizontalSpacing ;
@@ -705,7 +712,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
705712
706713 // clean up cache
707714 for (int i = 0 ; i < flushLength ; i ++) {
708- flush [i ].cacheWidth = flush [ i ]. cacheHeight = - 1 ;
715+ flush [i ].cacheSize = new Point . OfFloat ( SWT . DEFAULT , SWT . DEFAULT ) ;
709716 }
710717
711718 int totalDefaultWidth = 0 ;
0 commit comments