From 73e53986a3127e4d790f4b2c60cf2b21f486205d Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Sat, 20 Oct 2001 00:33:54 +0000 Subject: [PATCH] Forge: Preferences updates -- use notifications instead of globals. --- tools/Forge/Preferences.m | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tools/Forge/Preferences.m b/tools/Forge/Preferences.m index 5caa93cb7..eb958503f 100644 --- a/tools/Forge/Preferences.m +++ b/tools/Forge/Preferences.m @@ -26,7 +26,13 @@ $Id$ */ -#import "qedefs.h" +#import +#import +#import +#import + +#import +#import #import "Preferences.h" @@ -110,6 +116,11 @@ static Preferences *sharedInstance = nil; - (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver: self]; + [currentValues release]; + [displayedValues release]; + currentValues = displayedValues = nil; + [super dealloc]; } /* @@ -119,11 +130,13 @@ static Preferences *sharedInstance = nil; */ - (void) updateUI { - qprintf ("defaults updated"); - - [map_i makeGlobalPerform: @selector(flushTextures)]; - [quakeed_i updateAll]; - + id theCenter = [NSNotificationCenter defaultCenter]; + + NSLog (@"Defaults updated, UI should update."); + + [theCenter postNotificationName: @"ForgeTextureCacheShouldFlush" object: self userInfo: nil]; + [theCenter postNotificationName: @"ForgeUIShouldUpdate" object: self userInfo: nil]; + return; } @@ -216,6 +229,8 @@ static Preferences *sharedInstance = nil; [currentValues release]; currentValues = [defaultValues () copyWithZone: [self zone]]; + [currentValues retain]; + [self discardDisplayedValues]; }