aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPWindowController.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-05-08 00:37:16 +0000
committerstuconnolly <stuart02@gmail.com>2011-05-08 00:37:16 +0000
commit4dfa685461faec53e709afaba1323c8384d1c412 (patch)
tree80985da25971837f6408a6c95eeaf35b693da456 /Source/SPWindowController.m
parent824040d210122bae105d0a240a6e00b99328b4ef (diff)
downloadsequelpro-4dfa685461faec53e709afaba1323c8384d1c412.tar.gz
sequelpro-4dfa685461faec53e709afaba1323c8384d1c412.tar.bz2
sequelpro-4dfa685461faec53e709afaba1323c8384d1c412.zip
Add tab context menu.
Diffstat (limited to 'Source/SPWindowController.m')
-rw-r--r--Source/SPWindowController.m18
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m
index e9b73491..c097e711 100644
--- a/Source/SPWindowController.m
+++ b/Source/SPWindowController.m
@@ -160,14 +160,14 @@
*/
- (IBAction) closeTab:(id)sender
{
-
// Return if the selected tab shouldn't be closed
if (![selectedTableDocument parentTabShouldClose]) return;
// If there are multiple tabs, close the front tab.
if ([tabView numberOfTabViewItems] > 1) {
[tabView removeTabViewItem:[tabView selectedTabViewItem]];
- } else {
+ }
+ else {
[[self window] performClose:self];
}
}
@@ -572,6 +572,20 @@
}
/**
+ * Displays the current tab's context menu.
+ */
+- (NSMenu *)tabView:(NSTabView *)aTabView menuForTabViewItem:(NSTabViewItem *)tabViewItem
+{
+ NSMenu *menu = [[NSMenu alloc] init];
+
+ [menu addItemWithTitle:NSLocalizedString(@"Close Tab", @"close tab context menu item") action:@selector(closeTab:) keyEquivalent:@""];
+ [menu insertItem:[NSMenuItem separatorItem] atIndex:1];
+ [menu addItemWithTitle:NSLocalizedString(@"Open in New Tab", @"open connection in new tab context menu item") action:@selector(openDatabaseInNewTab:) keyEquivalent:@""];
+
+ return [menu autorelease];
+}
+
+/**
* When tab drags start, show all the tab bars. This allows adding tabs to windows
* containing only one tab - where the bar is normally hidden.
*/