Changeset 3360
- Timestamp:
- 09/27/06 01:20:00 (2 years ago)
- Files:
-
- trunk/Panels/JVChatConsolePanel.m (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Panels/JVChatConsolePanel.m
r3259 r3360 52 52 53 53 if( [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) 54 [(JVSplitView *)[[ [send superview] superview] superview] setIsPaneSplitter:YES];54 [(JVSplitView *)[[send enclosingScrollView] superview] setIsPaneSplitter:YES]; 55 55 } 56 56 … … 204 204 - (void) didSelect { 205 205 if( ! [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) { 206 [(JVSplitView *)[[ [send superview] superview] superview] setPositionUsingName:@"JVChatSplitViewPosition"];206 [(JVSplitView *)[[send enclosingScrollView] superview] setPositionUsingName:@"JVChatSplitViewPosition"]; 207 207 } else [self textDidChange:nil]; 208 208 } … … 290 290 [attrs setObject:para forKey:NSParagraphStyleAttributeName]; 291 291 292 NSScroller *scroller = [(NSScrollView *)[[display superview] superview] verticalScroller]; 293 if( ! scroller || [scroller floatValue] == 1. ) _scrollerIsAtBottom = YES; 292 NSScrollView *scrollView = [display enclosingScrollView]; 293 NSScroller *scroller = [scrollView verticalScroller]; 294 if( ! [scrollView hasVerticalScroller] || [scroller floatValue] >= 0.995 ) _scrollerIsAtBottom = YES; 294 295 else _scrollerIsAtBottom = NO; 295 296 … … 375 376 [send reset:nil]; 376 377 [self textDidChange:nil]; 377 [ display scrollRangeToVisible:NSMakeRange( [[display string] length], 0 )];378 [self performScrollToBottom]; 378 379 } 379 380 … … 462 463 // We need to resize the textview to fit the content. 463 464 // The scroll views are two superviews up: NSTextView -> NSClipView -> NSScrollView 464 NSSplitView *splitView = (NSSplitView *)[[ [send superview] superview] superview];465 NSSplitView *splitView = (NSSplitView *)[[send enclosingScrollView] superview]; 465 466 NSRect splitViewFrame = [splitView frame]; 466 467 NSSize contentSize = [send minimumSizeForContent]; 467 NSRect sendFrame = [[ [send superview] superview] frame];468 NSRect sendFrame = [[send enclosingScrollView] frame]; 468 469 float dividerThickness = [splitView dividerThickness]; 469 470 float maxContentHeight = ( NSHeight( splitViewFrame ) - dividerThickness - 75. ); … … 472 473 if( newContentHeight == NSHeight( sendFrame ) ) return; 473 474 474 NSRect displayFrame = [[ [display superview] superview] frame];475 NSRect displayFrame = [[display enclosingScrollView] frame]; 475 476 476 477 // Set size of the web view to the maximum size possible … … 484 485 [[display window] disableFlushWindow]; // prevent any draw (white) flashing that might occur 485 486 486 NSScroller *scroller = [(NSScrollView *)[[display superview] superview] verticalScroller]; 487 if( ! scroller || [scroller floatValue] == 1. ) _scrollerIsAtBottom = YES; 487 NSScrollView *scrollView = [display enclosingScrollView]; 488 NSScroller *scroller = [scrollView verticalScroller]; 489 if( ! [scrollView hasVerticalScroller] || [scroller floatValue] >= 0.995 ) _scrollerIsAtBottom = YES; 488 490 else _scrollerIsAtBottom = NO; 489 491 490 492 // Commit the changes 491 [[ [send superview] superview] setFrame:sendFrame];492 [[ [display superview] superview] setFrame:displayFrame];493 [[send enclosingScrollView] setFrame:sendFrame]; 494 [[display enclosingScrollView] setFrame:displayFrame]; 493 495 494 496 if( _scrollerIsAtBottom ) 495 [ display scrollRangeToVisible:NSMakeRange( [[display string] length], 0 )];497 [self performScrollToBottom]; 496 498 497 499 [splitView setNeedsDisplay:YES]; // makes the divider redraw correctly later … … 590 592 - (void) splitViewDidResizeSubviews:(NSNotification *) notification { 591 593 // Cache the height of the send box so we can keep it constant during window resizes. 592 NSRect sendFrame = [[ [send superview] superview] frame];594 NSRect sendFrame = [[send enclosingScrollView] frame]; 593 595 _sendHeight = sendFrame.size.height; 594 596 595 597 if( _scrollerIsAtBottom ) 596 [ display scrollRangeToVisible:NSMakeRange( [[display string] length], 0 )];598 [self performScrollToBottom]; 597 599 598 600 if( ! _forceSplitViewPosition && ! [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) … … 603 605 604 606 - (void) splitViewWillResizeSubviews:(NSNotification *) notification { 605 NSScroller *scroller = [(NSScrollView *)[[display superview] superview] verticalScroller]; 606 if( ! scroller || [scroller floatValue] == 1. ) _scrollerIsAtBottom = YES; 607 NSScrollView *scrollView = [display enclosingScrollView]; 608 NSScroller *scroller = [scrollView verticalScroller]; 609 if( ! [scrollView hasVerticalScroller] || [scroller floatValue] >= 0.995 ) _scrollerIsAtBottom = YES; 607 610 else _scrollerIsAtBottom = NO; 608 611 } … … 616 619 // We need to resize the scroll view frames of the webview and the textview. 617 620 // The scroll views are two superviews up: NSTextView(WebView) -> NSClipView -> NSScrollView 618 NSRect sendFrame = [[ [send superview] superview] frame];619 NSRect displayFrame = [[ [display superview] superview] frame];621 NSRect sendFrame = [[send enclosingScrollView] frame]; 622 NSRect displayFrame = [[display enclosingScrollView] frame]; 620 623 621 624 // Set size of the web view to the maximum size possible … … 630 633 631 634 // Commit the changes 632 [[ [send superview] superview] setFrame:sendFrame];633 [[ [display superview] superview] setFrame:displayFrame];635 [[send enclosingScrollView] setFrame:sendFrame]; 636 [[display enclosingScrollView] setFrame:displayFrame]; 634 637 } 635 638 @end
