aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-25 20:40:26 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-25 20:40:26 +0000
commit36af2c018db397c64dd7635b7c79476b4df6d610 (patch)
treeeb0a22035cd0099cc2edff1a8c7365aa6e8f0d95 /Source
parent29cb06ee02f5393c51d7b45d60e314a94c08e5b2 (diff)
downloadsequelpro-36af2c018db397c64dd7635b7c79476b4df6d610.tar.gz
sequelpro-36af2c018db397c64dd7635b7c79476b4df6d610.tar.bz2
sequelpro-36af2c018db397c64dd7635b7c79476b4df6d610.zip
• Bundle Editor
- some GUI improvements and tooltips for outline view
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m6
-rw-r--r--Source/SPBundleEditorController.h4
-rw-r--r--Source/SPBundleEditorController.m67
3 files changed, 74 insertions, 3 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 609593a8..b34cb0d5 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -1170,6 +1170,7 @@
@"executeBundleItemForApp:", nil];
NSInteger k = 0;
+ BOOL bundleOtherThanGeneralFound = NO;
for(NSString* scope in scopes) {
NSArray *bundleCategories = [[NSApp delegate] bundleCategoriesForScope:scope];
@@ -1195,7 +1196,8 @@
} else {
bundleMenu = menu;
- [menu addItem:[NSMenuItem separatorItem]];
+ if(bundleOtherThanGeneralFound)
+ [menu addItem:[NSMenuItem separatorItem]];
}
// Add found Category submenus
@@ -1220,7 +1222,7 @@
keyEq = @"";
NSMenuItem *mItem = [[[NSMenuItem alloc] initWithTitle:[item objectForKey:SPBundleInternLabelKey] action:NSSelectorFromString([scopeSelector objectAtIndex:k]) keyEquivalent:keyEq] autorelease];
-
+ bundleOtherThanGeneralFound = YES;
if([keyEq length])
[mItem setKeyEquivalentModifierMask:[[[item objectForKey:SPBundleFileKeyEquivalentKey] objectAtIndex:1] intValue]];
diff --git a/Source/SPBundleEditorController.h b/Source/SPBundleEditorController.h
index b08be971..84255fda 100644
--- a/Source/SPBundleEditorController.h
+++ b/Source/SPBundleEditorController.h
@@ -44,10 +44,14 @@
IBOutlet NSPopUpButton* scopePopupButton;
IBOutlet NSButton *removeButton;
IBOutlet NSButton *addButton;
+ IBOutlet NSButton *saveButton;
+ IBOutlet NSButton *cancelButton;
+ IBOutlet NSButton *helpButton;
IBOutlet NSMenuItem *duplicateMenuItem;
IBOutlet NSMenuItem *revealInFinderMenuItem;
IBOutlet SRRecorderControl *keyEquivalentField;
IBOutlet NSButton *disabledCheckbox;
+ IBOutlet NSView *bundleDataView;
IBOutlet NSTreeController *commandBundleTreeController;
NSMutableArray *touchedBundleArray;
diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m
index fe2c8289..01d74ddc 100644
--- a/Source/SPBundleEditorController.m
+++ b/Source/SPBundleEditorController.m
@@ -744,7 +744,11 @@
[commandBundleTreeController setContent:commandBundleTree];
[commandBundleTreeController rearrangeObjects];
[commandsOutlineView reloadData];
- [commandsOutlineView expandItem:nil expandChildren:YES];
+ [commandsOutlineView expandItem:[commandsOutlineView itemAtRow:0] expandChildren:NO];
+ NSUInteger *selPath[2];
+ selPath[0] = 0;
+ selPath[1] = 0;
+ [commandBundleTreeController setSelectionIndexPath:[NSIndexPath indexPathWithIndexes:&selPath length:2]];
}
@@ -1075,6 +1079,7 @@
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
+ if([outlineView levelForItem:item] == 0) return NO;
return YES;
}
@@ -1117,6 +1122,66 @@
}
+- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item
+{
+ if([outlineView levelForItem:item] == 0) return NO;
+ return YES;
+}
+
+- (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowCellExpansionForTableColumn:(NSTableColumn *)tableColumn item:(id)item
+{
+ return NO;
+}
+
+- (NSString *)outlineView:(NSOutlineView *)outlineView toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc item:(id)item mouseLocation:(NSPoint)mouseLocation{
+ if([outlineView levelForItem:item] == 0) return NSLocalizedString(@"Installed Bundles", @"Installed Bundles");
+ if([outlineView levelForItem:item] == 1) {
+ NSString *bName = [[item representedObject] objectForKey:kBundleNameKey];
+ NSUInteger k = 0;
+ BOOL found = NO;
+ for(id i in [[commandBundleTreeController arrangedObjects] childNodes]) {
+ for(id j in [i childNodes]) {
+ if([[[j representedObject] objectForKey:kBundleNameKey] isEqualToString:bName]) {
+ found = YES;
+ break;
+ }
+ k++;
+ }
+ if(found) break;
+ }
+ switch([self _scopeIndexForArrangedScopeIndex:k]) {
+ case kInputFieldScopeArrayIndex:
+ return NSLocalizedString(@"Input Field Scope\ncommands will run on each text input field", @"Input Field Scope\ncommands will run on each text input field tooltip");
+ break;
+ case kDataTableScopeArrayIndex:
+ return NSLocalizedString(@"Data Table Scope\ncommands will run on the Content and Query data tables", @"Data Table Scope\ncommands will run on the Content and Query data tables tooltip");
+ break;
+ case kGeneralScopeArrayIndex:
+ return NSLocalizedString(@"General Scope\ncommands will run application-wide", @"General Scope\ncommands will run application-wide tooltip");
+ break;
+ default:
+ return @"";
+ }
+ }
+ if([outlineView levelForItem:item] == 2) {
+ if([[item representedObject] objectForKey:kChildrenKey]) {
+ return [NSString stringWithFormat:@"“%@” %@", [[item representedObject] objectForKey:kBundleNameKey], NSLocalizedString(@"submenu label", @"submenu label")];
+ } else {
+ if([[item representedObject] objectForKey:SPBundleFileTooltipKey] && [[[item representedObject] objectForKey:SPBundleFileTooltipKey] length])
+ return [[item representedObject] objectForKey:SPBundleFileTooltipKey];
+ else
+ return [NSString stringWithFormat:@"“%@” Bundle", [[item representedObject] objectForKey:kBundleNameKey]];
+ }
+ }
+ if([outlineView levelForItem:item] == 3) {
+ if([[item representedObject] objectForKey:SPBundleFileTooltipKey] && [[[item representedObject] objectForKey:SPBundleFileTooltipKey] length])
+ return [[item representedObject] objectForKey:SPBundleFileTooltipKey];
+ else
+ return [NSString stringWithFormat:@"“%@” Bundle", [[item representedObject] objectForKey:kBundleNameKey]];
+ }
+ return @"";
+}
+
#pragma mark -
#pragma mark TableView delegate