mirror of
https://github.com/textmate/textmate.git
synced 2026-01-21 04:38:13 -05:00
Shrink height when tabs above document is enabled
This commit is contained in:
committed by
Allan Odgaard
parent
a9d80f5a0d
commit
034dd8f06b
@@ -1,5 +1,6 @@
|
||||
#import "OFBHeaderView.h"
|
||||
#import <OakAppKit/OakAppKit.h>
|
||||
#import <Preferences/Keys.h>
|
||||
|
||||
static NSButton* OakCreateImageButton (NSString* imageName)
|
||||
{
|
||||
@@ -26,6 +27,10 @@ static NSPopUpButton* OakCreatePopUpButton ()
|
||||
return res;
|
||||
}
|
||||
|
||||
@interface OFBHeaderView ()
|
||||
@property (nonatomic) BOOL matchTabBarHeight;
|
||||
@end
|
||||
|
||||
@implementation OFBHeaderView
|
||||
- (id)initWithFrame:(NSRect)aRect
|
||||
{
|
||||
@@ -53,12 +58,34 @@ static NSPopUpButton* OakCreatePopUpButton ()
|
||||
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-(-3)-[folder(>=75)]-(3)-[divider][shading]-(2)-[back(==22)]-(2)-[forward(==back)]-(3)-|" options:0 metrics:nil views:views]];
|
||||
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[folder(==divider,==shading,==back,==forward)]|" options:0 metrics:nil views:views]];
|
||||
|
||||
[self userDefaultsDidChange:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:[NSUserDefaults standardUserDefaults]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)userDefaultsDidChange:(NSNotification*)aNotification
|
||||
{
|
||||
self.matchTabBarHeight = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsTabsAboveDocumentKey];
|
||||
}
|
||||
|
||||
- (void)setMatchTabBarHeight:(BOOL)flag
|
||||
{
|
||||
if(_matchTabBarHeight != flag)
|
||||
{
|
||||
_matchTabBarHeight = flag;
|
||||
[self invalidateIntrinsicContentSize];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSSize)intrinsicContentSize
|
||||
{
|
||||
return NSMakeSize(NSViewNoInstrinsicMetric, 24);
|
||||
return NSMakeSize(NSViewNoInstrinsicMetric, self.matchTabBarHeight ? 20 : 24);
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user