Changeset 11507


Ignore:
Timestamp:
Dec 9, 2010, 11:30:35 PM (11 years ago)
Author:
livings124
Message:

#3788 Adjust the status and filter bars' colors; make status bar draggable (again)

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r11489 r11507  
    392392- (void) awakeFromNib
    393393{
     394    [fFilterBar setIsFilter: YES];
     395   
    394396    NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"TRMainToolbar"];
    395397    [toolbar setDelegate: self];
     
    421423    [fWindow setContentMinSize: contentMinSize];
    422424    [fWindow setContentBorderThickness: NSMinY([[fTableView enclosingScrollView] frame]) forEdge: NSMinYEdge];
     425    [fWindow setMovableByWindowBackground: YES];
    423426   
    424427    [[fTotalDLField cell] setBackgroundStyle: NSBackgroundStyleRaised];
  • trunk/macosx/StatusBarView.h

    r11489 r11507  
    2727@interface StatusBarView : NSView
    2828{
     29    BOOL fIsFilter;
     30    NSGradient * fInactiveGradient, * fStatusGradient, * fFilterGradient;
    2931    NSColor * fGrayBorderColor;
    3032}
    3133
     34- (void) setIsFilter: (BOOL) isFilter;
     35
    3236@end
  • trunk/macosx/StatusBarView.m

    r11489 r11507  
    2525#import "StatusBarView.h"
    2626
     27@interface StatusBarView (Private)
     28
     29- (void) reload;
     30
     31@end
     32
    2733@implementation StatusBarView
    2834
     
    3137    if ((self = [super initWithFrame: rect]))
    3238    {
     39        fIsFilter = NO;
    3340        fGrayBorderColor = [[NSColor colorWithCalibratedRed: 171.0/255.0 green: 171.0/255.0 blue: 171.0/255.0 alpha: 1.0] retain];
     41       
     42        NSColor * lightColor = [NSColor colorWithCalibratedRed: 230.0/255.0 green: 230.0/255.0 blue: 230.0/255.0 alpha: 1.0];
     43        NSColor * darkColor = [NSColor colorWithCalibratedRed: 220.0/255.0 green: 220.0/255.0 blue: 220.0/255.0 alpha: 1.0];
     44        fInactiveGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
     45       
     46        lightColor = [NSColor colorWithCalibratedRed: 160.0/255.0 green: 160.0/255.0 blue: 160.0/255.0 alpha: 1.0];
     47        darkColor = [NSColor colorWithCalibratedRed: 155.0/255.0 green: 155.0/255.0 blue: 155.0/255.0 alpha: 1.0];
     48        fStatusGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
     49       
     50        lightColor = [NSColor colorWithCalibratedRed: 235.0/255.0 green: 235.0/255.0 blue: 235.0/255.0 alpha: 1.0];
     51        darkColor = [NSColor colorWithCalibratedRed: 205.0/255.0 green: 205.0/255.0 blue: 205.0/255.0 alpha: 1.0];
     52        fFilterGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor];
     53       
     54        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload)
     55            name: NSWindowDidBecomeMainNotification object: [self window]];
     56        [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload)
     57            name: NSWindowDidResignMainNotification object: [self window]];
    3458    }
    3559    return self;
     
    3963{
    4064    [fGrayBorderColor release];
     65    [fStatusGradient release];
     66    [fInactiveGradient release];
     67    [fFilterGradient release];
    4168    [super dealloc];
     69}
     70
     71- (BOOL) mouseDownCanMoveWindow
     72{
     73    return !fIsFilter;
     74}
     75
     76#warning get rid of asap
     77- (void) setIsFilter: (BOOL) isFilter
     78{
     79    fIsFilter = isFilter;
    4280}
    4381
    4482- (void) drawRect: (NSRect) rect
    4583{
    46     NSInteger count = 0;
    47     NSRect gridRects[3];
    48     NSColor * colorRects[3];
    49    
    50     NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0);
    51     if (NSIntersectsRect(lineBorderRect, rect))
     84    if (fIsFilter)
    5285    {
    53         gridRects[count] = lineBorderRect;
    54         colorRects[count] = [NSColor whiteColor];
    55         ++count;
     86        NSInteger count = 0;
     87        NSRect gridRects[2];
     88        NSColor * colorRects[2];
    5689       
    57         rect.size.height -= 1.0;
     90        NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0);
     91        if ([[self window] isMainWindow])
     92        {
     93            if (NSIntersectsRect(lineBorderRect, rect))
     94            {
     95                gridRects[count] = lineBorderRect;
     96                colorRects[count] = [NSColor whiteColor];
     97                ++count;
     98               
     99                rect.size.height -= 1.0;
     100            }
     101        }
     102       
     103        lineBorderRect.origin.y = 0.0;
     104        if (NSIntersectsRect(lineBorderRect, rect))
     105        {
     106            gridRects[count] = lineBorderRect;
     107            colorRects[count] = [[self window] isMainWindow] ? [NSColor colorWithCalibratedWhite: 0.25 alpha: 1.0]
     108                                    : [NSColor colorWithCalibratedWhite: 0.5 alpha: 1.0];
     109            ++count;
     110           
     111            rect.origin.y += 1.0;
     112            rect.size.height -= 1.0;
     113        }
     114       
     115        NSRectFillListWithColors(gridRects, colorRects, count);
     116       
     117        [fFilterGradient drawInRect: rect angle: 270.0];
    58118    }
    59    
    60     lineBorderRect.origin.y = 0.0;
    61     if (NSIntersectsRect(lineBorderRect, rect))
     119    else
    62120    {
    63         gridRects[count] = lineBorderRect;
    64         colorRects[count] = fGrayBorderColor;
    65         ++count;
     121        const BOOL active = [[self window] isMainWindow];
    66122       
    67         rect.origin.y += 1.0;
    68         rect.size.height -= 1.0;
     123        NSInteger count = 0;
     124        NSRect gridRects[2];
     125        NSColor * colorRects[2];
     126       
     127        NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0);
     128        if (active)
     129        {
     130            if (NSIntersectsRect(lineBorderRect, rect))
     131            {
     132                gridRects[count] = lineBorderRect;
     133                colorRects[count] = [NSColor colorWithCalibratedWhite: 0.75 alpha: 1.0];
     134                ++count;
     135               
     136                rect.size.height -= 1.0;
     137            }
     138        }
     139       
     140        lineBorderRect.origin.y = 0.0;
     141        if (NSIntersectsRect(lineBorderRect, rect))
     142        {
     143            gridRects[count] = lineBorderRect;
     144            colorRects[count] = [[self window] isMainWindow] ? [NSColor colorWithCalibratedWhite: 0.25 alpha: 1.0]
     145                                    : [NSColor colorWithCalibratedWhite: 0.5 alpha: 1.0];
     146            ++count;
     147           
     148            rect.origin.y += 1.0;
     149            rect.size.height -= 1.0;
     150        }
     151       
     152        if (active)
     153            [fStatusGradient drawInRect: rect angle: 270.0];
     154        else
     155            [fInactiveGradient drawInRect: rect angle: 270.0];
     156       
     157        NSRectFillListWithColors(gridRects, colorRects, count);
    69158    }
    70    
    71     gridRects[count] = rect;
    72     colorRects[count] = [NSColor controlColor];
    73     ++count;
    74    
    75     NSRectFillListWithColors(gridRects, colorRects, count);
    76159}
    77160
    78161@end
     162
     163@implementation StatusBarView (Private)
     164
     165- (void) reload
     166{
     167    [self setNeedsDisplay: YES];
     168}
     169
     170@end
Note: See TracChangeset for help on using the changeset viewer.