Skip to content
Snippets Groups Projects
Commit d8dbef2e authored by George Nachman's avatar George Nachman
Browse files

Merge branch 'master' of https://github.com/gnachman/iTerm2

parents 05ee09eb f070a459
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
Loading
Loading
@@ -22,6 +22,11 @@
<action selector="showAbout:" target="201" id="509"/>
</connections>
</menuItem>
<menuItem title="Show Tip of the Day" id="ft3-BP-igZ">
<connections>
<action selector="showTipOfTheDay:" target="201" id="mc2-ec-uGY"/>
</connections>
</menuItem>
<menuItem title="Check For Updates…" id="880">
<connections>
<action selector="checkForUpdates:" target="879" id="881"/>
Loading
Loading
@@ -1015,6 +1020,7 @@ DQ
</menu>
<customObject id="201" userLabel="iTermApplicationDelegate" customClass="iTermApplicationDelegate">
<connections>
<outlet property="_showTipOfTheDay" destination="ft3-BP-igZ" id="WZt-qp-iuC"/>
<outlet property="bookmarkMenu" destination="592" id="874"/>
<outlet property="closeTab" destination="635" id="795"/>
<outlet property="closeWindow" destination="598" id="796"/>
Loading
Loading
Loading
Loading
@@ -201,6 +201,9 @@ static void RollInHotkeyTerm(PseudoTerminal* term)
}
if (rollIn) {
RollInHotkeyTerm(term);
} else {
// Order out for issue 4065.
[[term window] orderOut:nil];
}
return YES;
}
Loading
Loading
Loading
Loading
@@ -126,6 +126,7 @@ static BOOL hasBecomeActive = NO;
IBOutlet NSMenuItem *showFullScreenTabs;
IBOutlet NSMenuItem *useTransparency;
IBOutlet NSMenuItem *maximizePane;
IBOutlet NSMenuItem *_showTipOfTheDay; // Here because we must remove it for older OS versions.
BOOL secureInputDesired_;
BOOL quittingBecauseLastWindowClosed_;
 
Loading
Loading
@@ -678,8 +679,7 @@ static BOOL hasBecomeActive = NO;
[[iTermController sharedInstance] loadWindowArrangementWithName:[sender title]];
}
 
- (void)awakeFromNib
{
- (void)awakeFromNib {
secureInputDesired_ = [[[NSUserDefaults standardUserDefaults] objectForKey:@"Secure Input"] boolValue];
 
NSMenu *appMenu = [NSApp mainMenu];
Loading
Loading
@@ -695,6 +695,10 @@ static BOOL hasBecomeActive = NO;
keyEquivalent:@""] autorelease];
[item setView:labelTrackView];
[viewMenu addItem:item];
if (![iTermTipController sharedInstance]) {
[_showTipOfTheDay.menu removeItem:_showTipOfTheDay];
}
}
 
- (IBAction)openPasswordManager:(id)sender {
Loading
Loading
@@ -1548,6 +1552,8 @@ static BOOL hasBecomeActive = NO;
} else if ([menuItem action] == @selector(toggleMultiLinePasteWarning:)) {
menuItem.state = [self warnBeforeMultiLinePaste] ? NSOnState : NSOffState;
return YES;
} else if ([menuItem action] == @selector(showTipOfTheDay:)) {
return ![[iTermTipController sharedInstance] showingTip];
} else {
return YES;
}
Loading
Loading
@@ -1656,6 +1662,10 @@ static BOOL hasBecomeActive = NO;
}
}
 
- (IBAction)showTipOfTheDay:(id)sender {
[[iTermTipController sharedInstance] showTip];
}
#pragma mark - iTermPasswordManagerDelegate
 
- (void)iTermPasswordManagerEnterPassword:(NSString *)password {
Loading
Loading
Loading
Loading
@@ -16,11 +16,12 @@
 
#import <QuartzCore/QuartzCore.h>
 
static const CGFloat kButtonSideInset = 1;
static const CGFloat kContainerSideInset = 4;
static const CGFloat kButtonSideInset = 0;
static const CGFloat kContainerSideInset = 0;
static const CGFloat kContainerTopBorder = 1;
static const CGFloat kContainerBottomBorder = 1;
static const CGFloat kBodySideMargin = 10;
static const CGFloat kBodyBottomMargin = 6;
static const CGFloat kCardBottomMargin = 8;
static const CGFloat kCardTopMargin = 2;
static const CGFloat kMarginBetweenTextAndButtons = 0;
Loading
Loading
@@ -130,13 +131,15 @@ static const CGFloat kMarginBetweenTitleAndBody = 8;
NSMutableAttributedString *attributedString =
[[[NSMutableAttributedString alloc] init] autorelease];
 
NSMutableParagraphStyle *bigTextParagraphStyle = [[[NSMutableParagraphStyle alloc] init] autorelease];
[bigTextParagraphStyle setParagraphSpacing:4];
NSDictionary *bigTextAttributes =
@{ NSFontAttributeName: [NSFont fontWithName:@"Helvetica Neue Light" size:16],
NSForegroundColorAttributeName: [NSColor colorWithCalibratedWhite:0.2 alpha:1] };
NSForegroundColorAttributeName: [NSColor colorWithCalibratedWhite:0.2 alpha:1],
NSParagraphStyleAttributeName: bigTextParagraphStyle };
 
