patch from Nick Shanks to improve the filter bar
1
AUTHORS
|
@ -57,6 +57,7 @@ Other Contributors
|
|||
Michael Demars <keul@m0k.org> (Mac OS X patches)
|
||||
Fredrik Modéen (BeOS patches)
|
||||
Deanna Phillips (transmissioncli manpage)
|
||||
Nicholas Shanks (Mac OS X patches)
|
||||
|
||||
Third-Party Resources
|
||||
Thanks to:
|
||||
|
|
|
@ -70,7 +70,6 @@
|
|||
A232D29E0A70903E00973B12 /* Filter.png in Resources */ = {isa = PBXBuildFile; fileRef = A232D29D0A70903E00973B12 /* Filter.png */; };
|
||||
A2385DD40BFE06C800B24EF6 /* DragOverlayWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */; };
|
||||
A23BBEB70A9BBE77003F7274 /* FilterBarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A27431D90A68538400FA780A /* FilterBarButton.m */; };
|
||||
A24103070AF80E390001C8D0 /* FilterButtonPressedLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7140A699178008EE24F /* FilterButtonPressedLeft.png */; };
|
||||
A241528B0C0261B8007DD3B4 /* Globe.png in Resources */ = {isa = PBXBuildFile; fileRef = A2FB06950BFF484A0095564D /* Globe.png */; };
|
||||
A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; };
|
||||
A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; };
|
||||
|
@ -81,14 +80,6 @@
|
|||
A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
||||
A24F19210A3A796800C9C145 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
||||
A253F6F30A698970008EE24F /* FilterBarBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F6F20A698970008EE24F /* FilterBarBackground.png */; };
|
||||
A253F70B0A6990EB008EE24F /* FilterButtonOverMain.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7080A6990EB008EE24F /* FilterButtonOverMain.png */; };
|
||||
A253F70C0A6990EB008EE24F /* FilterButtonOverLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7090A6990EB008EE24F /* FilterButtonOverLeft.png */; };
|
||||
A253F70D0A6990EB008EE24F /* FilterButtonOverRight.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F70A0A6990EB008EE24F /* FilterButtonOverRight.png */; };
|
||||
A253F7150A699178008EE24F /* FilterButtonPressedRight.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7120A699178008EE24F /* FilterButtonPressedRight.png */; };
|
||||
A253F7160A699178008EE24F /* FilterButtonPressedMain.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7130A699178008EE24F /* FilterButtonPressedMain.png */; };
|
||||
A253F72A0A699373008EE24F /* FilterButtonSelectedLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7270A699373008EE24F /* FilterButtonSelectedLeft.png */; };
|
||||
A253F72B0A699373008EE24F /* FilterButtonSelectedMain.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7280A699373008EE24F /* FilterButtonSelectedMain.png */; };
|
||||
A253F72C0A699373008EE24F /* FilterButtonSelectedRight.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7290A699373008EE24F /* FilterButtonSelectedRight.png */; };
|
||||
A256588D0A9A695400E8A03B /* MessageWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A256588B0A9A695400E8A03B /* MessageWindowController.m */; };
|
||||
A259317E0A73B2CC002F4FE7 /* TransmissionHelp in Resources */ = {isa = PBXBuildFile; fileRef = A259316A0A73B2CC002F4FE7 /* TransmissionHelp */; };
|
||||
A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A25E74440AF5089E006F11AE /* ExpandedPathToPathTransformer.m */; };
|
||||
|
@ -322,7 +313,7 @@
|
|||
4DFBC2DD09C0970D00D5C571 /* Torrent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Torrent.h; path = macosx/Torrent.h; sourceTree = "<group>"; };
|
||||
4DFBC2DE09C0970D00D5C571 /* Torrent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Torrent.m; path = macosx/Torrent.m; sourceTree = "<group>"; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; name = Info.plist; path = macosx/Info.plist; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D1107320486CEB800E47090 /* Transmission.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Transmission.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A200B8390A2263BA007BBB1E /* InfoWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoWindowController.h; path = macosx/InfoWindowController.h; sourceTree = "<group>"; };
|
||||
A200B83A0A2263BA007BBB1E /* InfoWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InfoWindowController.m; path = macosx/InfoWindowController.m; sourceTree = "<group>"; };
|
||||
A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = "<group>"; };
|
||||
|
@ -393,15 +384,6 @@
|
|||
A24D2A780C0A65C400A0ED9F /* ipcparse.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ipcparse.h; path = libtransmission/ipcparse.h; sourceTree = "<group>"; };
|
||||
A24F19070A3A790800C9C145 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = macosx/Sparkle.framework; sourceTree = "<group>"; };
|
||||
A253F6F20A698970008EE24F /* FilterBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterBarBackground.png; path = macosx/Images/FilterBarBackground.png; sourceTree = "<group>"; };
|
||||
A253F7080A6990EB008EE24F /* FilterButtonOverMain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonOverMain.png; path = macosx/Images/FilterButtonOverMain.png; sourceTree = "<group>"; };
|
||||
A253F7090A6990EB008EE24F /* FilterButtonOverLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonOverLeft.png; path = macosx/Images/FilterButtonOverLeft.png; sourceTree = "<group>"; };
|
||||
A253F70A0A6990EB008EE24F /* FilterButtonOverRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonOverRight.png; path = macosx/Images/FilterButtonOverRight.png; sourceTree = "<group>"; };
|
||||
A253F7120A699178008EE24F /* FilterButtonPressedRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonPressedRight.png; path = macosx/Images/FilterButtonPressedRight.png; sourceTree = "<group>"; };
|
||||
A253F7130A699178008EE24F /* FilterButtonPressedMain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonPressedMain.png; path = macosx/Images/FilterButtonPressedMain.png; sourceTree = "<group>"; };
|
||||
A253F7140A699178008EE24F /* FilterButtonPressedLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonPressedLeft.png; path = macosx/Images/FilterButtonPressedLeft.png; sourceTree = "<group>"; };
|
||||
A253F7270A699373008EE24F /* FilterButtonSelectedLeft.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonSelectedLeft.png; path = macosx/Images/FilterButtonSelectedLeft.png; sourceTree = "<group>"; };
|
||||
A253F7280A699373008EE24F /* FilterButtonSelectedMain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonSelectedMain.png; path = macosx/Images/FilterButtonSelectedMain.png; sourceTree = "<group>"; };
|
||||
A253F7290A699373008EE24F /* FilterButtonSelectedRight.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonSelectedRight.png; path = macosx/Images/FilterButtonSelectedRight.png; sourceTree = "<group>"; };
|
||||
A256588A0A9A695400E8A03B /* MessageWindowController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MessageWindowController.h; path = macosx/MessageWindowController.h; sourceTree = "<group>"; };
|
||||
A256588B0A9A695400E8A03B /* MessageWindowController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = MessageWindowController.m; path = macosx/MessageWindowController.m; sourceTree = "<group>"; };
|
||||
A259316A0A73B2CC002F4FE7 /* TransmissionHelp */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TransmissionHelp; path = macosx/TransmissionHelp; sourceTree = "<group>"; };
|
||||
|
@ -767,15 +749,6 @@
|
|||
A27A53560A06A76400E1F16F /* StatusSep.png */,
|
||||
A232D29D0A70903E00973B12 /* Filter.png */,
|
||||
A253F6F20A698970008EE24F /* FilterBarBackground.png */,
|
||||
A253F7080A6990EB008EE24F /* FilterButtonOverMain.png */,
|
||||
A253F7090A6990EB008EE24F /* FilterButtonOverLeft.png */,
|
||||
A253F70A0A6990EB008EE24F /* FilterButtonOverRight.png */,
|
||||
A253F7120A699178008EE24F /* FilterButtonPressedRight.png */,
|
||||
A253F7130A699178008EE24F /* FilterButtonPressedMain.png */,
|
||||
A253F7140A699178008EE24F /* FilterButtonPressedLeft.png */,
|
||||
A253F7270A699373008EE24F /* FilterButtonSelectedLeft.png */,
|
||||
A253F7280A699373008EE24F /* FilterButtonSelectedMain.png */,
|
||||
A253F7290A699373008EE24F /* FilterButtonSelectedRight.png */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1211,14 +1184,6 @@
|
|||
A2F6DB090A55F31C0058D1E5 /* SpeedLimitButton.png in Resources */,
|
||||
A20AB97B0A5C622A004F81FA /* SmallTurtle.png in Resources */,
|
||||
A253F6F30A698970008EE24F /* FilterBarBackground.png in Resources */,
|
||||
A253F70B0A6990EB008EE24F /* FilterButtonOverMain.png in Resources */,
|
||||
A253F70C0A6990EB008EE24F /* FilterButtonOverLeft.png in Resources */,
|
||||
A253F70D0A6990EB008EE24F /* FilterButtonOverRight.png in Resources */,
|
||||
A253F7150A699178008EE24F /* FilterButtonPressedRight.png in Resources */,
|
||||
A253F7160A699178008EE24F /* FilterButtonPressedMain.png in Resources */,
|
||||
A253F72A0A699373008EE24F /* FilterButtonSelectedLeft.png in Resources */,
|
||||
A253F72B0A699373008EE24F /* FilterButtonSelectedMain.png in Resources */,
|
||||
A253F72C0A699373008EE24F /* FilterButtonSelectedRight.png in Resources */,
|
||||
A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */,
|
||||
A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */,
|
||||
A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */,
|
||||
|
@ -1232,7 +1197,6 @@
|
|||
35B038140AC5B6EC00A10FDF /* ResumeNoWaitOff.png in Resources */,
|
||||
A29C8B330ACC6E93000ED9F9 /* YellowDot.tiff in Resources */,
|
||||
A22A8D560AEEAFA5007E9CB9 /* Localizable.strings in Resources */,
|
||||
A24103070AF80E390001C8D0 /* FilterButtonPressedLeft.png in Resources */,
|
||||
A241528B0C0261B8007DD3B4 /* Globe.png in Resources */,
|
||||
A2E9AA760C249AF400085DCF /* Create.png in Resources */,
|
||||
A2F011990C27418800576FC0 /* CreateLarge.png in Resources */,
|
||||
|
|
|
@ -374,7 +374,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
currentFilterButton = fNoFilterButton;
|
||||
}
|
||||
|
||||
[currentFilterButton setEnabled: YES];
|
||||
[currentFilterButton setState: NSOnState];
|
||||
|
||||
//observe notifications
|
||||
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
|
||||
|
@ -1836,8 +1836,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
if (sender != prevFilterButton)
|
||||
{
|
||||
[prevFilterButton setEnabled: NO];
|
||||
[sender setEnabled: YES];
|
||||
[prevFilterButton setState: NSOffState];
|
||||
[sender setState: NSOnState];
|
||||
|
||||
NSString * filterType;
|
||||
if (sender == fDownloadFilterButton)
|
||||
|
|
|
@ -64,45 +64,7 @@ Lead Developers
|
|||
\fs20 \cf2 (Korean)\
|
||||
|
||||
\fs24 \cf0 Anton Sotkov
|
||||
\fs20 \cf2 (Russian)\
|
||||
|
||||
\fs24 \cf0 \
|
||||
GTK+:\
|
||||
Calor\'93 Alessandro
|
||||
\fs20 \cf2 (Italian)
|
||||
\fs24 \cf0 \
|
||||
Pierre-Henri Quelen
|
||||
\fs20 \cf2 (French)
|
||||
\fs24 \cf0 \
|
||||
Robert-Andr\'8e Mauchin
|
||||
\fs20 \cf2 (French)\
|
||||
|
||||
\fs24 \cf0 Jan Geboers
|
||||
\fs20 \cf2 (Dutch)
|
||||
\fs24 \cf0 \
|
||||
Vicente Carro Fernandez
|
||||
\fs20 \cf2 (Spanish)
|
||||
\fs24 \cf0 \
|
||||
Tomasz Dominikowski
|
||||
\fs20 \cf2 (Polish)
|
||||
\fs24 \cf0 \
|
||||
Nickolay V. Shmyrev
|
||||
\fs20 \cf2 (Russian)
|
||||
\fs24 \cf0 \
|
||||
Pavel Shevchuk
|
||||
\fs20 \cf2 (Russian)
|
||||
\fs24 \cf0 \
|
||||
Lubomir Marinov
|
||||
\fs20 \cf2 (Bulgarian)
|
||||
\fs24 \cf0 \
|
||||
Mircea Suciu
|
||||
\fs20 \cf2 (Romanian)
|
||||
\fs24 \cf0 \
|
||||
Daniel Nylander
|
||||
\fs20 \cf2 (Swedish)
|
||||
\fs24 \cf0 \
|
||||
Jaakko Huhtala
|
||||
\fs20 \cf2 (Finnish)
|
||||
\fs24 \cf0 \
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
|
@ -159,6 +121,9 @@ Image Contributors\
|
|||
\fs24 \cf0 \
|
||||
Deanna Phillips
|
||||
\fs20 \cf2 (transmissioncli manpage)
|
||||
\fs24 \cf0 \
|
||||
Nicholas Shanks
|
||||
\fs20 \cf2 (Mac OS X patches)
|
||||
\fs24 \cf0 \
|
||||
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
|
||||
\cf0 \
|
||||
|
|
|
@ -26,12 +26,13 @@
|
|||
|
||||
@interface FilterBarButton : NSButton
|
||||
{
|
||||
NSImage * fButtonNormal, * fButtonNormalDim, * fButtonOver,
|
||||
* fButtonPressed, * fButtonSelected, * fButtonSelectedDim;
|
||||
int fCount;
|
||||
|
||||
int fState;
|
||||
BOOL fEnabled;
|
||||
NSTrackingRectTag fTrackingTag;
|
||||
NSBezierPath * fPath, * fEdgePath, * fStepPath;
|
||||
NSDictionary * fNormalAttributes, * fNormalDimAttributes,
|
||||
* fHighlightedAttributes, * fHighlightedDimAttributes;
|
||||
}
|
||||
|
||||
- (void) setCount: (int) count;
|
||||
|
|
|
@ -23,10 +23,14 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#import "FilterBarButton.h"
|
||||
#import "CTGradient.h"
|
||||
#import "CTGradientAdditions.h"
|
||||
#import "BezierPathAdditions.h"
|
||||
|
||||
@interface FilterBarButton (Private)
|
||||
|
||||
- (void) createButtons;
|
||||
- (void) createPaths;
|
||||
- (void) createFontAttributes;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -38,24 +42,15 @@
|
|||
{
|
||||
fEnabled = NO;
|
||||
fTrackingTag = 0;
|
||||
|
||||
[self createButtons];
|
||||
[self setAlternateImage: fButtonPressed];
|
||||
[self setImage: fButtonNormal];
|
||||
|
||||
fCount = -1;
|
||||
[self setCount: 0];
|
||||
[self createPaths];
|
||||
[self createFontAttributes];
|
||||
|
||||
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc addObserver: self selector: @selector(setForActive:)
|
||||
name: NSWindowDidBecomeKeyNotification object: [self window]];
|
||||
|
||||
[nc addObserver: self selector: @selector(setForInactive:)
|
||||
name: NSWindowDidResignKeyNotification object: [self window]];
|
||||
|
||||
[nc addObserver: self selector: @selector(resetBounds:)
|
||||
name: NSViewFrameDidChangeNotification object: nil];
|
||||
[nc addObserver: self selector: @selector(setForActive:) name: NSWindowDidBecomeKeyNotification object: [self window]];
|
||||
[nc addObserver: self selector: @selector(setForInactive:) name: NSWindowDidResignKeyNotification object: [self window]];
|
||||
[nc addObserver: self selector: @selector(resetBounds:) name: NSViewFrameDidChangeNotification object: nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -64,15 +59,97 @@
|
|||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
|
||||
[fButtonNormal release];
|
||||
[fButtonOver release];
|
||||
[fButtonPressed release];
|
||||
[fButtonSelected release];
|
||||
[fButtonSelectedDim release];
|
||||
[fPath release];
|
||||
[fEdgePath release];
|
||||
[fStepPath release];
|
||||
[fNormalAttributes release];
|
||||
[fNormalDimAttributes release];
|
||||
[fHighlightedAttributes release];
|
||||
[fHighlightedDimAttributes release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)sizeToFit
|
||||
{
|
||||
NSSize size = [[self title] sizeWithAttributes: fNormalAttributes];
|
||||
size.width = floorf(size.width + 18.5);
|
||||
size.height += 1;
|
||||
[self setFrameSize: size];
|
||||
[self setBoundsSize: size];
|
||||
[self createPaths];
|
||||
}
|
||||
|
||||
- (BOOL)isFlipped
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
// draw background
|
||||
if ([[self cell] isHighlighted])
|
||||
{
|
||||
[[CTGradient gradientWithBeginningColor: [NSColor colorWithCalibratedRed: 134.0/255 green: 151.0/255
|
||||
blue: 176.0/255 alpha: 1.0]
|
||||
endingColor: [NSColor colorWithCalibratedRed: 104.0/255 green: 125.0/255
|
||||
blue: 157.0/255 alpha: 1.0]]
|
||||
fillBezierPath: fPath angle: -90.0];
|
||||
[[CTGradient gradientWithBeginningColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.25]
|
||||
// middleColor: [NSColor colorWithCalibratedWhite: 0.5 alpha: 0.00]
|
||||
middleColor1: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.25]
|
||||
middleColor2: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.50]
|
||||
endingColor: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.50]]
|
||||
fillBezierPath: fStepPath angle: -90.0];
|
||||
}
|
||||
else switch (fState)
|
||||
{
|
||||
case 1: // active
|
||||
[[CTGradient gradientWithBeginningColor: [NSColor colorWithCalibratedRed: 151.0/255 green: 166.0/255
|
||||
blue: 188.0/255 alpha: 1.0]
|
||||
endingColor: [NSColor colorWithCalibratedRed: 126.0/255 green: 144.0/255
|
||||
blue: 171.0/255 alpha: 1.0]]
|
||||
fillBezierPath: fPath angle: -90.0];
|
||||
[[CTGradient gradientWithBeginningColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.25]
|
||||
// middleColor: [NSColor colorWithCalibratedWhite: 0.5 alpha: 0.00]
|
||||
middleColor1: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.25]
|
||||
middleColor2: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.50]
|
||||
endingColor: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.50]]
|
||||
fillBezierPath: fStepPath angle: -90.0];
|
||||
break;
|
||||
case 2: // hovering
|
||||
[[CTGradient gradientWithBeginningColor: [NSColor colorWithCalibratedRed: 164.0/255 green: 177.0/255
|
||||
blue: 196.0/255 alpha: 1.0]
|
||||
endingColor: [NSColor colorWithCalibratedRed: 141.0/255 green: 158.0/255
|
||||
blue: 182.0/255 alpha: 1.0]]
|
||||
fillBezierPath: fPath angle: -90.0];
|
||||
[[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.075] set];
|
||||
[fEdgePath stroke];
|
||||
break;
|
||||
case 3: // clicked but cell is not highlighted
|
||||
break;
|
||||
}
|
||||
|
||||
// draw title
|
||||
NSSize titleSize = [[self title] sizeWithAttributes: fNormalAttributes];
|
||||
NSPoint titlePos = NSMakePoint(([self bounds].size.width - titleSize.width) * 0.5,
|
||||
([self bounds].size.height - titleSize.height) * 0.5 + 1.5);
|
||||
if (fEnabled)
|
||||
{
|
||||
if (fState && !(fState == 3 && ![[self cell] isHighlighted]))
|
||||
[[self title] drawAtPoint: titlePos withAttributes: fHighlightedAttributes];
|
||||
else
|
||||
[[self title] drawAtPoint: titlePos withAttributes: fNormalAttributes];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (fState)
|
||||
[[self title] drawAtPoint: titlePos withAttributes: fHighlightedDimAttributes];
|
||||
else
|
||||
[[self title] drawAtPoint: titlePos withAttributes: fNormalDimAttributes];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setCount: (int) count
|
||||
{
|
||||
if (count == fCount)
|
||||
|
@ -83,26 +160,49 @@
|
|||
: [NSString stringWithFormat: NSLocalizedString(@"%d Transfers", "Filter Bar Button -> tool tip"), fCount]];
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent *) event
|
||||
{
|
||||
if ([self state] != 1)
|
||||
[self setState: 3];
|
||||
[super mouseDown: event];
|
||||
}
|
||||
|
||||
- (void) mouseUp: (NSEvent *) event
|
||||
{
|
||||
[super mouseUp: event];
|
||||
if ([self state] != 1)
|
||||
[self setState: 1];
|
||||
}
|
||||
|
||||
- (void) mouseEntered: (NSEvent *) event
|
||||
{
|
||||
if (!fEnabled)
|
||||
[self setImage: fButtonOver];
|
||||
|
||||
[super mouseEntered: event];
|
||||
if ([self state] == 0)
|
||||
[self setState: 2];
|
||||
}
|
||||
|
||||
- (void) mouseExited: (NSEvent *) event
|
||||
{
|
||||
if (!fEnabled)
|
||||
[self setImage: fButtonNormal];
|
||||
|
||||
[super mouseExited: event];
|
||||
if ([self state] >= 2)
|
||||
[self setState: 0];
|
||||
}
|
||||
|
||||
- (void) setEnabled: (BOOL) enable
|
||||
{
|
||||
fEnabled = enable;
|
||||
[self setImage: fEnabled ? fButtonSelected : fButtonNormal];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (int) state
|
||||
{
|
||||
return fState;
|
||||
}
|
||||
|
||||
- (void) setState: (int) state
|
||||
{
|
||||
fState = state;
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) resetBounds: (NSNotification *) notification
|
||||
|
@ -114,177 +214,87 @@
|
|||
|
||||
- (void) setForActive: (NSNotification *) notification
|
||||
{
|
||||
[self setImage: fEnabled ? fButtonSelected : fButtonNormal];
|
||||
[self setEnabled: YES];
|
||||
[self resetBounds: nil];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void) setForInactive: (NSNotification *) notification
|
||||
{
|
||||
[self setImage: fEnabled ? fButtonSelectedDim : fButtonNormalDim];
|
||||
|
||||
if (fTrackingTag)
|
||||
{
|
||||
[self removeTrackingRect: fTrackingTag];
|
||||
fTrackingTag = 0;
|
||||
}
|
||||
[self setEnabled: NO];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FilterBarButton (Private)
|
||||
|
||||
- (void) createButtons
|
||||
- (void) createPaths
|
||||
{
|
||||
//create attributes
|
||||
NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
|
||||
[NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask];
|
||||
NSSize buttonSize = [self frame].size;
|
||||
|
||||
// the main button path
|
||||
[fPath release];
|
||||
fPath = [[NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.0, 1.0, buttonSize.width, buttonSize.height - 1.0)
|
||||
radius: (buttonSize.height - 1.0) / 2.0] retain];
|
||||
|
||||
// the path used to draw the hover edging
|
||||
[fEdgePath release];
|
||||
fEdgePath = [[NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.5, 1.5, buttonSize.width - 1.0, buttonSize.height - 2.0)
|
||||
radius: (buttonSize.height - 2.0) / 2.0] retain];
|
||||
|
||||
// the path used to draw the depressed shading/highlights of the active button
|
||||
[fStepPath release];
|
||||
fStepPath = [[NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.0, 0.0, buttonSize.width, buttonSize.height - 1.0)
|
||||
radius: (buttonSize.height - 1.0) / 2.0] retain];
|
||||
[fStepPath appendBezierPath: fPath];
|
||||
[fStepPath setWindingRule: NSEvenOddWindingRule];
|
||||
}
|
||||
|
||||
- (void) createFontAttributes
|
||||
{
|
||||
NSFont * boldSystemFont = [NSFont boldSystemFontOfSize: 12.0];
|
||||
NSSize shadowOffset = NSMakeSize(0.0, -1.0);
|
||||
|
||||
NSShadow * shadowNormal = [NSShadow alloc];
|
||||
NSShadow * shadowNormal = [[[NSShadow alloc] init] autorelease];
|
||||
[shadowNormal setShadowOffset: shadowOffset];
|
||||
[shadowNormal setShadowBlurRadius: 1.0];
|
||||
[shadowNormal setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.4]];
|
||||
[shadowNormal setShadowColor: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.4]];
|
||||
|
||||
NSShadow * shadowDim = [NSShadow alloc];
|
||||
[shadowDim setShadowOffset: shadowOffset];
|
||||
[shadowDim setShadowBlurRadius: 1.0];
|
||||
[shadowDim setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.2]];
|
||||
NSShadow * shadowNormalDim = [[[NSShadow alloc] init] autorelease];
|
||||
[shadowNormalDim setShadowOffset: shadowOffset];
|
||||
[shadowNormalDim setShadowBlurRadius: 1.0];
|
||||
[shadowNormalDim setShadowColor: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.2]];
|
||||
|
||||
NSShadow * shadowHighlighted = [NSShadow alloc];
|
||||
NSShadow * shadowHighlighted = [[[NSShadow alloc] init] autorelease];
|
||||
[shadowHighlighted setShadowOffset: shadowOffset];
|
||||
[shadowHighlighted setShadowBlurRadius: 1.0];
|
||||
[shadowHighlighted setShadowColor: [NSColor colorWithDeviceWhite: 0.0 alpha: 0.4]];
|
||||
[shadowHighlighted setShadowColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.4]];
|
||||
|
||||
NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor colorWithCalibratedRed: 0.259 green: 0.259 blue: 0.259 alpha: 1.0],
|
||||
NSForegroundColorAttributeName,
|
||||
boldFont, NSFontAttributeName,
|
||||
shadowNormal, NSShadowAttributeName, nil],
|
||||
* normalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
fNormalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor colorWithCalibratedWhite: 0.259 alpha: 1.0], NSForegroundColorAttributeName,
|
||||
boldSystemFont, NSFontAttributeName,
|
||||
shadowNormal, NSShadowAttributeName, nil];
|
||||
|
||||
fNormalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor disabledControlTextColor], NSForegroundColorAttributeName,
|
||||
boldFont, NSFontAttributeName,
|
||||
shadowDim, NSShadowAttributeName, nil],
|
||||
* highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
boldSystemFont, NSFontAttributeName,
|
||||
shadowNormalDim, NSShadowAttributeName, nil];
|
||||
|
||||
fHighlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor whiteColor], NSForegroundColorAttributeName,
|
||||
boldFont, NSFontAttributeName,
|
||||
shadowHighlighted, NSShadowAttributeName, nil],
|
||||
* highlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue: 0.9 alpha: 1.0], NSForegroundColorAttributeName,
|
||||
boldFont, NSFontAttributeName,
|
||||
boldSystemFont, NSFontAttributeName,
|
||||
shadowHighlighted, NSShadowAttributeName, nil];
|
||||
|
||||
[shadowNormal release];
|
||||
[shadowDim release];
|
||||
[shadowHighlighted release];
|
||||
|
||||
//get images
|
||||
NSImage * leftOver = [NSImage imageNamed: @"FilterButtonOverLeft.png"],
|
||||
* rightOver = [NSImage imageNamed: @"FilterButtonOverRight.png"],
|
||||
* mainOver = [NSImage imageNamed: @"FilterButtonOverMain.png"];
|
||||
|
||||
NSImage * leftPressed = [NSImage imageNamed: @"FilterButtonPressedLeft.png"],
|
||||
* rightPressed = [NSImage imageNamed: @"FilterButtonPressedRight.png"],
|
||||
* mainPressed = [NSImage imageNamed: @"FilterButtonPressedMain.png"];
|
||||
|
||||
NSImage * leftSelected = [NSImage imageNamed: @"FilterButtonSelectedLeft.png"],
|
||||
* rightSelected = [NSImage imageNamed: @"FilterButtonSelectedRight.png"],
|
||||
* mainSelected = [NSImage imageNamed: @"FilterButtonSelectedMain.png"];
|
||||
|
||||
//get button sizes and placement
|
||||
NSString * text = [self title];
|
||||
NSSize textSize = [text sizeWithAttributes: normalAttributes];
|
||||
textSize.width = ceilf(textSize.width);
|
||||
|
||||
float overlap = 7.0;
|
||||
NSSize endSize = [leftOver size],
|
||||
mainSize = NSMakeSize(textSize.width - overlap * 2.0, endSize.height),
|
||||
buttonSize = NSMakeSize(mainSize.width + 2.0 * endSize.width, endSize.height);
|
||||
NSRect textRect = NSMakeRect(endSize.width - overlap, (buttonSize.height - textSize.height) * 0.5 + 1.5,
|
||||
textSize.width, textSize.height);
|
||||
|
||||
NSPoint leftPoint = NSZeroPoint,
|
||||
mainPoint = NSMakePoint(endSize.width, 0),
|
||||
rightPoint = NSMakePoint(mainPoint.x + mainSize.width, 0);
|
||||
|
||||
fButtonNormal = [[NSImage alloc] initWithSize: buttonSize];
|
||||
fButtonNormalDim = [[NSImage alloc] initWithSize: buttonSize];
|
||||
fButtonOver = [[NSImage alloc] initWithSize: buttonSize];
|
||||
fButtonPressed = [[NSImage alloc] initWithSize: buttonSize];
|
||||
fButtonSelected = [[NSImage alloc] initWithSize: buttonSize];
|
||||
fButtonSelectedDim = [[NSImage alloc] initWithSize: buttonSize];
|
||||
|
||||
//rolled over button
|
||||
[mainOver setScalesWhenResized: YES];
|
||||
[mainOver setSize: mainSize];
|
||||
|
||||
[fButtonOver lockFocus];
|
||||
[leftOver compositeToPoint: leftPoint operation: NSCompositeSourceOver];
|
||||
[mainOver compositeToPoint: mainPoint operation: NSCompositeSourceOver];
|
||||
[rightOver compositeToPoint: rightPoint operation: NSCompositeSourceOver];
|
||||
[fButtonOver unlockFocus];
|
||||
|
||||
//pressed button
|
||||
[mainPressed setScalesWhenResized: YES];
|
||||
[mainPressed setSize: mainSize];
|
||||
|
||||
[fButtonPressed lockFocus];
|
||||
[leftPressed compositeToPoint: leftPoint operation: NSCompositeSourceOver];
|
||||
[mainPressed compositeToPoint: mainPoint operation: NSCompositeSourceOver];
|
||||
[rightPressed compositeToPoint: rightPoint operation: NSCompositeSourceOver];
|
||||
[fButtonPressed unlockFocus];
|
||||
|
||||
//selected button
|
||||
[mainSelected setScalesWhenResized: YES];
|
||||
[mainSelected setSize: mainSize];
|
||||
|
||||
[fButtonSelected lockFocus];
|
||||
[leftSelected compositeToPoint: leftPoint operation: NSCompositeSourceOver];
|
||||
[mainSelected compositeToPoint: mainPoint operation: NSCompositeSourceOver];
|
||||
[rightSelected compositeToPoint: rightPoint operation: NSCompositeSourceOver];
|
||||
[fButtonSelected unlockFocus];
|
||||
|
||||
//selected and dimmed button
|
||||
fButtonSelectedDim = [fButtonSelected copy];
|
||||
|
||||
//normal button
|
||||
[fButtonNormal lockFocus];
|
||||
[text drawInRect: textRect withAttributes: normalAttributes];
|
||||
[fButtonNormal unlockFocus];
|
||||
|
||||
//normal and dim button
|
||||
[fButtonNormalDim lockFocus];
|
||||
[text drawInRect: textRect withAttributes: normalDimAttributes];
|
||||
[fButtonNormalDim unlockFocus];
|
||||
|
||||
//rolled over button
|
||||
[fButtonOver lockFocus];
|
||||
[text drawInRect: textRect withAttributes: highlightedAttributes];
|
||||
[fButtonOver unlockFocus];
|
||||
|
||||
//pressed button
|
||||
[fButtonPressed lockFocus];
|
||||
[text drawInRect: textRect withAttributes: highlightedAttributes];
|
||||
[fButtonPressed unlockFocus];
|
||||
|
||||
//selected button
|
||||
[fButtonSelected lockFocus];
|
||||
[text drawInRect: textRect withAttributes: highlightedAttributes];
|
||||
[fButtonSelected unlockFocus];
|
||||
|
||||
//selected and dim button
|
||||
[fButtonSelectedDim lockFocus];
|
||||
[text drawInRect: textRect withAttributes: highlightedDimAttributes];
|
||||
[fButtonSelectedDim unlockFocus];
|
||||
|
||||
[normalAttributes release];
|
||||
[normalDimAttributes release];
|
||||
[highlightedAttributes release];
|
||||
[highlightedDimAttributes release];
|
||||
|
||||
//resize button
|
||||
NSPoint point = [self frame].origin;
|
||||
[self setFrame: NSMakeRect(point.x, point.y, buttonSize.width, buttonSize.height)];
|
||||
fHighlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSColor colorWithCalibratedWhite: 0.9 alpha: 1.0], NSForegroundColorAttributeName,
|
||||
boldSystemFont, NSFontAttributeName,
|
||||
shadowHighlighted, NSShadowAttributeName, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -28,6 +28,16 @@
|
|||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[fNoFilterButton setTitle: NSLocalizedString(@"All", @"Filter Bar Button -> title")];
|
||||
[fDownloadFilterButton setTitle: NSLocalizedString(@"Downloading", @"Filter Bar Button -> title")];
|
||||
[fSeedFilterButton setTitle: NSLocalizedString(@"Seeding", @"Filter Bar Button -> title")];
|
||||
[fPauseFilterButton setTitle: NSLocalizedString(@"Paused", @"Filter Bar Button -> title")];
|
||||
|
||||
[fNoFilterButton sizeToFit];
|
||||
[fDownloadFilterButton sizeToFit];
|
||||
[fSeedFilterButton sizeToFit];
|
||||
[fPauseFilterButton sizeToFit];
|
||||
|
||||
float padding = 2.0, base = 3.0;
|
||||
[fNoFilterButton setFrameOrigin: NSMakePoint(padding + 2.0, base)];
|
||||
[fDownloadFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fNoFilterButton frame]) + padding, base)];
|
||||
|
|
Before Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 132 B |
Before Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 359 B |