From 36af2c018db397c64dd7635b7c79476b4df6d610 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 25 Nov 2010 20:40:26 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20Editor=20-=20some=20GUI=20improvem?= =?UTF-8?q?ents=20and=20tooltips=20for=20outline=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Interfaces/English.lproj/BundleEditor.xib | 107 ++++++++++++++++++------------ Source/SPAppController.m | 6 +- Source/SPBundleEditorController.h | 4 ++ Source/SPBundleEditorController.m | 67 ++++++++++++++++++- 4 files changed, 139 insertions(+), 45 deletions(-) diff --git a/Interfaces/English.lproj/BundleEditor.xib b/Interfaces/English.lproj/BundleEditor.xib index f7f1d6fa..eff00e7b 100644 --- a/Interfaces/English.lproj/BundleEditor.xib +++ b/Interfaces/English.lproj/BundleEditor.xib @@ -23,6 +23,7 @@ YES + YES @@ -90,7 +91,6 @@ 4370 {142, 420} - YES @@ -191,7 +191,6 @@ {{1, 1}, {142, 420}} - @@ -202,7 +201,6 @@ -2147483392 {{-100, -100}, {15, 102}} - _doScroller: 0.99585062265396118 @@ -212,7 +210,6 @@ -2147483392 {{-100, -100}, {192, 15}} - 1 _doScroller: @@ -221,7 +218,6 @@ {{0, 22}, {144, 422}} - 530 @@ -239,7 +235,6 @@ 292 {{-1, -1}, {32, 25}} - YES 67239424 @@ -268,7 +263,6 @@ 292 {{30, -1}, {32, 25}} - YES 67239424 @@ -293,7 +287,6 @@ 292 {{61, -1}, {32, 24}} - YES 71433792 @@ -390,7 +383,6 @@ - 3 YES 1 YES @@ -400,7 +392,6 @@ {142, 23} - YES YES NO @@ -409,7 +400,6 @@ {142, 444} - NSView @@ -422,7 +412,6 @@ 268 {{236, 318}, {292, 18}} - YES -2080244224 @@ -483,7 +472,6 @@ {138, 92} - @@ -565,7 +553,6 @@ {{1, 1}, {504, 210}} - @@ -580,7 +567,6 @@ -2147483392 {{454, 1}, {15, 190}} - _doScroller: 1 @@ -591,7 +577,6 @@ -2147483392 {{-100, -100}, {87, 18}} - 1 _doScroller: @@ -601,7 +586,6 @@ {{20, 105}, {506, 212}} - 562 @@ -613,7 +597,6 @@ 289 {{435, 58}, {96, 28}} - 1 YES @@ -635,7 +618,6 @@ 289 {{435, 16}, {96, 28}} - YES 67239424 @@ -646,7 +628,7 @@ -2038284033 129 - Gw + 200 25 @@ -656,7 +638,6 @@ 292 {{20, 20}, {161, 22}} - YES 67239424 @@ -679,7 +660,6 @@ 268 {{236, 351}, {167, 22}} - YES -2076049856 @@ -713,7 +693,6 @@ 292 {{17, 61}, {167, 22}} - YES -2076049856 @@ -747,7 +726,6 @@ 268 {{236, 391}, {167, 22}} - YES -2076049856 @@ -781,7 +759,6 @@ 268 {{17, 351}, {167, 22}} - YES -2076049856 @@ -815,7 +792,6 @@ 265 {{504, 349}, {25, 25}} - YES 67239424 @@ -836,7 +812,6 @@ 268 {{186, 355}, {48, 14}} - YES 68288064 @@ -858,7 +833,6 @@ 292 {{204, 63}, {161, 19}} - YES -1804468671 @@ -887,7 +861,6 @@ 288 {{17, 83}, {167, 14}} - YES 68288064 @@ -904,7 +877,6 @@ 292 {{201, 83}, {167, 14}} - YES 68288064 @@ -921,7 +893,6 @@ 268 {{236, 414}, {167, 14}} - YES 68288064 @@ -938,7 +909,6 @@ 268 {{17, 320}, {167, 14}} - YES 68288064 @@ -955,7 +925,6 @@ 268 {{17, 374}, {167, 14}} - YES 68288064 @@ -972,7 +941,6 @@ 292 {{201, 43}, {167, 14}} - YES 68288064 @@ -989,7 +957,6 @@ 292 {{204, 22}, {161, 19}} - YES -1804468671 @@ -1008,7 +975,6 @@ 264 {{17, 414}, {167, 14}} - YES 68288064 @@ -1025,7 +991,6 @@ 264 {{20, 394}, {161, 19}} - YES -1804468671 @@ -1042,13 +1007,11 @@ {{143, 0}, {548, 444}} - NSView {691, 444} - YES 2 SPQueryFavoriteSplitView @@ -1115,7 +1078,6 @@ {691, 444} - {{0, 0}, {1920, 1058}} {691, 466} @@ -1182,6 +1144,7 @@ bundleName disabled name + command YES @@ -1746,6 +1709,38 @@ 1028 + + + bundleDataView + + + + 1035 + + + + helpButton + + + + 1036 + + + + saveButton + + + + 1037 + + + + cancelButton + + + + 1038 + @@ -2664,7 +2659,7 @@ ToolTip - Q2xvc2UgdGhlIEJ1bmRsZSBFZGl0b3Igd2l0aG91dCBzYXZpbmcgKA/ijospA + Close the Bundle Editor without saving com.apple.InterfaceBuilder.CocoaPlugin @@ -2739,7 +2734,7 @@ - 1028 + 1038 @@ -2986,6 +2981,8 @@ YES addButton + bundleDataView + cancelButton categoryTextField commandBundleTreeController commandTextView @@ -2994,6 +2991,7 @@ disabledCheckbox duplicateMenuItem fallbackLabelField + helpButton inputFallbackPopupButton inputPopupButton keyEquivalentField @@ -3001,12 +2999,15 @@ outputPopupButton removeButton revealInFinderMenuItem + saveButton scopePopupButton tootlipTextField YES NSButton + NSView + NSButton NSTextField NSTreeController id @@ -3015,6 +3016,7 @@ NSButton NSMenuItem NSTextField + NSButton NSPopUpButton NSPopUpButton SRRecorderControl @@ -3022,6 +3024,7 @@ NSPopUpButton NSButton NSMenuItem + NSButton NSPopUpButton NSTextField @@ -3031,6 +3034,8 @@ YES addButton + bundleDataView + cancelButton categoryTextField commandBundleTreeController commandTextView @@ -3039,6 +3044,7 @@ disabledCheckbox duplicateMenuItem fallbackLabelField + helpButton inputFallbackPopupButton inputPopupButton keyEquivalentField @@ -3046,6 +3052,7 @@ outputPopupButton removeButton revealInFinderMenuItem + saveButton scopePopupButton tootlipTextField @@ -3055,6 +3062,14 @@ addButton NSButton + + bundleDataView + NSView + + + cancelButton + NSButton + categoryTextField NSTextField @@ -3087,6 +3102,10 @@ fallbackLabelField NSTextField + + helpButton + NSButton + inputFallbackPopupButton NSPopUpButton @@ -3115,6 +3134,10 @@ revealInFinderMenuItem NSMenuItem + + saveButton + NSButton + scopePopupButton NSPopUpButton 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 -- cgit v1.2.3