summaryrefslogtreecommitdiffstats
path: root/macosx/ChapterTitles.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2008-06-04 18:54:56 +0000
committerritsuka <[email protected]>2008-06-04 18:54:56 +0000
commit13f00d4e63ce8e89f61ec6f5a5f517228e1c9e17 (patch)
tree045168bc8a6050345de4f8bdb39f27409df1a5ab /macosx/ChapterTitles.m
parent88df187b33e6d240292d03e8070b748eb57cfc91 (diff)
MacGUI: Implements a part of the NSTableView delegate in ChapterTitles so that pressing Return selects the next row and edits the chapter title so that the mouse or Mac OS X's full keyboard access is not required. Patch by bkiico517.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1492 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/ChapterTitles.m')
-rw-r--r--macosx/ChapterTitles.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/macosx/ChapterTitles.m b/macosx/ChapterTitles.m
index c58a0a03a..cc2d50c23 100644
--- a/macosx/ChapterTitles.m
+++ b/macosx/ChapterTitles.m
@@ -101,4 +101,39 @@
return cellEntry;
}
+
+/* Method to edit the next chapter when the user presses Return. We have to use
+a timer to avoid interfering with the chain of events that handles the edit. */
+- (void)controlTextDidEndEditing: (NSNotification *) notification
+{
+ NSTableView *chapterTable = [notification object];
+ NSInteger column = [chapterTable editedColumn];
+ NSInteger row = [chapterTable editedRow];
+ int textMovement;
+
+ // Edit the cell in the next row, same column
+ row++;
+ textMovement = [[[notification userInfo] objectForKey:@"NSTextMovement"] intValue];
+ if( textMovement == NSReturnTextMovement && row < [chapterTable numberOfRows] )
+ {
+ NSArray *info = [NSArray arrayWithObjects:chapterTable,
+ [NSNumber numberWithInteger:column], [NSNumber numberWithInteger:row], nil];
+ /* The delay is unimportant; editNextRow: won't be called until the responder
+ chain finishes because the event loop containing the timer is on this thread */
+ [self performSelector:@selector(editNextRow:) withObject:info afterDelay:0.0];
+ }
+}
+
+- (void)editNextRow: (id) objects
+{
+ NSTableView *chapterTable = [objects objectAtIndex:0];
+ NSInteger column = [[objects objectAtIndex:1] integerValue];
+ NSInteger row = [[objects objectAtIndex:2] integerValue];
+
+ if( row >= 0 && row < [chapterTable numberOfRows] )
+ {
+ [chapterTable selectRow:row byExtendingSelection:NO];
+ [chapterTable editColumn:column row:row withEvent:nil select:YES];
+ }
+}
@end