From a06b23045deb51ce036acf7bdcd3ab3c5514bfaf Mon Sep 17 00:00:00 2001 From: Matthew Judy Date: Sun, 23 Nov 2003 15:08:17 +0000 Subject: [PATCH] Checking in improvements to the effect availability heuristic. --- NetworkController.m | 2 +- PreferencesController.m | 68 +++++++++++++++------------------------ StatusWindowController.m | 32 ++++++------------ libValidate.a | Bin 8032 -> 8032 bytes 4 files changed, 37 insertions(+), 65 deletions(-) diff --git a/NetworkController.m b/NetworkController.m index 1e7a230..7bdcac2 100755 --- a/NetworkController.m +++ b/NetworkController.m @@ -282,7 +282,7 @@ static NetworkController *sharedController; - (void)netServiceDidResolveAddress:(NSNetService *)sender { ITDebugLog(@"Resolved service named %@.", [sender name]); - NSLog(@"Resolved service named %@.", [sender name]); +// NSLog(@"Resolved service named %@.", [sender name]); [[NSNotificationCenter defaultCenter] postNotificationName:@"ITMTFoundNetService" object:nil]; [sender stop]; } diff --git a/PreferencesController.m b/PreferencesController.m index 9690e0b..96fcfea 100755 --- a/PreferencesController.m +++ b/PreferencesController.m @@ -39,7 +39,6 @@ - (void)setupCustomizationTables; - (void)setupMenuItems; - (void)setupUI; -- (NSArray *)effectNamesFromDictionary:(NSDictionary *)infoDict; - (void)setCustomColor:(NSColor *)color updateWell:(BOOL)update; - (IBAction)changeMenus:(id)sender; - (void)setLaunchesAtLogin:(BOOL)flag; @@ -382,42 +381,19 @@ static PreferencesController *prefs = nil; } else if ( [sender tag] == 2020) { // update screen selection } else if ( [sender tag] == 2030) { - int effectTag = [[sender selectedItem] tag]; + Class selectedClass = [[sender selectedItem] representedObject]; float time = ([df floatForKey:@"statusWindowAppearanceSpeed"] ? [df floatForKey:@"statusWindowAppearanceSpeed"] : 0.8); - [df setInteger:effectTag forKey:@"statusWindowAppearanceEffect"]; - - if ( effectTag == 2100 ) { - [sw setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2101 ) { - [sw setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2102 ) { - [sw setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2103 ) { - [sw setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2104 ) { - [sw setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]]; - } + [df setObject:NSStringFromClass(selectedClass) forKey:@"statusWindowAppearanceEffect"]; + [sw setEntryEffect:[[[selectedClass alloc] initWithWindow:sw] autorelease]]; [[sw entryEffect] setEffectTime:time]; } else if ( [sender tag] == 2040) { - int effectTag = [[sender selectedItem] tag]; + Class selectedClass = [[sender selectedItem] representedObject]; float time = ([df floatForKey:@"statusWindowVanishSpeed"] ? [df floatForKey:@"statusWindowVanishSpeed"] : 0.8); + [df setObject:NSStringFromClass(selectedClass) forKey:@"statusWindowVanishEffect"]; - [df setInteger:[[sender selectedItem] tag] forKey:@"statusWindowVanishEffect"]; - - if ( effectTag == 2100 ) { - [sw setExitEffect:[[[ITCutWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2101 ) { - [sw setExitEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2102 ) { - [sw setExitEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2103 ) { - [sw setExitEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:sw] autorelease]]; - } else if ( effectTag == 2104 ) { - [sw setExitEffect:[[[ITPivotWindowEffect alloc] initWithWindow:sw] autorelease]]; - } - + [sw setExitEffect:[[[selectedClass alloc] initWithWindow:sw] autorelease]]; [[sw exitEffect] setEffectTime:time]; } else if ( [sender tag] == 2050) { @@ -735,13 +711,13 @@ static PreferencesController *prefs = nil; - (void)setupUI { NSMutableDictionary *loginwindow; - NSMutableArray *loginarray; + NSMutableArray *loginarray; NSEnumerator *loginEnum; NSEnumerator *keyArrayEnum; NSString *serverName; NSData *colorData; NSArray *effectClasses = [ITWindowEffect effectClasses]; -// NSEnumerator *effectEnum = [effectList objectEnumerator]; + NSEnumerator *effectEnum = [effectClasses objectEnumerator]; int selectedBGStyle; id anItem; @@ -794,15 +770,28 @@ static PreferencesController *prefs = nil; // Populate the effects popups [appearanceEffectPopup removeItemAtIndex:0]; [vanishEffectPopup removeItemAtIndex:0]; - [appearanceEffectPopup addItemsWithTitles:[[effectList allValues] objectsForKey:@"Name"]]; // category method - [vanishEffectPopup addItemsWithTitles:[[effectList allValues] objectsForKey:@"Name"]]; // category method + + while ( (anItem = [effectEnum nextObject]) ) { + [appearanceEffectPopup addItemWithTitle:[anItem effectName]]; + [vanishEffectPopup addItemWithTitle:[anItem effectName]]; + [[appearanceEffectPopup lastItem] setRepresentedObject:anItem]; + [[vanishEffectPopup lastItem] setRepresentedObject:anItem]; + } // Attempt to find the pref'd effect in the list. // If it's not there, use cut/dissolve. - + if ( [effectClasses containsObject:NSClassFromString([df stringForKey:@"statusWindowAppearanceEffect"])] ) { + [appearanceEffectPopup selectItemAtIndex:[effectClasses indexOfObject:NSClassFromString([df stringForKey:@"statusWindowAppearanceEffect"])]]; + } else { + [appearanceEffectPopup selectItemAtIndex:[effectClasses indexOfObject:NSClassFromString(@"ITCutWindowEffect")]]; + } + + if ( [effectClasses containsObject:NSClassFromString([df stringForKey:@"statusWindowVanishEffect"])] ) { + [vanishEffectPopup selectItemAtIndex:[effectClasses indexOfObject:NSClassFromString([df stringForKey:@"statusWindowVanishEffect"])]]; + } else { + [vanishEffectPopup selectItemAtIndex:[effectClasses indexOfObject:NSClassFromString(@"ITCutWindowEffect")]]; + } - [appearanceEffectPopup selectItem:[appearanceEffectPopup itemAtIndex:[appearanceEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowAppearanceEffect"]]]]; - [vanishEffectPopup selectItem:[vanishEffectPopup itemAtIndex:[vanishEffectPopup indexOfItemWithTag:[df integerForKey:@"statusWindowVanishEffect"]]]]; [appearanceSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowAppearanceSpeed"])]; [vanishSpeedSlider setFloatValue:-([df floatForKey:@"statusWindowVanishSpeed"])]; [vanishDelaySlider setFloatValue:[df floatForKey:@"statusWindowVanishDelay"]]; @@ -871,11 +860,6 @@ static PreferencesController *prefs = nil; } } -- (NSArray *)effectNamesFromDictionary:(NSDictionary *)infoDict -{ - -} - - (IBAction)changeMenus:(id)sender { ITDebugLog(@"Synchronizing menus"); diff --git a/StatusWindowController.m b/StatusWindowController.m index 2ee7342..293e35c 100755 --- a/StatusWindowController.m +++ b/StatusWindowController.m @@ -33,8 +33,9 @@ static StatusWindowController *sharedController; if ( ( self = [super init] ) ) { float exitDelay; - int entryTag; - int exitTag; + NSString *entryClass; + NSString *exitClass; + NSArray *classList = [ITWindowEffect effectClasses]; float entrySpeed; float exitSpeed; @@ -47,8 +48,8 @@ static StatusWindowController *sharedController; df = [[NSUserDefaults standardUserDefaults] retain]; exitDelay = [df floatForKey:@"statusWindowVanishDelay"]; - entryTag = [df integerForKey:@"statusWindowAppearanceEffect"]; - exitTag = [df integerForKey:@"statusWindowVanishEffect"]; + entryClass = [df stringForKey:@"statusWindowAppearanceEffect"]; + exitClass = [df stringForKey:@"statusWindowVanishEffect"]; entrySpeed = [df floatForKey:@"statusWindowAppearanceSpeed"]; exitSpeed = [df floatForKey:@"statusWindowVanishSpeed"]; @@ -60,32 +61,19 @@ static StatusWindowController *sharedController; [_window setSizing:(StatusWindowSizing)[df integerForKey:@"statusWindowSizing"]]; - if ( entryTag == 2101 ) { - entryEffect = [[[ITDissolveWindowEffect alloc] initWithWindow:_window] autorelease]; - } else if ( entryTag == 2102 ) { - entryEffect = [[[ITSlideVerticallyWindowEffect alloc] initWithWindow:_window] autorelease]; - } else if ( entryTag == 2103 ) { - entryEffect = [[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:_window] autorelease]; - } else if ( entryTag == 2104 ) { - entryEffect = [[[ITPivotWindowEffect alloc] initWithWindow:_window] autorelease]; + if ( [classList containsObject:NSClassFromString(entryClass)] ) { + entryEffect = [[[NSClassFromString(entryClass) alloc] initWithWindow:_window] autorelease]; } else { entryEffect = [[[ITCutWindowEffect alloc] initWithWindow:_window] autorelease]; } - [_window setEntryEffect:entryEffect]; - - if ( exitTag == 2100 ) { - exitEffect = [[[ITCutWindowEffect alloc] initWithWindow:_window] autorelease]; - } else if ( exitTag == 2102 ) { - exitEffect = [[[ITSlideVerticallyWindowEffect alloc] initWithWindow:_window] autorelease]; - } else if ( exitTag == 2103 ) { - exitEffect = [[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:_window] autorelease]; - } else if ( exitTag == 2104 ) { - exitEffect = [[[ITPivotWindowEffect alloc] initWithWindow:_window] autorelease]; + if ( [classList containsObject:NSClassFromString(exitClass)] ) { + exitEffect = [[[NSClassFromString(exitClass) alloc] initWithWindow:_window] autorelease]; } else { exitEffect = [[[ITDissolveWindowEffect alloc] initWithWindow:_window] autorelease]; } + [_window setEntryEffect:entryEffect]; [_window setExitEffect:exitEffect]; [[_window entryEffect] setEffectTime:(entrySpeed ? entrySpeed : 0.8)]; diff --git a/libValidate.a b/libValidate.a index 8245865e3934f5f2b5b8b0530057956702f12f98..b75030d2856c827cd91c55dc9fc973b690bd4fcf 100755 GIT binary patch delta 16 XcmaE0_rPv~EUTrZk-5o6B|CWlG=l{$ delta 16 XcmaE0_rPv~EUUSxiKWp-B|CWlG+_lQ -- 2.20.1