aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableView.m35
-rw-r--r--Source/SPWindowAdditions.m4
2 files changed, 21 insertions, 18 deletions
diff --git a/Source/SPTableView.m b/Source/SPTableView.m
index 8ec61f0a..61c63c75 100644
--- a/Source/SPTableView.m
+++ b/Source/SPTableView.m
@@ -42,7 +42,7 @@
@end
-@interface SPTableView (PrivateAPI)
+@interface SPTableView ()
- (void)_doubleClickAction;
- (void)_disableDoubleClickAction:(NSNotification *)notification;
@@ -50,32 +50,37 @@
@end
-
@implementation SPTableView
@synthesize tabEditingDisabled;
-- (id) init
+- (id)init
{
if ((self = [super init])) {
emptyDoubleClickAction = NULL;
}
+
return self;
}
-- (void) awakeFromNib
+- (void)awakeFromNib
{
[super setDoubleAction:@selector(_doubleClickAction)];
- if ([NSTableView instancesRespondToSelector:@selector(awakeFromNib)])
+
+ if ([NSTableView instancesRespondToSelector:@selector(awakeFromNib)]) {
[super awakeFromNib];
+ }
}
+#pragma mark -
+
/**
* Track window changes, in order to add listeners for when sheets are shown
* or hidden; this allows the double-click action to be disabled while sheets
* are open, preventing beeps when using the field editor on double-click.
*/
-- (void) viewWillMoveToWindow:(NSWindow *)aWindow {
+- (void)viewWillMoveToWindow:(NSWindow *)aWindow
+{
NSNotificationCenter *notifier = [NSNotificationCenter defaultCenter];
[notifier removeObserver:self name:NSWindowWillBeginSheetNotification object:nil];
@@ -87,8 +92,6 @@
}
}
-#pragma mark -
-
/**
* Right-click at row will select that row before ordering out the contextual menu
* if not more than one row is selected.
@@ -100,7 +103,7 @@
SPDatabaseDocument *parentTableDocument = nil;
if ([[[[[self window] delegate] class] description] isEqualToString:@"SPWindowController"]) {
- parentTableDocument = [[[self window] delegate] selectedTableDocument];
+ parentTableDocument = [(SPWindowController *)[[self window] delegate] selectedTableDocument];
}
// If SPDatabaseDocument is performing a task suppress any context menu
@@ -150,11 +153,14 @@
* display instead; this prevents the selected cell from automatically editing
* if the table is backtabbed to.
*/
-- (BOOL)becomeFirstResponder {
+- (BOOL)becomeFirstResponder
+{
if (tabEditingDisabled) {
[self display];
+
return YES;
}
+
return [super becomeFirstResponder];
}
@@ -208,9 +214,11 @@
else if (tabEditingDisabled && [[theEvent characters] length] && [[theEvent characters] characterAtIndex:0] == NSTabCharacter) {
if (([theEvent modifierFlags] & NSShiftKeyMask) != NSShiftKeyMask) {
[[self window] selectKeyViewFollowingView:self];
- } else {
+ }
+ else {
[[self window] selectKeyViewPrecedingView:self];
}
+
return;
}
@@ -277,11 +285,6 @@
#endif
-@end
-
-
-@implementation SPTableView (PrivateAPI)
-
/**
* On a double click, determine whether the action was in the empty area
* of the current table; if so, perform the assigned emptyDoubleClick action.
diff --git a/Source/SPWindowAdditions.m b/Source/SPWindowAdditions.m
index 9cec1a7c..6966b311 100644
--- a/Source/SPWindowAdditions.m
+++ b/Source/SPWindowAdditions.m
@@ -82,9 +82,9 @@
*/
- (void)swipeWithEvent:(NSEvent *)event
{
- if (![[self delegate] isKindOfClass:[SPWindowController class]] || ![[[self delegate] documents] count]) return;
+ if (![[self delegate] isKindOfClass:[SPWindowController class]] || ![[(SPWindowController *)[self delegate] documents] count]) return;
- id frontDoc = [[self delegate] selectedTableDocument];
+ id frontDoc = [(SPWindowController *)[self delegate] selectedTableDocument];
if (frontDoc && [frontDoc isKindOfClass:[SPDatabaseDocument class]] && [frontDoc valueForKeyPath:@"spHistoryControllerInstance"] && ![frontDoc isWorking])
{