adium 4265:2275e003304f: Visually seperate the tab bar from mess...
commits at adium.im
commits at adium.im
Sat Oct 29 08:17:14 UTC 2011
details: http://hg.adium.im/adium/rev/2275e003304f
revision: 4265:2275e003304f
branch: (none)
author: Stephen Holt <sholt at adium.im>
date: Sat Oct 29 01:16:22 2011 -0700
Visually seperate the tab bar from message / text entry views.
diffs (160 lines):
diff -r f471f0bbbc83 -r 2275e003304f Plugins/Dual Window Interface/AIMessageWindowController.h
--- a/Plugins/Dual Window Interface/AIMessageWindowController.h Fri Oct 28 21:36:21 2011 -0700
+++ b/Plugins/Dual Window Interface/AIMessageWindowController.h Sat Oct 29 01:16:22 2011 -0700
@@ -36,6 +36,7 @@
@interface AIMessageWindowController : AIWindowController <NSToolbarDelegate, NSSplitViewDelegate> {
IBOutlet NSTabView *tabView_messages;
IBOutlet PSMTabBarControl *tabView_tabBar;
+ NSBox *tabView_horzLine;
PSMAdiumTabStyle *tabView_tabStyle;
AIMessageTabSplitView *tabView_splitView;
AIDualWindowInterfacePlugin *interface;
diff -r f471f0bbbc83 -r 2275e003304f Plugins/Dual Window Interface/AIMessageWindowController.m
--- a/Plugins/Dual Window Interface/AIMessageWindowController.m Fri Oct 28 21:36:21 2011 -0700
+++ b/Plugins/Dual Window Interface/AIMessageWindowController.m Sat Oct 29 01:16:22 2011 -0700
@@ -439,11 +439,13 @@
[tabView_tabBar retain];
[tabView_tabBar removeFromSuperview];
[tabView_splitView removeFromSuperview];
-
[[[self window] contentView] addSubview:tabView_messages];
[[[self window] contentView] addSubview:tabView_tabBar];
[tabView_messages release];
[tabView_tabBar release];
+ } else {
+ [tabView_horzLine removeFromSuperview];
+ tabView_horzLine = nil;
}
[tabView_tabBar setOrientation:orientation];
BOOL isTabBarHidden = [tabView_tabBar isTabBarHidden]; //!alwaysShowTabs && m_containedChats.count <= 1;
@@ -468,7 +470,8 @@
tabBarFrame.origin.y = NSMaxY(contentRect) - NSHeight(tabBarFrame);
tabViewMessagesFrame.origin.y = NSMinY(contentRect);
- tabViewMessagesFrame.size.height = NSHeight(contentRect) - NSHeight(tabBarFrame) + (isTabBarHidden? 2 : 0);
+ tabViewMessagesFrame.size.height = NSHeight(contentRect) - NSHeight(tabBarFrame) + (isTabBarHidden? 2 : 1);
+
[tabView_tabBar setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)];
}
/* If the cell is less than 60, icon + title + unread message count may overlap */
@@ -478,6 +481,18 @@
tabBarFrame.origin.x = 0;
tabViewMessagesFrame.origin.x = 0;
+ if (!isTabBarHidden){
+ NSRect horzLineFrame = NSMakeRect(tabBarFrame.origin.x, (tabPosition == AdiumTabPositionBottom)? NSMinY(tabViewMessagesFrame)-1 : NSMaxY(tabViewMessagesFrame)-2, NSWidth(tabViewMessagesFrame), 1);
+ NSUInteger mask = (tabPosition == AdiumTabPositionBottom)? (NSViewMinYMargin|NSViewWidthSizable) : (NSViewMaxYMargin|NSViewWidthSizable);
+ tabView_horzLine = [[[NSBox alloc] initWithFrame:horzLineFrame] autorelease];
+ [tabView_horzLine setBorderColor:[NSColor windowFrameColor]];
+ [tabView_horzLine setBorderWidth:1];
+ [tabView_horzLine setBorderType:NSLineBorder];
+ [tabView_horzLine setBoxType:NSBoxCustom];
+ [tabView_horzLine setAutoresizingMask:mask];
+ [[[self window] contentView] addSubview:tabView_horzLine];
+ }
+
break;
}
case PSMTabBarVerticalOrientation:
@@ -518,11 +533,13 @@
if (tabPosition == AdiumTabPositionLeft) {
[tabView_splitView addSubview:tabView_tabBar];
[tabView_splitView addSubview:tabView_messages];
+ [tabView_splitView setTabPosition:AIMessageSplitTabPositionLeft];
[tabView_splitView setLeftColor:[NSColor colorWithCalibratedWhite:0.92f alpha:1.0f]
rightColor:[NSColor colorWithCalibratedWhite:0.91f alpha:1.0f]];
} else {
[tabView_splitView addSubview:tabView_messages];
[tabView_splitView addSubview:tabView_tabBar];
+ [tabView_splitView setTabPosition:AIMessageSplitTabPositionRight];
[tabView_splitView setLeftColor:[NSColor colorWithCalibratedWhite:0.91f alpha:1.0f]
rightColor:[NSColor colorWithCalibratedWhite:0.92f alpha:1.0f]];
}
@@ -1094,8 +1111,16 @@
*/
if (tabPosition == AdiumTabPositionBottom) {
frame.origin.y -= HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
- frame.size.height += HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ frame.size.height += HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ NSRect lineFrame = tabView_horzLine.frame;
+ lineFrame.origin.y -= HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ [tabView_horzLine setFrame:lineFrame];
+ } else {
+ NSRect lineFrame = tabView_horzLine.frame;
+ lineFrame.origin.y += HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ [tabView_horzLine setFrame:lineFrame];
}
+ [tabView_horzLine setHidden:YES];
break;
case PSMTabBarVerticalOrientation:
@@ -1125,8 +1150,17 @@
*/
if (tabPosition == AdiumTabPositionBottom) {
frame.origin.y += HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
- frame.size.height -= HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ frame.size.height -= HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+
+ NSRect lineFrame = tabView_horzLine.frame;
+ lineFrame.origin.y += HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ [tabView_horzLine setFrame:lineFrame];
+ } else {
+ NSRect lineFrame = tabView_horzLine.frame;
+ lineFrame.origin.y -= HORIZONTAL_TAB_BAR_TO_VIEW_SPACING;
+ [tabView_horzLine setFrame:lineFrame];
}
+ [tabView_horzLine setHidden:NO];
break;
case PSMTabBarVerticalOrientation:
diff -r f471f0bbbc83 -r 2275e003304f Source/AIMessageTabSplitView.h
--- a/Source/AIMessageTabSplitView.h Fri Oct 28 21:36:21 2011 -0700
+++ b/Source/AIMessageTabSplitView.h Sat Oct 29 01:16:22 2011 -0700
@@ -16,11 +16,18 @@
#import <AIUtilities/AISplitView.h>
+typedef enum
+{
+ AIMessageSplitTabPositionLeft = 0,
+ AIMessageSplitTabPositionRight,
+} AIMessageSplitTabPosition;
+
@interface AIMessageTabSplitView : AISplitView {
NSColor *leftColor;
NSColor *rightColor;
+ AIMessageSplitTabPosition position;
}
- (void)setLeftColor:(NSColor *)inLeftColor rightColor:(NSColor *)inRightColor;
-
+- (void)setTabPosition:(AIMessageSplitTabPosition)inPosition;
@end
diff -r f471f0bbbc83 -r 2275e003304f Source/AIMessageTabSplitView.m
--- a/Source/AIMessageTabSplitView.m Fri Oct 28 21:36:21 2011 -0700
+++ b/Source/AIMessageTabSplitView.m Sat Oct 29 01:16:22 2011 -0700
@@ -41,12 +41,24 @@
[self setNeedsDisplay:YES];
}
+- (void)setTabPosition:(AIMessageSplitTabPosition)inPosition
+{
+ position = inPosition;
+}
+
-(void)drawDividerInRect:(NSRect)aRect
{
if (rightColor && leftColor) {
NSBezierPath *path = [NSBezierPath bezierPathWithRect:aRect];
[path linearVerticalGradientFillWithStartColor:leftColor
endColor:rightColor];
+ NSBezierPath *line = nil;
+
+ if (position == AIMessageSplitTabPositionLeft) {
+ line = [NSBezierPath bezierPathWithRect:NSMakeRect(NSMaxX(aRect) - 1, aRect.origin.y, 1, aRect.size.height)];
+ }
+ [[NSColor windowFrameColor] set];
+ [line fill];
} else {
[super drawDividerInRect:aRect];
}
More information about the commits
mailing list