From 711ec0b3bb7c7d09c75c81fd3fe12b329bd6b58e Mon Sep 17 00:00:00 2001 From: Evan Schoenberg Date: Thu, 3 Jan 2008 18:18:48 +0000 Subject: [PATCH] After the tab view hides or shows (including when the chat window first opens, if the tab view is not set to always show), we need to readjust the size of the text entry view. Fixes #8701 git-svn-id: svn://svn.adiumx.com/adium/trunk@22112 1c916fce-81e2-0310-a464-8ca513f45935 --- .../Source/AITigerCompatibility.h | 4 ++ .../Dual Window Interface/AIMessageTabViewItem.h | 1 + .../Dual Window Interface/AIMessageTabViewItem.m | 5 +++ .../AIMessageViewController.h | 3 +- .../AIMessageViewController.m | 45 ++++++++++++++-------- .../AIMessageWindowController.m | 5 ++- 6 files changed, 45 insertions(+), 18 deletions(-) diff --git a/Frameworks/AIUtilities Framework/Source/AITigerCompatibility.h b/Frameworks/AIUtilities Framework/Source/AITigerCompatibility.h index 398c4fa76..b0450b1fe 100644 --- a/Frameworks/AIUtilities Framework/Source/AITigerCompatibility.h +++ b/Frameworks/AIUtilities Framework/Source/AITigerCompatibility.h @@ -51,6 +51,10 @@ - (BOOL)isGrammarCheckingEnabled; - (void)toggleGrammarChecking:(id)sender; @end + + @interface NSSplitView (NSScrollViewTigerMethods) + - (void)setPosition:(float)position ofDividerAtIndex:(NSInteger)dividerIndex; + @end # endif #else //Not compiling for 10.5 diff --git a/Plugins/Dual Window Interface/AIMessageTabViewItem.h b/Plugins/Dual Window Interface/AIMessageTabViewItem.h index 7877d17a1..e8ed7ee23 100644 --- a/Plugins/Dual Window Interface/AIMessageTabViewItem.h +++ b/Plugins/Dual Window Interface/AIMessageTabViewItem.h @@ -37,6 +37,7 @@ - (NSImage *)image; - (AIMessageViewController *)messageViewController; - (void)tabViewItemWasSelected; +- (void)tabViewDidChangeVisibility; - (void)setWindowController:(AIMessageWindowController *)inWindowController; - (AIMessageWindowController *)windowController; diff --git a/Plugins/Dual Window Interface/AIMessageTabViewItem.m b/Plugins/Dual Window Interface/AIMessageTabViewItem.m index fc064dd42..dff4e8609 100644 --- a/Plugins/Dual Window Interface/AIMessageTabViewItem.m +++ b/Plugins/Dual Window Interface/AIMessageTabViewItem.m @@ -294,4 +294,9 @@ [[self chat] unviewedContentCount] : 0); } +- (void)tabViewDidChangeVisibility +{ + [[self messageViewController] tabViewDidChangeVisibility]; +} + @end diff --git a/Plugins/Dual Window Interface/AIMessageViewController.h b/Plugins/Dual Window Interface/AIMessageViewController.h index 3d144f618..7942bf6c9 100644 --- a/Plugins/Dual Window Interface/AIMessageViewController.h +++ b/Plugins/Dual Window Interface/AIMessageViewController.h @@ -98,8 +98,7 @@ // -(void)collapseShelfView; -(void)toggleUserlist:(id)sender; - - +- (void)tabViewDidChangeVisibility; @end diff --git a/Plugins/Dual Window Interface/AIMessageViewController.m b/Plugins/Dual Window Interface/AIMessageViewController.m index 78c3ba46c..ce71150cb 100644 --- a/Plugins/Dual Window Interface/AIMessageViewController.m +++ b/Plugins/Dual Window Interface/AIMessageViewController.m @@ -46,6 +46,8 @@ #import #import +#import + #import #import "KNShelfSplitView.h" #import "ESChatUserListController.h" @@ -765,6 +767,11 @@ [self _updateTextEntryViewHeight]; } +- (void)tabViewDidChangeVisibility +{ + [self _updateTextEntryViewHeight]; +} + /* * @brief Update the height of our text entry view * @@ -774,26 +781,34 @@ - (void)_updateTextEntryViewHeight { int height = [self _textEntryViewProperHeightIgnoringUserMininum:NO]; - NSRect tempFrame, newFrame; - BOOL changed = NO; //Display the vertical scroller if our view is not tall enough to display all the entered text [scrollView_outgoing setHasVerticalScroller:(height < [textView_outgoing desiredSize].height)]; - //Size the outgoing text view to the desired height - tempFrame = [scrollView_outgoing frame]; - newFrame = NSMakeRect(tempFrame.origin.x, - [splitView_textEntryHorizontal frame].size.height - height, - tempFrame.size.width, - height); - if (!NSEqualRects(tempFrame, newFrame)) { - [scrollView_outgoing setFrame:newFrame]; - [scrollView_outgoing setNeedsDisplay:YES]; - changed = YES; - } + if ([NSApp isOnLeopardOrBetter]) { + //Attempt to maximize the message view's size. We'll automatically restrict it to the correct minimum via the NSSplitView's delegate methods. + [splitView_textEntryHorizontal setPosition:NSHeight([splitView_textEntryHorizontal frame]) + ofDividerAtIndex:0]; + + } else { + NSRect tempFrame, newFrame; + BOOL changed = NO; + + //Size the outgoing text view to the desired height + tempFrame = [scrollView_outgoing frame]; + newFrame = NSMakeRect(tempFrame.origin.x, + [splitView_textEntryHorizontal frame].size.height - height, + tempFrame.size.width, + height); + if (!NSEqualRects(tempFrame, newFrame)) { + [scrollView_outgoing setFrame:newFrame]; + [scrollView_outgoing setNeedsDisplay:YES]; + changed = YES; + } - if (changed) { - [splitView_textEntryHorizontal adjustSubviews]; + if (changed) { + [splitView_textEntryHorizontal adjustSubviews]; + } } } diff --git a/Plugins/Dual Window Interface/AIMessageWindowController.m b/Plugins/Dual Window Interface/AIMessageWindowController.m index 4e7049359..fc781474c 100644 --- a/Plugins/Dual Window Interface/AIMessageWindowController.m +++ b/Plugins/Dual Window Interface/AIMessageWindowController.m @@ -54,7 +54,6 @@ @interface AIMessageWindowController (PRIVATE) - (id)initWithWindowNibName:(NSString *)windowNibName interface:(AIDualWindowInterfacePlugin *)inInterface containerID:(NSString *)inContainerID containerName:(NSString *)inName; -- (void)preferencesChanged:(NSNotification *)notification; - (void)_configureToolbar; - (void)_updateWindowTitleAndIcon; - (NSString *)_frameSaveKey; @@ -996,6 +995,8 @@ [tabView setFrame:frame]; [tabView setNeedsDisplay:YES]; + + [[tabView_messages tabViewItems] makeObjectsPerformSelector:@selector(tabViewDidChangeVisibility)]; } - (void)tabView:(NSTabView *)tabView tabBarDidUnhide:(PSMTabBarControl *)tabBarControl @@ -1019,6 +1020,8 @@ [tabView setFrame:frame]; [tabView setNeedsDisplay:YES]; + + [[tabView_messages tabViewItems] makeObjectsPerformSelector:@selector(tabViewDidChangeVisibility)]; } - (float)desiredWidthForVerticalTabBar:(PSMTabBarControl *)tabBarControl -- 2.11.4.GIT