Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

HistoryView: Allow tripple-clicking on header to undo sorting

  • Loading branch information...
commit bae7566cde9b9bbcb99ac88eac4b313757a04950 1 parent 8c59a12
Pieter de Bie authored October 03, 2008
6  GitX.xcodeproj/project.pbxproj
@@ -31,6 +31,7 @@
31 31
 		F56174570E058893001DCD79 /* PBGitTree.m in Sources */ = {isa = PBXBuildFile; fileRef = F56174560E058893001DCD79 /* PBGitTree.m */; };
32 32
 		F561777D0E05C88E001DCD79 /* DetailView.png in Resources */ = {isa = PBXBuildFile; fileRef = F561777C0E05C88E001DCD79 /* DetailView.png */; };
33 33
 		F561E6CD0E7AFDDF00521636 /* keyboardNavigation.js in Resources */ = {isa = PBXBuildFile; fileRef = F561E6CB0E7AFDD000521636 /* keyboardNavigation.js */; };
  34
+		F56244090E9684B0002B6C44 /* PBUnsortableTableHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */; };
34 35
 		F56524BB0E02D22D00F03B52 /* NSFileHandleExt.m in Sources */ = {isa = PBXBuildFile; fileRef = F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */; };
35 36
 		F56524F00E02D45200F03B52 /* PBGitCommit.m in Sources */ = {isa = PBXBuildFile; fileRef = F56524EF0E02D45200F03B52 /* PBGitCommit.m */; };
36 37
 		F56526240E03D85900F03B52 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F56526230E03D85900F03B52 /* WebKit.framework */; };
@@ -131,6 +132,8 @@
131 132
 		F56174560E058893001DCD79 /* PBGitTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitTree.m; sourceTree = "<group>"; };
132 133
 		F561777C0E05C88E001DCD79 /* DetailView.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DetailView.png; sourceTree = "<group>"; };
133 134
 		F561E6CB0E7AFDD000521636 /* keyboardNavigation.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; name = keyboardNavigation.js; path = html/keyboardNavigation.js; sourceTree = "<group>"; };
  135
+		F56244070E9684B0002B6C44 /* PBUnsortableTableHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBUnsortableTableHeader.h; sourceTree = "<group>"; };
  136
+		F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBUnsortableTableHeader.m; sourceTree = "<group>"; };
134 137
 		F56524B90E02D22D00F03B52 /* NSFileHandleExt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSFileHandleExt.m; sourceTree = "<group>"; };
135 138
 		F56524BA0E02D22D00F03B52 /* NSFileHandleExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSFileHandleExt.h; sourceTree = "<group>"; };
136 139
 		F56524EE0E02D45200F03B52 /* PBGitCommit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitCommit.h; sourceTree = "<group>"; };
@@ -364,6 +367,8 @@
364 367
 				91B103CB0E898EC300C84364 /* PBIconAndTextCell.mm */,
365 368
 				F5140DC70E8A8EB20091E9F3 /* RoundedRectangle.h */,
366 369
 				F5140DC80E8A8EB20091E9F3 /* RoundedRectangle.m */,
  370
+				F56244070E9684B0002B6C44 /* PBUnsortableTableHeader.h */,
  371
+				F56244080E9684B0002B6C44 /* PBUnsortableTableHeader.m */,
367 372
 			);
368 373
 			name = Aux;
369 374
 			sourceTree = "<group>";
@@ -562,6 +567,7 @@
562 567
 				F5E927FC0E883F0700056E75 /* PBWebChangesController.m in Sources */,
563 568
 				91B103CC0E898EC300C84364 /* PBIconAndTextCell.mm in Sources */,
564 569
 				F5140DC90E8A8EB20091E9F3 /* RoundedRectangle.m in Sources */,
  570
+				F56244090E9684B0002B6C44 /* PBUnsortableTableHeader.m in Sources */,
565 571
 			);
566 572
 			runOnlyForDeploymentPostprocessing = 0;
567 573
 		};
28  PBGitHistoryView.xib
@@ -8,7 +8,7 @@
8 8
 		<string key="IBDocument.HIToolboxVersion">352.00</string>
9 9
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
10 10
 			<bool key="EncodedWithXMLCoder">YES</bool>
11  
-			<integer value="2"/>
  11
+			<integer value="3"/>
12 12
 		</object>
13 13
 		<object class="NSArray" key="IBDocument.PluginDependencies">
14 14
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1754,6 +1754,14 @@
1754 1754
 					</object>
1755 1755
 					<int key="connectionID">216</int>
1756 1756
 				</object>
  1757
+				<object class="IBConnectionRecord">
  1758
+					<object class="IBOutletConnection" key="connection">
  1759
+						<string key="label">controller</string>
  1760
+						<reference key="source" ref="942510576"/>
  1761
+						<reference key="destination" ref="391209158"/>
  1762
+					</object>
  1763
+					<int key="connectionID">217</int>
  1764
+				</object>
1757 1765
 			</object>
1758 1766
 			<object class="IBMutableOrderedSet" key="objectRecords">
