- (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;
} 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) {
- (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;
// 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"]];
}
}
-- (NSArray *)effectNamesFromDictionary:(NSDictionary *)infoDict
-{
-
-}
-
- (IBAction)changeMenus:(id)sender
{
ITDebugLog(@"Synchronizing menus");
if ( ( self = [super init] ) ) {
float exitDelay;
- int entryTag;
- int exitTag;
+ NSString *entryClass;
+ NSString *exitClass;
+ NSArray *classList = [ITWindowEffect effectClasses];
float entrySpeed;
float exitSpeed;
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"];
[_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)];