NSMutableParagraphStyle *paragraphStyle = [[[NSMutableParagraphStyle alloc] init] autorelease];
[paragraphStyle setAlignment:NSRightTextAlignment];
NSDictionary *signatureAttributes =
@{ NSFontAttributeName: [NSFont fontWithName:@"Helvetica Neue Light Italic" size:12],
NSForegroundColorAttributeName: [NSColor colorWithCalibratedWhite:0.3 alpha:1],
Loading
Loading
@@ -244,6 +247,7 @@ static const CGFloat kMarginBetweenTitleAndBody = 8;
// Compute size of body text.
NSRect bodyFrame = _body.frame;
bodyFrame.size = [_body sizeThatFits:NSMakeSize(containerWidth - kBodySideMargin * 2, CGFLOAT_MAX)];
bodyFrame.size.height += kBodyBottomMargin;
bodyFrame.origin.x = kBodySideMargin;
bodyFrame.origin.y = NSMaxY(_titleBox.frame) + kMarginBetweenTitleAndBody;
 
Loading
Loading
Loading
Loading
@@ -12,9 +12,15 @@
// sharedInstance on older OSes.
@interface iTermTipController : NSObject
 
// Are we currently showing a tip?
@property(nonatomic, readonly) BOOL showingTip;
+ (instancetype)sharedInstance;
 
// Call this when the app finishes launching to show the initial card.
- (void)applicationDidFinishLaunching;
 
// Show the last-seen tip (or first, if there is no last-seen) immediately.
- (void)showTip;
@end
Loading
Loading
@@ -65,6 +65,7 @@ static const NSTimeInterval kMinDelayBeforeAskingForPermission = 2 * kSecondsPer
- (void)dealloc {
[_tips release];
[_currentTipName release];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
 
Loading
Loading
@@ -84,6 +85,15 @@ static const NSTimeInterval kMinDelayBeforeAskingForPermission = 2 * kSecondsPer
}
 
[self tryToShowTip];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActive:)
name:NSApplicationDidBecomeActiveNotification
object:nil];
}
- (void)applicationDidBecomeActive:(NSNotification *)notification {
[self tryToShowTip];
}
 
- (BOOL)havePermission {
Loading
Loading
@@ -115,6 +125,9 @@ static const NSTimeInterval kMinDelayBeforeAskingForPermission = 2 * kSecondsPer
if ([[NSUserDefaults standardUserDefaults] boolForKey:kTipsDisabledKey]) {
return;
}
if (![[NSApplication sharedApplication] isActive]) {
return;
}
if (_showingTip || [self haveShownTipRecently]) {
[self performSelector:@selector(tryToShowTip) withObject:nil afterDelay:kSecondsPerDay];
return;
Loading
Loading
@@ -126,6 +139,23 @@ static const NSTimeInterval kMinDelayBeforeAskingForPermission = 2 * kSecondsPer
}
}
 
- (void)showTip {
if (_showingTip) {
return;
}
// Try to show the last-seen tip.
NSArray *unshowableTips = [[NSUserDefaults standardUserDefaults] objectForKey:kUnshowableTipsKey];
NSString *key = [unshowableTips lastObject];
if (!key) {
// You've never seen it before? Then show the first one.
key = [self nextTipKey];
}
if (key) { // Key should always be non-nil, but better be safe.
[self showTipForKey:key];
}
}
- (BOOL)haveShownTipRecently {
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
NSTimeInterval previous = [[NSUserDefaults standardUserDefaults] doubleForKey:kLastTipTimeKey];
Loading
Loading
@@ -205,6 +235,15 @@ static const NSTimeInterval kMinDelayBeforeAskingForPermission = 2 * kSecondsPer
 
- (void)tipWindowRequestsDisable {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kTipsDisabledKey];
_showingTip = NO;
}
- (void)tipWindowRequestsEnable {
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:kTipsDisabledKey];
}
- (BOOL)tipWindowTipsAreDisabled {
return [[NSUserDefaults standardUserDefaults] boolForKey:kTipsDisabledKey];
}
 
