Changeset 1289

Show
Ignore:
Timestamp:
06/24/10 10:05:53 (2 years ago)
Author:
gbooker
Message:

Overlays no longer need an NSWindow, the window number is sufficient.

Location:
trunk/CommonMediaPlayer
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/CommonMediaPlayer/General Actions/CMPOverlayAction.h

    r1286 r1289  
    7777@end 
    7878 
    79 extern NSString *CMPOverlayActionWindowKey; 
     79extern NSString *CMPOverlayActionWindowNumberKey; 
     80extern NSString *CMPOverlayActionWindowRectKey; 
    8081 
    8182@interface CMPOverlayAction : NSObject <CMPActionController>{ 
    82         NSWindow                                *window; 
     83        NSRect                                  windowRect; 
     84        int                                             windowNumber; 
    8385        NSMutableArray                  *overlays; 
    8486} 
  • trunk/CommonMediaPlayer/General Actions/CMPOverlayAction.m

    r1286 r1289  
    2222#import "CMPOverlayAction.h" 
    2323#import "CoreGraphicsServices.h" 
    24 #import "CMPOverlayModeAction.h" 
    2524#import "CMPATVVersion.h" 
    2625 
     
    568567@end 
    569568 
    570 NSString *CMPOverlayActionWindowKey = @"window"; 
     569NSString *CMPOverlayActionNumberKey = @"windowNumber"; 
     570NSString *CMPOverlayActionRectKey = @"windowNumber"; 
    571571 
    572572@interface BRDisplayManager (compat) 
     
    578578- (id)initWithController:(id <CMPPlayerController>)controller andSettings:(NSDictionary *)settings 
    579579{ 
    580         NSWindow *win = [settings objectForKey:CMPOverlayActionWindowKey]; 
    581         if(win == nil) 
     580        NSNumber *windowNum = [settings objectForKey:CMPOverlayActionWindowNumberKey]; 
     581        if(windowNum == nil) 
    582582                return [self autorelease]; 
    583583         
     
    586586                return self; 
    587587         
    588         window = [win retain]; 
     588        windowNumber = [windowNum intValue]; 
     589        NSValue *windowRectValue = [settings objectForKey:CMPOverlayActionWindowRectKey]; 
     590        if(windowRectValue != nil) 
     591                windowRect = [windowRectValue rectValue]; 
     592        else { 
     593                CGDirectDisplayID display = [(BRDisplayManager *)[BRDisplayManager sharedInstance] display]; 
     594                CGRect frame = CGDisplayBounds(display); 
     595                frame.size.width = CGDisplayPixelsWide(display); 
     596                frame.size.height = CGDisplayPixelsHigh(display); 
     597                 
     598                if(frame.size.width < 0.0f) 
     599                        frame.size.width = ABS(frame.size.width); 
     600                if(frame.size.height < 0.0f) 
     601                        frame.size.height = ABS(frame.size.height); 
     602                 
     603                windowRect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height);            
     604        } 
    589605        overlays = [[NSMutableArray alloc] init]; 
    590606         
     
    594610- (void) dealloc 
    595611{ 
    596         [window release]; 
    597612        [overlays release]; 
    598613        [super dealloc]; 
     
    606621- (CMPOverlayWindow *)addBlackShieldWindow 
    607622{ 
    608         CMPOverlayWindow *ret = [[CMPOverlayWindow alloc] initWithContentRect:[window frame] overWindow:[window windowNumber]]; 
     623        CMPOverlayWindow *ret = [[CMPOverlayWindow alloc] initWithContentRect:windowRect overWindow:windowNumber]; 
    609624         
    610625        [overlays addObject:ret]; 
     
    616631- (CMPTextView *)addTextOverlayInPosition:(CMPOverlayPosition)position 
    617632{ 
    618         CMPTextView *ret = [[CMPTextView alloc] initWithContentRect:[window frame] position:position overWindow:[window windowNumber]]; 
     633        CMPTextView *ret = [[CMPTextView alloc] initWithContentRect:windowRect position:position overWindow:windowNumber]; 
    619634         
    620635        [overlays addObject:ret]; 
     
    626641- (CMPPlayerPlayHead *)addPlayheadOverlay 
    627642{ 
    628         CMPPlayerPlayHead *ret = [[CMPPlayerPlayHead alloc] initWithContentRect:[window frame] overWindow:[window windowNumber]]; 
     643        CMPPlayerPlayHead *ret = [[CMPPlayerPlayHead alloc] initWithContentRect:windowRect overWindow:windowNumber]; 
    629644         
    630645        [overlays addObject:ret]; 
     
    636651- (CMPBlurredMenu *)addBlurredMenuOverlayWithItems:(NSArray *)items 
    637652{ 
    638         CMPBlurredMenu *ret = [[CMPBlurredMenu alloc] initWithItems:items contentRect:[window frame] overWindow:[window windowNumber]]; 
     653        CMPBlurredMenu *ret = [[CMPBlurredMenu alloc] initWithItems:items contentRect:windowRect overWindow:windowNumber]; 
    639654         
    640655        [overlays addObject:ret]; 
     
    673688{ 
    674689        [self closeAllOverlays]; 
    675         [window close]; 
    676690        return YES; 
    677691} 
  • trunk/CommonMediaPlayer/Media Players/DVD Framework/CMPDVDWindowCreationAction.m

    r1286 r1289  
    2525#import "CMPScreenReleaseAction.h" 
    2626#import "CoreGraphicsServices.h" 
    27 #import "CMPOverlayModeAction.h" 
    2827#import "CMPATVVersion.h" 
    2928#import "CMPDVDPlayer.h" 
     
    4241                return self; 
    4342         
    44 //      screenRelease = [[CMPOverlayModeAction alloc] initWithController:controller andSettings:settings]; 
    4543        screenRelease = [[CMPScreenReleaseAction alloc] initWithController:controller andSettings:settings]; 
    4644         
     
    123121    CGContextRelease(ctx); 
    124122         
    125         overlayAction = [[CMPOverlayAction alloc] initWithController:nil andSettings:[NSDictionary dictionaryWithObjectsAndKeys:dvdWindow, CMPOverlayActionWindowKey, nil]]; 
     123        overlayAction = [[CMPOverlayAction alloc] initWithController:nil andSettings:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:[dvdWindow windowNumber]], CMPOverlayActionWindowNumberKey, [NSValue valueWithRect:[dvdWindow frame]], CMPOverlayActionWindowRectKey, nil]]; 
    126124        [overlayAction openWithError:nil]; 
    127125