Changeset 686
- Timestamp:
- Jul 23, 2006, 10:23:59 PM (16 years ago)
- Location:
- trunk/macosx
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/BarButton.h
r640 r686 25 25 #import <Cocoa/Cocoa.h> 26 26 27 @interface BarButton : NS ImageView27 @interface BarButton : NSButton 28 28 { 29 29 NSImage * fButtonNormal, * fButtonNormalDim, * fButtonOver, … … 34 34 } 35 35 36 - (void) setText: (NSString *) text;37 36 - (void) setEnabled: (BOOL) enable; 38 37 -
trunk/macosx/BarButton.m
r668 r686 25 25 #import "BarButton.h" 26 26 27 @interface BarButton (Private) 28 29 - (void) setText; 30 31 @end 32 27 33 @implementation BarButton 28 34 … … 94 100 fButtonSelectedDim = [fButtonSelected copy]; 95 101 102 [self setText]; 103 104 [self setImage: fButtonNormal]; 105 [self setAlternateImage: fButtonPressed]; 106 96 107 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(resetBounds:) 97 108 name: NSViewBoundsDidChangeNotification object: nil]; 98 109 } 99 110 return self; 111 } 112 113 //call only once to avoid overlapping text 114 - (void) setText 115 { 116 NSString * text = [self title]; 117 118 NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont: 119 [NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask]; 120 121 NSSize shadowOffset = NSMakeSize(0.0, -1.0); 122 123 NSShadow * shadowNormal = [NSShadow alloc]; 124 [shadowNormal setShadowOffset: shadowOffset]; 125 [shadowNormal setShadowBlurRadius: 1.0]; 126 [shadowNormal setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.4]]; 127 128 NSShadow * shadowNormalDim = [NSShadow alloc]; 129 [shadowNormalDim setShadowOffset: shadowOffset]; 130 [shadowNormalDim setShadowBlurRadius: 1.0]; 131 [shadowNormalDim setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.2]]; 132 133 NSShadow * shadowHighlighted = [NSShadow alloc]; 134 [shadowHighlighted setShadowOffset: shadowOffset]; 135 [shadowHighlighted setShadowBlurRadius: 1.0]; 136 [shadowHighlighted setShadowColor: [NSColor colorWithDeviceWhite: 0.0 alpha: 0.4]]; 137 138 NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: 139 [NSColor colorWithCalibratedRed: 0.259 green: 0.259 blue: 0.259 alpha: 1.0], 140 NSForegroundColorAttributeName, 141 boldFont, NSFontAttributeName, 142 shadowNormal, NSShadowAttributeName, nil], 143 * normalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: 144 [NSColor disabledControlTextColor], NSForegroundColorAttributeName, 145 boldFont, NSFontAttributeName, 146 shadowNormalDim, NSShadowAttributeName, nil], 147 * highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: 148 [NSColor whiteColor], NSForegroundColorAttributeName, 149 boldFont, NSFontAttributeName, 150 shadowHighlighted, NSShadowAttributeName, nil], 151 * highlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: 152 [NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue: 0.9 alpha: 1.0], NSForegroundColorAttributeName, 153 boldFont, NSFontAttributeName, 154 shadowHighlighted, NSShadowAttributeName, nil]; 155 156 NSSize textSizeNormal = [text sizeWithAttributes: normalAttributes], 157 textSizeBold = [text sizeWithAttributes: highlightedAttributes], 158 buttonSize = [self frame].size; 159 160 NSRect textRect = NSMakeRect((buttonSize.width - textSizeNormal.width) * 0.5, 161 (buttonSize.height - textSizeNormal.height) * 0.5 + 1.5, textSizeNormal.width, textSizeNormal.height); 162 163 [shadowNormal release]; 164 [shadowNormalDim release]; 165 [shadowHighlighted release]; 166 167 //normal button 168 [fButtonNormal lockFocus]; 169 [text drawInRect: textRect withAttributes: normalAttributes]; 170 [fButtonNormal unlockFocus]; 171 172 //normal and dim button 173 [fButtonNormalDim lockFocus]; 174 [text drawInRect: textRect withAttributes: normalDimAttributes]; 175 [fButtonNormalDim unlockFocus]; 176 177 //rolled over button 178 [fButtonOver lockFocus]; 179 [text drawInRect: textRect withAttributes: highlightedAttributes]; 180 [fButtonOver unlockFocus]; 181 182 //pressed button 183 [fButtonPressed lockFocus]; 184 [text drawInRect: textRect withAttributes: highlightedAttributes]; 185 [fButtonPressed unlockFocus]; 186 187 //selected button 188 [fButtonSelected lockFocus]; 189 [text drawInRect: textRect withAttributes: highlightedAttributes]; 190 [fButtonSelected unlockFocus]; 191 192 //selected and dim button 193 [fButtonSelectedDim lockFocus]; 194 [text drawInRect: textRect withAttributes: highlightedDimAttributes]; 195 [fButtonSelectedDim unlockFocus]; 196 197 [normalAttributes release]; 198 [normalDimAttributes release]; 199 [highlightedAttributes release]; 200 [highlightedDimAttributes release]; 100 201 } 101 202 … … 111 212 } 112 213 113 //call only once to avoid overlapping text114 - (void) setText: (NSString *) text115 {116 NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:117 [NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask];118 119 NSSize shadowOffset = NSMakeSize(0.0, -1.0);120 121 NSShadow * shadowNormal = [NSShadow alloc];122 [shadowNormal setShadowOffset: shadowOffset];123 [shadowNormal setShadowBlurRadius: 1.0];124 [shadowNormal setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.4]];125 126 NSShadow * shadowNormalDim = [NSShadow alloc];127 [shadowNormalDim setShadowOffset: shadowOffset];128 [shadowNormalDim setShadowBlurRadius: 1.0];129 [shadowNormalDim setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.2]];130 131 NSShadow * shadowHighlighted = [NSShadow alloc];132 [shadowHighlighted setShadowOffset: shadowOffset];133 [shadowHighlighted setShadowBlurRadius: 1.0];134 [shadowHighlighted setShadowColor: [NSColor colorWithDeviceWhite: 0.0 alpha: 0.4]];135 136 NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:137 [NSColor colorWithCalibratedRed: 0.259 green: 0.259 blue: 0.259 alpha: 1.0],138 NSForegroundColorAttributeName,139 boldFont, NSFontAttributeName,140 shadowNormal, NSShadowAttributeName, nil],141 * normalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:142 [NSColor disabledControlTextColor], NSForegroundColorAttributeName,143 boldFont, NSFontAttributeName,144 shadowNormalDim, NSShadowAttributeName, nil],145 * highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:146 [NSColor whiteColor], NSForegroundColorAttributeName,147 boldFont, NSFontAttributeName,148 shadowHighlighted, NSShadowAttributeName, nil],149 * highlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:150 [NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue: 0.9 alpha: 1.0], NSForegroundColorAttributeName,151 boldFont, NSFontAttributeName,152 shadowHighlighted, NSShadowAttributeName, nil];153 154 NSSize textSizeNormal = [text sizeWithAttributes: normalAttributes],155 textSizeBold = [text sizeWithAttributes: highlightedAttributes],156 buttonSize = [self frame].size;157 158 NSRect textRect = NSMakeRect((buttonSize.width - textSizeNormal.width) * 0.5,159 (buttonSize.height - textSizeNormal.height) * 0.5 + 1.5, textSizeNormal.width, textSizeNormal.height);160 161 [shadowNormal release];162 [shadowNormalDim release];163 [shadowHighlighted release];164 165 //normal button166 [fButtonNormal lockFocus];167 [text drawInRect: textRect withAttributes: normalAttributes];168 [fButtonNormal unlockFocus];169 170 //normal and dim button171 [fButtonNormalDim lockFocus];172 [text drawInRect: textRect withAttributes: normalDimAttributes];173 [fButtonNormalDim unlockFocus];174 175 //rolled over button176 [fButtonOver lockFocus];177 [text drawInRect: textRect withAttributes: highlightedAttributes];178 [fButtonOver unlockFocus];179 180 //pressed button181 [fButtonPressed lockFocus];182 [text drawInRect: textRect withAttributes: highlightedAttributes];183 [fButtonPressed unlockFocus];184 185 //selected button186 [fButtonSelected lockFocus];187 [text drawInRect: textRect withAttributes: highlightedAttributes];188 [fButtonSelected unlockFocus];189 190 //selected and dim button191 [fButtonSelectedDim lockFocus];192 [text drawInRect: textRect withAttributes: highlightedDimAttributes];193 [fButtonSelectedDim unlockFocus];194 195 [self setImage: fButtonNormal];196 197 [normalAttributes release];198 [normalDimAttributes release];199 [highlightedAttributes release];200 [highlightedDimAttributes release];201 }202 203 214 - (void) mouseEntered: (NSEvent *) event 204 215 { … … 217 228 } 218 229 219 - (void) mouseDown: (NSEvent *) event230 /*- (void) mouseDown: (NSEvent *) event 220 231 { 221 232 [self setImage: fButtonPressed]; … … 229 240 230 241 [self setImage: fEnabled ? fButtonSelected : fButtonOver]; 231 } 242 }*/ 232 243 233 244 - (void) setEnabled: (BOOL) enable -
trunk/macosx/Controller.m
r684 r686 249 249 //set filter 250 250 fFilterType = [[fDefaults stringForKey: @"Filter"] retain]; 251 252 //button width should be 9 pixels surrounding text length253 [fNoFilterButton setText: @"All"]; //16.64254 [fDownloadFilterButton setText: @"Downloading"]; //81.69255 [fSeedFilterButton setText: @"Seeding"]; //48.57256 [fPauseFilterButton setText: @"Paused"]; //44.06257 251 258 252 BarButton * currentFilterButton; -
trunk/macosx/English.lproj/MainMenu.nib/classes.nib
r652 r686 1 1 { 2 2 IBClasses = ( 3 {CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NS ImageView; },3 {CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; }, 4 4 { 5 5 ACTIONS = { -
trunk/macosx/English.lproj/MainMenu.nib/info.nib
r671 r686 12 12 <string>366 546 420 63 0 0 1152 842 </string> 13 13 <key>1603</key> 14 <string>3 60 371477 67 0 0 1152 842 </string>14 <string>337 544 477 67 0 0 1152 842 </string> 15 15 <key>29</key> 16 16 <string>9 780 451 44 0 0 1152 842 </string> … … 32 32 <key>IBOpenObjects</key> 33 33 <array> 34 <integer>1 480</integer>34 <integer>1603</integer> 35 35 <integer>29</integer> 36 36 <integer>21</integer> -
trunk/macosx/InfoWindowController.m
r678 r686 423 423 unsigned int i; 424 424 for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i]) 425 [[NSWorkspace sharedWorkspace] selectFile: [fFiles objectAtIndex: i] 426 inFileViewerRootedAtPath: nil]; 425 [[NSWorkspace sharedWorkspace] selectFile: [fFiles objectAtIndex: i] inFileViewerRootedAtPath: nil]; 427 426 } 428 427
Note: See TracChangeset
for help on using the changeset viewer.