From ff43fd2343a09b30865aea649fc96f222c16269b Mon Sep 17 00:00:00 2001 From: Kazuki Sakamoto Date: Mon, 19 Sep 2016 21:46:33 -0700 Subject: [PATCH] Honor defaults settings of Tab width on Yosemite or later --- src/MacVim/MMAppController.m | 24 ++++++++++++++++++++---- src/MacVim/MMVimView.m | 13 ++++++++++--- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 355f0cca82..cb2eb593db 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -181,12 +181,28 @@ fsEventCallback(ConstFSEventStreamRef streamRef, CFPreferencesSetAppValue(CFSTR("NSRepeatCountBinding"), CFSTR(""), kCFPreferencesCurrentApplication); - + + int tabMinWidthKey; + int tabMaxWidthKey; + int tabOptimumWidthKey; + if (shouldUseYosemiteTabBarStyle()) { + tabMinWidthKey = 120; + tabMaxWidthKey = 0; + tabOptimumWidthKey = 0; + } else { + tabMinWidthKey = 64; + tabMaxWidthKey = 6*64; + tabOptimumWidthKey = 132; + } + NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:NO], MMNoWindowKey, - [NSNumber numberWithInt:64], MMTabMinWidthKey, - [NSNumber numberWithInt:6*64], MMTabMaxWidthKey, - [NSNumber numberWithInt:132], MMTabOptimumWidthKey, + [NSNumber numberWithInt:tabMinWidthKey], + MMTabMinWidthKey, + [NSNumber numberWithInt:tabMaxWidthKey], + MMTabMaxWidthKey, + [NSNumber numberWithInt:tabOptimumWidthKey], + MMTabOptimumWidthKey, [NSNumber numberWithBool:YES], MMShowAddTabButtonKey, [NSNumber numberWithInt:2], MMTextInsetLeftKey, [NSNumber numberWithInt:1], MMTextInsetRightKey, diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index f62e2aec36..5cdb496c67 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -127,10 +127,17 @@ enum { if (shouldUseYosemiteTabBarStyle()) { CGFloat screenWidth = [[NSScreen mainScreen] frame].size.width; + int tabMaxWidth = [ud integerForKey:MMTabMaxWidthKey]; + if (tabMaxWidth == 0) + tabMaxWidth = screenWidth; + int tabOptimumWidth = [ud integerForKey:MMTabOptimumWidthKey]; + if (tabOptimumWidth == 0) + tabOptimumWidth = screenWidth; + [tabBarControl setStyleNamed:@"Yosemite"]; - [tabBarControl setCellMinWidth:120]; - [tabBarControl setCellMaxWidth:screenWidth]; - [tabBarControl setCellOptimumWidth:screenWidth]; + [tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]]; + [tabBarControl setCellMaxWidth:tabMaxWidth]; + [tabBarControl setCellOptimumWidth:tabOptimumWidth]; } else { [tabBarControl setCellMinWidth:[ud integerForKey:MMTabMinWidthKey]]; [tabBarControl setCellMaxWidth:[ud integerForKey:MMTabMaxWidthKey]];