Revision: 15174
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15174&view=rev
Author: hofman
Date: 2009-04-24 17:21:55 +0000 (Fri, 24 Apr 2009)
Log Message:
-----------
Remove table header popup from group outlineview. Instead add the popup menu to
the main View menu, and also use this as contextual menu for the category
parent group. Use the current group field as the title of the category parent
group.
Modified Paths:
--------------
trunk/bibdesk/BDSKAppController.h
trunk/bibdesk/BDSKAppController.m
trunk/bibdesk/BDSKGroupOutlineView.h
trunk/bibdesk/BDSKGroupOutlineView.m
trunk/bibdesk/BDSKParentGroup.h
trunk/bibdesk/BDSKParentGroup.m
trunk/bibdesk/BibDocument.m
trunk/bibdesk/BibDocument_DataSource.m
trunk/bibdesk/BibDocument_Groups.h
trunk/bibdesk/BibDocument_Groups.m
trunk/bibdesk/BibDocument_Menus.m
trunk/bibdesk/English.lproj/MainMenu.nib/classes.nib
trunk/bibdesk/English.lproj/MainMenu.nib/info.nib
trunk/bibdesk/English.lproj/MainMenu.nib/keyedobjects.nib
Modified: trunk/bibdesk/BDSKAppController.h
===================================================================
--- trunk/bibdesk/BDSKAppController.h 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BDSKAppController.h 2009-04-24 17:21:55 UTC (rev 15174)
@@ -56,6 +56,7 @@
IBOutlet NSMenu *columnsMenu;
IBOutlet NSMenu *groupSortMenu;
+ IBOutlet NSMenu *groupFieldMenu;
IBOutlet NSMenu *copyAsTemplateMenu;
IBOutlet NSMenu *previewDisplayMenu;
IBOutlet NSMenu *sidePreviewDisplayMenu;
@@ -70,6 +71,7 @@
- (void)copyAllExportTemplatesToApplicationSupportAndOverwrite:(BOOL)overwrite;
- (NSMenu *)groupSortMenu;
+- (NSMenu *)groupFieldMenu;
- (NSArray *)requiredFieldsForCiteKey;
- (void)setRequiredFieldsForCiteKey:(NSArray *)newFields;
Modified: trunk/bibdesk/BDSKAppController.m
===================================================================
--- trunk/bibdesk/BDSKAppController.m 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BDSKAppController.m 2009-04-24 17:21:55 UTC (rev 15174)
@@ -537,6 +537,11 @@
return groupSortMenu;
}
+- (NSMenu *)groupFieldMenu {
+ [self menuNeedsUpdate:groupFieldMenu];
+ return groupFieldMenu;
+}
+
- (BOOL) validateMenuItem:(NSMenuItem*)menuItem{
SEL act = [menuItem action];
@@ -641,6 +646,19 @@
BibDocument *document = (BibDocument *)[[NSDocumentController
sharedDocumentController] currentDocument];
[menu addItemsFromMenu:[document columnsMenu]];
+ } else if ([menu isEqual:groupFieldMenu]) {
+
+ NSEnumerator *fieldEnum = [[[NSUserDefaults standardUserDefaults]
stringArrayForKey:BDSKGroupFieldsKey] reverseObjectEnumerator];
+ NSString *field;
+
+ while ([[menu itemAtIndex:1] isSeparatorItem] == NO)
+ [menu removeItemAtIndex:1];
+
+ while (field = [fieldEnum nextObject]) {
+ NSMenuItem *menuItem = [menu insertItemWithTitle:field
action:@selector(changeGroupFieldAction:) keyEquivalent:@"" atIndex:1];
+ [menuItem setRepresentedObject:field];
+ }
+
} else if ([menu isEqual:copyAsTemplateMenu]) {
NSArray *styles = [BDSKTemplate allStyleNames];
Modified: trunk/bibdesk/BDSKGroupOutlineView.h
===================================================================
--- trunk/bibdesk/BDSKGroupOutlineView.h 2009-04-24 11:38:41 UTC (rev
15173)
+++ trunk/bibdesk/BDSKGroupOutlineView.h 2009-04-24 17:21:55 UTC (rev
15174)
@@ -44,7 +44,6 @@
@interface BDSKGroupOutlineView : BDSKGradientOutlineView {
NSTextFieldCell *parentCell;
}
-- (NSPopUpButtonCell *)popUpHeaderCell;
- (NSTextFieldCell *)parentCell;
- (void)handleClipViewFrameChangedNotification:(NSNotification *)note;
- (void)updateHighlights;
@@ -52,17 +51,9 @@
#pragma mark -
-...@interface BDSKGroupTableHeaderView : NSTableHeaderView
-- (id)initWithTableColumn:(NSTableColumn *)tableColumn;
-- (NSPopUpButtonCell *)popUpHeaderCell;
-...@end
-
-#pragma mark -
-
@interface NSObject (BDSKGroupTableViewDelegate)
- (NSIndexSet *)outlineView:(BDSKGroupOutlineView *)anOutlineView
indexesOfRowsToHighlightInRange:(NSRange)indexRange;
- (NSIndexSet *)outlineViewSingleSelectionIndexes:(BDSKGroupOutlineView
*)anOutlineView;
- (void)outlineView:(BDSKGroupOutlineView *)aTableView
doubleClickedOnIconOfItem:(id)item;
-- (NSMenu *)outlineView:(BDSKGroupOutlineView *)anOutlineView
menuForTableHeaderColumn:(NSTableColumn *)aTableColumn onPopUp:(BOOL)flag;
- (BOOL)outlineViewShouldEditNextItemWhenEditingEnds:(BDSKGroupOutlineView
*)aTableView;
@end
Modified: trunk/bibdesk/BDSKGroupOutlineView.m
===================================================================
--- trunk/bibdesk/BDSKGroupOutlineView.m 2009-04-24 11:38:41 UTC (rev
15173)
+++ trunk/bibdesk/BDSKGroupOutlineView.m 2009-04-24 17:21:55 UTC (rev
15174)
@@ -60,19 +60,7 @@
- (void)awakeFromNib
{
- if([self numberOfColumns] == 0)
- [NSException raise:BDSKUnimplementedException format:@"%@ needs
at least one column.", [self class]];
- NSTableColumn *column = [[self tableColumns] objectAtIndex:0];
- BDSKPRECONDITION(column);
-
- NSTableHeaderView *currentTableHeaderView = [self headerView];
- BDSKGroupTableHeaderView *customTableHeaderView =
[[BDSKGroupTableHeaderView alloc] initWithTableColumn:column];
-
- [customTableHeaderView setFrame:[currentTableHeaderView frame]];
- [customTableHeaderView setBounds:[currentTableHeaderView bounds]];
-
- [self setHeaderView:customTableHeaderView];
- [customTableHeaderView release];
+ [self setHeaderView:nil];
BDSKPRECONDITION([[self enclosingScrollView] contentView]);
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -95,10 +83,6 @@
return row > 0 ? [super frameOfOutlineCellAtRow:row] : NSZeroRect;
}
-- (NSPopUpButtonCell *)popUpHeaderCell{
- return [(BDSKGroupTableHeaderView *)[self headerView] popUpHeaderCell];
-}
-
- (NSTextFieldCell *)parentCell {
if (parentCell == nil) {
parentCell = [[NSTextFieldCell alloc] init];
@@ -305,79 +289,3 @@
}
@end
-
-#pragma mark -
-
-...@implementation BDSKGroupTableHeaderView
-
-- (id)initWithTableColumn:(NSTableColumn *)tableColumn
-{
- if(![super init])
- return nil;
-
- BDSKHeaderPopUpButtonCell *cell;
- cell = [[BDSKHeaderPopUpButtonCell alloc] initWithHeaderCell:[tableColumn
headerCell]];
-
- [tableColumn setHeaderCell:cell];
- [cell release];
-
- return self;
-}
-
-- (void)mouseDown:(NSEvent *)theEvent
-{
- NSPoint location = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
-
- NSInteger colIndex = [self columnAtPoint:location];
- BDSKASSERT(colIndex != -1);
- if(colIndex == -1)
- return;
-
- NSTableColumn *column = [[[self tableView] tableColumns]
objectAtIndex:colIndex];
- id cell = [column headerCell];
- NSRect headerRect = [self headerRectOfColumn:colIndex];
-
- if ([cell isKindOfClass:[BDSKHeaderPopUpButtonCell class]]) {
- if (NSMouseInRect(location, [cell
popUpRectForBounds:headerRect], [self isFlipped])) {
- [cell trackMouse:theEvent
- inRect:headerRect
- ofView:self
- untilMouseUp:YES];
- } else {
- [super mouseDown:theEvent];
- }
- } else {
- [super mouseDown:theEvent];
- }
-}
-
-- (NSMenu *)menuForEvent:(NSEvent *)theEvent {
- BDSKGroupOutlineView *outlineView = (BDSKGroupOutlineView *)[self
tableView];
- id delegate = [outlineView delegate];
- NSPoint location = [self convertPoint:[theEvent locationInWindow]
fromView:nil];
- NSInteger column = [self columnAtPoint:location];
-
- if (column == -1)
- return nil;
-
- NSTableColumn *tableColumn = [[outlineView tableColumns]
objectAtIndex:column];
- id cell = [tableColumn headerCell];
- BOOL onPopUp = NO;
-
- if ([cell isKindOfClass:[BDSKHeaderPopUpButtonCell class]] &&
- NSMouseInRect(location, [cell popUpRectForBounds:[self
headerRectOfColumn:column]], [self isFlipped]))
- onPopUp = YES;
-
- if ([delegate
respondsToSelector:@selector(outlineView:menuForTableHeaderColumn:onPopUp:)]) {
- return [delegate outlineView:outlineView
menuForTableHeaderColumn:tableColumn onPopUp:onPopUp];
- }
- return nil;
-}
-
-- (NSPopUpButtonCell *)popUpHeaderCell{
- id headerCell = [[[[self tableView] tableColumns] objectAtIndex:0]
headerCell];
- BDSKASSERT([headerCell isKindOfClass:[NSPopUpButtonCell class]]);
- return headerCell;
-}
-
-...@end
Modified: trunk/bibdesk/BDSKParentGroup.h
===================================================================
--- trunk/bibdesk/BDSKParentGroup.h 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BDSKParentGroup.h 2009-04-24 17:21:55 UTC (rev 15174)
@@ -113,6 +113,8 @@
- (NSArray *)categoryGroups;
- (void)setCategoryGroups:(NSArray *)array;
+- (void)setName:(id)newName;
+
@end
#pragma mark -
Modified: trunk/bibdesk/BDSKParentGroup.m
===================================================================
--- trunk/bibdesk/BDSKParentGroup.m 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BDSKParentGroup.m 2009-04-24 17:21:55 UTC (rev 15174)
@@ -324,6 +324,13 @@
}
}
+- (void)setName:(id)newName {
+ if (name != newName) {
+ [name release];
+ name = [newName retain];
+ }
+}
+
@end
#pragma mark -
Modified: trunk/bibdesk/BibDocument.m
===================================================================
--- trunk/bibdesk/BibDocument.m 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BibDocument.m 2009-04-24 17:21:55 UTC (rev 15174)
@@ -615,18 +615,6 @@
[[groupActionButton cell] setUsesItemFromMenu:NO];
[groupActionButton setMenu:groupMenu];
- BDSKHeaderPopUpButtonCell *headerCell = (BDSKHeaderPopUpButtonCell
*)[groupOutlineView popUpHeaderCell];
- [headerCell setAction:@selector(changeGroupFieldAction:)];
- [headerCell setTarget:self];
- [headerCell setMenu:[self groupFieldsMenu]];
- [headerCell setIndicatorImage:[NSImage
imageNamed:docState.sortGroupsDescending ? @"NSDescendingSortIndicator" :
@"NSAscendingSortIndicator"]];
- [headerCell setUsesItemFromMenu:NO];
- [headerCell setTitle:[currentGroupField localizedFieldName]];
- if([headerCell indexOfItemWithRepresentedObject:currentGroupField] != -1)
- [headerCell selectItemAtIndex:[headerCell
indexOfItemWithRepresentedObject:currentGroupField]];
- else
- [headerCell selectItemAtIndex:0];
-
// array of BDSKSharedGroup objects and zeroconf support, doesn't do
anything when already enabled
// we don't do this in appcontroller as we want our data to be loaded
if([sud boolForKey:BDSKShouldLookForSharedFilesKey]){
@@ -2736,10 +2724,6 @@
name:BDSKGroupFieldChangedNotification
object:self];
[nc addObserver:self
- selector:@selector(handleGroupFieldAddRemoveNotification:)
- name:BDSKGroupFieldAddRemoveNotification
- object:nil];
- [nc addObserver:self
selector:@selector(handleTableSelectionChangedNotification:)
name:BDSKTableSelectionChangedNotification
object:self];
Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m 2009-04-24 11:38:41 UTC (rev
15173)
+++ trunk/bibdesk/BibDocument_DataSource.m 2009-04-24 17:21:55 UTC (rev
15174)
@@ -1274,7 +1274,10 @@
- (NSMenu *)outlineView:(NSOutlineView *)ov menuForTableColumn:(NSTableColumn
*)tableColumn item:(id)item {
if (ov != groupOutlineView || tableColumn == nil || item == nil)
return nil;
-
+
+ if (item == [groups categoryParent])
+ return [[NSApp delegate] groupFieldMenu];
+
NSMenu *menu = [[groupMenu copyWithZone:[NSMenu menuZone]] autorelease];
[menu removeItemAtIndex:0];
Modified: trunk/bibdesk/BibDocument_Groups.h
===================================================================
--- trunk/bibdesk/BibDocument_Groups.h 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BibDocument_Groups.h 2009-04-24 17:21:55 UTC (rev 15174)
@@ -66,7 +66,6 @@
- (BOOL)addPublications:(NSArray *)pubs toGroup:(BDSKGroup *)group;
- (BOOL)removePublications:(NSArray *)pubs fromGroups:(NSArray *)groupArray;
- (BOOL)movePublications:(NSArray *)pubs fromGroup:(BDSKGroup *)group
toGroupNamed:(NSString *)newGroupName;
-- (NSMenu *)groupFieldsMenu;
- (IBAction)changeGroupFieldAction:(id)sender;
- (IBAction)addGroupFieldAction:(id)sender;
@@ -81,7 +80,6 @@
- (void)hideSearchGroupView;
- (void)handleGroupFieldChangedNotification:(NSNotification *)notification;
-- (void)handleGroupFieldAddRemoveNotification:(NSNotification *)notification;
- (void)handleGroupNameChangedNotification:(NSNotification *)notification;
- (void)handleWebGroupUpdatedNotification:(NSNotification *)notification;
- (void)handleStaticGroupChangedNotification:(NSNotification *)notification;
Modified: trunk/bibdesk/BibDocument_Groups.m
===================================================================
--- trunk/bibdesk/BibDocument_Groups.m 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BibDocument_Groups.m 2009-04-24 17:21:55 UTC (rev 15174)
@@ -53,6 +53,7 @@
#import "BDSKStaticGroup.h"
#import "BDSKCategoryGroup.h"
#import "BDSKWebGroup.h"
+#import "BDSKParentGroup.h"
#import "BDSKFieldSheetController.h"
#import "BibItem.h"
#import "BibAuthor.h"
@@ -139,6 +140,7 @@
if (field != currentGroupField) {
[currentGroupField release];
currentGroupField = [field copy];
+ [[groups categoryParent] setName:[NSString isEmptyString:field]
? NSLocalizedString(@"FIELD", @"source list group row title") : [field
uppercaseString]];
}
}
@@ -713,38 +715,6 @@
return [self selectGroups:[NSArray arrayWithObject:aGroup]];
}
-- (NSMenu *)groupFieldsMenu {
- NSMenu *menu = [[NSMenu allocWithZone:[NSMenu menuZone]] init];
- NSMenuItem *menuItem;
- NSEnumerator *fieldEnum = [[[NSUserDefaults standardUserDefaults]
stringArrayForKey:BDSKGroupFieldsKey] objectEnumerator];
- NSString *field;
-
- [menu addItemWithTitle:NSLocalizedString(@"No Field", @"Menu item title")
action:NULL keyEquivalent:@""];
-
- while (field = [fieldEnum nextObject]) {
- menuItem = [menu addItemWithTitle:field action:NULL
keyEquivalent:@""];
- [menuItem setRepresentedObject:field];
- }
-
- [menu addItem:[NSMenuItem separatorItem]];
-
- menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]]
initWithTitle:[NSLocalizedString(@"Add Field", @"Menu item title")
stringByAppendingEllipsis]
-
action:@selector(addGroupFieldAction:)
-
keyEquivalent:@""];
- [menuItem setTarget:self];
- [menu addItem:menuItem];
- [menuItem release];
-
- menuItem = [[NSMenuItem allocWithZone:[NSMenu menuZone]]
initWithTitle:[NSLocalizedString(@"Remove Field", @"Menu item title")
stringByAppendingEllipsis]
-
action:@selector(removeGroupFieldAction:)
-
keyEquivalent:@""];
- [menuItem setTarget:self];
- [menu addItem:menuItem];
- [menuItem release];
-
- return [menu autorelease];
-}
-
#pragma mark Spinners
- (NSProgressIndicator *)spinnerForGroup:(BDSKGroup *)group{
@@ -787,26 +757,20 @@
#pragma mark Actions
- (IBAction)sortGroupsByGroup:(id)sender{
- if ([sortGroupsKey isEqualToString:BDSKGroupCellStringKey] == NO)
- [self sortGroupsByKey:BDSKGroupCellStringKey];
+ [self sortGroupsByKey:BDSKGroupCellStringKey];
}
- (IBAction)sortGroupsByCount:(id)sender{
- if ([sortGroupsKey isEqualToString:BDSKGroupCellCountKey] == NO)
- [self sortGroupsByKey:BDSKGroupCellCountKey];
+ [self sortGroupsByKey:BDSKGroupCellCountKey];
}
- (IBAction)changeGroupFieldAction:(id)sender{
- NSPopUpButtonCell *headerCell = [groupOutlineView popUpHeaderCell];
- NSString *field = ([headerCell indexOfSelectedItem] == 0) ? @"" :
[[headerCell selectedItem] representedObject];
+ NSString *field = [sender representedObject] ?: @"";
if(![field isEqualToString:currentGroupField]){
[self setCurrentGroupField:field];
- [headerCell setTitle:[headerCell indexOfSelectedItem] == 0 ? @"" :
[headerCell titleOfSelectedItem]];
-
- [[NSNotificationCenter defaultCenter]
postNotificationName:BDSKGroupFieldChangedNotification
-
object:self
-
userInfo:[NSDictionary dictionary]];
+
+ [[NSNotificationCenter defaultCenter]
postNotificationName:BDSKGroupFieldChangedNotification object:self];
}
}
@@ -831,18 +795,8 @@
[array addObject:newGroupField];
[[NSUserDefaults standardUserDefaults] setObject:array
forKey:BDSKGroupFieldsKey];
- [[NSNotificationCenter defaultCenter]
postNotificationName:BDSKGroupFieldAddRemoveNotification
- object:self
- userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:newGroupField, NSKeyValueChangeNewKey, [NSNumber
numberWithInt:NSKeyValueChangeInsertion], NSKeyValueChangeKindKey, nil]];
-
- NSPopUpButtonCell *headerCell = [groupOutlineView popUpHeaderCell];
+ [self setCurrentGroupField:newGroupField];
- [headerCell insertItemWithTitle:newGroupField atIndex:[array count]];
- [[headerCell itemAtIndex:[array count]]
setRepresentedObject:newGroupField];
- [self setCurrentGroupField:newGroupField];
- [headerCell selectItemAtIndex:[headerCell
indexOfItemWithRepresentedObject:currentGroupField]];
- [headerCell setTitle:[headerCell indexOfSelectedItem] == 0 ? @"" :
[headerCell titleOfSelectedItem]];
-
[[NSNotificationCenter defaultCenter]
postNotificationName:BDSKGroupFieldChangedNotification
object:self
userInfo:[NSDictionary dictionary]];
@@ -850,16 +804,6 @@
}
- (IBAction)addGroupFieldAction:(id)sender{
- NSPopUpButtonCell *headerCell = [groupOutlineView popUpHeaderCell];
-
- if ([currentGroupField isEqualToString:@""]) {
- [headerCell selectItemAtIndex:0];
- [headerCell setTitle:@""];
- } else {
- [headerCell selectItemAtIndex:[headerCell
indexOfItemWithRepresentedObject:currentGroupField]];
- [headerCell setTitle:[headerCell titleOfSelectedItem]];
- }
-
BDSKTypeManager *typeMan = [BDSKTypeManager sharedManager];
NSArray *groupFields = [[NSUserDefaults standardUserDefaults]
stringArrayForKey:BDSKGroupFieldsKey];
NSArray *colNames = [typeMan allFieldNamesIncluding:[NSArray
arrayWithObjects:BDSKPubTypeString, BDSKCrossrefString, nil]
@@ -885,35 +829,17 @@
[[NSUserDefaults standardUserDefaults] setObject:array
forKey:BDSKGroupFieldsKey];
[array release];
- NSPopUpButtonCell *headerCell = [groupOutlineView popUpHeaderCell];
-
- [headerCell removeItemWithTitle:oldGroupField];
if([oldGroupField isEqualToString:currentGroupField]){
[self setCurrentGroupField:@""];
- [headerCell selectItemAtIndex:0];
- [headerCell setTitle:@""];
+ [[groups categoryParent] setName:NSLocalizedString(@"FIELD",
@"")];
[[NSNotificationCenter defaultCenter]
postNotificationName:BDSKGroupFieldChangedNotification
object:self
userInfo:[NSDictionary dictionary]];
}
-
- [[NSNotificationCenter defaultCenter]
postNotificationName:BDSKGroupFieldAddRemoveNotification
- object:self
- userInfo:[NSDictionary
dictionaryWithObjectsAndKeys:oldGroupField, NSKeyValueChangeNewKey, [NSNumber
numberWithInt:NSKeyValueChangeRemoval], NSKeyValueChangeKindKey, nil]];
}
- (IBAction)removeGroupFieldAction:(id)sender{
- NSPopUpButtonCell *headerCell = [groupOutlineView popUpHeaderCell];
-
- if ([currentGroupField isEqualToString:@""]) {
- [headerCell selectItemAtIndex:0];
- [headerCell setTitle:@""];
- } else {
- [headerCell selectItemAtIndex:[headerCell
indexOfItemWithRepresentedObject:currentGroupField]];
- [headerCell setTitle:[headerCell titleOfSelectedItem]];
- }
-
BDSKRemoveFieldSheetController *removeFieldController =
[[BDSKRemoveFieldSheetController alloc]
initWithPrompt:NSLocalizedString(@"Group field to remove:", @"Label for
removing group field")
fieldsArray:[[NSUserDefaults standardUserDefaults]
stringArrayForKey:BDSKGroupFieldsKey]];
[removeFieldController beginSheetModalForWindow:documentWindow
@@ -923,31 +849,6 @@
[removeFieldController release];
}
-- (void)handleGroupFieldAddRemoveNotification:(NSNotification *)notification{
- // Handle changes to the popup from other documents. The userInfo for
this notification uses key-value observing keys: NSKeyValueChangeNewKey is the
affected field (whether add/remove), and NSKeyValueChangeKindKey will be either
insert/remove
- if([notification object] != self){
- NSPopUpButtonCell *headerCell = [groupOutlineView popUpHeaderCell];
-
- id userInfo = [notification userInfo];
- NSParameterAssert(userInfo && [userInfo
valueForKey:NSKeyValueChangeKindKey]);
-
- NSString *field = [userInfo valueForKey:NSKeyValueChangeNewKey];
- NSParameterAssert(field);
-
- // Ignore this change if we already have that field (shouldn't
happen), or are removing the current group field; in the latter case, it's
already removed in prefs, so it'll be gone next time the document is opened.
Removing all fields means we have to deal with the add/remove menu items and
separator, so avoid that.
- if([[[headerCell selectedItem] representedObject]
isEqualToString:field] == NO){
- NSInteger changeType = [[userInfo
valueForKey:NSKeyValueChangeKindKey] intValue];
-
- if(changeType == NSKeyValueChangeInsertion) {
- [headerCell insertItemWithTitle:field atIndex:0];
- [[headerCell itemAtIndex:0] setRepresentedObject:field];
- } else if(changeType == NSKeyValueChangeRemoval) {
- [headerCell removeItemAtIndex:[headerCell
indexOfItemWithRepresentedObject:field]];
- } else [NSException raise:NSInvalidArgumentException
format:@"Unrecognized change type %ld", (long)changeType];
- }
- }
-}
-
- (IBAction)addSmartGroupAction:(id)sender {
BDSKFilterController *filterController = [[BDSKFilterController alloc]
init];
[filterController beginSheetModalForWindow:documentWindow
@@ -1702,10 +1603,6 @@
[groups sortUsingDescriptors:sortDescriptors];
- // Set the graphic for the new column header
- BDSKHeaderPopUpButtonCell *headerPopup = (BDSKHeaderPopUpButtonCell
*)[groupOutlineView popUpHeaderCell];
- [headerPopup setIndicatorImage:[NSImage
imageNamed:docState.sortGroupsDescending ? @"NSDescendingSortIndicator" :
@"NSAscendingSortIndicator"]];
-
[[(NSMutableDictionary *)groupSpinners allValues]
makeObjectsPerformSelector:@selector(removeFromSuperview)];
[groupOutlineView reloadData];
Modified: trunk/bibdesk/BibDocument_Menus.m
===================================================================
--- trunk/bibdesk/BibDocument_Menus.m 2009-04-24 11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/BibDocument_Menus.m 2009-04-24 17:21:55 UTC (rev 15174)
@@ -349,7 +349,7 @@
}
- (BOOL) validateChangeGroupFieldMenuItem:(NSMenuItem *)menuItem{
- if([[menuItem title] isEqualToString:[self currentGroupField]])
+ if([([menuItem representedObject] ?: @"") isEqualToString:[self
currentGroupField]])
[menuItem setState:NSOnState];
else
[menuItem setState:NSOffState];
Modified: trunk/bibdesk/English.lproj/MainMenu.nib/classes.nib
===================================================================
--- trunk/bibdesk/English.lproj/MainMenu.nib/classes.nib 2009-04-24
11:38:41 UTC (rev 15173)
+++ trunk/bibdesk/English.lproj/MainMenu.nib/classes.nib 2009-04-24
17:21:55 UTC (rev 15174)
@@ -193,7 +193,7 @@
<key>actionMenuButton</key>
<string>BDSKImagePopUpButton</string>
<key>bottomFileView</key>
- <string>FileView</string>
+ <string>FVFileView</string>
<key>bottomPreviewButton</key>
<string>NSSegmentedControl</string>
<key>bottomPreviewTabView</key>
@@ -224,12 +224,14 @@
<string>BDSKGradientView</string>
<key>groupMenu</key>
<string>NSMenu</string>
+ <key>groupOutlineView</key>
+ <string>BDSKGroupOutlineView</string>
<key>groupSplitView</key>
<string>BDSKGradientSplitView</string>
<key>groupTableView</key>
<string>BDSKGroupTableView</string>
<key>mainBox</key>
- <string>BDSKColoredBox</string>
+ <string>BDSKColoredView</string>
<key>mainView</key>
<string>NSView</string>
<key>saveAccessoryView</key>
@@ -245,7 +247,7 @@
<key>searchField</key>
<string>NSSearchField</string>
<key>sideFileView</key>
- <string>FileView</string>
+ <string>FVFileView</string>
<key>sidePreviewButton</key>
<string>NSSegmentedControl</string>
<key>sidePreviewTabView</key>
@@ -351,14 +353,6 @@
<string>NSView</string>
</dict>
<dict>
- <key>CLASS</key>
- <string>BDSKEncodingPopUpButton</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSPopUpButton</string>
- </dict>
- <dict>
<key>ACTIONS</key>
<dict>
<key>hideWindow</key>
@@ -375,6 +369,14 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>BDSKEncodingPopUpButton</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSPopUpButton</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>NSObject</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -450,24 +452,6 @@
<dict>
<key>ACTIONS</key>
<dict>
- <key>checkForUpdates</key>
- <string>id</string>
- </dict>
- <key>CLASS</key>
- <string>SUUpdater</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>OUTLETS</key>
- <dict>
- <key>delegate</key>
- <string>id</string>
- </dict>
- <key>SUPERCLASS</key>
- <string>NSObject</string>
- </dict>
- <dict>
- <key>ACTIONS</key>
- <dict>
<key>changeFont</key>
<string>id</string>
<key>copy</key>
@@ -505,7 +489,25 @@
<string>NSTableView</string>
</dict>
<dict>
+ <key>ACTIONS</key>
+ <dict>
+ <key>checkForUpdates</key>
+ <string>id</string>
+ </dict>
<key>CLASS</key>
+ <string>SUUpdater</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>OUTLETS</key>
+ <dict>
+ <key>delegate</key>
+ <string>id</string>
+ </dict>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>NSWindow</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -605,7 +607,7 @@
<key>fileSplitView</key>
<string>BDSKGradientSplitView</string>
<key>fileView</key>
- <string>FileView</string>
+ <string>FVFileView</string>
<key>mainSplitView</key>
<string>BDSKGradientSplitView</string>
<key>matrix</key>
@@ -643,6 +645,8 @@
<dict>
<key>ACTIONS</key>
<dict>
+ <key>changeFont</key>
+ <string>id</string>
<key>copy</key>
<string>id</string>
<key>cut</key>
@@ -720,14 +724,6 @@
<string>NSDocumentController</string>
</dict>
<dict>
- <key>CLASS</key>
- <string>BDSKEditorTableView</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSTableView</string>
- </dict>
- <dict>
<key>ACTIONS</key>
<dict>
<key>alternateCut</key>
@@ -744,6 +740,14 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>BDSKEditorTableView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSTableView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>BDSKSplitView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -985,6 +989,8 @@
<string>NSMenu</string>
<key>copyAsTemplateMenu</key>
<string>NSMenu</string>
+ <key>groupFieldMenu</key>
+ <string>NSMenu</string>
<key>groupSortMenu</key>
<string>NSMenu</string>
<key>previewDisplayMenu</key>
@@ -1053,6 +1059,8 @@
<string>ObjC</string>
<key>OUTLETS</key>
<dict>
+ <key>actionMenu</key>
+ <string>NSMenu</string>
<key>actionMenuButton</key>
<string>BDSKImagePopUpButton</string>
<key>addAndCloseButton</key>
@@ -1103,6 +1111,14 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>NSCell</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSObject</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>BDSKGradientSplitView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -1164,7 +1180,7 @@
<key>stopOrReloadButton</key>
<string>NSButton</string>
<key>urlField</key>
- <string>NSTextField</string>
+ <string>BDSKDragTextField</string>
<key>view</key>
<string>BDSKEdgeView</string>
<key>webEdgeView</key>
@@ -1176,6 +1192,14 @@
<string>NSWindowController</string>
</dict>
<dict>
+ <key>CLASS</key>
+ <string>BDSKColoredView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSView</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>localChangeFont</key>
@@ -1315,6 +1339,14 @@
<string>NSWindowController</string>
</dict>
<dict>
+ <key>CLASS</key>
+ <string>BDSKGradientOutlineView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>BDSKOutlineView</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>addBookmark</key>
@@ -1365,6 +1397,14 @@
</dict>
<dict>
<key>CLASS</key>
+ <string>BDSKGroupOutlineView</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>BDSKGradientOutlineView</string>
+ </dict>
+ <dict>
+ <key>CLASS</key>
<string>BDSKPreferencePane</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -1378,14 +1418,6 @@
</dict>
<dict>
<key>CLASS</key>
- <string>BDSKColoredBox</string>
- <key>LANGUAGE</key>
- <string>ObjC</string>
- <key>SUPERCLASS</key>
- <string>NSBox</string>
- </dict>
- <dict>
- <key>CLASS</key>
<string>NSTextView</string>
<key>LANGUAGE</key>
<string>ObjC</string>
@@ -1436,6 +1468,14 @@
<string>BDSKGradientView</string>
</dict>
<dict>
+ <key>CLASS</key>
+ <string>BDSKDragTextField</string>
+ <key>LANGUAGE</key>
+ <string>ObjC</string>
+ <key>SUPERCLASS</key>
+ <string>NSTextField</string>
+ </dict>
+ <dict>
<key>ACTIONS</key>
<dict>
<key>changeFont</key>
Modified: trunk/bibdesk/English.lproj/MainMenu.nib/info.nib
===================================================================
--- trunk/bibdesk/English.lproj/MainMenu.nib/info.nib 2009-04-24 11:38:41 UTC
(rev 15173)
+++ trunk/bibdesk/English.lproj/MainMenu.nib/info.nib 2009-04-24 17:21:55 UTC
(rev 15174)
@@ -10,9 +10,9 @@
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
- <integer>57</integer>
<integer>493</integer>
<integer>424</integer>
+ <integer>29</integer>
</array>
<key>IBSystem Version</key>
<string>9G55</string>
Modified: trunk/bibdesk/English.lproj/MainMenu.nib/keyedobjects.nib
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensign option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit