Revision: 2688
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2688&view=rev
Author:   hofman
Date:     2007-08-20 03:51:17 -0700 (Mon, 20 Aug 2007)

Log Message:
-----------
Implement Home/End function keys in tables.

Modified Paths:
--------------
    trunk/Skim.xcodeproj/project.pbxproj

Added Paths:
-----------
    trunk/NSTableView_SKExtensions.h
    trunk/NSTableView_SKExtensions.m

Added: trunk/NSTableView_SKExtensions.h
===================================================================
--- trunk/NSTableView_SKExtensions.h                            (rev 0)
+++ trunk/NSTableView_SKExtensions.h    2007-08-20 10:51:17 UTC (rev 2688)
@@ -0,0 +1,44 @@
+//
+//  NSTableView_SKExtensions.h
+//  Skim
+//
+//  Created by Christiaan Hofman on 8/20/07.
+/*
+ This software is Copyright (c) 2007
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
[EMAIL PROTECTED] NSTableView (SKExtensions)
+
[EMAIL PROTECTED]

Added: trunk/NSTableView_SKExtensions.m
===================================================================
--- trunk/NSTableView_SKExtensions.m                            (rev 0)
+++ trunk/NSTableView_SKExtensions.m    2007-08-20 10:51:17 UTC (rev 2688)
@@ -0,0 +1,74 @@
+//
+//  NSTableView_SKExtensions.m
+//  Skim
+//
+//  Created by Christiaan Hofman on 8/20/07.
+/*
+ This software is Copyright (c) 2007
+ Christiaan Hofman. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+ - Neither the name of Christiaan Hofman nor the names of any
+    contributors may be used to endorse or promote products derived
+    from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "NSTableView_SKExtensions.h"
+#import "OBUtilities.h"
+
+
[EMAIL PROTECTED] NSTableView (SKExtensions)
+
+static IMP originalKeyDown = NULL;
+
++ (void)load {
+    originalKeyDown = OBReplaceMethodImplementationWithSelector(self, 
@selector(keyDown:), @selector(replacementKeyDown:));
+}
+
+- (void)scrollToBeginningOfDocument:(id)sender {
+    if ([self numberOfRows])
+        [self scrollRowToVisible:0];
+}
+
+- (void)scrollToEndOfDocument:(id)sender {
+    if ([self numberOfRows])
+        [self scrollRowToVisible:[self numberOfRows] - 1];
+}
+
+- (void)replacementKeyDown:(NSEvent *)theEvent {
+    NSString *characters = [theEvent charactersIgnoringModifiers];
+    unichar eventChar = [characters length] > 0 ? [characters 
characterAtIndex:0] : 0;
+       unsigned modifierFlags = [theEvent modifierFlags] & 
NSDeviceIndependentModifierFlagsMask;
+    
+    if (eventChar == NSHomeFunctionKey && (modifierFlags & ~NSFunctionKeyMask) 
== 0)
+        [self scrollToBeginningOfDocument:nil];
+    else if (eventChar == NSEndFunctionKey && (modifierFlags & 
~NSFunctionKeyMask) == 0)
+        [self scrollToEndOfDocument:nil];
+    else
+        originalKeyDown(self, _cmd, theEvent);
+}
+
[EMAIL PROTECTED]

Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj        2007-08-19 17:06:04 UTC (rev 
2687)
+++ trunk/Skim.xcodeproj/project.pbxproj        2007-08-20 10:51:17 UTC (rev 
2688)
@@ -126,6 +126,8 @@
                CE5487BC0B35A20A00F8AFB6 /* NSFileManager_ExtendedAttributes.m 
in Sources */ = {isa = PBXBuildFile; fileRef = CE5487BB0B35A20A00F8AFB6 /* 
NSFileManager_ExtendedAttributes.m */; };
                CE54898C0B35D4EF00F8AFB6 /* InfoWindow.nib in Resources */ = 
{isa = PBXBuildFile; fileRef = CE54898A0B35D4EF00F8AFB6 /* InfoWindow.nib */; };
                CE54898F0B35D50E00F8AFB6 /* SKInfoWindowController.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE54898E0B35D50E00F8AFB6 /* 
SKInfoWindowController.m */; };
+               CE5BC5B10C79A27B00EBDCF7 /* NSTableView_SKExtensions.h in 
CopyFiles */ = {isa = PBXBuildFile; fileRef = CE5BC5AF0C79A27B00EBDCF7 /* 
NSTableView_SKExtensions.h */; };
+               CE5BC5B20C79A27B00EBDCF7 /* NSTableView_SKExtensions.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE5BC5B00C79A27B00EBDCF7 /* 
NSTableView_SKExtensions.m */; };
                CE5F42AF0BF89FE00069D89C /* AppleRemote.m in Sources */ = {isa 
= PBXBuildFile; fileRef = CE5F42AD0BF89FE00069D89C /* AppleRemote.m */; };
                CE5F43730BF8A3410069D89C /* IOKit.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = CE5F42D30BF8A3400069D89C /* IOKit.framework */; 
};
                CE67BB260BC44AC9007B6929 /* ZoomValues.strings in Resources */ 
