From: <ho...@us...> - 2006-03-23 00:02:05
|
Revision: 5953 Author: hofman Date: 2006-03-22 16:01:52 -0800 (Wed, 22 Mar 2006) ViewCVS: http://svn.sourceforge.net/bibdesk/?rev=5953&view=rev Log Message: ----------- Change last commit to silence compiler warnings. Modified Paths: -------------- trunk/bibdesk/BDSKGlobalMacroResolver.m Modified: trunk/bibdesk/BDSKGlobalMacroResolver.m =================================================================== --- trunk/bibdesk/BDSKGlobalMacroResolver.m 2006-03-22 23:43:12 UTC (rev 5952) +++ trunk/bibdesk/BDSKGlobalMacroResolver.m 2006-03-23 00:01:52 UTC (rev 5953) @@ -88,14 +88,14 @@ // legacy, load old style prefs NSDictionary *oldMacros = [pw dictionaryForKey:BDSKBibStyleMacroDefinitionsKey]; if (oldMacros) - [[self macroDefinitions] addEntriesFromDictionary:oldMacros]; + [macroDefinitions addEntriesFromDictionary:oldMacros]; NSDictionary *macros = [pw dictionaryForKey:BDSKGlobalMacroDefinitionsKey]; NSEnumerator *keyEnum = [macros keyEnumerator]; NSString *key; while (key = [keyEnum nextObject]) { - [[self macroDefinitions] setObject:[NSString complexStringWithBibTeXString:[macros objectForKey:key] macroResolver:self] + [macroDefinitions setObject:[NSString complexStringWithBibTeXString:[macros objectForKey:key] macroResolver:self] forKey:key]; } if(oldMacros){ @@ -175,21 +175,25 @@ } - (void)addMacroDefinitionWithoutUndo:(NSString *)macroString forMacro:(NSString *)macroKey{ - [[self macroDefinitions] setObject:macroString forKey:macroKey]; + if (macroDefinitions == nil) + [self loadMacrosFromPreferences]; + [macroDefinitions setObject:macroString forKey:macroKey]; [self synchronizePreferences]; } - (void)changeMacroKey:(NSString *)oldKey to:(NSString *)newKey{ - if([[self macroDefinitions] objectForKey:oldKey] == nil) + if (macroDefinitions == nil) + [self loadMacrosFromPreferences]; + if([macroDefinitions objectForKey:oldKey] == nil) [NSException raise:NSInvalidArgumentException format:@"tried to change the value of a macro key that doesn't exist"]; [[[self undoManager] prepareWithInvocationTarget:self] changeMacroKey:newKey to:oldKey]; - NSString *val = [[self macroDefinitions] valueForKey:oldKey]; + NSString *val = [macroDefinitions valueForKey:oldKey]; [val retain]; // so the next line doesn't kill it - [[self macroDefinitions] removeObjectForKey:oldKey]; - [[self macroDefinitions] setObject:[val autorelease] forKey:newKey]; + [macroDefinitions removeObjectForKey:oldKey]; + [macroDefinitions setObject:[val autorelease] forKey:newKey]; [self synchronizePreferences]; @@ -200,11 +204,13 @@ } - (void)addMacroDefinition:(NSString *)macroString forMacro:(NSString *)macroKey{ + if (macroDefinitions == nil) + [self loadMacrosFromPreferences]; // we're adding a new one, so to undo, we remove. [[[self undoManager] prepareWithInvocationTarget:self] removeMacro:macroKey]; - [[self macroDefinitions] setObject:macroString forKey:macroKey]; + [macroDefinitions setObject:macroString forKey:macroKey]; [self synchronizePreferences]; @@ -215,7 +221,9 @@ } - (void)setMacroDefinition:(NSString *)newDefinition forMacro:(NSString *)macroKey{ - NSString *oldDef = [[self macroDefinitions] objectForKey:macroKey]; + if (macroDefinitions == nil) + [self loadMacrosFromPreferences]; + NSString *oldDef = [macroDefinitions objectForKey:macroKey]; if(oldDef == nil){ [self addMacroDefinition:newDefinition forMacro:macroKey]; return; @@ -223,7 +231,7 @@ // we're just changing an existing one, so to undo, we change back. [[[self undoManager] prepareWithInvocationTarget:self] setMacroDefinition:oldDef forMacro:macroKey]; - [[self macroDefinitions] setObject:newDefinition forKey:macroKey]; + [macroDefinitions setObject:newDefinition forKey:macroKey]; [self synchronizePreferences]; @@ -234,7 +242,9 @@ } - (void)removeMacro:(NSString *)macroKey{ - NSString *currentValue = [[self macroDefinitions] objectForKey:macroKey]; + if (macroDefinitions == nil) + [self loadMacrosFromPreferences]; + NSString *currentValue = [macroDefinitions objectForKey:macroKey]; if(!currentValue){ return; }else{ @@ -242,7 +252,7 @@ addMacroDefinition:currentValue forMacro:macroKey]; } - [[self macroDefinitions] removeObjectForKey:macroKey]; + [macroDefinitions removeObjectForKey:macroKey]; [self synchronizePreferences]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |