diff --git a/ChangeLog b/ChangeLog index 200a5e9..519300e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-09-20 Matt Rice + + * EOInterface/EOGenericControlAssociation.m (-endEditing): + Fix copy/paste error. + * GDL2Palette/Palette.[hm]: Load bundles from GDL2PaletteBundles key. + * GDL2Palette/ConnectInspector.m: Replace static map table with + walking the list of connectors. + 2006-09-19 Matt Rice * GDL2Palette/KeyWrapper.h: Add LocalType. diff --git a/EOInterface/EOGenericControlAssociation.m b/EOInterface/EOGenericControlAssociation.m index 9ac3e68..1093ac7 100644 --- a/EOInterface/EOGenericControlAssociation.m +++ b/EOInterface/EOGenericControlAssociation.m @@ -189,7 +189,7 @@ textShouldBeginEditing: (NSText *)fieldEditor EODisplayGroup *dg2 = [self displayGroupForAspect:@"enabled"]; if (dg2 != dg || flag == NO) { - flag = [dg endEditing]; + flag = [dg2 endEditing]; if (flag == YES) { [dg2 associationDidBeginEditing:self]; diff --git a/GDL2Palette/ConnectionInspector.m b/GDL2Palette/ConnectionInspector.m index 3274e33..b6cf567 100644 --- a/GDL2Palette/ConnectionInspector.m +++ b/GDL2Palette/ConnectionInspector.m @@ -35,18 +35,12 @@ /* TODO get notifications for IB{Will,Did}RemoveConnectorNotification * and remove the object from the _objectToAssociation map table if * there are no more connectors for it */ -static NSMapTable *_objectToAssociation; + @interface NSApplication(missingStuff) - (GormClassManager *)classManager; @end @implementation GDL2ConnectionInspector -+ (void) initialize -{ - _objectToAssociation = NSCreateMapTableWithZone(NSObjectMapKeyCallBacks, - NSObjectMapValueCallBacks, - 0, [self zone]); -} - (NSButton *)okButton { @@ -413,10 +407,23 @@ static NSMapTable *_objectToAssociation; if (!found) { - ASSIGN(_association,NSMapGet(_objectToAssociation, object)); + NSArray *aConns = [[(id)NSApp activeDocument] connectorsForSource:object ofClass:[EOAspectConnector class]]; + Class assocClass = [[popUp selectedItem] representedObject]; + + _association = nil; + + for (i = 0; i < c; i++) + { + EOAspectConnector *aConn = [aConns objectAtIndex:i]; + EOAssociation *assoc = [aConn association]; + if ([[assoc class] isEqual: assocClass]) + { + ASSIGN(_association, assoc); + } + } + if (!_association) { - Class assocClass = [[popUp selectedItem] representedObject]; _association = [[assocClass alloc] initWithObject:object]; /* this shouldn't happen until ok:. */ } @@ -770,7 +777,6 @@ willDisplayCell:(id)cell atRow:(int)row column:(int)column else if ([_currentConnector isKindOfClass:[EOAspectConnector class]]) { [_connectors addObject:_currentConnector]; - NSMapInsert(_objectToAssociation, object, _association); [[(id)NSApp activeDocument] attachObject:_association toParent:object]; } diff --git a/GDL2Palette/Palette.h b/GDL2Palette/Palette.h index 2d6d0d7..0318995 100644 --- a/GDL2Palette/Palette.h +++ b/GDL2Palette/Palette.h @@ -1,4 +1,5 @@ #include +static NSConstantString *GDL2PaletteBundles; @interface GDL2Palette : IBPalette { diff --git a/GDL2Palette/Palette.m b/GDL2Palette/Palette.m index 54d9138..1c15d34 100644 --- a/GDL2Palette/Palette.m +++ b/GDL2Palette/Palette.m @@ -1,13 +1,21 @@ #include "Palette.h" #include "ResourceManager.h" +#include +#include - +static NSConstantString *GDL2PaletteBundles = @"GDL2PaletteBundles"; @implementation GDL2Palette +(void) initialize { // NSLog(@"GDL2Palette initialize"); + NSArray *bundles; + int i, c; + [IBResourceManager registerResourceManagerClass:[GDL2ResourceManager class]]; + bundles = [[NSUserDefaults standardUserDefaults] arrayForKey:GDL2PaletteBundles]; + for (i = 0, c = [bundles count]; i < c; i++) + [[NSBundle bundleWithPath:[bundles objectAtIndex:i]] load]; } @end