- (iTermTip *)tipWindowTipAfterTipWithIdentifier:(NSString *)previousId {
Loading
Loading
Loading
Loading
@@ -21,6 +21,12 @@
// User requested to disable all tips.
- (void)tipWindowRequestsDisable;
 
// User requested to enable all tips.
- (void)tipWindowRequestsEnable;
// Are tips disabled?
- (BOOL)tipWindowTipsAreDisabled;
// Get the tip with a named id.
- (iTermTip *)tipWindowTipAfterTipWithIdentifier:(NSString *)identifier;
- (iTermTip *)tipWindowTipBeforeTipWithIdentifier:(NSString *)identifier;
Loading
Loading
Loading
Loading
@@ -25,6 +25,7 @@ static NSString *const kFewerOptionsTitle = @"Fewer Options";
static NSString *const kMoreOptionsTitle = @"More Options";
static NSString *const kShowThisLaterTitle = @"Show This Later";
static NSString *const kDisableTipsTitle = @"Disable Tips";
static NSString *const kEnableTipsTitle = @"Enable Tips";
static NSString *const kReallyDisableTipsTitle = @"Click Again to Disable Tips";
static NSString *const kShowNextTipTitle = @"Show Next Tip";
static NSString *const kShowPreviousTipTitle = @"Show Previous Tip";
Loading
Loading
@@ -139,15 +140,28 @@ static const CGFloat kWindowWidth = 400;
if (!expanded) {
[button setCollapsed:YES];
}
NSString *enableOrDisableTitle;
if ([_delegate tipWindowTipsAreDisabled]) {
enableOrDisableTitle = kEnableTipsTitle;
} else {
enableOrDisableTitle = kDisableTipsTitle;
}
button =
[card addActionWithTitle:kDisableTipsTitle
[card addActionWithTitle:enableOrDisableTitle
icon:[NSImage imageNamed:@"DisableTips"]
block:^(id sendingCard) {
iTermTipCardActionButton *theButton = [card actionWithTitle:kDisableTipsTitle];
if (theButton) {
[theButton setTitle:kReallyDisableTipsTitle];
if (![_delegate tipWindowTipsAreDisabled]) {
iTermTipCardActionButton *theButton = [card actionWithTitle:kDisableTipsTitle];
if (theButton) {
[theButton setTitle:kReallyDisableTipsTitle];
} else {
[self disableTips];
}
} else {
[self disableTips];
iTermTipCardActionButton *theButton = [card actionWithTitle:kEnableTipsTitle];
[self enableTips];
[theButton setTitle:kDisableTipsTitle];
}
}];
if (!expanded) {
Loading
Loading
@@ -200,6 +214,7 @@ static const CGFloat kWindowWidth = 400;
return @[ kShowThisLaterTitle,
kDisableTipsTitle,
kReallyDisableTipsTitle,
kEnableTipsTitle,
kShowNextTipTitle,
kShowPreviousTipTitle ];
}
Loading
Loading
@@ -332,6 +347,7 @@ static const CGFloat kWindowWidth = 400;
[[card actionWithTitle:kShowThisLaterTitle] setAnimationState:kTipCardButtonAnimatingIn];
[[card actionWithTitle:kDisableTipsTitle] setAnimationState:kTipCardButtonAnimatingIn];
[[card actionWithTitle:kReallyDisableTipsTitle] setAnimationState:kTipCardButtonAnimatingIn];
[[card actionWithTitle:kEnableTipsTitle] setAnimationState:kTipCardButtonAnimatingIn];
[[card actionWithTitle:kShowNextTipTitle] setAnimationState:kTipCardButtonAnimatingIn];
[[card actionWithTitle:kShowPreviousTipTitle] setAnimationState:kTipCardButtonAnimatingIn];
} else {
Loading
Loading
@@ -342,6 +358,7 @@ static const CGFloat kWindowWidth = 400;
[[card actionWithTitle:kShowThisLaterTitle] setAnimationState:kTipCardButtonAnimatingOut];
[[card actionWithTitle:kDisableTipsTitle] setAnimationState:kTipCardButtonAnimatingOut];
[[card actionWithTitle:kReallyDisableTipsTitle] setAnimationState:kTipCardButtonAnimatingOut];
[[card actionWithTitle:kEnableTipsTitle] setAnimationState:kTipCardButtonAnimatingOut];
[[card actionWithTitle:kShowNextTipTitle] setAnimationState:kTipCardButtonAnimatingOut];
[[card actionWithTitle:kShowPreviousTipTitle] setAnimationState:kTipCardButtonAnimatingOut];
}
Loading
Loading
@@ -353,6 +370,10 @@ static const CGFloat kWindowWidth = 400;
[_delegate tipWindowPostponed];
}
 
- (void)enableTips {
[_delegate tipWindowRequestsEnable];
}
- (void)disableTips {
[self animateOut];
[_delegate tipWindowRequestsDisable];
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment