diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-06-11 11:57:54 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-06-11 11:57:54 +0000 |
commit | a7247b9f9098b40f170f6b2bcd28a4e934a02dc5 (patch) | |
tree | cd415a4b57db3f2c5ddba08446176a0b06d9533c | |
parent | fb96c4b17accaab40f972bef05f421fe85cb1fdb (diff) | |
download | sequelpro-a7247b9f9098b40f170f6b2bcd28a4e934a02dc5.tar.gz sequelpro-a7247b9f9098b40f170f6b2bcd28a4e934a02dc5.tar.bz2 sequelpro-a7247b9f9098b40f170f6b2bcd28a4e934a02dc5.zip |
• Select Next/Previous Tab now cycles through available tabs if it's called for the last/first tab
-rw-r--r-- | Source/SPWindowController.m | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index b68a4668..a19bcd08 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -152,19 +152,25 @@ } /** - * Select next tab. + * Select next tab; if last select first one. */ - (IBAction)selectNextDocumentTab:(id)sender { - [tabView selectNextTabViewItem:nil]; + if([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == [tabView numberOfTabViewItems] - 1) + [tabView selectFirstTabViewItem:nil]; + else + [tabView selectNextTabViewItem:nil]; } /** - * Select previous tab. + * Select previous tab; if first select last one. */ - (IBAction)selectPreviousDocumentTab:(id)sender { - [tabView selectPreviousTabViewItem:nil]; + if([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) + [tabView selectLastTabViewItem:nil]; + else + [tabView selectPreviousTabViewItem:nil]; } /** @@ -172,16 +178,11 @@ */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { - // Select Previous Tab - if ([menuItem action] == @selector(selectPreviousDocumentTab:)) { - return ([tabView numberOfTabViewItems] && [tabView indexOfTabViewItem:[tabView selectedTabViewItem]]); + // Select Next/Previous Tab + if ([menuItem action] == @selector(selectPreviousDocumentTab:) || [menuItem action] == @selector(selectNextDocumentTab:)) { + return ([tabView numberOfTabViewItems] != 1); } - - // Select Next Tab - if ([menuItem action] == @selector(selectNextDocumentTab:)) { - return ([tabView numberOfTabViewItems] && [tabView indexOfTabViewItem:[tabView selectedTabViewItem]]<[tabView numberOfTabViewItems]-1); - } - + return YES; } |