Changeset 13454


Ignore:
Timestamp:
Aug 30, 2012, 2:37:00 AM (9 years ago)
Author:
livings124
Message:

#5026 StatusBarView? doesn't fully match toolbar on 10.7+

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/StatusBarView.h

    r13162 r13454  
    2424
    2525#import <Cocoa/Cocoa.h>
     26#import <QuartzCore/QuartzCore.h>
    2627
    2728@interface StatusBarView : NSView
    2829{
    2930    NSGradient * fGradient;
     31    CIImage * fNoiseImage;
    3032}
    3133
  • trunk/macosx/StatusBarView.m

    r13251 r13454  
    2424
    2525#import "StatusBarView.h"
     26#import "NSApplicationAdditions.h"
     27#import <QuartzCore/QuartzCore.h>
    2628
    2729@interface StatusBarView (Private)
     
    4143        fGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
    4244       
    43         [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload)
    44             name: NSWindowDidBecomeMainNotification object: [self window]];
    45         [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload)
    46             name: NSWindowDidResignMainNotification object: [self window]];
     45        //noise only for 10.7 +
     46        if([NSApp isOnLionOrBetter])
     47        {
     48            CIFilter * randomFilter = [CIFilter filterWithName: @"CIRandomGenerator"];
     49            [randomFilter setDefaults];
     50           
     51            fNoiseImage = [randomFilter valueForKey: @"outputImage"];
     52           
     53            CIFilter * monochromeFilter = [CIFilter filterWithName: @"CIColorMonochrome"];
     54            [monochromeFilter setDefaults];
     55            [monochromeFilter setValue: fNoiseImage forKey: @"inputImage"];
     56            CIColor * monoFilterColor = [CIColor colorWithRed:1.0 green:1.0 blue:1.0];
     57            [monochromeFilter setValue: monoFilterColor forKey: @"inputColor"];
     58            fNoiseImage = [[monochromeFilter valueForKey:@"outputImage"] retain];
     59        }
     60        else
     61            fNoiseImage = nil;
     62       
     63        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload) name: NSWindowDidBecomeMainNotification object: [self window]];
     64        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload) name: NSWindowDidResignMainNotification object: [self window]];
    4765    }
    4866    return self;
     
    5270{
    5371    [[NSNotificationCenter defaultCenter] removeObserver: self];
    54    
     72    [fNoiseImage release];
    5573    [fGradient release];
    5674    [super dealloc];
     
    116134   
    117135    NSRectFillListWithColors(gridRects, colorRects, count);
     136   
     137    [fNoiseImage drawInRect: rect
     138                   fromRect: [self convertRectToBacking: rect]
     139                  operation: NSCompositeSourceOver
     140                   fraction: 0.15];
    118141}
    119142
Note: See TracChangeset for help on using the changeset viewer.