diff --git a/GitUp/Application/Document.m b/GitUp/Application/Document.m index 2af46e95..6917a22f 100644 --- a/GitUp/Application/Document.m +++ b/GitUp/Application/Document.m @@ -1792,7 +1792,7 @@ - (void)setSnapshotToggleState:(NSControlStateValue)state { XLOG_ERROR(@"This used to be a button, update this function if the layout has changed."); return; } - + [button setState:state]; } diff --git a/GitUp/GitUp.xcodeproj/project.pbxproj b/GitUp/GitUp.xcodeproj/project.pbxproj index dcd300e3..5e4c862f 100644 --- a/GitUp/GitUp.xcodeproj/project.pbxproj +++ b/GitUp/GitUp.xcodeproj/project.pbxproj @@ -636,7 +636,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.3.5; + MARKETING_VERSION = 1.4.0; PRODUCT_BUNDLE_IDENTIFIER = "co.gitup.mac-debug"; PRODUCT_NAME = GitUp; }; @@ -655,7 +655,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - MARKETING_VERSION = 1.3.5; + MARKETING_VERSION = 1.4.0; PRODUCT_BUNDLE_IDENTIFIER = co.gitup.mac; PRODUCT_NAME = GitUp; }; diff --git a/GitUpKit/Components/GIDiffFilesViewController.m b/GitUpKit/Components/GIDiffFilesViewController.m index 8ba27ff8..a4b5590b 100644 --- a/GitUpKit/Components/GIDiffFilesViewController.m +++ b/GitUpKit/Components/GIDiffFilesViewController.m @@ -213,7 +213,7 @@ - (NSInteger)numberOfRowsInTableView:(NSTableView*)tableView { if (GC_FILE_MODE_IS_FILE(delta.oldFile.mode) || GC_FILE_MODE_IS_FILE(delta.newFile.mode)) { NSString* pathExtension = delta.canonicalPath.pathExtension; NSString* utType = (__bridge_transfer NSString*)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)pathExtension, kUTTypeData); - + if (utType) { GIDiffFileProvider* provider = [[GIDiffFileProvider alloc] initWithFileType:utType delegate:self]; provider.userInfo = delta; diff --git a/GitUpKit/Core/GCHistory.m b/GitUpKit/Core/GCHistory.m index d88fcfa2..aa5f2f98 100644 --- a/GitUpKit/Core/GCHistory.m +++ b/GitUpKit/Core/GCHistory.m @@ -819,8 +819,8 @@ - (BOOL)_reloadHistory:(GCHistory*)history XLOG_DEBUG_CHECK(headBranch == nil); headBranch = (GCHistoryLocalBranch*)referenceObject; } - - int status = gitup_branch_upstream_name(&upstreamName, self.private, git_reference_name(reference)); + + int status = gitup_branch_upstream_name(&upstreamName, self.private, git_reference_name(reference)); if ((status != GIT_OK) && (status != GIT_ENOTFOUND)) { LOG_LIBGIT2_ERROR(status); // Don't fail because of corrupted config } diff --git a/GitUpKit/Core/GCMacros.h b/GitUpKit/Core/GCMacros.h index a49a263f..01eb9f5c 100644 --- a/GitUpKit/Core/GCMacros.h +++ b/GitUpKit/Core/GCMacros.h @@ -46,7 +46,7 @@ static inline void __GCItemListInitialize(GCItemList* list, size_t initialCapaci #define GC_LIST_CAPACITY(name) name.capacity -#define GC_LIST_ITEM_POINTER(name, index) (name.items + (index)*name.size) +#define GC_LIST_ITEM_POINTER(name, index) (name.items + (index) * name.size) static inline void __GCItemListAppend(GCItemList* list, const void* itemPointer) { if (list->count == list->capacity) { @@ -178,14 +178,13 @@ static inline BOOL __GCPointerListContains(GCPointerList* list, void* pointer) { #define GC_POINTER_LIST_CONTAINS(name, pointer) __GCPointerListContains(&name, pointer) #define GC_POINTER_LIST_FOR_LOOP_NO_BRIDGE(name, type, variable) \ - type variable = (type)GC_POINTER_LIST_GET(name, 0); \ + type variable = (type)GC_POINTER_LIST_GET(name, 0); \ for (size_t __##variable = 0; (__##variable < name.count) && (variable = (type)GC_POINTER_LIST_GET(name, __##variable), 1); ++__##variable) -#define GC_POINTER_LIST_FOR_LOOP(name, type, variable) \ - type variable = (__bridge type)GC_POINTER_LIST_GET(name, 0); \ +#define GC_POINTER_LIST_FOR_LOOP(name, type, variable) \ + type variable = (__bridge type)GC_POINTER_LIST_GET(name, 0); \ for (size_t __##variable = 0; (__##variable < name.count) && (variable = (__bridge type)GC_POINTER_LIST_GET(name, __##variable), 1); ++__##variable) - #define GC_POINTER_LIST_REVERSE_FOR_LOOP(name, type, variable) \ type variable = name.count ? GC_POINTER_LIST_GET(name, name.count - 1) : NULL; \ for (ssize_t __##variable = name.count - 1; (__##variable >= 0) && (variable = GC_POINTER_LIST_GET(name, __##variable), 1); --__##variable) diff --git a/GitUpKit/Core/GCReflogMessages.h b/GitUpKit/Core/GCReflogMessages.h index 15d32b3d..468c6df8 100644 --- a/GitUpKit/Core/GCReflogMessages.h +++ b/GitUpKit/Core/GCReflogMessages.h @@ -78,6 +78,6 @@ #define kGCReflogMessageFormat_GitUp_SetTip @kGCReflogCustomPrefix @"set tip" #define kGCReflogMessageFormat_GitUp_MoveTip @kGCReflogCustomPrefix @"move tip" -//#define kGCReflogMessageFormat_GitUp_HardReset @kGCReflogCustomPrefix @"hard reset for '%@'" +// #define kGCReflogMessageFormat_GitUp_HardReset @kGCReflogCustomPrefix @"hard reset for '%@'" #define kGCReflogMessageFormat_GitUp_Undo @kGCReflogCustomPrefix @"undo '%@'" #define kGCReflogMessageFormat_GitUp_Redo @kGCReflogCustomPrefix @"redo '%@'" diff --git a/GitUpKit/Core/GCRemote.m b/GitUpKit/Core/GCRemote.m index a272738e..6b2fa720 100644 --- a/GitUpKit/Core/GCRemote.m +++ b/GitUpKit/Core/GCRemote.m @@ -634,11 +634,11 @@ - (GCRemote*)lookupRemoteForRemoteBranch:(GCRemoteBranch*)branch sourceBranchNam - (BOOL)cloneUsingRemote:(GCRemote*)remote recursive:(BOOL)recursive error:(NSError**)error { [self willStartRemoteTransferWithURL:remote.URL]; -// git_fetch_options fetchOptions = GIT_FETCH_OPTIONS_INIT; -// [self setRemoteCallbacks:&fetchOptions.callbacks]; -// git_checkout_options checkoutOptions = GIT_CHECKOUT_OPTIONS_INIT; -// checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE; - + // git_fetch_options fetchOptions = GIT_FETCH_OPTIONS_INIT; + // [self setRemoteCallbacks:&fetchOptions.callbacks]; + // git_checkout_options checkoutOptions = GIT_CHECKOUT_OPTIONS_INIT; + // checkoutOptions.checkout_strategy = GIT_CHECKOUT_SAFE; + git_fetch_options fetchOptions = GIT_FETCH_OPTIONS_INIT; [self setRemoteCallbacks:&fetchOptions.callbacks]; git_checkout_options checkoutOptions = GIT_CHECKOUT_OPTIONS_INIT; diff --git a/GitUpKit/Core/GCRepository+Config-Tests.m b/GitUpKit/Core/GCRepository+Config-Tests.m index 1c79d2e5..0c4eb8c2 100644 --- a/GitUpKit/Core/GCRepository+Config-Tests.m +++ b/GitUpKit/Core/GCRepository+Config-Tests.m @@ -48,7 +48,7 @@ - (void)testConfig { NSArray* config2 = [self.repository readAllConfigs:NULL]; XCTAssertEqual(config2.count, 8); - NSUInteger index = [config2 indexOfObjectPassingTest:^BOOL(GCConfigOption *obj, NSUInteger idx, BOOL *stop) { + NSUInteger index = [config2 indexOfObjectPassingTest:^BOOL(GCConfigOption* obj, NSUInteger idx, BOOL* stop) { return [obj.variable isEqualToString:@"core.repositoryformatversion"]; }]; option = config2[index]; diff --git a/GitUpKit/Extensions/GCRepository+Utilities-Tests.m b/GitUpKit/Extensions/GCRepository+Utilities-Tests.m index 7c6aae07..438ba724 100644 --- a/GitUpKit/Extensions/GCRepository+Utilities-Tests.m +++ b/GitUpKit/Extensions/GCRepository+Utilities-Tests.m @@ -48,7 +48,7 @@ - (void)testUtilities { XCTAssertEqualObjects([self.repository hostingURLForProject:&service error:NULL], [NSURL URLWithString:@"https://github.com/git-up/GitUp-Mac"]); XCTAssertEqual(service, kGCHostingService_GitHub); - XCTAssertTrue([self.repository writeConfigOptionForLevel:kGCConfigLevel_Local variable:@"remote.origin.url" withValue:@"ssh://git@bitbucket.org:gitup/test.git" error:NULL]); + XCTAssertTrue([self.repository writeConfigOptionForLevel:kGCConfigLevel_Local variable:@"remote.origin.url" withValue:@"git@bitbucket.org:gitup/test.git" error:NULL]); XCTAssertEqualObjects([self.repository hostingURLForProject:&service error:NULL], [NSURL URLWithString:@"https://bitbucket.org/gitup/test"]); XCTAssertEqual(service, kGCHostingService_BitBucket); XCTAssertTrue([self.repository writeConfigOptionForLevel:kGCConfigLevel_Local variable:@"remote.origin.url" withValue:@"https://user@bitbucket.org/gitup/test.git" error:NULL]); diff --git a/GitUpKit/GitUpKit.xcodeproj/project.pbxproj b/GitUpKit/GitUpKit.xcodeproj/project.pbxproj index c04b171e..6a48a69d 100644 --- a/GitUpKit/GitUpKit.xcodeproj/project.pbxproj +++ b/GitUpKit/GitUpKit.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -13,6 +13,9 @@ 0AC8525A23A122C400479160 /* GILaunchServicesLocator.m in Sources */ = {isa = PBXBuildFile; fileRef = 0AC8525823A122C400479160 /* GILaunchServicesLocator.m */; }; 1D615D81286BEDC600FFF7E7 /* XLFacilityMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D615D7E286BE79200FFF7E7 /* XLFacilityMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1D615D82286BEDCE00FFF7E7 /* XLFacilityMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D615D7E286BE79200FFF7E7 /* XLFacilityMacros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1D841F782B955C3800E4FCCC /* GIRemappingExplanationPopover.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D841F752B955C3800E4FCCC /* GIRemappingExplanationPopover.h */; }; + 1D841F792B955C3800E4FCCC /* GIRemappingExplanationPopover.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D841F762B955C3800E4FCCC /* GIRemappingExplanationPopover.m */; }; + 1D841F7A2B955C3800E4FCCC /* GIRemappingExplanationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D841F772B955C3800E4FCCC /* GIRemappingExplanationViewController.xib */; }; 1DADC0DA25A25D54008C2C35 /* libsqlite3.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBBEE637256B08D300F96DAF /* libsqlite3.xcframework */; }; 1DADC0DE25A25D5D008C2C35 /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = DBBEE654256B095000F96DAF /* libiconv.tbd */; }; 1DADC0E225A25D63008C2C35 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = DBBEE64C256B094000F96DAF /* libz.tbd */; }; @@ -347,6 +350,9 @@ 0AC8525823A122C400479160 /* GILaunchServicesLocator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GILaunchServicesLocator.m; sourceTree = ""; }; 0AD01C0B26D6A11C0068A02E /* Third-Party */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "Third-Party"; sourceTree = ""; }; 1D615D7E286BE79200FFF7E7 /* XLFacilityMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XLFacilityMacros.h; sourceTree = ""; }; + 1D841F752B955C3800E4FCCC /* GIRemappingExplanationPopover.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIRemappingExplanationPopover.h; sourceTree = ""; }; + 1D841F762B955C3800E4FCCC /* GIRemappingExplanationPopover.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIRemappingExplanationPopover.m; sourceTree = ""; }; + 1D841F772B955C3800E4FCCC /* GIRemappingExplanationViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GIRemappingExplanationViewController.xib; sourceTree = ""; }; 1DF371CB22F5262300EF7BD9 /* GCLiveRepository+Utilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GCLiveRepository+Utilities.h"; sourceTree = ""; }; 1DF371CC22F5262300EF7BD9 /* GCLiveRepository+Utilities.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "GCLiveRepository+Utilities.m"; sourceTree = ""; }; 6D8E3F0A25D90E1300AAFC17 /* GIImageDiffView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIImageDiffView.m; sourceTree = ""; }; @@ -703,6 +709,9 @@ E22942031AC11F56000A83AF /* GIQuickViewController.h */, E22942041AC11F56000A83AF /* GIQuickViewController.m */, E22941F11AC11F56000A83AF /* GIQuickViewController.xib */, + 1D841F752B955C3800E4FCCC /* GIRemappingExplanationPopover.h */, + 1D841F762B955C3800E4FCCC /* GIRemappingExplanationPopover.m */, + 1D841F772B955C3800E4FCCC /* GIRemappingExplanationViewController.xib */, E22942051AC11F56000A83AF /* GISimpleCommitViewController.h */, E22942061AC11F56000A83AF /* GISimpleCommitViewController.m */, E22941F31AC11F56000A83AF /* GISimpleCommitViewController.xib */, @@ -966,6 +975,7 @@ E267E1BA1B84D80500BAB377 /* GCBranch.h in Headers */, E267E1BB1B84D80500BAB377 /* GCCommit.h in Headers */, E267E1BC1B84D80500BAB377 /* GCCommitDatabase.h in Headers */, + 1D841F782B955C3800E4FCCC /* GIRemappingExplanationPopover.h in Headers */, E267E1BD1B84D80500BAB377 /* GCCore.h in Headers */, E267E1BE1B84D80500BAB377 /* GCDiff.h in Headers */, E267E2A61B84F02A00BAB377 /* GCError.h in Headers */, @@ -1151,6 +1161,7 @@ E267E2201B84DBD600BAB377 /* Utilities.xcassets in Resources */, DBDFBC0C22B610F1003EEC6C /* Interface.xcassets in Resources */, E267E2211B84DBD900BAB377 /* GIWindowController.xib in Resources */, + 1D841F7A2B955C3800E4FCCC /* GIRemappingExplanationViewController.xib in Resources */, E267E23B1B84DC4B00BAB377 /* Components.xcassets in Resources */, E267E23C1B84DC4B00BAB377 /* Reasons.strings in Resources */, E267E23D1B84DC4B00BAB377 /* GICommitListViewController.xib in Resources */, @@ -1311,6 +1322,7 @@ E267E22E1B84DBF800BAB377 /* GIViewController+Utilities.m in Sources */, E267E22F1B84DBF800BAB377 /* GIWindowController.m in Sources */, E267E2311B84DC2600BAB377 /* GICommitListViewController.m in Sources */, + 1D841F792B955C3800E4FCCC /* GIRemappingExplanationPopover.m in Sources */, E267E2321B84DC2600BAB377 /* GIDiffContentsViewController.m in Sources */, E267E2331B84DC2600BAB377 /* GIDiffFilesViewController.m in Sources */, 1DF371CE22F5262300EF7BD9 /* GCLiveRepository+Utilities.m in Sources */, diff --git a/GitUpKit/Interface/GIFunctions.m b/GitUpKit/Interface/GIFunctions.m index 742f5b05..27bfb6a9 100644 --- a/GitUpKit/Interface/GIFunctions.m +++ b/GitUpKit/Interface/GIFunctions.m @@ -46,11 +46,7 @@ void GIComputeHighlightRanges(const char* deletedBytes, NSUInteger deletedCount, } else if (TEST_BITS(byte, 0b11111100)) { remaining = 6; } else { - do { -// NSCAssert(NO, @"Unreachable code executed in '%s': %s:%i", __FUNCTION__, __FILE__, (int)__LINE__); -// NSAssert(NO, ); - } while (0); -// XLOG_DEBUG_CHECK(!(byte & (1 << 7))); + XLOG_DEBUG_CHECK(!(byte & (1 << 7))); remaining = 1; } } diff --git a/GitUpKit/Interface/GIGraph.m b/GitUpKit/Interface/GIGraph.m index ef0f01fa..da4efd7f 100644 --- a/GitUpKit/Interface/GIGraph.m +++ b/GitUpKit/Interface/GIGraph.m @@ -26,11 +26,11 @@ @implementation GIGraph { GINode* __unsafe_unretained* _mapping; - NSMutableArray *_branches; - NSMutableArray *_layers; - NSMutableArray *_lines; - NSMutableArray *_nodes; - NSMutableArray *_nodesWithReferences; + NSMutableArray* _branches; + NSMutableArray* _layers; + NSMutableArray* _lines; + NSMutableArray* _nodes; + NSMutableArray* _nodesWithReferences; } - (instancetype)initWithHistory:(GCHistory*)history options:(GIGraphOptions)options { @@ -43,7 +43,7 @@ - (instancetype)initWithHistory:(GCHistory*)history options:(GIGraphOptions)opti _lines = [NSMutableArray array]; _nodes = [NSMutableArray array]; _nodesWithReferences = [NSMutableArray array]; - _mapping = (GINode *__unsafe_unretained*)calloc(_history.nextAutoIncrementID, sizeof(GINode*)); + _mapping = (GINode * __unsafe_unretained*)calloc(_history.nextAutoIncrementID, sizeof(GINode*)); [self _generateGraph]; #if DEBUG @@ -128,7 +128,7 @@ - (void)_generateGraph { if ((commit.timeIntervalSinceReferenceDate < staleTime) && ![headCommit isEqualToCommit:commit]) { [tips removeObject:commit]; if (commit.leaf && !COMMIT_SKIPPED(commit)) { - GC_POINTER_LIST_APPEND(skipList, (__bridge void *)(commit)); + GC_POINTER_LIST_APPEND(skipList, (__bridge void*)(commit)); COMMIT_SKIPPED(commit) = YES; } } @@ -138,7 +138,7 @@ - (void)_generateGraph { if ((commit.timeIntervalSinceReferenceDate < staleTime) && ![headCommit isEqualToCommit:commit]) { [tips removeObject:commit]; if (commit.leaf && !COMMIT_SKIPPED(commit)) { - GC_POINTER_LIST_APPEND(skipList, (__bridge void *)(commit)); + GC_POINTER_LIST_APPEND(skipList, (__bridge void*)(commit)); COMMIT_SKIPPED(commit) = YES; } } @@ -153,7 +153,7 @@ - (void)_generateGraph { if (!commit.remoteBranches || (_options & kGIGraphOption_SkipStandaloneRemoteBranchTips)) { [tips removeObject:commit]; if (!COMMIT_SKIPPED(commit)) { - GC_POINTER_LIST_APPEND(skipList, (__bridge void *)(commit)); + GC_POINTER_LIST_APPEND(skipList, (__bridge void*)(commit)); COMMIT_SKIPPED(commit) = YES; } } @@ -170,7 +170,7 @@ - (void)_generateGraph { if (!(_options & kGIGraphOption_PreserveUpstreamRemoteBranchTips) || ![upstreamTips containsObject:commit]) { [tips removeObject:commit]; if (commit.leaf && !COMMIT_SKIPPED(commit)) { - GC_POINTER_LIST_APPEND(skipList, (__bridge void *)(commit)); + GC_POINTER_LIST_APPEND(skipList, (__bridge void*)(commit)); COMMIT_SKIPPED(commit) = YES; } } @@ -244,8 +244,8 @@ - (void)_generateGraph { // Skip commit if applicable if (skip) { XLOG_DEBUG_CHECK(!updateTips || ![tips containsObject:parent]); - XLOG_DEBUG_CHECK(!GC_POINTER_LIST_CONTAINS(newSkipList, (__bridge void *)(parent))); - GC_POINTER_LIST_APPEND(newSkipList, (__bridge void *)(parent)); + XLOG_DEBUG_CHECK(!GC_POINTER_LIST_CONTAINS(newSkipList, (__bridge void*)(parent))); + GC_POINTER_LIST_APPEND(newSkipList, (__bridge void*)(parent)); COMMIT_SKIPPED(parent) = YES; } } @@ -454,7 +454,7 @@ - (void)_computeNodePositions { CGFloat maxX = 0.0; for (CFIndex i = 0, count = self.layers.count; i < count; ++i) { GILayer* layer = self.layers[i]; - + CGFloat lastX = 0.0; NSUInteger index = 0; for (GINode* node in layer.nodes) { @@ -696,7 +696,7 @@ - (void)walkAncestorsOfNode:(GINode*)node __block CFIndex index = node.layer.index; CFIndex maxIndex = self.layers.count; - GC_POINTER_LIST_APPEND(row, (__bridge void *)(node)); + GC_POINTER_LIST_APPEND(row, (__bridge void*)(node)); while (1) { ++index; if (index == maxIndex) { @@ -714,13 +714,13 @@ - (void)walkAncestorsOfNode:(GINode*)node for (NSUInteger i = 0, count = previousNode.parentCount; i < count; ++i) { GINode* parent = [previousNode parentAtIndex:i]; XLOG_DEBUG_CHECK(parent.layer == layer); - if (!GC_POINTER_LIST_CONTAINS( tempRow, (__bridge void *)(parent) )) { + if (!GC_POINTER_LIST_CONTAINS(tempRow, (__bridge void*)(parent))) { BOOL stop = NO; nodeBlock(layer, parent, &stop); if (stop) { goto cleanup; } - GC_POINTER_LIST_APPEND( tempRow, (__bridge void *)(parent) ); + GC_POINTER_LIST_APPEND(tempRow, (__bridge void*)(parent)); } } } diff --git a/GitUpKit/Interface/GIGraphView.m b/GitUpKit/Interface/GIGraphView.m index 3bce3610..59399132 100644 --- a/GitUpKit/Interface/GIGraphView.m +++ b/GitUpKit/Interface/GIGraphView.m @@ -72,8 +72,8 @@ #define kScrollingInset kSpacingY -#define CONVERT_X(x) (kSpacingX + (x)*kSpacingX) -#define CONVERT_Y(y) (kSpacingY + (y)*kSpacingY) +#define CONVERT_X(x) (kSpacingX + (x) * kSpacingX) +#define CONVERT_Y(y) (kSpacingY + (y) * kSpacingY) #define SQUARE(x) ((x) * (x)) #define SELECTED_NODE_BOUNDS(x, y) NSMakeRect(x - kSpacingX / 2, y - (kSelectedLabelMaxHeight / 2) - kSelectedBorderWidth, kSelectedLabelMaxWidth + kSpacingX / 2 + 40, kSelectedLabelMaxHeight + (kSelectedBorderWidth * 2)) #define NODE_LABEL_BOUNDS(x, y) NSMakeRect(x - kSpacingX / 2, y - kSpacingY / 2, kNodeLabelMaxWidth + kSpacingX / 2 + 30, kNodeLabelMaxHeight + kSpacingY / 2) diff --git a/GitUpKit/Utilities/NSColor+GINamedColors.m b/GitUpKit/Utilities/NSColor+GINamedColors.m index 239682ae..db597654 100644 --- a/GitUpKit/Utilities/NSColor+GINamedColors.m +++ b/GitUpKit/Utilities/NSColor+GINamedColors.m @@ -46,10 +46,10 @@ + (NSArray*)gitUpGraphAlternatingBranchColors { } #define IMPLEMENT_NAMED_COLOR(__NAME__, __ASSET__) \ - +(NSColor*)gitUp##__NAME__##Color { \ - NSBundle* bundle = NSBundle.gitUpKitBundle; \ - return [NSColor colorNamed:@__ASSET__ \ - bundle:bundle]; \ + +(NSColor*)gitUp##__NAME__##Color { \ + NSBundle* bundle = NSBundle.gitUpKitBundle; \ + return [NSColor colorNamed:@__ASSET__ \ + bundle:bundle]; \ } IMPLEMENT_NAMED_COLOR(Separator, "separator") diff --git a/GitUpKit/Views/GIAdvancedCommitViewController.m b/GitUpKit/Views/GIAdvancedCommitViewController.m index f719d367..75dfd4f2 100644 --- a/GitUpKit/Views/GIAdvancedCommitViewController.m +++ b/GitUpKit/Views/GIAdvancedCommitViewController.m @@ -20,6 +20,7 @@ #import "GIAdvancedCommitViewController.h" #import "GIDiffFilesViewController.h" #import "GIDiffContentsViewController.h" +#import "GIRemappingExplanationPopover.h" #import "GIViewController+Utilities.h" #import "GIColorView.h" @@ -89,6 +90,13 @@ - (void)viewWillAppear { _indexFilesViewController.selectedDelta = _indexStatus.deltas.firstObject; } +- (void)viewDidAppear { + [super viewDidAppear]; + + // Remove this logic in a year or so + [GIRemappingExplanationPopover showIfNecessaryRelativeToRect:NSZeroRect ofView:_commitButton preferredEdge:NSRectEdgeMinY]; +} + - (void)viewDidDisappear { [super viewDidDisappear]; @@ -332,7 +340,7 @@ - (BOOL)diffFilesViewController:(GIDiffFilesViewController*)controller handleKey } } else if (controller == _indexFilesViewController && !modifiers && event.keyCode == kGIKeyCode_Up) { bool onlyFirstFileSelected = (controller.selectedDeltas.count == 1) && (controller.selectedDelta == controller.deltas.firstObject); - bool hasWorkdirFiles =_workdirFilesViewController.deltas.count > 0; + bool hasWorkdirFiles = _workdirFilesViewController.deltas.count > 0; if (onlyFirstFileSelected && hasWorkdirFiles) { // move focus to previous controller [[controller.view window] selectPreviousKeyView:_workdirFilesViewController.view]; diff --git a/GitUpKit/Views/GIRemappingExplanationPopover.h b/GitUpKit/Views/GIRemappingExplanationPopover.h new file mode 100644 index 00000000..b3600717 --- /dev/null +++ b/GitUpKit/Views/GIRemappingExplanationPopover.h @@ -0,0 +1,18 @@ +// +// GIRemappingExplanationViewController.h +// GitUpKit +// +// Created by Lucas Derraugh on 3/3/24. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface GIRemappingExplanationPopover : NSObject + ++ (void)showIfNecessaryRelativeToRect:(NSRect)positioningRect ofView:(NSView*)positioningView preferredEdge:(NSRectEdge)preferredEdge; + +@end + +NS_ASSUME_NONNULL_END diff --git a/GitUpKit/Views/GIRemappingExplanationPopover.m b/GitUpKit/Views/GIRemappingExplanationPopover.m new file mode 100644 index 00000000..8dffde5e --- /dev/null +++ b/GitUpKit/Views/GIRemappingExplanationPopover.m @@ -0,0 +1,52 @@ +// +// GIRemappingExplanationPopover.m +// GitUpKit +// +// Created by Lucas Derraugh on 3/3/24. +// + +#import "GIRemappingExplanationPopover.h" + +static NSString* const GIRemappingExplanationShownUserDefaultKey = @"GIRemappingExplanationShownUserDefaultKey"; + +@interface GIRemappingExplanationViewController : NSViewController +@end + +@interface GIRemappingExplanationViewController () +@property(nonatomic, copy) void (^dismissCallback)(); +@end + +@implementation GIRemappingExplanationViewController + +- (instancetype)initWithDismissCallback:(void (^)())dismissCallback { + if ((self = [super initWithNibName:NSStringFromClass(self.class) bundle:[NSBundle bundleForClass:self.class]])) { + self.dismissCallback = dismissCallback; + } + return self; +} + +- (IBAction)okay:(id)sender { + self.dismissCallback(); +} + +@end + +@interface GIRemappingExplanationPopover () +@end + +@implementation GIRemappingExplanationPopover + ++ (void)showIfNecessaryRelativeToRect:(NSRect)positioningRect ofView:(NSView*)positioningView preferredEdge:(NSRectEdge)preferredEdge { + NSUserDefaults* defaults = NSUserDefaults.standardUserDefaults; + if (![defaults boolForKey:GIRemappingExplanationShownUserDefaultKey]) { + NSPopover* popover = [[NSPopover alloc] init]; + __weak NSPopover* weakPopover = popover; + popover.contentViewController = [[GIRemappingExplanationViewController alloc] initWithDismissCallback:^{ + [defaults setBool:YES forKey:GIRemappingExplanationShownUserDefaultKey]; + [weakPopover close]; + }]; + [popover showRelativeToRect:positioningRect ofView:positioningView preferredEdge:NSRectEdgeMinY]; + } +} + +@end diff --git a/GitUpKit/Views/GIRemappingExplanationViewController.xib b/GitUpKit/Views/GIRemappingExplanationViewController.xib new file mode 100644 index 00000000..3e1b9f78 --- /dev/null +++ b/GitUpKit/Views/GIRemappingExplanationViewController.xib @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + All action buttons involving text entry that are default +highlighted are now triggered via Command-Return (⌘⏎). + +This replaces the previous Option-Return (⌥⏎) +as it was a less common shortcut for Mac apps. + + + + + + + + + + + + + + + + + + diff --git a/GitUpKit/Views/GISimpleCommitViewController.m b/GitUpKit/Views/GISimpleCommitViewController.m index 2fa63cbf..19b56634 100644 --- a/GitUpKit/Views/GISimpleCommitViewController.m +++ b/GitUpKit/Views/GISimpleCommitViewController.m @@ -20,6 +20,7 @@ #import "GISimpleCommitViewController.h" #import "GIDiffContentsViewController.h" #import "GIDiffFilesViewController.h" +#import "GIRemappingExplanationPopover.h" #import "GIViewController+Utilities.h" #import "GIInterface.h" @@ -67,6 +68,13 @@ - (void)viewWillAppear { [self _reloadContents]; } +- (void)viewDidAppear { + [super viewDidAppear]; + + // Remove this logic in a year or so + [GIRemappingExplanationPopover showIfNecessaryRelativeToRect:NSZeroRect ofView:_commitButton preferredEdge:NSRectEdgeMinY]; +} + - (void)viewDidDisappear { [super viewDidDisappear];