Changeset 11453
- Timestamp:
- Dec 4, 2010, 3:55:36 AM (12 years ago)
- Location:
- trunk/macosx
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r11441 r11453 392 392 - (void) awakeFromNib 393 393 { 394 [fFilterBar setIsFilter: YES]; 395 394 396 NSToolbar * toolbar = [[NSToolbar alloc] initWithIdentifier: @"TRMainToolbar"]; 395 397 [toolbar setDelegate: self]; … … 421 423 [fWindow setContentMinSize: contentMinSize]; 422 424 [fWindow setContentBorderThickness: NSMinY([[fTableView enclosingScrollView] frame]) forEdge: NSMinYEdge]; 425 [fWindow setMovableByWindowBackground: YES]; 423 426 424 427 [[fTotalDLField cell] setBackgroundStyle: NSBackgroundStyleRaised]; -
trunk/macosx/StatusBarView.h
r9844 r11453 27 27 @interface StatusBarView : NSView 28 28 { 29 BOOL fIsFilter; 30 NSGradient * fInactiveGradient, * fFilterGradient; 29 31 NSColor * fGrayBorderColor; 30 32 } 31 33 34 - (void) setIsFilter: (BOOL) isFilter; 35 32 36 @end -
trunk/macosx/StatusBarView.m
r9844 r11453 25 25 #import "StatusBarView.h" 26 26 27 @interface StatusBarView (Private) 28 29 - (void) reload; 30 31 @end 32 27 33 @implementation StatusBarView 28 34 … … 31 37 if ((self = [super initWithFrame: rect])) 32 38 { 39 fIsFilter = NO; 33 40 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: 235.0/255.0 green: 235.0/255.0 blue: 235.0/255.0 alpha: 1.0]; 47 darkColor = [NSColor colorWithCalibratedRed: 205.0/255.0 green: 205.0/255.0 blue: 205.0/255.0 alpha: 1.0]; 48 fFilterGradient = [[NSGradient alloc] initWithStartingColor: lightColor endingColor: darkColor]; 49 50 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload) 51 name: NSWindowDidBecomeMainNotification object: [self window]]; 52 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reload) 53 name: NSWindowDidResignMainNotification object: [self window]]; 34 54 } 35 55 return self; … … 39 59 { 40 60 [fGrayBorderColor release]; 61 [fInactiveGradient release]; 62 [fFilterGradient release]; 41 63 [super dealloc]; 64 } 65 66 - (BOOL) mouseDownCanMoveWindow 67 { 68 return !fIsFilter; 69 } 70 71 #warning get rid of asap 72 - (void) setIsFilter: (BOOL) isFilter 73 { 74 fIsFilter = isFilter; 42 75 } 43 76 44 77 - (void) drawRect: (NSRect) rect 45 78 { 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)) 79 if (fIsFilter) 52 80 { 53 gridRects[count] = lineBorderRect;54 colorRects[count] = [NSColor whiteColor];55 ++count;81 NSInteger count = 0; 82 NSRect gridRects[2]; 83 NSColor * colorRects[2]; 56 84 57 rect.size.height -= 1.0; 85 NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0); 86 if ([[self window] isMainWindow]) 87 { 88 if (NSIntersectsRect(lineBorderRect, rect)) 89 { 90 gridRects[count] = lineBorderRect; 91 colorRects[count] = [NSColor whiteColor]; 92 ++count; 93 94 rect.size.height -= 1.0; 95 } 96 } 97 98 lineBorderRect.origin.y = 0.0; 99 if (NSIntersectsRect(lineBorderRect, rect)) 100 { 101 gridRects[count] = lineBorderRect; 102 colorRects[count] = fGrayBorderColor; 103 ++count; 104 105 rect.origin.y += 1.0; 106 rect.size.height -= 1.0; 107 } 108 109 NSRectFillListWithColors(gridRects, colorRects, count); 110 111 [fFilterGradient drawInRect: rect angle: 270.0]; 58 112 } 59 60 lineBorderRect.origin.y = 0.0; 61 if (NSIntersectsRect(lineBorderRect, rect)) 113 else 62 114 { 63 gridRects[count] = lineBorderRect; 64 colorRects[count] = fGrayBorderColor; 65 ++count; 115 const BOOL active = [[self window] isMainWindow]; 66 116 67 rect.origin.y += 1.0; 68 rect.size.height -= 1.0; 117 NSInteger count = 0; 118 NSRect gridRects[active ? 3 : 2]; 119 NSColor * colorRects[active ? 3 : 2]; 120 121 NSRect lineBorderRect = NSMakeRect(NSMinX(rect), NSHeight([self bounds]) - 1.0, NSWidth(rect), 1.0); 122 if (active) 123 { 124 if (NSIntersectsRect(lineBorderRect, rect)) 125 { 126 gridRects[count] = lineBorderRect; 127 colorRects[count] = [NSColor colorWithCalibratedWhite: 0.75 alpha: 1.0]; 128 ++count; 129 130 rect.size.height -= 1.0; 131 } 132 } 133 134 lineBorderRect.origin.y = 0.0; 135 if (NSIntersectsRect(lineBorderRect, rect)) 136 { 137 gridRects[count] = lineBorderRect; 138 colorRects[count] = [[self window] isMainWindow] ? [NSColor colorWithCalibratedWhite: 0.25 alpha: 1.0] 139 : [NSColor colorWithCalibratedWhite: 0.5 alpha: 1.0]; 140 ++count; 141 142 rect.origin.y += 1.0; 143 rect.size.height -= 1.0; 144 } 145 146 if (active) 147 { 148 gridRects[count] = rect; 149 colorRects[count] = [NSColor colorWithCalibratedWhite: 0.59 alpha: 1.0]; 150 ++count; 151 } 152 else 153 [fInactiveGradient drawInRect: rect angle: 270.0]; 154 155 NSRectFillListWithColors(gridRects, colorRects, count); 69 156 } 70 71 gridRects[count] = rect;72 colorRects[count] = [NSColor controlColor];73 ++count;74 75 NSRectFillListWithColors(gridRects, colorRects, count);76 157 } 77 158 78 159 @end 160 161 @implementation StatusBarView (Private) 162 163 - (void) reload 164 { 165 [self setNeedsDisplay: YES]; 166 } 167 168 @end
Note: See TracChangeset
for help on using the changeset viewer.