Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

HistoryView: Allow tripple-clicking on header to undo sorting

  • Loading branch information...
commit bae7566cde9b9bbcb99ac88eac4b313757a04950 1 parent 8c59a12
@pieter pieter authored
View
6 GitX.xcodeproj/project.pbxproj
@@ -31,6 +31,7 @@
F56174570E058893001DCD79 /* PBGitTree.m in Sources */ = {isa = PBXBuildFile; fileRef = F56174560E058893001DCD79 /* PBGitTree.m */; };
F561777D0E05C88E001DCD79 /* DetailView.png in Resources */ = {isa = PBXBuildFile; fileRef = F561777C0E05C88E001DCD79 /* DetailView.png */; };
F561E6CD0E7AFDDF00521636 /* keyboardNavigation.js in Resources */ = {isa = PBXBuildFile; fileRef = F561E6CB0E7AFDD000521636 /* keyboardNavigation.js */; };
+ F56244090E9684B0002B6C44 /* PBUnsortableTableHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */; };
F56524BB0E02D22D00F03B52 /* NSFileHandleExt.m in Sources */ = {isa = PBXBuildFile; fileRef = F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */; };
F56524F00E02D45200F03B52 /* PBGitCommit.m in Sources */ = {isa = PBXBuildFile; fileRef = F56524EF0E02D45200F03B52 /* PBGitCommit.m */; };
F56526240E03D85900F03B52 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56526230E03D85900F03B52 /* WebKit.framework */; };
@@ -131,6 +132,8 @@
F56174560E058893001DCD79 /* PBGitTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitTree.m; sourceTree = "<group>"; };
F561777C0E05C88E001DCD79 /* DetailView.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DetailView.png; sourceTree = "<group>"; };
F561E6CB0E7AFDD000521636 /* keyboardNavigation.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = keyboardNavigation.js; path = html/keyboardNavigation.js; sourceTree = "<group>"; };
+ F56244070E9684B0002B6C44 /* PBUnsortableTableHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBUnsortableTableHeader.h; sourceTree = "<group>"; };
+ F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBUnsortableTableHeader.m; sourceTree = "<group>"; };
F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSFileHandleExt.m; sourceTree = "<group>"; };
F56524BA0E02D22D00F03B52 /* NSFileHandleExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSFileHandleExt.h; sourceTree = "<group>"; };
F56524EE0E02D45200F03B52 /* PBGitCommit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitCommit.h; sourceTree = "<group>"; };
@@ -364,6 +367,8 @@
91B103CB0E898EC300C84364 /* PBIconAndTextCell.mm */,
F5140DC70E8A8EB20091E9F3 /* RoundedRectangle.h */,
F5140DC80E8A8EB20091E9F3 /* RoundedRectangle.m */,
+ F56244070E9684B0002B6C44 /* PBUnsortableTableHeader.h */,
+ F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */,
);
name = Aux;
sourceTree = "<group>";
@@ -562,6 +567,7 @@
F5E927FC0E883F0700056E75 /* PBWebChangesController.m in Sources */,
91B103CC0E898EC300C84364 /* PBIconAndTextCell.mm in Sources */,
F5140DC90E8A8EB20091E9F3 /* RoundedRectangle.m in Sources */,
+ F56244090E9684B0002B6C44 /* PBUnsortableTableHeader.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
28 PBGitHistoryView.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">352.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="2"/>
+ <integer value="3"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1754,6 +1754,14 @@
</object>
<int key="connectionID">216</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">controller</string>
+ <reference key="source" ref="942510576"/>
+ <reference key="destination" ref="391209158"/>
+ </object>
+ <int key="connectionID">217</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2279,6 +2287,7 @@
<string>29.IBShouldRemoveOnLegacySave</string>
<string>3.IBPluginDependency</string>
<string>3.ImportedFromIB2</string>
+ <string>30.CustomClassName</string>
<string>30.IBShouldRemoveOnLegacySave</string>
<string>31.IBPluginDependency</string>
<string>31.ImportedFromIB2</string>
@@ -2362,6 +2371,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
+ <string>PBUnsortableTableHeader</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
@@ -2385,7 +2395,7 @@
</object>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{359, 261}, {852, 432}}</string>
+ <string>{{358, 261}, {852, 432}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2415,7 +2425,7 @@
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">216</int>
+ <int key="maxID">217</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2537,6 +2547,18 @@
</object>
</object>
<object class="IBPartialClassDescription">
+ <string key="className">PBUnsortableTableHeader</string>
+ <string key="superclassName">NSTableHeaderView</string>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">controller</string>
+ <string key="NS.object.0">NSArrayController</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">PBUnsortableTableHeader.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">PBViewController</string>
<string key="superclassName">NSViewController</string>
<object class="NSMutableDictionary" key="outlets">
View
18 PBUnsortableTableHeader.h
@@ -0,0 +1,18 @@
+//
+// PBUnsortableTableHeader.h
+// GitX
+//
+// Created by Pieter de Bie on 03-10-08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface PBUnsortableTableHeader : NSTableHeaderView {
+ IBOutlet NSArrayController *controller;
+ int clickCount;
+ int columnIndex;
+}
+
+@end
View
39 PBUnsortableTableHeader.m
@@ -0,0 +1,39 @@
+//
+// PBUnsortableTableHeader.m
+// GitX
+//
+// Created by Pieter de Bie on 03-10-08.
+// Copyright 2008 __MyCompanyName__. All rights reserved.
+//
+
+#import "PBUnsortableTableHeader.h"
+
+
+@implementation PBUnsortableTableHeader
+
+- (void)mouseDown:(NSEvent *)theEvent
+{
+ NSPoint location = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:[[self window] contentView]];
+ int aColumnIndex = [self columnAtPoint:location];
+
+ // If the user pressed on another column, reset
+ if (aColumnIndex != columnIndex)
+ {
+ clickCount = 1;
+ columnIndex = aColumnIndex;
+ [super mouseDown:theEvent];
+ return;
+ }
+
+ // On the third click, reset the sorting and
+ // Don't pass on the click
+ if (++clickCount == 3)
+ {
+ clickCount = 0;
+ controller.sortDescriptors = [NSArray array];
+ [controller rearrangeObjects];
+ return;
+ }
+ [super mouseDown:theEvent];
+}
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.