Changeset 3360

Show
Ignore:
Timestamp:
09/27/06 01:20:00 (2 years ago)
Author:
timothy
Message:

Attempt a fix for #611. Still no luck. =\

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Panels/JVChatConsolePanel.m

    r3259 r3360  
    5252 
    5353        if( [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) 
    54                 [(JVSplitView *)[[[send superview] superview] superview] setIsPaneSplitter:YES]; 
     54                [(JVSplitView *)[[send enclosingScrollView] superview] setIsPaneSplitter:YES]; 
    5555} 
    5656 
     
    204204- (void) didSelect { 
    205205        if( ! [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) { 
    206                 [(JVSplitView *)[[[send superview] superview] superview] setPositionUsingName:@"JVChatSplitViewPosition"]; 
     206                [(JVSplitView *)[[send enclosingScrollView] superview] setPositionUsingName:@"JVChatSplitViewPosition"]; 
    207207        } else [self textDidChange:nil]; 
    208208} 
     
    290290        [attrs setObject:para forKey:NSParagraphStyleAttributeName]; 
    291291 
    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; 
    294295        else _scrollerIsAtBottom = NO; 
    295296 
     
    375376        [send reset:nil]; 
    376377        [self textDidChange:nil]; 
    377         [display scrollRangeToVisible:NSMakeRange( [[display string] length], 0 )]; 
     378        [self performScrollToBottom]; 
    378379} 
    379380 
     
    462463        // We need to resize the textview to fit the content. 
    463464        // 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]; 
    465466        NSRect splitViewFrame = [splitView frame]; 
    466467        NSSize contentSize = [send minimumSizeForContent]; 
    467         NSRect sendFrame = [[[send superview] superview] frame]; 
     468        NSRect sendFrame = [[send enclosingScrollView] frame]; 
    468469        float dividerThickness = [splitView dividerThickness]; 
    469470        float maxContentHeight = ( NSHeight( splitViewFrame ) - dividerThickness - 75. ); 
     
    472473        if( newContentHeight == NSHeight( sendFrame ) ) return; 
    473474 
    474         NSRect displayFrame = [[[display superview] superview] frame]; 
     475        NSRect displayFrame = [[display enclosingScrollView] frame]; 
    475476 
    476477        // Set size of the web view to the maximum size possible 
     
    484485        [[display window] disableFlushWindow]; // prevent any draw (white) flashing that might occur 
    485486 
    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; 
    488490        else _scrollerIsAtBottom = NO; 
    489491 
    490492        // 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]; 
    493495 
    494496        if( _scrollerIsAtBottom ) 
    495                 [display scrollRangeToVisible:NSMakeRange( [[display string] length], 0 )]; 
     497                [self performScrollToBottom]; 
    496498 
    497499        [splitView setNeedsDisplay:YES]; // makes the divider redraw correctly later 
     
    590592- (void) splitViewDidResizeSubviews:(NSNotification *) notification { 
    591593        // 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]; 
    593595        _sendHeight = sendFrame.size.height; 
    594596 
    595597        if( _scrollerIsAtBottom ) 
    596                 [display scrollRangeToVisible:NSMakeRange( [[display string] length], 0 )]; 
     598                [self performScrollToBottom]; 
    597599 
    598600        if( ! _forceSplitViewPosition && ! [[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatInputAutoResizes"] ) 
     
    603605 
    604606- (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; 
    607610        else _scrollerIsAtBottom = NO; 
    608611} 
     
    616619        // We need to resize the scroll view frames of the webview and the textview. 
    617620        // 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]; 
    620623 
    621624        // Set size of the web view to the maximum size possible 
     
    630633 
    631634        // 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]; 
    634637} 
    635638@end