@@ -292,16 +292,16 @@ 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 .cacheWidth + data .horizontalIndent ;
305
305
widths [j ] = Math .max (widths [j ], w );
306
306
if (data .grabExcessHorizontalSpace ) {
307
307
if (!expandColumn [j ]) expandCount ++;
@@ -330,27 +330,23 @@ 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 .cacheWidth + 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 ;
338
337
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 ]);
340
339
}
341
- if (last > -1 ) widths [last ] += remainder ;
342
340
} else {
343
341
if (spanExpandCount == 0 ) {
344
342
widths [j ] += w ;
345
343
} else {
346
- int delta = w / spanExpandCount ;
347
- int remainder = w % spanExpandCount , last = -1 ;
344
+ float delta = w / spanExpandCount ;
348
345
for (int k = 0 ; k < hSpan ; k ++) {
349
346
if (expandColumn [j -k ]) {
350
- widths [last = j -k ] += delta ;
347
+ widths [j -k ] += delta ;
351
348
}
352
349
}
353
- if (last > -1 ) widths [last ] += remainder ;
354
350
}
355
351
}
356
352
}
@@ -361,14 +357,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
361
357
if (spanExpandCount == 0 ) {
362
358
minWidths [j ] += w ;
363
359
} else {
364
- int delta = w / spanExpandCount ;
365
- int remainder = w % spanExpandCount , last = -1 ;
360
+ float delta = w / spanExpandCount ;
366
361
for (int k = 0 ; k < hSpan ; k ++) {
367
362
if (expandColumn [j -k ]) {
368
- minWidths [last = j -k ] += delta ;
363
+ minWidths [j -k ] += delta ;
369
364
}
370
365
}
371
- if (last > -1 ) minWidths [last ] += remainder ;
372
366
}
373
367
}
374
368
}
@@ -377,8 +371,8 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
377
371
}
378
372
}
379
373
if (makeColumnsEqualWidth ) {
380
- int minColumnWidth = 0 ;
381
- int columnWidth = 0 ;
374
+ float minColumnWidth = 0 ;
375
+ float columnWidth = 0 ;
382
376
for (int i =0 ; i <columnCount ; i ++) {
383
377
minColumnWidth = Math .max (minColumnWidth , minWidths [i ]);
384
378
columnWidth = Math .max (columnWidth , widths [i ]);
@@ -424,20 +418,18 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
424
418
spanWidth += widths [j -k ];
425
419
if (expandColumn [j -k ]) spanExpandCount ++;
426
420
}
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 ;
428
422
w += data .horizontalIndent - spanWidth - (hSpan - 1 ) * horizontalSpacing ;
429
423
if (w > 0 ) {
430
424
if (spanExpandCount == 0 ) {
431
425
widths [j ] += w ;
432
426
} else {
433
- int delta2 = w / spanExpandCount ;
434
- int remainder2 = w % spanExpandCount , last2 = -1 ;
427
+ float delta2 = w / spanExpandCount ;
435
428
for (int k = 0 ; k < hSpan ; k ++) {
436
429
if (expandColumn [j -k ]) {
437
- widths [last2 = j -k ] += delta2 ;
430
+ widths [j -k ] += delta2 ;
438
431
}
439
432
}
440
- if (last2 > -1 ) widths [last2 ] += remainder2 ;
441
433
}
442
434
}
443
435
}
@@ -499,16 +491,16 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
499
491
/* Row heights */
500
492
int availableHeight = height - verticalSpacing * (rowCount - 1 ) - (marginTop + marginHeight * 2 + marginBottom );
501
493
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 ];
504
496
boolean [] expandRow = new boolean [rowCount ];
505
497
for (int i =0 ; i <rowCount ; i ++) {
506
498
for (int j =0 ; j <columnCount ; j ++) {
507
499
GridData data = getData (grid , i , j , rowCount , columnCount , true );
508
500
if (data != null ) {
509
501
int vSpan = Math .max (1 , Math .min (data .verticalSpan , rowCount ));
510
502
if (vSpan == 1 ) {
511
- int h = data .cacheHeight + data .verticalIndent ;
503
+ float h = data .cacheHeight + data .verticalIndent ;
512
504
heights [i ] = Math .max (heights [i ], h );
513
505
if (data .grabExcessVerticalSpace ) {
514
506
if (!expandRow [i ]) expandCount ++;
@@ -537,19 +529,17 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
537
529
expandCount ++;
538
530
expandRow [i ] = true ;
539
531
}
540
- int h = data .cacheHeight + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
532
+ float h = data .cacheHeight + data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
541
533
if (h > 0 ) {
542
534
if (spanExpandCount == 0 ) {
543
535
heights [i ] += h ;
544
536
} else {
545
- int delta = h / spanExpandCount ;
546
- int remainder = h % spanExpandCount , last = -1 ;
537
+ float delta = h / spanExpandCount ;
547
538
for (int k = 0 ; k < vSpan ; k ++) {
548
539
if (expandRow [i -k ]) {
549
- heights [last = i -k ] += delta ;
540
+ heights [i -k ] += delta ;
550
541
}
551
542
}
552
- if (last > -1 ) heights [last ] += remainder ;
553
543
}
554
544
}
555
545
if (!data .grabExcessVerticalSpace || data .minimumHeight != 0 ) {
@@ -559,14 +549,12 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
559
549
if (spanExpandCount == 0 ) {
560
550
minHeights [i ] += h ;
561
551
} else {
562
- int delta = h / spanExpandCount ;
563
- int remainder = h % spanExpandCount , last = -1 ;
552
+ float delta = h / spanExpandCount ;
564
553
for (int k = 0 ; k < vSpan ; k ++) {
565
554
if (expandRow [i -k ]) {
566
- minHeights [last = i -k ] += delta ;
555
+ minHeights [i -k ] += delta ;
567
556
}
568
557
}
569
- if (last > -1 ) minHeights [last ] += remainder ;
570
558
}
571
559
}
572
560
}
@@ -609,20 +597,18 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
609
597
spanHeight += heights [i -k ];
610
598
if (expandRow [i -k ]) spanExpandCount ++;
611
599
}
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 ;
613
601
h += data .verticalIndent - spanHeight - (vSpan - 1 ) * verticalSpacing ;
614
602
if (h > 0 ) {
615
603
if (spanExpandCount == 0 ) {
616
604
heights [i ] += h ;
617
605
} else {
618
- int delta2 = h / spanExpandCount ;
619
- int remainder2 = h % spanExpandCount , last2 = -1 ;
606
+ float delta2 = h / spanExpandCount ;
620
607
for (int k = 0 ; k < vSpan ; k ++) {
621
608
if (expandRow [i -k ]) {
622
- heights [last2 = i -k ] += delta2 ;
609
+ heights [i -k ] += delta2 ;
623
610
}
624
611
}
625
- if (last2 > -1 ) heights [last2 ] += remainder2 ;
626
612
}
627
613
}
628
614
}
@@ -651,7 +637,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
651
637
if (data != null ) {
652
638
int hSpan = Math .max (1 , Math .min (data .horizontalSpan , columnCount ));
653
639
int vSpan = Math .max (1 , data .verticalSpan );
654
- int cellWidth = 0 , cellHeight = 0 ;
640
+ float cellWidth = 0 , cellHeight = 0 ;
655
641
for (int k =0 ; k <hSpan ; k ++) {
656
642
cellWidth += widths [j +k ];
657
643
}
@@ -660,7 +646,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
660
646
}
661
647
cellWidth += horizontalSpacing * (hSpan - 1 );
662
648
int childX = gridX + data .horizontalIndent ;
663
- int childWidth = Math .min (data .cacheWidth , cellWidth );
649
+ float childWidth = Math .min (data .cacheWidth , cellWidth );
664
650
switch (data .horizontalAlignment ) {
665
651
case SWT .CENTER :
666
652
case GridData .CENTER :
@@ -677,7 +663,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
677
663
}
678
664
cellHeight += verticalSpacing * (vSpan - 1 );
679
665
int childY = gridY + data .verticalIndent ;
680
- int childHeight = Math .min (data .cacheHeight , cellHeight );
666
+ float childHeight = Math .min (data .cacheHeight , cellHeight );
681
667
switch (data .verticalAlignment ) {
682
668
case SWT .CENTER :
683
669
case GridData .CENTER :
@@ -694,7 +680,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
694
680
}
695
681
Control child = grid [i ][j ];
696
682
if (child != null ) {
697
- child .setBounds (childX , childY , childWidth , childHeight );
683
+ child .setBounds (new Rectangle . OfFloat ( childX , childY , childWidth , childHeight ) );
698
684
}
699
685
}
700
686
gridX += widths [j ] + horizontalSpacing ;
@@ -708,8 +694,8 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
708
694
flush [i ].cacheWidth = flush [i ].cacheHeight = -1 ;
709
695
}
710
696
711
- int totalDefaultWidth = 0 ;
712
- int totalDefaultHeight = 0 ;
697
+ float totalDefaultWidth = 0 ;
698
+ float totalDefaultHeight = 0 ;
713
699
for (int i =0 ; i <columnCount ; i ++) {
714
700
totalDefaultWidth += widths [i ];
715
701
}
@@ -718,7 +704,7 @@ Point layout (Composite composite, boolean move, int x, int y, int width, int he
718
704
}
719
705
totalDefaultWidth += horizontalSpacing * (columnCount - 1 ) + marginLeft + marginWidth * 2 + marginRight ;
720
706
totalDefaultHeight += verticalSpacing * (rowCount - 1 ) + marginTop + marginHeight * 2 + marginBottom ;
721
- return new Point (totalDefaultWidth , totalDefaultHeight );
707
+ return new Point . OfFloat (totalDefaultWidth , totalDefaultHeight );
722
708
}
723
709
724
710
String getName () {
0 commit comments