Mercurial > dwindows
comparison mac/dw.m @ 1553:46a2123ff570
Cleanup of the previous commits on Mac, don't do more calculations than we need to.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 14 Jan 2012 19:05:56 +0000 |
parents | f00f91d15cbf |
children | 4a9c574d5c17 |
comparison
equal
deleted
inserted
replaced
1552:f00f91d15cbf | 1553:46a2123ff570 |
---|---|
3541 if([ object isMemberOfClass:[DWMLE class] ]) | 3541 if([ object isMemberOfClass:[DWMLE class] ]) |
3542 { | 3542 { |
3543 NSScrollView *sv = [object scrollview]; | 3543 NSScrollView *sv = [object scrollview]; |
3544 NSSize frame = [sv frame].size; | 3544 NSSize frame = [sv frame].size; |
3545 BOOL hscroll = [sv hasHorizontalScroller]; | 3545 BOOL hscroll = [sv hasHorizontalScroller]; |
3546 BOOL scrolled = FALSE; | |
3547 | 3546 |
3548 /* Make sure word wrap is off for the first part */ | 3547 /* Make sure word wrap is off for the first part */ |
3549 if(!hscroll) | 3548 if(!hscroll) |
3550 { | 3549 { |
3551 [[object textContainer] setWidthTracksTextView:NO]; | 3550 [[object textContainer] setWidthTracksTextView:NO]; |
3561 /* Re-enable word wrapping if it was on */ | 3560 /* Re-enable word wrapping if it was on */ |
3562 if(!hscroll) | 3561 if(!hscroll) |
3563 { | 3562 { |
3564 [[object textContainer] setWidthTracksTextView:YES]; | 3563 [[object textContainer] setWidthTracksTextView:YES]; |
3565 [sv setHasHorizontalScroller:NO]; | 3564 [sv setHasHorizontalScroller:NO]; |
3566 } | |
3567 /* If the un wrapped it is beyond the bounds... */ | |
3568 if(size.width > _DW_SCROLLED_MAX_WIDTH) | |
3569 { | |
3570 NSSize max = [object maxSize]; | |
3571 | 3565 |
3572 /* Set the flag for later */ | 3566 /* If the un wrapped it is beyond the bounds... */ |
3573 scrolled = TRUE; | 3567 if(size.width > _DW_SCROLLED_MAX_WIDTH) |
3574 /* Set the max size to the limit */ | 3568 { |
3575 [object setMaxSize:NSMakeSize(_DW_SCROLLED_MAX_WIDTH, max.height)]; | 3569 NSSize max = [object maxSize]; |
3576 /* Recalculate the size */ | 3570 |
3577 [object sizeToFit]; | 3571 /* Set the max size to the limit */ |
3578 size = [object bounds].size; | 3572 [object setMaxSize:NSMakeSize(_DW_SCROLLED_MAX_WIDTH, max.height)]; |
3579 size.width += 2.0; | 3573 /* Recalculate the size */ |
3580 size.height += 2.0; | 3574 [object sizeToFit]; |
3581 [object setMaxSize:max]; | 3575 size = [object bounds].size; |
3576 size.width += 2.0; | |
3577 size.height += 2.0; | |
3578 [object setMaxSize:max]; | |
3579 } | |
3582 } | 3580 } |
3583 [sv setFrameSize:frame]; | 3581 [sv setFrameSize:frame]; |
3584 /* Take into account the horizontal scrollbar */ | 3582 /* Take into account the horizontal scrollbar */ |
3585 if(hscroll && scrolled) | 3583 if(hscroll && size.width > _DW_SCROLLED_MAX_WIDTH) |
3586 size.height += 16.0; | 3584 size.height += 16.0; |
3587 } | 3585 } |
3588 else | 3586 else |
3589 size = [object frame].size; | 3587 size = [object frame].size; |
3590 | 3588 |