From 1c7cf0aa49e68714dbfc4d7ca01fccd519e22aee Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Wed, 18 Nov 2009 00:44:03 +0000 Subject: Manually set the delegate of the anchored button bars in the content filter editor and query favorites editor as you can't do it in IB. --- Interfaces/English.lproj/ContentFilterManager.xib | 22 ++++++++++++++++------ Interfaces/English.lproj/QueryFavoriteManager.xib | 21 +++++++++++++++------ Source/SPContentFilterManager.h | 4 ++++ Source/SPContentFilterManager.m | 6 ++++-- Source/SPQueryFavoriteManager.h | 5 ++++- Source/SPQueryFavoriteManager.m | 19 ++++++++++--------- 6 files changed, 53 insertions(+), 24 deletions(-) diff --git a/Interfaces/English.lproj/ContentFilterManager.xib b/Interfaces/English.lproj/ContentFilterManager.xib index 7228ee55..6605c651 100644 --- a/Interfaces/English.lproj/ContentFilterManager.xib +++ b/Interfaces/English.lproj/ContentFilterManager.xib @@ -2,10 +2,10 @@ 1050 - 10B504 + 10C540 740 - 1038.2 - 437.00 + 1038.25 + 458.00 YES @@ -1322,6 +1322,14 @@ 367 + + + splitViewButtonBar + + + + 368 + @@ -1925,9 +1933,9 @@ YES com.apple.InterfaceBuilder.CocoaPlugin - {{627, 417}, {500, 371}} + {{571, 417}, {500, 371}} com.apple.InterfaceBuilder.CocoaPlugin - {{627, 417}, {500, 371}} + {{571, 417}, {500, 371}} {196, 240} {{357, 418}, {480, 270}} @@ -2114,7 +2122,7 @@ - 367 + 368 @@ -2294,6 +2302,7 @@ removeButton resultingClauseContentLabel resultingClauseLabel + splitViewButtonBar YES @@ -2309,6 +2318,7 @@ id id id + BWAnchoredButtonBar diff --git a/Interfaces/English.lproj/QueryFavoriteManager.xib b/Interfaces/English.lproj/QueryFavoriteManager.xib index bfa36ff3..f45e707e 100644 --- a/Interfaces/English.lproj/QueryFavoriteManager.xib +++ b/Interfaces/English.lproj/QueryFavoriteManager.xib @@ -21,7 +21,7 @@ YES - + YES @@ -573,7 +573,6 @@ Apple PNG pasteboard type Apple URL pasteboard type CorePasteboardFlavorType 0x6D6F6F76 - CorePasteboardFlavorType 0x75726C20 NSColor pasteboard type NSFilenamesPboardType NSStringPboardType @@ -1195,6 +1194,14 @@ 300 + + + splitViewButtonBar + + + + 301 + @@ -1669,9 +1676,9 @@ YES com.apple.InterfaceBuilder.CocoaPlugin - {{418, 306}, {500, 371}} + {{417, 428}, {500, 371}} com.apple.InterfaceBuilder.CocoaPlugin - {{418, 306}, {500, 371}} + {{417, 428}, {500, 371}} {196, 240} {{357, 418}, {480, 270}} @@ -1819,7 +1826,7 @@ - 300 + 301 @@ -1997,6 +2004,7 @@ favoritesArrayController favoritesTableView removeButton + splitViewButtonBar YES @@ -2005,7 +2013,8 @@ NSTextView NSArrayController NSTableView - id + NSButton + BWAnchoredButtonBar diff --git a/Source/SPContentFilterManager.h b/Source/SPContentFilterManager.h index 441e8b43..f8ffe16e 100644 --- a/Source/SPContentFilterManager.h +++ b/Source/SPContentFilterManager.h @@ -25,6 +25,8 @@ #import +@class BWAnchoredButtonBar; + @interface NSObject (SPContentFilterManagerDelegate) - (void)contentFiltersHaveBeenUpdated:(id)manager; @@ -47,6 +49,8 @@ IBOutlet id resultingClauseLabel; IBOutlet id resultingClauseContentLabel; IBOutlet id insertPlaceholderButton; + + IBOutlet BWAnchoredButtonBar *splitViewButtonBar; IBOutlet id contentFilterArrayController; diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index 2fd22dfd..33be5048 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -29,6 +29,7 @@ #import "SPQueryController.h" #import "TableContent.h" #import "SPConstants.h" +#import "SPConnectionController.h" #define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]") #define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]") @@ -75,7 +76,6 @@ */ - (void)awakeFromNib { - [contentFilterTextView setAllowsDocumentBackgroundColorChange:YES]; NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; @@ -141,6 +141,8 @@ // Set column header [[[contentFilterTableView tableColumnWithIdentifier:@"MenuLabel"] headerCell] setStringValue:[NSString stringWithFormat:NSLocalizedString(@"‘%@’ Fields Content Filters", @"content filter for field type ‘%@’"), filterType]]; + // Set the button delegate + [splitViewButtonBar setSplitViewDelegate:self]; } #pragma mark - @@ -384,7 +386,7 @@ */ - (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset { - return (proposedMax - 220); + return (proposedMax - 245); } /** diff --git a/Source/SPQueryFavoriteManager.h b/Source/SPQueryFavoriteManager.h index 1546186e..9318ed22 100644 --- a/Source/SPQueryFavoriteManager.h +++ b/Source/SPQueryFavoriteManager.h @@ -25,6 +25,8 @@ #import +@class BWAnchoredButtonBar; + @interface NSObject (SPQueryFavoriteManagerDelegate) - (void)queryFavoritesHaveBeenUpdated:(id)manager; @@ -40,7 +42,8 @@ IBOutlet NSTableView *favoritesTableView; IBOutlet NSTextField *favoriteNameTextField; IBOutlet NSTextView *favoriteQueryTextView; - IBOutlet id removeButton; + IBOutlet NSButton *removeButton; + IBOutlet BWAnchoredButtonBar *splitViewButtonBar; IBOutlet NSArrayController *favoritesArrayController; diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 8acf2f0a..dc1cfdcf 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -28,6 +28,7 @@ #import "SPEncodingPopupAccessory.h" #import "SPQueryController.h" #import "SPConstants.h" +#import "SPConnectionController.h" #define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]") #define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]") @@ -73,7 +74,6 @@ */ - (void)awakeFromNib { - [favoriteQueryTextView setAllowsDocumentBackgroundColorChange:YES]; NSMutableDictionary *bindingOptions = [NSMutableDictionary dictionary]; @@ -110,12 +110,11 @@ [favorites addObject:[[fav mutableCopy] autorelease]]; } - - // Select the first query if any - NSUInteger i = 0; - for(i=0; i < [favorites count]; i++ ) - if(![[favorites objectAtIndex:i] objectForKey:@"headerOfFileURL"]) - break; + // Select the first query if any + for (NSDictionary *favorite in favorites) + { + if (![favorite objectForKey:@"headerOfFileURL"]) break; + } [[self window] makeFirstResponder:favoritesTableView]; [self _initWithNoSelection]; @@ -128,7 +127,9 @@ // Set Remove button state [removeButton setEnabled:([favoritesTableView numberOfSelectedRows] > 0)]; - + + // Set the button delegate + [splitViewButtonBar setSplitViewDelegate:self]; } #pragma mark - @@ -388,7 +389,7 @@ */ - (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset { - return (proposedMax - 220); + return (proposedMax - 240); } /** -- cgit v1.2.3