aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPWindowController.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-06-11 11:57:54 +0000
committerBibiko <bibiko@eva.mpg.de>2010-06-11 11:57:54 +0000
commita7247b9f9098b40f170f6b2bcd28a4e934a02dc5 (patch)
treecd415a4b57db3f2c5ddba08446176a0b06d9533c /Source/SPWindowController.m
parentfb96c4b17accaab40f972bef05f421fe85cb1fdb (diff)
downloadsequelpro-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
Diffstat (limited to 'Source/SPWindowController.m')
-rw-r--r--Source/SPWindowController.m27
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;
}