some rewriting of the filter bar so it can dynamically place the buttons, and some extra, yet-to-be-used code
This commit is contained in:
parent
73c6c3324e
commit
3852bbb6e6
|
@ -62,6 +62,7 @@
|
||||||
A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; };
|
A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; };
|
||||||
A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; };
|
A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; };
|
||||||
A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */; };
|
A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */; };
|
||||||
|
A24838820C0BA608005CC3FE /* FilterBarView.m in Sources */ = {isa = PBXBuildFile; fileRef = A24838800C0BA608005CC3FE /* FilterBarView.m */; };
|
||||||
A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */; };
|
A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */; };
|
||||||
A24D2A640C0A624600A0ED9F /* IPCController.m in Sources */ = {isa = PBXBuildFile; fileRef = A24D2A620C0A624600A0ED9F /* IPCController.m */; };
|
A24D2A640C0A624600A0ED9F /* IPCController.m in Sources */ = {isa = PBXBuildFile; fileRef = A24D2A620C0A624600A0ED9F /* IPCController.m */; };
|
||||||
A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
A24F19080A3A790800C9C145 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A24F19070A3A790800C9C145 /* Sparkle.framework */; };
|
||||||
|
@ -328,6 +329,8 @@
|
||||||
A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonPressed.png; path = macosx/Images/SpeedLimitButtonPressed.png; sourceTree = "<group>"; };
|
A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonPressed.png; path = macosx/Images/SpeedLimitButtonPressed.png; sourceTree = "<group>"; };
|
||||||
A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonBlue.png; path = macosx/Images/SpeedLimitButtonBlue.png; sourceTree = "<group>"; };
|
A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonBlue.png; path = macosx/Images/SpeedLimitButtonBlue.png; sourceTree = "<group>"; };
|
||||||
A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonGraphite.png; path = macosx/Images/SpeedLimitButtonGraphite.png; sourceTree = "<group>"; };
|
A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonGraphite.png; path = macosx/Images/SpeedLimitButtonGraphite.png; sourceTree = "<group>"; };
|
||||||
|
A248387F0C0BA608005CC3FE /* FilterBarView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FilterBarView.h; path = macosx/FilterBarView.h; sourceTree = "<group>"; };
|
||||||
|
A24838800C0BA608005CC3FE /* FilterBarView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FilterBarView.m; path = macosx/FilterBarView.m; sourceTree = "<group>"; };
|
||||||
A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButton.h; path = macosx/ActionPopUpButton.h; sourceTree = "<group>"; };
|
A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButton.h; path = macosx/ActionPopUpButton.h; sourceTree = "<group>"; };
|
||||||
A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButton.m; path = macosx/ActionPopUpButton.m; sourceTree = "<group>"; };
|
A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButton.m; path = macosx/ActionPopUpButton.m; sourceTree = "<group>"; };
|
||||||
A24D2A610C0A624600A0ED9F /* IPCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = IPCController.h; path = macosx/IPCController.h; sourceTree = "<group>"; };
|
A24D2A610C0A624600A0ED9F /* IPCController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = IPCController.h; path = macosx/IPCController.h; sourceTree = "<group>"; };
|
||||||
|
@ -616,6 +619,8 @@
|
||||||
A2A1CB770BF29D5500AE959F /* PeerProgressIndicatorCell.h */,
|
A2A1CB770BF29D5500AE959F /* PeerProgressIndicatorCell.h */,
|
||||||
A2A1CB780BF29D5500AE959F /* PeerProgressIndicatorCell.m */,
|
A2A1CB780BF29D5500AE959F /* PeerProgressIndicatorCell.m */,
|
||||||
E138A9720C04D88F00C5426C /* CTGradient */,
|
E138A9720C04D88F00C5426C /* CTGradient */,
|
||||||
|
A248387F0C0BA608005CC3FE /* FilterBarView.h */,
|
||||||
|
A24838800C0BA608005CC3FE /* FilterBarView.m */,
|
||||||
);
|
);
|
||||||
name = Sources;
|
name = Sources;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1208,6 +1213,7 @@
|
||||||
E138A9770C04D88F00C5426C /* CTGradient.m in Sources */,
|
E138A9770C04D88F00C5426C /* CTGradient.m in Sources */,
|
||||||
E138A9780C04D88F00C5426C /* CTGradientAdditions.m in Sources */,
|
E138A9780C04D88F00C5426C /* CTGradientAdditions.m in Sources */,
|
||||||
A24D2A640C0A624600A0ED9F /* IPCController.m in Sources */,
|
A24D2A640C0A624600A0ED9F /* IPCController.m in Sources */,
|
||||||
|
A24838820C0BA608005CC3FE /* FilterBarView.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -242,7 +242,9 @@ void tr_ioSync( tr_io_t * io )
|
||||||
closeFiles( io );
|
closeFiles( io );
|
||||||
|
|
||||||
if( io->checkFilesPassed )
|
if( io->checkFilesPassed )
|
||||||
|
{
|
||||||
fastResumeSave( io );
|
fastResumeSave( io );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -335,7 +337,7 @@ static int checkFiles( tr_io_t * io )
|
||||||
{
|
{
|
||||||
if ( io->pieceSlot[j] > 0 && j == i)
|
if ( io->pieceSlot[j] > 0 && j == i)
|
||||||
{
|
{
|
||||||
// only remove double piece when we found one sitting in the right slot
|
/* Only remove double piece when we found one sitting in the right slot */
|
||||||
|
|
||||||
tr_inf( "found piece %d (slot: %d) already on slot %d",j,i,io->pieceSlot[j] );
|
tr_inf( "found piece %d (slot: %d) already on slot %d",j,i,io->pieceSlot[j] );
|
||||||
io->slotPiece[io->pieceSlot[j]] = -1;
|
io->slotPiece[io->pieceSlot[j]] = -1;
|
||||||
|
@ -343,7 +345,7 @@ static int checkFiles( tr_io_t * io )
|
||||||
io->pieceSlot[j] = i;
|
io->pieceSlot[j] = i;
|
||||||
io->slotPiece[i] = j;
|
io->slotPiece[i] = j;
|
||||||
}
|
}
|
||||||
else // we found no double
|
else /* We found no double */
|
||||||
{
|
{
|
||||||
io->pieceSlot[j] = i;
|
io->pieceSlot[j] = i;
|
||||||
io->slotPiece[i] = j;
|
io->slotPiece[i] = j;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#import "DragOverlayWindow.h"
|
#import "DragOverlayWindow.h"
|
||||||
#import "Badger.h"
|
#import "Badger.h"
|
||||||
#import "ImageBackgroundView.h"
|
#import "ImageBackgroundView.h"
|
||||||
#import "FilterBarButton.h"
|
#import "FilterBarView.h"
|
||||||
#import "IPCController.h"
|
#import "IPCController.h"
|
||||||
|
|
||||||
#import <Growl/Growl.h>
|
#import <Growl/Growl.h>
|
||||||
|
@ -72,9 +72,9 @@
|
||||||
* fNameSortActionItem, * fStateSortActionItem, * fProgressSortActionItem,
|
* fNameSortActionItem, * fStateSortActionItem, * fProgressSortActionItem,
|
||||||
* fDateSortActionItem, * fOrderSortActionItem;
|
* fDateSortActionItem, * fOrderSortActionItem;
|
||||||
|
|
||||||
IBOutlet ImageBackgroundView * fFilterBar;
|
IBOutlet FilterBarView * fFilterBar;
|
||||||
IBOutlet FilterBarButton * fNoFilterButton, * fPauseFilterButton,
|
IBOutlet FilterBarButton * fNoFilterButton, * fDownloadFilterButton,
|
||||||
* fSeedFilterButton, * fDownloadFilterButton;
|
* fSeedFilterButton, * fPauseFilterButton;
|
||||||
IBOutlet NSSearchField * fSearchFilterField;
|
IBOutlet NSSearchField * fSearchFilterField;
|
||||||
IBOutlet NSMenuItem * fNextFilterItem, * fPrevFilterItem;
|
IBOutlet NSMenuItem * fNextFilterItem, * fPrevFilterItem;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
NSMutableDictionary * fPendingTorrentDownloads;
|
NSMutableDictionary * fPendingTorrentDownloads;
|
||||||
NSTimer * fAutoImportTimer;
|
NSTimer * fAutoImportTimer;
|
||||||
|
|
||||||
BOOL fRemoteQuit;
|
BOOL fRemoteQuit;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) openFiles: (NSArray *) filenames;
|
- (void) openFiles: (NSArray *) filenames;
|
||||||
|
|
|
@ -360,6 +360,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
||||||
|
|
||||||
[currentFilterButton setEnabled: YES];
|
[currentFilterButton setEnabled: YES];
|
||||||
|
|
||||||
|
[fFilterBar replaceButtons];
|
||||||
|
|
||||||
//observe notifications
|
//observe notifications
|
||||||
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter * nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,17 @@
|
||||||
SUPERCLASS = NSObject;
|
SUPERCLASS = NSObject;
|
||||||
},
|
},
|
||||||
{CLASS = FilterBarButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
|
{CLASS = FilterBarButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; },
|
||||||
|
{
|
||||||
|
CLASS = FilterBarView;
|
||||||
|
LANGUAGE = ObjC;
|
||||||
|
OUTLETS = {
|
||||||
|
fDownloadFilterButton = FilterBarButton;
|
||||||
|
fNoFilterButton = FilterBarButton;
|
||||||
|
fPauseFilterButton = FilterBarButton;
|
||||||
|
fSeedFilterButton = FilterBarButton;
|
||||||
|
};
|
||||||
|
SUPERCLASS = ImageBackgroundView;
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ACTIONS = {deselectAll = id; revealFile = id; setNextTab = id; setPreviousTab = id; };
|
ACTIONS = {deselectAll = id; revealFile = id; setNextTab = id; setPreviousTab = id; };
|
||||||
CLASS = FirstResponder;
|
CLASS = FirstResponder;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<key>1480</key>
|
<key>1480</key>
|
||||||
<string>366 546 420 63 0 0 1152 842 </string>
|
<string>366 546 420 63 0 0 1152 842 </string>
|
||||||
<key>1603</key>
|
<key>1603</key>
|
||||||
<string>275 437 477 67 0 0 1152 842 </string>
|
<string>337 544 477 67 0 0 1152 842 </string>
|
||||||
<key>29</key>
|
<key>29</key>
|
||||||
<string>145 689 451 44 0 0 1152 842 </string>
|
<string>145 689 451 44 0 0 1152 842 </string>
|
||||||
<key>456</key>
|
<key>456</key>
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
<key>IBOpenObjects</key>
|
<key>IBOpenObjects</key>
|
||||||
<array>
|
<array>
|
||||||
<integer>21</integer>
|
<integer>21</integer>
|
||||||
|
<integer>1603</integer>
|
||||||
</array>
|
</array>
|
||||||
<key>IBSystem Version</key>
|
<key>IBSystem Version</key>
|
||||||
<string>8P135</string>
|
<string>8P135</string>
|
||||||
|
|
Binary file not shown.
|
@ -28,11 +28,13 @@
|
||||||
{
|
{
|
||||||
NSImage * fButtonNormal, * fButtonNormalDim, * fButtonOver,
|
NSImage * fButtonNormal, * fButtonNormalDim, * fButtonOver,
|
||||||
* fButtonPressed, * fButtonSelected, * fButtonSelectedDim;
|
* fButtonPressed, * fButtonSelected, * fButtonSelectedDim;
|
||||||
|
int fCount;
|
||||||
|
|
||||||
BOOL fEnabled;
|
BOOL fEnabled;
|
||||||
NSTrackingRectTag fTrackingTag;
|
NSTrackingRectTag fTrackingTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) createButtonsWithCount: (int) count;
|
||||||
- (void) setEnabled: (BOOL) enable;
|
- (void) setEnabled: (BOOL) enable;
|
||||||
|
|
||||||
- (void) resetBounds: (NSNotification *) notification;
|
- (void) resetBounds: (NSNotification *) notification;
|
||||||
|
|
|
@ -24,15 +24,8 @@
|
||||||
|
|
||||||
#import "FilterBarButton.h"
|
#import "FilterBarButton.h"
|
||||||
|
|
||||||
@interface FilterBarButton (Private)
|
|
||||||
|
|
||||||
- (void) createButtons;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation FilterBarButton
|
@implementation FilterBarButton
|
||||||
|
|
||||||
//height of button should be 17.0
|
|
||||||
- (id) initWithCoder: (NSCoder *) coder
|
- (id) initWithCoder: (NSCoder *) coder
|
||||||
{
|
{
|
||||||
if ((self = [super initWithCoder: coder]))
|
if ((self = [super initWithCoder: coder]))
|
||||||
|
@ -40,7 +33,8 @@
|
||||||
fEnabled = NO;
|
fEnabled = NO;
|
||||||
fTrackingTag = 0;
|
fTrackingTag = 0;
|
||||||
|
|
||||||
[self createButtons];
|
fCount = -1;
|
||||||
|
[self createButtonsWithCount: 0];
|
||||||
|
|
||||||
[self setImage: fButtonNormal];
|
[self setImage: fButtonNormal];
|
||||||
[self setAlternateImage: fButtonPressed];
|
[self setAlternateImage: fButtonPressed];
|
||||||
|
@ -73,9 +67,83 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
//call only once
|
//call only once
|
||||||
- (void) createButtons
|
- (void) createButtonsWithCount: (int) count
|
||||||
{
|
{
|
||||||
NSSize buttonSize = [self frame].size;
|
if (fCount == count)
|
||||||
|
return;
|
||||||
|
fCount = count;
|
||||||
|
|
||||||
|
//create attributes
|
||||||
|
NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
|
||||||
|
[NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask];
|
||||||
|
|
||||||
|
NSSize shadowOffset = NSMakeSize(0.0, -1.0);
|
||||||
|
|
||||||
|
NSShadow * shadow = [NSShadow alloc];
|
||||||
|
[shadow setShadowOffset: shadowOffset];
|
||||||
|
[shadow setShadowBlurRadius: 1.0];
|
||||||
|
[shadow setShadowColor: [NSColor colorWithDeviceWhite: 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]];
|
||||||
|
|
||||||
|
NSDictionary * normalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSColor colorWithCalibratedRed: 0.259 green: 0.259 blue: 0.259 alpha: 1.0],
|
||||||
|
NSForegroundColorAttributeName,
|
||||||
|
boldFont, NSFontAttributeName,
|
||||||
|
shadow, NSShadowAttributeName, nil],
|
||||||
|
* normalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSColor disabledControlTextColor], NSForegroundColorAttributeName,
|
||||||
|
boldFont, NSFontAttributeName,
|
||||||
|
shadowDim, NSShadowAttributeName, nil],
|
||||||
|
* highlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSColor whiteColor], NSForegroundColorAttributeName,
|
||||||
|
boldFont, NSFontAttributeName,
|
||||||
|
shadow, NSShadowAttributeName, nil],
|
||||||
|
* highlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||||
|
[NSColor colorWithCalibratedRed: 0.9 green: 0.9 blue: 0.9 alpha: 1.0], NSForegroundColorAttributeName,
|
||||||
|
boldFont, NSFontAttributeName,
|
||||||
|
shadow, NSShadowAttributeName, nil];
|
||||||
|
|
||||||
|
[shadow release];
|
||||||
|
[shadowDim release];
|
||||||
|
|
||||||
|
//create button text
|
||||||
|
NSString * text = [self title];
|
||||||
|
if (fCount > 0)
|
||||||
|
text = [text stringByAppendingString: [NSString stringWithFormat: @" (%d)", fCount]];
|
||||||
|
|
||||||
|
//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
|
||||||
|
NSLog(text);
|
||||||
|
NSSize textSize = [text sizeWithAttributes: normalAttributes];NSLog(NSStringFromSize(textSize));
|
||||||
|
textSize.width = ceilf(textSize.width);NSLog(NSStringFromSize(textSize));
|
||||||
|
|
||||||
|
float overlap = 4.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];
|
fButtonNormal = [[NSImage alloc] initWithSize: buttonSize];
|
||||||
fButtonNormalDim = [[NSImage alloc] initWithSize: buttonSize];
|
fButtonNormalDim = [[NSImage alloc] initWithSize: buttonSize];
|
||||||
fButtonOver = [[NSImage alloc] initWithSize: buttonSize];
|
fButtonOver = [[NSImage alloc] initWithSize: buttonSize];
|
||||||
|
@ -84,16 +152,6 @@
|
||||||
fButtonSelectedDim = [[NSImage alloc] initWithSize: buttonSize];
|
fButtonSelectedDim = [[NSImage alloc] initWithSize: buttonSize];
|
||||||
|
|
||||||
//rolled over button
|
//rolled over button
|
||||||
NSImage * leftOver = [NSImage imageNamed: @"FilterButtonOverLeft.png"],
|
|
||||||
* rightOver = [NSImage imageNamed: @"FilterButtonOverRight.png"],
|
|
||||||
* mainOver = [NSImage imageNamed: @"FilterButtonOverMain.png"];
|
|
||||||
|
|
||||||
NSSize endSize = [leftOver size],
|
|
||||||
mainSize = NSMakeSize(buttonSize.width - endSize.width * 2.0, endSize.height);
|
|
||||||
NSPoint leftPoint = NSMakePoint(0, 0),
|
|
||||||
rightPoint = NSMakePoint(buttonSize.width - endSize.width, 0),
|
|
||||||
mainPoint = NSMakePoint(endSize.width, 0);
|
|
||||||
|
|
||||||
[mainOver setScalesWhenResized: YES];
|
[mainOver setScalesWhenResized: YES];
|
||||||
[mainOver setSize: mainSize];
|
[mainOver setSize: mainSize];
|
||||||
|
|
||||||
|
@ -104,10 +162,6 @@
|
||||||
[fButtonOver unlockFocus];
|
[fButtonOver unlockFocus];
|
||||||
|
|
||||||
//pressed button
|
//pressed button
|
||||||
NSImage * leftPressed = [NSImage imageNamed: @"FilterButtonPressedLeft.png"],
|
|
||||||
* rightPressed = [NSImage imageNamed: @"FilterButtonPressedRight.png"],
|
|
||||||
* mainPressed = [NSImage imageNamed: @"FilterButtonPressedMain.png"];
|
|
||||||
|
|
||||||
[mainPressed setScalesWhenResized: YES];
|
[mainPressed setScalesWhenResized: YES];
|
||||||
[mainPressed setSize: mainSize];
|
[mainPressed setSize: mainSize];
|
||||||
|
|
||||||
|
@ -118,10 +172,6 @@
|
||||||
[fButtonPressed unlockFocus];
|
[fButtonPressed unlockFocus];
|
||||||
|
|
||||||
//selected button
|
//selected button
|
||||||
NSImage * leftSelected = [NSImage imageNamed: @"FilterButtonSelectedLeft.png"],
|
|
||||||
* rightSelected = [NSImage imageNamed: @"FilterButtonSelectedRight.png"],
|
|
||||||
* mainSelected = [NSImage imageNamed: @"FilterButtonSelectedMain.png"];
|
|
||||||
|
|
||||||
[mainSelected setScalesWhenResized: YES];
|
[mainSelected setScalesWhenResized: YES];
|
||||||
[mainSelected setSize: mainSize];
|
[mainSelected setSize: mainSize];
|
||||||
|
|
||||||
|
@ -134,55 +184,6 @@
|
||||||
//selected and dimmed button
|
//selected and dimmed button
|
||||||
fButtonSelectedDim = [fButtonSelected copy];
|
fButtonSelectedDim = [fButtonSelected copy];
|
||||||
|
|
||||||
//create button text
|
|
||||||
NSString * text = [self title];
|
|
||||||
|
|
||||||
NSFont * boldFont = [[NSFontManager sharedFontManager] convertFont:
|
|
||||||
[NSFont fontWithName: @"Lucida Grande" size: 12.0] toHaveTrait: NSBoldFontMask];
|
|
||||||
|
|
||||||
NSSize shadowOffset = NSMakeSize(0.0, -1.0);
|
|
||||||
|
|
||||||
NSShadow * shadowNormal = [NSShadow alloc];
|
|
||||||
[shadowNormal setShadowOffset: shadowOffset];
|
|
||||||
[shadowNormal setShadowBlurRadius: 1.0];
|
|
||||||
[shadowNormal setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.4]];
|
|
||||||
|
|
||||||
NSShadow * shadowNormalDim = [NSShadow alloc];
|
|
||||||
[shadowNormalDim setShadowOffset: shadowOffset];
|
|
||||||
[shadowNormalDim setShadowBlurRadius: 1.0];
|
|
||||||
[shadowNormalDim setShadowColor: [NSColor colorWithDeviceWhite: 1.0 alpha: 0.2]];
|
|
||||||
|
|
||||||
NSShadow * shadowHighlighted = [NSShadow alloc];
|
|
||||||
[shadowHighlighted setShadowOffset: shadowOffset];
|
|
||||||
[shadowHighlighted setShadowBlurRadius: 1.0];
|
|
||||||
[shadowHighlighted setShadowColor: [NSColor colorWithDeviceWhite: 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:
|
|
||||||
[NSColor disabledControlTextColor], NSForegroundColorAttributeName,
|
|
||||||
boldFont, NSFontAttributeName,
|
|
||||||
shadowNormalDim, NSShadowAttributeName, nil],
|
|
||||||
* highlightedAttributes = [[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,
|
|
||||||
shadowHighlighted, NSShadowAttributeName, nil];
|
|
||||||
|
|
||||||
NSSize textSizeNormal = [text sizeWithAttributes: normalAttributes];
|
|
||||||
NSRect textRect = NSMakeRect((buttonSize.width - textSizeNormal.width) * 0.5,
|
|
||||||
(buttonSize.height - textSizeNormal.height) * 0.5 + 1.5, textSizeNormal.width, textSizeNormal.height);
|
|
||||||
|
|
||||||
[shadowNormal release];
|
|
||||||
[shadowNormalDim release];
|
|
||||||
[shadowHighlighted release];
|
|
||||||
|
|
||||||
//normal button
|
//normal button
|
||||||
[fButtonNormal lockFocus];
|
[fButtonNormal lockFocus];
|
||||||
[text drawInRect: textRect withAttributes: normalAttributes];
|
[text drawInRect: textRect withAttributes: normalAttributes];
|
||||||
|
@ -217,6 +218,11 @@
|
||||||
[normalDimAttributes release];
|
[normalDimAttributes release];
|
||||||
[highlightedAttributes release];
|
[highlightedAttributes release];
|
||||||
[highlightedDimAttributes release];
|
[highlightedDimAttributes release];
|
||||||
|
|
||||||
|
//resize button
|
||||||
|
NSPoint point = [self frame].origin;
|
||||||
|
[self setFrame: NSMakeRect(point.x, point.y, buttonSize.width, buttonSize.height)];
|
||||||
|
[self setNeedsDisplay: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) mouseEntered: (NSEvent *) event
|
- (void) mouseEntered: (NSEvent *) event
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007 Transmission authors and contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import "ImageBackgroundView.h"
|
||||||
|
#import "FilterBarButton.h"
|
||||||
|
|
||||||
|
@interface FilterBarView : ImageBackgroundView
|
||||||
|
{
|
||||||
|
IBOutlet FilterBarButton * fNoFilterButton, * fDownloadFilterButton,
|
||||||
|
* fSeedFilterButton, * fPauseFilterButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) replaceButtons;
|
||||||
|
|
||||||
|
@end
|
|
@ -0,0 +1,38 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (c) 2007 Transmission authors and contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
* to deal in the Software without restriction, including without limitation
|
||||||
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#import "FilterBarView.h"
|
||||||
|
|
||||||
|
@implementation FilterBarView
|
||||||
|
|
||||||
|
- (void) replaceButtons
|
||||||
|
{
|
||||||
|
float padding = 2.0, base = 3.0;
|
||||||
|
[fNoFilterButton setFrameOrigin: NSMakePoint(padding + 2.0, base)];
|
||||||
|
[fDownloadFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fNoFilterButton frame]) + padding, base)];
|
||||||
|
[fSeedFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fDownloadFilterButton frame]) + padding, base)];
|
||||||
|
[fPauseFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fSeedFilterButton frame]) + padding, base)];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
Loading…
Reference in New Issue