mirror of
https://github.com/transmission/transmission
synced 2024-12-26 01:27:28 +00:00
Filter buttons now actually are buttons, meaning their behavior matches more to Mail.app's
This commit is contained in:
parent
5c1b9771d7
commit
53039b2074
7 changed files with 32 additions and 29 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface BarButton : NSImageView
|
||||
@interface BarButton : NSButton
|
||||
{
|
||||
NSImage * fButtonNormal, * fButtonNormalDim, * fButtonOver,
|
||||
* fButtonPressed, * fButtonSelected, * fButtonSelectedDim;
|
||||
|
@ -33,7 +33,6 @@
|
|||
NSTrackingRectTag fTrackingTag;
|
||||
}
|
||||
|
||||
- (void) setText: (NSString *) text;
|
||||
- (void) setEnabled: (BOOL) enable;
|
||||
|
||||
- (void) resetBounds: (NSNotification *) notification;
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
|
||||
#import "BarButton.h"
|
||||
|
||||
@interface BarButton (Private)
|
||||
|
||||
- (void) setText;
|
||||
|
||||
@end
|
||||
|
||||
@implementation BarButton
|
||||
|
||||
//height of button should be 17.0
|
||||
|
@ -93,26 +99,22 @@
|
|||
//selected and dimmed button
|
||||
fButtonSelectedDim = [fButtonSelected copy];
|
||||
|
||||
[self setText];
|
||||
|
||||
[self setImage: fButtonNormal];
|
||||
[self setAlternateImage: fButtonPressed];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(resetBounds:)
|
||||
name: NSViewBoundsDidChangeNotification object: nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[fButtonNormal release];
|
||||
[fButtonOver release];
|
||||
[fButtonPressed release];
|
||||
[fButtonSelected release];
|
||||
[fButtonSelectedDim release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
//call only once to avoid overlapping text
|
||||
- (void) setText: (NSString *) text
|
||||
- (void) setText
|
||||
{
|
||||
NSString * text = [self title];
|
||||
|
||||
NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
|
||||
[NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask];
|
||||
|
||||
|
@ -192,14 +194,23 @@
|
|||
[text drawInRect: textRect withAttributes: highlightedDimAttributes];
|
||||
[fButtonSelectedDim unlockFocus];
|
||||
|
||||
[self setImage: fButtonNormal];
|
||||
|
||||
[normalAttributes release];
|
||||
[normalDimAttributes release];
|
||||
[highlightedAttributes release];
|
||||
[highlightedDimAttributes release];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[fButtonNormal release];
|
||||
[fButtonOver release];
|
||||
[fButtonPressed release];
|
||||
[fButtonSelected release];
|
||||
[fButtonSelectedDim release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void) mouseEntered: (NSEvent *) event
|
||||
{
|
||||
if (!fEnabled)
|
||||
|
@ -216,7 +227,7 @@
|
|||
[super mouseExited: event];
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent *) event
|
||||
/*- (void) mouseDown: (NSEvent *) event
|
||||
{
|
||||
[self setImage: fButtonPressed];
|
||||
|
||||
|
@ -228,7 +239,7 @@
|
|||
[NSApp sendAction: [self action] to: [self target] from: self];
|
||||
|
||||
[self setImage: fEnabled ? fButtonSelected : fButtonOver];
|
||||
}
|
||||
}*/
|
||||
|
||||
- (void) setEnabled: (BOOL) enable
|
||||
{
|
||||
|
|
|
@ -249,12 +249,6 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
//set filter
|
||||
fFilterType = [[fDefaults stringForKey: @"Filter"] retain];
|
||||
|
||||
//button width should be 9 pixels surrounding text length
|
||||
[fNoFilterButton setText: @"All"]; //16.64
|
||||
[fDownloadFilterButton setText: @"Downloading"]; //81.69
|
||||
[fSeedFilterButton setText: @"Seeding"]; //48.57
|
||||
[fPauseFilterButton setText: @"Paused"]; //44.06
|
||||
|
||||
BarButton * currentFilterButton;
|
||||
if ([fFilterType isEqualToString: @"Pause"])
|
||||
currentFilterButton = fPauseFilterButton;
|
||||
|
|
2
macosx/English.lproj/MainMenu.nib/classes.nib
generated
2
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NSImageView; },
|
||||
{CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
|
||||
{
|
||||
ACTIONS = {
|
||||
applyFilter = id;
|
||||
|
|
4
macosx/English.lproj/MainMenu.nib/info.nib
generated
4
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -11,7 +11,7 @@
|
|||
<key>1480</key>
|
||||
<string>366 546 420 63 0 0 1152 842 </string>
|
||||
<key>1603</key>
|
||||
<string>360 371 477 67 0 0 1152 842 </string>
|
||||
<string>337 544 477 67 0 0 1152 842 </string>
|
||||
<key>29</key>
|
||||
<string>9 780 451 44 0 0 1152 842 </string>
|
||||
<key>456</key>
|
||||
|
@ -31,7 +31,7 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>1480</integer>
|
||||
<integer>1603</integer>
|
||||
<integer>29</integer>
|
||||
<integer>21</integer>
|
||||
</array>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
|
@ -422,8 +422,7 @@
|
|||
NSIndexSet * indexSet = [fFileTable selectedRowIndexes];
|
||||
unsigned int i;
|
||||
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
|
||||
[[NSWorkspace sharedWorkspace] selectFile: [fFiles objectAtIndex: i]
|
||||
inFileViewerRootedAtPath: nil];
|
||||
[[NSWorkspace sharedWorkspace] selectFile: [fFiles objectAtIndex: i] inFileViewerRootedAtPath: nil];
|
||||
}
|
||||
|
||||
- (void) setRatioCheck: (id) sender
|
||||
|
|
Loading…
Reference in a new issue