Fixed a crash when Core Image was available.
[ITKit.git] / Showcase / Controller.m
old mode 100755 (executable)
new mode 100644 (file)
index ba9c278..9f9c1f6
@@ -9,6 +9,7 @@
 #import "ITSlideHorizontallyWindowEffect.h"
 #import "ITSlideVerticallyWindowEffect.h"
 #import "ITPivotWindowEffect.h"
 #import "ITSlideHorizontallyWindowEffect.h"
 #import "ITSlideVerticallyWindowEffect.h"
 #import "ITPivotWindowEffect.h"
+#import "ITZoomWindowEffect.h"
 #import "ITMultilineTextFieldCell.h"
 
 
 #import "ITMultilineTextFieldCell.h"
 
 
@@ -31,7 +32,7 @@
 {
     [self createStatusItem];
     [button setBezelStyle:1001];
 {
     [self createStatusItem];
     [button setBezelStyle:1001];
-    [button setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:14]];
+    [button setFont:[NSFont fontWithName:@"LucidaGrande-Bold" size:14]];
     [button setTitle:@"Launch Manually"];
     [button sizeToFit];
     [button setFrameSize:NSMakeSize([button frame].size.width + 8, 24)];
     [button setTitle:@"Launch Manually"];
     [button sizeToFit];
     [button setFrameSize:NSMakeSize([button frame].size.width + 8, 24)];
     [bevelView setBevelDepth:10];
     statusWindow = [ITIconAndTextStatusWindow sharedWindow];
     [statusWindow setEntryEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
     [bevelView setBevelDepth:10];
     statusWindow = [ITIconAndTextStatusWindow sharedWindow];
     [statusWindow setEntryEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
-    [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]];
+    [statusWindow setExitEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
     [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]];
     [[statusWindow exitEffect]  setEffectTime:[swExitSpeedSlider floatValue]];
     [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]];
     [[statusWindow exitEffect]  setEffectTime:[swExitSpeedSlider floatValue]];
+    [self populateEffectPopups];
 //  [tabView setAllowsDragging:YES];
     [[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
     
 //  [tabView setAllowsDragging:YES];
     [[NSColorPanel sharedColorPanel] setShowsAlpha:YES];
     
 #pragma mark ITTransientStatusWindow SUPPORT
 /*************************************************************************/
 
 #pragma mark ITTransientStatusWindow SUPPORT
 /*************************************************************************/
 
+- (void)populateEffectPopups
+{
+    NSArray *effects = [ITWindowEffect effectClasses];
+    int i;
+    [entryEffectPopup removeAllItems];
+    [exitEffectPopup removeAllItems];
+    for (i = 0; i < [effects count]; i++) {
+        id anItem = [effects objectAtIndex:i];
+        [entryEffectPopup addItemWithTitle:[anItem effectName]];
+        [exitEffectPopup addItemWithTitle:[anItem effectName]];
+        [[entryEffectPopup lastItem] setRepresentedObject:anItem];
+        [[exitEffectPopup lastItem] setRepresentedObject:anItem];
+    }
+}
+
 - (IBAction)buildStatusWindow:(id)sender
 {
     NSImage     *image        = [NSImage imageNamed:SW_IMAGE];
 - (IBAction)buildStatusWindow:(id)sender
 {
     NSImage     *image        = [NSImage imageNamed:SW_IMAGE];
     } else if ( [sender tag] == 3061 ) {
         [[statusWindow exitEffect]  setEffectTime:[sender floatValue]];
     } else if ( [sender tag] == 3070 ) {
     } else if ( [sender tag] == 3061 ) {
         [[statusWindow exitEffect]  setEffectTime:[sender floatValue]];
     } else if ( [sender tag] == 3070 ) {
-    
-        if ( [sender indexOfSelectedItem] == 0 ) {
-            [statusWindow setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
-        } else if ( [sender indexOfSelectedItem] == 1 ) {
-            [statusWindow setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
-        } else if ( [sender indexOfSelectedItem] == 2 ) {
-            [statusWindow setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
-        } else if ( [sender indexOfSelectedItem] == 3 ) {
-            [statusWindow setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
-        } else if ( [sender indexOfSelectedItem] == 4 ) {
-            [statusWindow setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:statusWindow] autorelease]];
-        }
-
+        [statusWindow setEntryEffect:[[[[[sender selectedItem] representedObject] alloc] initWithWindow:statusWindow] autorelease]];
         [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]];
         [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]];
-        
     } else if ( [sender tag] == 3080 ) {
     } else if ( [sender tag] == 3080 ) {
-
-        if ( [sender indexOfSelectedItem] == 0 ) {
-            [statusWindow setExitEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]];
-        } else if ( [sender indexOfSelectedItem] == 1 ) {
-            [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]];
-        } else if ( [sender indexOfSelectedItem] == 2 ) {
-            [statusWindow setExitEffect:[[ITSlideVerticallyWindowEffect alloc] initWithWindow:statusWindow]];
-        } else if ( [sender indexOfSelectedItem] == 3 ) {
-            [statusWindow setExitEffect:[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:statusWindow]];
-        } else if ( [sender indexOfSelectedItem] == 4 ) {
-            [statusWindow setExitEffect:[[ITPivotWindowEffect alloc] initWithWindow:statusWindow]];
-        }
-
+        [statusWindow setExitEffect:[[[[[sender selectedItem] representedObject] alloc] initWithWindow:statusWindow] autorelease]];
         [[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]];
         [[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]];
-
     } else if ( [sender tag] == 3090 ) {
     } else if ( [sender tag] == 3090 ) {
-    
         if ( [sender indexOfSelectedItem] == 0 ) {
             [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundApple];
         } else if ( [sender indexOfSelectedItem] == 1 ) {
         if ( [sender indexOfSelectedItem] == 0 ) {
             [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundApple];
         } else if ( [sender indexOfSelectedItem] == 1 ) {
         } else if ( [sender indexOfSelectedItem] == 2 ) {
             [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundColored];
         }
         } else if ( [sender indexOfSelectedItem] == 2 ) {
             [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundColored];
         }
-        
     } else if ( [sender tag] == 3100 ) {
         [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundColor:[sender color]];
     }
     } else if ( [sender tag] == 3100 ) {
         [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundColor:[sender color]];
     }