@@ -224,7 +224,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
224
224
if (flushCache ) data .flushCache ();
225
225
data .computeSize (child , data .widthHint , data .heightHint , flushCache );
226
226
if (data .grabExcessHorizontalSpace && data .minimumWidth > 0 ) {
227
- if (data .cacheWidth < data .minimumWidth ) {
227
+ if (data .cacheSize . getX () < data .minimumWidth ) {
228
228
int trim = 0 ;
229
229
//TEMPORARY CODE
230
230
if (child instanceof Scrollable ) {
@@ -233,12 +233,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
233
233
} else {
234
234
trim = child .getBorderWidth () * 2 ;
235
235
}
236
- data .cacheWidth = data . cacheHeight = SWT .DEFAULT ;
236
+ data .cacheSize = new Point . OfFloat ( SWT . DEFAULT , SWT .DEFAULT ) ;
237
237
data .computeSize (child , Math .max (0 , data .minimumWidth - trim ), data .heightHint , false );
238
238
}
239
239
}
240
240
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 ) );
242
242
}
243
243
}
244
244
@@ -292,23 +292,23 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
292
292
/* Column widths */
293
293
int availableWidth = width - horizontalSpacing * (columnCount - 1 ) - (marginLeft + marginWidth * 2 + marginRight );
294
294
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 ];
297
297
boolean [] expandColumn = new boolean [columnCount ];
298
298
for (int j =0 ; j <columnCount ; j ++) {
299
299
for (int i =0 ; i <rowCount ; i ++) {
300
300
GridData data = getData (grid , i , j , rowCount , columnCount , true );
301
301
if (data != null ) {
302
302
int hSpan = Math .max (1 , Math .min (data .horizontalSpan , columnCount ));
303
303
if (hSpan == 1 ) {
304
- int w = data .cacheWidth + data .horizontalIndent ;
304
+ float w = data .cacheSize . getX () + data .horizontalIndent ;
305
305
widths [j ] = Math .max (widths [j ], w );
306
306
if (data .grabExcessHorizontalSpace ) {
307
307
if (!expandColumn [j ]) expandCount ++;
308
308
expandColumn [j ] = true ;
309
309
}
310
310
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 ;
312
312
w += data .horizontalIndent ;
313
313
minWidths [j ] = Math .max (minWidths [j ], w );
314
314
}
@@ -330,11 +330,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
330
330
expandCount ++;
331
331
expandColumn [j ] = true ;
332
332
}
333
- int w = data .cacheWidth + data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
333
+ float w = data .cacheSize . getX () + data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
334
334
if (w > 0 ) {
335
335
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 ;
338
339
for (int k = 0 ; k < hSpan ; k ++) {
339
340
widths [last =j -k ] = Math .max (equalWidth , widths [j -k ]);
340
341
}
@@ -343,8 +344,9 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
343
344
if (spanExpandCount == 0 ) {
344
345
widths [j ] += w ;
345
346
} 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 ;
348
350
for (int k = 0 ; k < hSpan ; k ++) {
349
351
if (expandColumn [j -k ]) {
350
352
widths [last =j -k ] += delta ;
@@ -355,14 +357,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
355
357
}
356
358
}
357
359
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 ;
359
361
w += data .horizontalIndent - spanMinWidth - (hSpan - 1 ) * horizontalSpacing ;
360
362
if (w > 0 ) {
361
363
if (spanExpandCount == 0 ) {
362
364
minWidths [j ] += w ;
363
365
} 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 ;
366
369
for (int k = 0 ; k < hSpan ; k ++) {
367
370
if (expandColumn [j -k ]) {
368
371
minWidths [last =j -k ] += delta ;
@@ -377,8 +380,8 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
377
380
}
378
381
}
379
382
if (makeColumnsEqualWidth ) {
380
- int minColumnWidth = 0 ;
381
- int columnWidth = 0 ;
383
+ float minColumnWidth = 0 ;
384
+ float columnWidth = 0 ;
382
385
for (int i =0 ; i <columnCount ; i ++) {
383
386
minColumnWidth = Math .max (minColumnWidth , minWidths [i ]);
384
387
columnWidth = Math .max (columnWidth , widths [i ]);
@@ -424,14 +427,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
424
427
spanWidth += widths [j -k ];
425
428
if (expandColumn [j -k ]) spanExpandCount ++;
426
429
}
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 ;
428
431
w += data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
429
432
if (w > 0 ) {
430
433
if (spanExpandCount == 0 ) {
431
434
widths [j ] += w ;
432
435
} 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 ;
435
439
for (int k = 0 ; k < hSpan ; k ++) {
436
440
if (expandColumn [j -k ]) {
437
441
widths [last2 =j -k ] += delta2 ;
@@ -474,18 +478,18 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
474
478
currentWidth += widths [j -k ];
475
479
}
476
480
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 )) {
478
482
int trim = 0 ;
479
483
if (child instanceof Scrollable ) {
480
484
Rectangle rect = ((Scrollable ) child ).computeTrim (0 , 0 , 0 , 0 );
481
485
trim = rect .width ;
482
486
} else {
483
487
trim = child .getBorderWidth () * 2 ;
484
488
}
485
- data .cacheWidth = data . cacheHeight = SWT .DEFAULT ;
489
+ data .cacheSize = new Point . OfFloat ( SWT . DEFAULT , SWT .DEFAULT ) ;
486
490
data .computeSize (child , Math .max (0 , currentWidth - trim ), data .heightHint , false );
487
491
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 ) );
489
493
}
490
494
if (flush == null ) flush = new GridData [count ];
491
495
flush [flushLength ++] = data ;
@@ -499,23 +503,23 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
499
503
/* Row heights */
500
504
int availableHeight = height - verticalSpacing * (rowCount - 1 ) - (marginTop + marginHeight * 2 + marginBottom );
501
505
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 ];
504
508
boolean [] expandRow = new boolean [rowCount ];
505
509
for (int i =0 ; i <rowCount ; i ++) {
506
510
for (int j =0 ; j <columnCount ; j ++) {
507
511
GridData data = getData (grid , i , j , rowCount , columnCount , true );
508
512
if (data != null ) {
509
513
int vSpan = Math .max (1 , Math .min (data .verticalSpan , rowCount ));
510
514
if (vSpan == 1 ) {
511
- int h = data .cacheHeight + data .verticalIndent ;
515
+ float h = data .cacheSize . getY () + data .verticalIndent ;
512
516
heights [i ] = Math .max (heights [i ], h );
513
517
if (data .grabExcessVerticalSpace ) {
514
518
if (!expandRow [i ]) expandCount ++;
515
519
expandRow [i ] = true ;
516
520
}
517
521
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 ;
519
523
h += data .verticalIndent ;
520
524
minHeights [i ] = Math .max (minHeights [i ], h );
521
525
}
@@ -537,13 +541,14 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
537
541
expandCount ++;
538
542
expandRow [i ] = true ;
539
543
}
540
- int h = data .cacheHeight + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
544
+ float h = data .cacheSize . getY () + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
541
545
if (h > 0 ) {
542
546
if (spanExpandCount == 0 ) {
543
547
heights [i ] += h ;
544
548
} 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 ;
547
552
for (int k = 0 ; k < vSpan ; k ++) {
548
553
if (expandRow [i -k ]) {
549
554
heights [last =i -k ] += delta ;
@@ -553,14 +558,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
553
558
}
554
559
}
555
560
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 ;
557
562
h += data .verticalIndent - spanMinHeight - (vSpan - 1 ) * verticalSpacing ;
558
563
if (h > 0 ) {
559
564
if (spanExpandCount == 0 ) {
560
565
minHeights [i ] += h ;
561
566
} 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 ;
564
570
for (int k = 0 ; k < vSpan ; k ++) {
565
571
if (expandRow [i -k ]) {
566
572
minHeights [last =i -k ] += delta ;
@@ -609,14 +615,15 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
609
615
spanHeight += heights [i -k ];
610
616
if (expandRow [i -k ]) spanExpandCount ++;
611
617
}
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 ;
613
619
h += data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
614
620
if (h > 0 ) {
615
621
if (spanExpandCount == 0 ) {
616
622
heights [i ] += h ;
617
623
} 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 ;
620
627
for (int k = 0 ; k < vSpan ; k ++) {
621
628
if (expandRow [i -k ]) {
622
629
heights [last2 =i -k ] += delta2 ;
@@ -660,7 +667,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
660
667
}
661
668
cellWidth += horizontalSpacing * (hSpan - 1 );
662
669
int childX = gridX + data .horizontalIndent ;
663
- int childWidth = Math .min (data .cacheWidth , cellWidth );
670
+ float childWidth = Math .min (data .cacheSize . getX () , cellWidth );
664
671
switch (data .horizontalAlignment ) {
665
672
case SWT .CENTER :
666
673
case GridData .CENTER :
@@ -677,7 +684,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
677
684
}
678
685
cellHeight += verticalSpacing * (vSpan - 1 );
679
686
int childY = gridY + data .verticalIndent ;
680
- int childHeight = Math .min (data .cacheHeight , cellHeight );
687
+ float childHeight = Math .min (data .cacheSize . getY () , cellHeight );
681
688
switch (data .verticalAlignment ) {
682
689
case SWT .CENTER :
683
690
case GridData .CENTER :
@@ -694,7 +701,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
694
701
}
695
702
Control child = grid [i ][j ];
696
703
if (child != null ) {
697
- child .setBounds (childX , childY , childWidth , childHeight );
704
+ child .setBounds (new Rectangle . OfFloat ( childX , childY , childWidth , childHeight ) );
698
705
}
699
706
}
700
707
gridX += widths [j ] + horizontalSpacing ;
@@ -705,7 +712,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
705
712
706
713
// clean up cache
707
714
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 ) ;
709
716
}
710
717
711
718
int totalDefaultWidth = 0 ;
0 commit comments