diff --git a/macosx/Controller.h b/macosx/Controller.h index 0296342a0..1ab801b3c 100644 --- a/macosx/Controller.h +++ b/macosx/Controller.h @@ -69,8 +69,7 @@ * fTrackerSortActionItem, * fDateSortActionItem, * fOrderSortActionItem; IBOutlet FilterBarView * fFilterBar; - IBOutlet FilterBarButton * fNoFilterButton, * fDownloadFilterButton, - * fSeedFilterButton, * fPauseFilterButton; + IBOutlet NSButton * fNoFilterButton, * fDownloadFilterButton, * fSeedFilterButton, * fPauseFilterButton; IBOutlet NSSearchField * fSearchFilterField; IBOutlet NSMenuItem * fNextFilterItem, * fPrevFilterItem; diff --git a/macosx/Controller.m b/macosx/Controller.m index ab6d59153..9307e1a93 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -339,7 +339,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi #warning clean up NSString * filterType = [fDefaults stringForKey: @"Filter"]; - FilterBarButton * currentFilterButton; + NSButton * currentFilterButton; if ([filterType isEqualToString: FILTER_PAUSE]) currentFilterButton = fPauseFilterButton; else if ([filterType isEqualToString: FILTER_SEED]) @@ -1154,8 +1154,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi " and trash both data and torrent files.", "Removal confirm panel -> title"), torrentName]; message = NSLocalizedString(@"This transfer is active." - " Once removed, continuing the transfer will require the torrent file." - " Do you really want to remove it?", "Removal confirm panel -> message"); + " Once removed, continuing the transfer will require the torrent file.", + "Removal confirm panel -> message"); } else { @@ -1180,8 +1180,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi message = [NSString stringWithFormat: NSLocalizedString(@"There are %d transfers (%d active).", "Removal confirm panel -> message part 1"), selected, active]; message = [message stringByAppendingString: - NSLocalizedString(@" Once removed, continuing the transfers will require the torrent files." - " Do you really want to remove them?", "Removal confirm panel -> message part 2")]; + NSLocalizedString(@" Once removed, continuing the transfers will require the torrent files.", + "Removal confirm panel -> message part 2")]; } NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"), @@ -1856,10 +1856,11 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi [tempTorrents setArray: fTorrents]; //set buttons with counts - [fNoFilterButton setCount: [fTorrents count]]; + #warning reimplement + /*[fNoFilterButton setCount: [fTorrents count]]; [fDownloadFilterButton setCount: downloading]; [fSeedFilterButton setCount: seeding]; - [fPauseFilterButton setCount: paused]; + [fPauseFilterButton setCount: paused];*/ NSString * searchString = [fSearchFilterField stringValue]; if ([searchString length] > 0) @@ -1942,7 +1943,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi { NSString * oldFilterType = [fDefaults stringForKey: @"Filter"]; - FilterBarButton * prevFilterButton; + NSButton * prevFilterButton; if ([oldFilterType isEqualToString: FILTER_PAUSE]) prevFilterButton = fPauseFilterButton; else if ([oldFilterType isEqualToString: FILTER_SEED]) @@ -1999,11 +2000,12 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi [self applyFilter: nil]; } +#warning improve - (void) switchFilter: (id) sender { NSString * filterType = [fDefaults stringForKey: @"Filter"]; - FilterBarButton * button; + NSButton * button; if ([filterType isEqualToString: FILTER_NONE]) button = sender == fNextFilterItem ? fDownloadFilterButton : fPauseFilterButton; else if ([filterType isEqualToString: FILTER_DOWNLOAD]) diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index 8200a43ff..f0cb2895f 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -9,17 +9,6 @@ FilterBarView LANGUAGE ObjC - OUTLETS - - fDownloadFilterButton - FilterBarButton - fNoFilterButton - FilterBarButton - fPauseFilterButton - FilterBarButton - fSeedFilterButton - FilterBarButton - SUPERCLASS ImageBackgroundView @@ -173,7 +162,7 @@ fDockMenu NSMenu fDownloadFilterButton - FilterBarButton + NSButton fDownloadLimitItem NSMenuItem fDownloadMenu @@ -191,7 +180,7 @@ fNextInfoTabItem NSMenuItem fNoFilterButton - FilterBarButton + NSButton fOpenIgnoreDownloadFolder NSMenuItem fOrderSortActionItem @@ -199,7 +188,7 @@ fOrderSortItem NSMenuItem fPauseFilterButton - FilterBarButton + NSButton fPrevFilterItem NSMenuItem fPrevInfoTabItem @@ -213,7 +202,7 @@ fSearchFilterField NSSearchField fSeedFilterButton - FilterBarButton + NSButton fSpeedLimitButton NSButton fStateSortActionItem @@ -252,14 +241,6 @@ SUPERCLASS NSObject - - CLASS - FilterBarButton - LANGUAGE - ObjC - SUPERCLASS - NSButton - ACTIONS diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index b2e767230..3853a6ae2 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -10,7 +10,7 @@ 5 IBOpenObjects - 2185 + 1603 IBSystem Version 9A581 diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index 7d074c155..c8270d907 100644 Binary files a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib and b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib differ diff --git a/macosx/FilterBarButton.h b/macosx/FilterBarButton.h deleted file mode 100644 index 50463222e..000000000 --- a/macosx/FilterBarButton.h +++ /dev/null @@ -1,51 +0,0 @@ -/****************************************************************************** - * $Id$ - * - * Copyright (c) 2006-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 - -@class CTGradient; -@interface FilterBarButton : NSButton -{ - int fCount; - int fState; - BOOL fEnabled; - NSTrackingRectTag fTrackingTag; - NSBezierPath * fPath, * fEdgePath, * fStepPath; - NSDictionary * fNormalAttributes, * fNormalDimAttributes, - * fHighlightedAttributes, * fHighlightedDimAttributes; - CTGradient * fHighlightedBackground, * fHighlightedOutline, - * fActiveBackground, * fActiveOutline, - * fHoveringBackground; - NSColor * fHoveringOutline; -} - -- (void) setCount: (int) count; -- (void) setEnabled: (BOOL) enable; - -- (void) resetBounds: (NSNotification *) notification; - -- (void) setForActive: (NSNotification *) notification; -- (void) setForInactive: (NSNotification *) notification; - -@end diff --git a/macosx/FilterBarButton.m b/macosx/FilterBarButton.m deleted file mode 100644 index 9748679df..000000000 --- a/macosx/FilterBarButton.m +++ /dev/null @@ -1,300 +0,0 @@ -/****************************************************************************** - * $Id$ - * - * Copyright (c) 2006-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 "FilterBarButton.h" -#import "CTGradient.h" -#import "CTGradientAdditions.h" -#import "NSBezierPathAdditions.h" - -@interface FilterBarButton (Private) - -- (void) createPaths; -- (void) createGradients; -- (void) createFontAttributes; - -@end - -@implementation FilterBarButton - -- (id) initWithCoder: (NSCoder *) coder -{ - if ((self = [super initWithCoder: coder])) - { - fEnabled = NO; - fTrackingTag = 0; - fCount = -1; - [self setCount: 0]; - [self createPaths]; - [self createGradients]; - [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]; - } - return self; -} - -- (void) dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver: self]; - - [fPath release]; - [fEdgePath release]; - [fStepPath release]; - - [fNormalAttributes release]; - [fNormalDimAttributes release]; - [fHighlightedAttributes release]; - - [fHighlightedDimAttributes release]; - [fHighlightedBackground release]; - [fHighlightedOutline release]; - [fActiveBackground release]; - [fActiveOutline release]; - [fHoveringBackground release]; - [fHoveringOutline release]; - - [super dealloc]; -} - -- (void) sizeToFit -{ - NSSize size = [[self title] sizeWithAttributes: fNormalAttributes]; - size.width = floorf(size.width + 14.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]) - { - [fHighlightedBackground fillBezierPath: fPath angle: -90.0]; - [fHighlightedOutline fillBezierPath: fStepPath angle: -90.0]; - } - else - switch (fState) - { - case 1: // active - [fActiveBackground fillBezierPath: fPath angle: -90.0]; - [fActiveOutline fillBezierPath: fStepPath angle: -90.0]; - break; - case 2: // hovering - case 3: // clicked but cell is not highlighted - [fHoveringBackground fillBezierPath: fPath angle: -90.0]; - [fHoveringOutline setStroke]; - [fEdgePath stroke]; - 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); - - NSDictionary * attributes; - if (fState) - attributes = fEnabled ? fHighlightedAttributes : fHighlightedDimAttributes; - else - attributes = fEnabled ? fNormalAttributes : fNormalDimAttributes; - - [[self title] drawAtPoint: titlePos withAttributes: attributes]; -} - -- (void) setCount: (int) count -{ - if (count == fCount) - return; - fCount = count; - - [self setToolTip: fCount == 1 ? NSLocalizedString(@"1 Transfer", "Filter Bar Button -> tool tip") - : [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 -{ - [super mouseEntered: event]; - if ([self state] == 0) - [self setState: 2]; -} - -- (void) mouseExited: (NSEvent *) event -{ - [super mouseExited: event]; - if ([self state] >= 2) - [self setState: 0]; -} - -- (void) setEnabled: (BOOL) enable -{ - fEnabled = enable; - [self setNeedsDisplay: YES]; -} - -- (int) state -{ - return fState; -} - -- (void) setState: (int) state -{ - fState = state; - [self setNeedsDisplay: YES]; -} - -- (void) resetBounds: (NSNotification *) notification -{ - if (fTrackingTag) - [self removeTrackingRect: fTrackingTag]; - fTrackingTag = [self addTrackingRect: [self bounds] owner: self userData: nil assumeInside: NO]; -} - -- (void) setForActive: (NSNotification *) notification -{ - [self setEnabled: YES]; - [self resetBounds: nil]; - [self setNeedsDisplay: YES]; -} - -- (void) setForInactive: (NSNotification *) notification -{ - if (fTrackingTag) - { - [self removeTrackingRect: fTrackingTag]; - fTrackingTag = 0; - } - [self setEnabled: NO]; - [self setNeedsDisplay: YES]; -} - -@end - -@implementation FilterBarButton (Private) - -- (void) createPaths -{ - 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) createGradients -{ - NSColor *quarterAlphaBlack = [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.25]; - NSColor *thirdAlphaWhite = [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.3333]; - fHighlightedBackground = [[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]] retain]; - fHighlightedOutline = [[CTGradient gradientWithBeginningColor: quarterAlphaBlack - middleColor1: quarterAlphaBlack - middleColor2: thirdAlphaWhite - endingColor: thirdAlphaWhite] retain]; - fActiveBackground = [[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]] retain]; - fActiveOutline = [fHighlightedOutline retain]; - fHoveringBackground = [[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]] retain]; - fHoveringOutline = [[NSColor colorWithCalibratedWhite: 0.0 alpha: 0.075] retain]; -} - -- (void) createFontAttributes -{ - NSFont * boldSystemFont = [NSFont boldSystemFontOfSize: 12.0]; - NSSize shadowOffset = NSMakeSize(0.0, -1.0); - - NSShadow * shadowNormal = [[[NSShadow alloc] init] autorelease]; - [shadowNormal setShadowOffset: shadowOffset]; - [shadowNormal setShadowBlurRadius: 1.0]; - [shadowNormal setShadowColor: [NSColor colorWithCalibratedWhite: 1.0 alpha: 0.4]]; - - 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] init] autorelease]; - [shadowHighlighted setShadowOffset: shadowOffset]; - [shadowHighlighted setShadowBlurRadius: 1.0]; - [shadowHighlighted setShadowColor: [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.4]]; - - fNormalAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSColor colorWithCalibratedWhite: 0.259 alpha: 1.0], NSForegroundColorAttributeName, - boldSystemFont, NSFontAttributeName, - shadowNormal, NSShadowAttributeName, nil]; - - fNormalDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSColor disabledControlTextColor], NSForegroundColorAttributeName, - boldSystemFont, NSFontAttributeName, - shadowNormalDim, NSShadowAttributeName, nil]; - - fHighlightedAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSColor whiteColor], NSForegroundColorAttributeName, - boldSystemFont, NSFontAttributeName, - shadowHighlighted, NSShadowAttributeName, nil]; - - fHighlightedDimAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSColor colorWithCalibratedWhite: 0.9 alpha: 1.0], NSForegroundColorAttributeName, - boldSystemFont, NSFontAttributeName, - shadowHighlighted, NSShadowAttributeName, nil]; -} - -@end diff --git a/macosx/FilterBarView.h b/macosx/FilterBarView.h index d5f78cecc..f9e22cc5f 100644 --- a/macosx/FilterBarView.h +++ b/macosx/FilterBarView.h @@ -24,12 +24,9 @@ #import #import "ImageBackgroundView.h" -#import "FilterBarButton.h" @interface FilterBarView : ImageBackgroundView { - IBOutlet FilterBarButton * fNoFilterButton, * fDownloadFilterButton, - * fSeedFilterButton, * fPauseFilterButton; } @end diff --git a/macosx/FilterBarView.m b/macosx/FilterBarView.m index 72d356878..494026b87 100644 --- a/macosx/FilterBarView.m +++ b/macosx/FilterBarView.m @@ -22,32 +22,15 @@ * DEALINGS IN THE SOFTWARE. *****************************************************************************/ -#import "FilterBarView.h" +#warning needed? -#define ORIGIN_VERTICAL 3.0 -#define ORIGIN_HORIZONTAL 4.0 -#define PADDING_HORIZONTAL 2.0 +#import "FilterBarView.h" @implementation FilterBarView - (void) awakeFromNib { [self setBackgroundImage: [NSImage imageNamed: @"FilterBarBackground.png"]]; - - [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]; - - [fNoFilterButton setFrameOrigin: NSMakePoint(ORIGIN_HORIZONTAL, ORIGIN_VERTICAL)]; - [fDownloadFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fNoFilterButton frame]) + PADDING_HORIZONTAL, ORIGIN_VERTICAL)]; - [fSeedFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fDownloadFilterButton frame]) + PADDING_HORIZONTAL, ORIGIN_VERTICAL)]; - [fPauseFilterButton setFrameOrigin: NSMakePoint(NSMaxX([fSeedFilterButton frame]) + PADDING_HORIZONTAL, ORIGIN_VERTICAL)]; } @end diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index 1527d132a..19893cafd 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -461,7 +461,6 @@ float * piecePercent = malloc(pieceCount * sizeof(float)); [torrent getAmountFinished: piecePercent size: pieceCount]; - //lines 2 to 14: blue, green, or gray depending on piece availability int i, h, index; float increment = (float)pieceCount / MAX_PIECES; NSColor * pieceColor;