diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index e379daf28..4a0defb3f 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -48,6 +48,7 @@ A200B9B60A22893D007BBB1E /* InfoWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A200B9620A227FD0007BBB1E /* InfoWindow.nib */; }; A20AB97B0A5C622A004F81FA /* SmallTurtle.png in Resources */ = {isa = PBXBuildFile; fileRef = A20AB97A0A5C622A004F81FA /* SmallTurtle.png */; }; A21567ED0A9A5034004DECD6 /* MessageWindow.nib in Resources */ = {isa = PBXBuildFile; fileRef = A21567EB0A9A5034004DECD6 /* MessageWindow.nib */; }; + A215760B0C0D449A0057A26A /* BezierPathAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A21576090C0D449A0057A26A /* BezierPathAdditions.m */; }; A2173E1C0A33C1B300B0D8AB /* ActionButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A2173E1B0A33C1B300B0D8AB /* ActionButtonPressed.png */; }; A21DFF100A292B2B007C5F76 /* Transfers.png in Resources */ = {isa = PBXBuildFile; fileRef = A21DFF0F0A292B2B007C5F76 /* Transfers.png */; }; A21F5B890AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A21F5B870AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m */; }; @@ -308,6 +309,8 @@ A200B9630A227FD0007BBB1E /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/InfoWindow.nib; sourceTree = ""; }; A20AB97A0A5C622A004F81FA /* SmallTurtle.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SmallTurtle.png; path = macosx/Images/SmallTurtle.png; sourceTree = ""; }; A21567EC0A9A5034004DECD6 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = macosx/English.lproj/MessageWindow.nib; sourceTree = ""; }; + A21576090C0D449A0057A26A /* BezierPathAdditions.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = BezierPathAdditions.m; path = macosx/BezierPathAdditions.m; sourceTree = ""; }; + A215760A0C0D449A0057A26A /* BezierPathAdditions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = BezierPathAdditions.h; path = macosx/BezierPathAdditions.h; sourceTree = ""; }; A2173E1B0A33C1B300B0D8AB /* ActionButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ActionButtonPressed.png; path = macosx/Images/ActionButtonPressed.png; sourceTree = ""; }; A21DFF0F0A292B2B007C5F76 /* Transfers.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Transfers.png; path = macosx/Images/Transfers.png; sourceTree = ""; }; A21F5B860AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionMenuRatioToDisplayRatioTransformer.h; path = macosx/ActionMenuRatioToDisplayRatioTransformer.h; sourceTree = ""; }; @@ -556,6 +559,8 @@ children = ( A24D2A610C0A624600A0ED9F /* IPCController.h */, A24D2A620C0A624600A0ED9F /* IPCController.m */, + A21576090C0D449A0057A26A /* BezierPathAdditions.m */, + A215760A0C0D449A0057A26A /* BezierPathAdditions.h */, A2FB057C0BFEB6800095564D /* DragOverlayView.h */, A2FB057D0BFEB6800095564D /* DragOverlayView.m */, A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */, @@ -1214,6 +1219,7 @@ E138A9780C04D88F00C5426C /* CTGradientAdditions.m in Sources */, A24D2A640C0A624600A0ED9F /* IPCController.m in Sources */, A24838820C0BA608005CC3FE /* FilterBarView.m in Sources */, + A215760B0C0D449A0057A26A /* BezierPathAdditions.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macosx/BezierPathAdditions.h b/macosx/BezierPathAdditions.h new file mode 100644 index 000000000..ca76c0745 --- /dev/null +++ b/macosx/BezierPathAdditions.h @@ -0,0 +1,31 @@ +/****************************************************************************** + * $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 + +@interface NSBezierPath (BezierPathAdditions) + ++ (NSBezierPath *) bezierPathWithRoundedRect: (NSRect) rect radius: (float) radius; + +@end diff --git a/macosx/BezierPathAdditions.m b/macosx/BezierPathAdditions.m new file mode 100644 index 000000000..21ecf9d59 --- /dev/null +++ b/macosx/BezierPathAdditions.m @@ -0,0 +1,49 @@ +/****************************************************************************** + * $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 "BezierPathAdditions.h" + +@implementation NSBezierPath (BezierPathAdditions) + ++ (NSBezierPath *) bezierPathWithRoundedRect: (NSRect) rect radius: (float) radius +{ + float minX = NSMinX(rect), + minY = NSMinY(rect), + maxX = NSMaxX(rect), + maxY = NSMaxY(rect), + midX = NSMidX(rect), + midY = NSMidY(rect); + + NSBezierPath * bp = [NSBezierPath bezierPath]; + [bp moveToPoint: NSMakePoint(maxX, midY)]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(maxX, maxY) toPoint: NSMakePoint(midX, maxY) radius: radius]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(minX, maxY) toPoint: NSMakePoint(minX, midY) radius: radius]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(minX, minY) toPoint: NSMakePoint(midX, minY) radius: radius]; + [bp appendBezierPathWithArcFromPoint: NSMakePoint(maxX, minY) toPoint: NSMakePoint(maxX, midY) radius: radius]; + [bp closePath]; + + return bp; +} + +@end diff --git a/macosx/Controller.m b/macosx/Controller.m index 44f2e0e84..69c2d3562 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -3039,6 +3039,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy [[NSWorkspace sharedWorkspace] selectFile: location inFileViewerRootedAtPath: nil]; } +#warning move to additions - (NSString *) applicationSupportFolder { return [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) objectAtIndex: 0] diff --git a/macosx/DragOverlayView.m b/macosx/DragOverlayView.m index 78bf92ed7..a4322e24a 100644 --- a/macosx/DragOverlayView.m +++ b/macosx/DragOverlayView.m @@ -23,6 +23,7 @@ *****************************************************************************/ #import "DragOverlayView.h" +#import "BezierPathAdditions.h" @implementation DragOverlayView @@ -32,22 +33,7 @@ { //create badge NSRect badgeRect = NSMakeRect(0, 0, 325.0, 84.0); - - float minX = NSMinX(badgeRect), - minY = NSMinY(badgeRect), - maxX = NSMaxX(badgeRect), - maxY = NSMaxY(badgeRect), - midX = NSMidX(badgeRect), - midY = NSMidY(badgeRect), - radius = 15.0; - - NSBezierPath * bp = [NSBezierPath bezierPath]; - [bp moveToPoint: NSMakePoint(maxX, midY)]; - [bp appendBezierPathWithArcFromPoint: NSMakePoint(maxX, maxY) toPoint: NSMakePoint(midX, maxY) radius: radius]; - [bp appendBezierPathWithArcFromPoint: NSMakePoint(minX, maxY) toPoint: NSMakePoint(minX, midY) radius: radius]; - [bp appendBezierPathWithArcFromPoint: NSMakePoint(minX, minY) toPoint: NSMakePoint(midX, minY) radius: radius]; - [bp appendBezierPathWithArcFromPoint: NSMakePoint(maxX, minY) toPoint: NSMakePoint(maxX, midY) radius: radius]; - [bp closePath]; + NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: badgeRect radius: 15.0]; fBackBadge = [[NSImage alloc] initWithSize: badgeRect.size]; [fBackBadge lockFocus];