1759 1767
 				<object class="NSArray" key="orderedObjects">
@@ -2279,6 +2287,7 @@
2279 2287
 					<string>29.IBShouldRemoveOnLegacySave</string>
2280 2288
 					<string>3.IBPluginDependency</string>
2281 2289
 					<string>3.ImportedFromIB2</string>
  2290
+					<string>30.CustomClassName</string>
2282 2291
 					<string>30.IBShouldRemoveOnLegacySave</string>
2283 2292
 					<string>31.IBPluginDependency</string>
2284 2293
 					<string>31.ImportedFromIB2</string>
@@ -2362,6 +2371,7 @@
2362 2371
 					<reference ref="9"/>
2363 2372
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2364 2373
 					<reference ref="9"/>
  2374
+					<string>PBUnsortableTableHeader</string>
2365 2375
 					<reference ref="9"/>
2366 2376
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2367 2377
 					<reference ref="9"/>
@@ -2385,7 +2395,7 @@
2385 2395
 						</object>
2386 2396
 					</object>
2387 2397
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2388  
-					<string>{{359, 261}, {852, 432}}</string>
  2398
+					<string>{{358, 261}, {852, 432}}</string>
2389 2399
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2390 2400
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
2391 2401
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2415,7 +2425,7 @@
2415 2425
 				</object>
2416 2426
 			</object>
2417 2427
 			<nil key="sourceID"/>
2418  
-			<int key="maxID">216</int>
  2428
+			<int key="maxID">217</int>
2419 2429
 		</object>
2420 2430
 		<object class="IBClassDescriber" key="IBDocument.Classes">
2421 2431
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -2537,6 +2547,18 @@
2537 2547
 					</object>
2538 2548
 				</object>
2539 2549
 				<object class="IBPartialClassDescription">
  2550
+					<string key="className">PBUnsortableTableHeader</string>
  2551
+					<string key="superclassName">NSTableHeaderView</string>
  2552
+					<object class="NSMutableDictionary" key="outlets">
  2553
+						<string key="NS.key.0">controller</string>
  2554
+						<string key="NS.object.0">NSArrayController</string>
  2555
+					</object>
  2556
+					<object class="IBClassDescriptionSource" key="sourceIdentifier">
  2557
+						<string key="majorKey">IBProjectSource</string>
  2558
+						<string key="minorKey">PBUnsortableTableHeader.h</string>
  2559
+					</object>
  2560
+				</object>
  2561
+				<object class="IBPartialClassDescription">
2540 2562
 					<string key="className">PBViewController</string>
2541 2563
 					<string key="superclassName">NSViewController</string>
2542 2564
 					<object class="NSMutableDictionary" key="outlets">
18  PBUnsortableTableHeader.h
... ...
@@ -0,0 +1,18 @@
  1
+//
  2
+//  PBUnsortableTableHeader.h
  3
+//  GitX
  4
+//
  5
+//  Created by Pieter de Bie on 03-10-08.
  6
+//  Copyright 2008 __MyCompanyName__. All rights reserved.
  7
+//
  8
+
  9
+#import <Cocoa/Cocoa.h>
  10
+
  11
+
  12
+@interface PBUnsortableTableHeader : NSTableHeaderView {
  13
+	IBOutlet NSArrayController *controller;
  14
+	int clickCount;
  15
+	int columnIndex;
  16
+}
  17
+
  18
+@end
39  PBUnsortableTableHeader.m
... ...
@@ -0,0 +1,39 @@
  1
+//
  2
+//  PBUnsortableTableHeader.m
  3
+//  GitX
  4
+//
  5
+//  Created by Pieter de Bie on 03-10-08.
  6
+//  Copyright 2008 __MyCompanyName__. All rights reserved.
  7
+//
  8
+
  9
+#import "PBUnsortableTableHeader.h"
  10
+
  11
+
  12
+@implementation PBUnsortableTableHeader
  13
+
  14
+- (void)mouseDown:(NSEvent *)theEvent
  15
+{
  16
+	NSPoint location = [self convertPoint:[[self window] mouseLocationOutsideOfEventStream] fromView:[[self window] contentView]];
  17
+	int aColumnIndex = [self columnAtPoint:location];
  18
+
  19
+	// If the user pressed on another column, reset
  20
+	if (aColumnIndex != columnIndex)
  21
+	{
  22
+		clickCount = 1;
  23
+		columnIndex = aColumnIndex;
  24
+		[super mouseDown:theEvent];
  25
+		return;
  26
+	}
  27
+
  28
+	// On the third click, reset the sorting and
  29
+	// Don't pass on the click
  30
+	if (++clickCount == 3)
  31
+	{
  32
+		clickCount = 0;
  33
+		controller.sortDescriptors = [NSArray array];
  34
+		[controller rearrangeObjects];
  35
+		return;
  36
+	}
  37
+	[super mouseDown:theEvent];
  38
+}
  39
+@end

0 notes on commit bae7566

Please sign in to comment.
Something went wrong with that request. Please try again.