= {isa = PBXBuildFile; fileRef = CE67BB240BC44AC9007B6929 /* ZoomValues.strings 
*/; };
@@ -255,6 +257,7 @@
                        dstSubfolderSpec = 10;
                        files = (
                                CE2BD8450BD4135600A5F4DB /* Sparkle.framework 
in CopyFiles */,
+                               CE5BC5B10C79A27B00EBDCF7 /* 
NSTableView_SKExtensions.h in CopyFiles */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
@@ -480,6 +483,8 @@
                CE54898D0B35D50E00F8AFB6 /* SKInfoWindowController.h */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path 
= SKInfoWindowController.h; sourceTree = "<group>"; };
                CE54898E0B35D50E00F8AFB6 /* SKInfoWindowController.m */ = {isa 
= PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; 
path = SKInfoWindowController.m; sourceTree = "<group>"; };
                CE54AA8E0BBC037400008750 /* ReleaseNotes.rtf */ = {isa = 
PBXFileReference; lastKnownFileType = text.rtf; path = ReleaseNotes.rtf; 
sourceTree = "<group>"; };
+               CE5BC5AF0C79A27B00EBDCF7 /* NSTableView_SKExtensions.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = NSTableView_SKExtensions.h; sourceTree = "<group>"; };
+               CE5BC5B00C79A27B00EBDCF7 /* NSTableView_SKExtensions.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = NSTableView_SKExtensions.m; sourceTree = "<group>"; };
                CE5F42AC0BF89FE00069D89C /* AppleRemote.h */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = 
AppleRemote.h; path = vendorsrc/martinkahr/AppleRemoteSource_R80/AppleRemote.h; 
sourceTree = "<group>"; };
                CE5F42AD0BF89FE00069D89C /* AppleRemote.m */ = {isa = 
PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; 
name = AppleRemote.m; path = 
vendorsrc/martinkahr/AppleRemoteSource_R80/AppleRemote.m; sourceTree = 
"<group>"; };
                CE5F42D30BF8A3400069D89C /* IOKit.framework */ = {isa = 
PBXFileReference; lastKnownFileType = wrapper.framework; name = 
IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree 
= "<absolute>"; };
@@ -795,6 +800,8 @@
                                CE070EA10B89039700733CC8 /* 
NSScrollView_SKExtensions.m */,
                                CE38ECD10B8093B200A1B779 /* 
NSString_SKExtensions.h */,
                                CE38ECD20B8093B200A1B779 /* 
NSString_SKExtensions.m */,
+                               CE5BC5AF0C79A27B00EBDCF7 /* 
NSTableView_SKExtensions.h */,
+                               CE5BC5B00C79A27B00EBDCF7 /* 
NSTableView_SKExtensions.m */,
                                CEAA67230C70A882006BD633 /* 
NSURL_SKExtensions.h */,
                                CEAA67240C70A882006BD633 /* 
NSURL_SKExtensions.m */,
                                CEF7119F0B90B714003A2771 /* 
NSUserDefaultsController_SKExtensions.h */,
@@ -1460,6 +1467,7 @@
                                CEAA55B70C6DE452006BD633 /* SKProgressCell.m in 
Sources */,
                                CEAA67260C70A882006BD633 /* 
NSURL_SKExtensions.m in Sources */,
                                CEF839B30C77742A00A3AD51 /* 
Files_SKExtensions.m in Sources */,
+                               CE5BC5B20C79A27B00EBDCF7 /* 
NSTableView_SKExtensions.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to