Mercurial > dwindows
comparison mac/dw.m @ 1435:3c5287b8eebb
Temporary fix on Mac for box miscalculation when box is not expandable but items are in complex layouts.
There is a fundamental flaw in the calculation of these types of boxes... and after looking at the code...
in general the layout code does a lot more calculation than necessary... I will be rewriting and
simplifying this code in the near future... but this is a temporary fix to get things to work better
in the meantime.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 07 Dec 2011 18:51:48 +0000 |
parents | 6aa94c8a91de |
children | a50e8b486a1a |
comparison
equal
deleted
inserted
replaced
1434:2cca36ec3da6 | 1435:3c5287b8eebb |
---|---|
2489 | 2489 |
2490 tmp->parentxratio = thisbox->xratio; | 2490 tmp->parentxratio = thisbox->xratio; |
2491 tmp->parentyratio = thisbox->yratio; | 2491 tmp->parentyratio = thisbox->yratio; |
2492 | 2492 |
2493 tmp->parentpad = tmp->pad; | 2493 tmp->parentpad = tmp->pad; |
2494 tmp->hsize = thisbox->items[z].hsize; | |
2495 tmp->vsize = thisbox->items[z].vsize; | |
2494 | 2496 |
2495 /* Just in case */ | 2497 /* Just in case */ |
2496 tmp->xratio = thisbox->xratio; | 2498 tmp->xratio = thisbox->xratio; |
2497 tmp->yratio = thisbox->yratio; | 2499 tmp->yratio = thisbox->yratio; |
2498 | 2500 |
2605 upxmax = thisbox->items[z].pad*2; | 2607 upxmax = thisbox->items[z].pad*2; |
2606 } | 2608 } |
2607 } | 2609 } |
2608 else | 2610 else |
2609 { | 2611 { |
2610 if(thisbox->items[z].width == -1) | 2612 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); |
2611 { | 2613 if(thisbox->items[z].hsize != SIZEEXPAND) |
2612 /* figure out how much space this item requires */ | 2614 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; |
2613 /* thisbox->items[z].width = */ | |
2614 } | |
2615 else | 2615 else |
2616 { | 2616 (*usedpadx) += thisbox->items[z].pad*2; |
2617 (*usedx) += thisbox->items[z].width + (thisbox->items[z].pad*2); | |
2618 if(thisbox->items[z].hsize != SIZEEXPAND) | |
2619 (*usedpadx) += (thisbox->items[z].pad*2) + thisbox->items[z].width; | |
2620 else | |
2621 (*usedpadx) += thisbox->items[z].pad*2; | |
2622 } | |
2623 } | 2617 } |
2624 if(thisbox->type == DW_HORZ) | 2618 if(thisbox->type == DW_HORZ) |
2625 { | 2619 { |
2626 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) | 2620 if((thisbox->items[z].height + (thisbox->items[z].pad*2)) > uymax) |
2627 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); | 2621 uymax = (thisbox->items[z].height + (thisbox->items[z].pad*2)); |
2636 upymax = thisbox->items[z].pad*2; | 2630 upymax = thisbox->items[z].pad*2; |
2637 } | 2631 } |
2638 } | 2632 } |
2639 else | 2633 else |
2640 { | 2634 { |
2641 if(thisbox->items[z].height == -1) | 2635 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); |
2642 { | 2636 if(thisbox->items[z].vsize != SIZEEXPAND) |
2643 /* figure out how much space this item requires */ | 2637 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; |
2644 /* thisbox->items[z].height = */ | |
2645 } | |
2646 else | 2638 else |
2647 { | 2639 (*usedpady) += thisbox->items[z].pad*2; |
2648 (*usedy) += thisbox->items[z].height + (thisbox->items[z].pad*2); | |
2649 if(thisbox->items[z].vsize != SIZEEXPAND) | |
2650 (*usedpady) += (thisbox->items[z].pad*2) + thisbox->items[z].height; | |
2651 else | |
2652 (*usedpady) += thisbox->items[z].pad*2; | |
2653 } | |
2654 } | 2640 } |
2655 } | 2641 } |
2656 | 2642 |
2657 (*usedx) += uxmax; | 2643 (*usedx) += uxmax; |
2658 (*usedy) += uymax; | 2644 (*usedy) += uymax; |
2749 if(thisbox->items[z].hsize != SIZEEXPAND) | 2735 if(thisbox->items[z].hsize != SIZEEXPAND) |
2750 vectorx = 0; | 2736 vectorx = 0; |
2751 | 2737 |
2752 point.x = currentx + pad; | 2738 point.x = currentx + pad; |
2753 point.y = currenty + pad; | 2739 point.y = currenty + pad; |
2754 size.width = width + vectorx; | 2740 if(thisbox->type == DW_VERT && thisbox->hsize == SIZESTATIC && thisbox->items[z].hsize == SIZEEXPAND && thisbox->width) |
2755 size.height = height + vectory; | 2741 size.width = thisbox->width; |
2742 else | |
2743 size.width = width + vectorx; | |
2744 if(thisbox->type == DW_HORZ && thisbox->vsize == SIZESTATIC && thisbox->items[z].vsize == SIZEEXPAND && thisbox->height) | |
2745 size.height = thisbox->height; | |
2746 else | |
2747 size.height = height + vectory; | |
2756 [handle setFrameOrigin:point]; | 2748 [handle setFrameOrigin:point]; |
2757 [handle setFrameSize:size]; | 2749 [handle setFrameSize:size]; |
2758 | 2750 |
2759 /* After placing a box... place its components */ | 2751 /* After placing a box... place its components */ |
2760 if(thisbox->items[z].type == TYPEBOX) | 2752 if(thisbox->items[z].type == TYPEBOX) |