diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index d64fae612..505e9f8e9 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -89,7 +89,6 @@ 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 */; }; - A21610FC0A050B1700E8E4C1 /* MenuButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A21610FB0A050B1700E8E4C1 /* MenuButton.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 */; }; @@ -111,6 +110,8 @@ A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; }; A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; }; A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */; }; + A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */; }; + A24999440B49F5AD001EADA3 /* ActionPopUpButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */; }; 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 */; }; @@ -289,8 +290,6 @@ 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 = ""; }; - A21610FA0A050B1700E8E4C1 /* MenuButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = MenuButton.h; path = macosx/MenuButton.h; sourceTree = ""; }; - A21610FB0A050B1700E8E4C1 /* MenuButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = MenuButton.m; path = macosx/MenuButton.m; 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 = ""; }; @@ -312,6 +311,10 @@ A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonPressed.png; path = macosx/Images/SpeedLimitButtonPressed.png; sourceTree = ""; }; A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonBlue.png; path = macosx/Images/SpeedLimitButtonBlue.png; sourceTree = ""; }; A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = SpeedLimitButtonGraphite.png; path = macosx/Images/SpeedLimitButtonGraphite.png; sourceTree = ""; }; + A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButton.h; path = macosx/ActionPopUpButton.h; sourceTree = ""; }; + A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButton.m; path = macosx/ActionPopUpButton.m; sourceTree = ""; }; + A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionPopUpButtonCell.m; path = macosx/ActionPopUpButtonCell.m; sourceTree = ""; }; + A24999430B49F5AD001EADA3 /* ActionPopUpButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ActionPopUpButtonCell.h; path = macosx/ActionPopUpButtonCell.h; sourceTree = ""; }; A24F19070A3A790800C9C145 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = macosx/Sparkle.framework; sourceTree = ""; }; A253F6F20A698970008EE24F /* FilterBarBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterBarBackground.png; path = macosx/Images/FilterBarBackground.png; sourceTree = ""; }; A253F7080A6990EB008EE24F /* FilterButtonOverMain.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = FilterButtonOverMain.png; path = macosx/Images/FilterButtonOverMain.png; sourceTree = ""; }; @@ -452,8 +455,6 @@ 4DCCBB3C09C3D71100D3CABF /* TorrentCell.m */, 29B97316FDCFA39411CA2CEA /* main.m */, 32CA4F630368D1EE00C91783 /* Transmission_Prefix.pch */, - A21610FA0A050B1700E8E4C1 /* MenuButton.h */, - A21610FB0A050B1700E8E4C1 /* MenuButton.m */, A2AF1C360A3D0F6200F1575D /* FileTableView.h */, A2AF1C370A3D0F6200F1575D /* FileTableView.m */, A27431D80A68538400FA780A /* BarButton.h */, @@ -464,6 +465,10 @@ A2710E750A86796000CE4F7D /* PrefsWindow.m */, A2AA579A0ADFCAB400CA59F6 /* PiecesImageView.h */, A2AA579B0ADFCAB400CA59F6 /* PiecesImageView.m */, + A24999200B49F1B5001EADA3 /* ActionPopUpButton.h */, + A24999210B49F1B5001EADA3 /* ActionPopUpButton.m */, + A24999420B49F5AD001EADA3 /* ActionPopUpButtonCell.m */, + A24999430B49F5AD001EADA3 /* ActionPopUpButtonCell.h */, ); name = Sources; sourceTree = ""; @@ -910,7 +915,6 @@ 4DE5CCA70980735700BE280E /* Badger.m in Sources */, 4DFBC2DF09C0970D00D5C571 /* Torrent.m in Sources */, 4DCCBB3E09C3D71100D3CABF /* TorrentCell.m in Sources */, - A21610FC0A050B1700E8E4C1 /* MenuButton.m in Sources */, A200B9200A22798F007BBB1E /* InfoWindowController.m in Sources */, A2AF1C390A3D0F6200F1575D /* FileTableView.m in Sources */, A27ABC240A6ADE410020EC71 /* ImageBackgroundView.m in Sources */, @@ -929,6 +933,8 @@ A25E74650AF5097C006F11AE /* ExpandedPathToPathTransformer.m in Sources */, A25E74660AF5097D006F11AE /* ExpandedPathToIconTransformer.m in Sources */, A2BF07910B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m in Sources */, + A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */, + A24999440B49F5AD001EADA3 /* ActionPopUpButtonCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macosx/ActionPopUpButton.h b/macosx/ActionPopUpButton.h new file mode 100644 index 000000000..54f10180a --- /dev/null +++ b/macosx/ActionPopUpButton.h @@ -0,0 +1,8 @@ +/* ActionPopUpButton */ + +#import + +@interface ActionPopUpButton : NSPopUpButton +{ +} +@end diff --git a/macosx/ActionPopUpButton.m b/macosx/ActionPopUpButton.m new file mode 100644 index 000000000..7c9bd4551 --- /dev/null +++ b/macosx/ActionPopUpButton.m @@ -0,0 +1,20 @@ +#import "ActionPopUpButton.h" +#import "ActionPopUpButtonCell.h" + +@implementation ActionPopUpButton + ++ (Class) cellClass +{ + return [ActionPopUpButtonCell class]; +} + +- (id) initWithCoder: (NSCoder *) coder +{ + if (self = [super initWithCoder: coder]) + { + [self setCell: [[ActionPopUpButtonCell alloc] initTextCell: @"" pullsDown: YES]]; + } + return self; +} + +@end diff --git a/macosx/ActionPopUpButtonCell.h b/macosx/ActionPopUpButtonCell.h new file mode 100644 index 000000000..edba57f5d --- /dev/null +++ b/macosx/ActionPopUpButtonCell.h @@ -0,0 +1,9 @@ +/* ActionPopUpButton */ + +#import + +@interface ActionPopUpButtonCell : NSPopUpButtonCell +{ + NSImage * fImage, * fImagePressed; +} +@end diff --git a/macosx/ActionPopUpButtonCell.m b/macosx/ActionPopUpButtonCell.m new file mode 100644 index 000000000..39419d4e7 --- /dev/null +++ b/macosx/ActionPopUpButtonCell.m @@ -0,0 +1,24 @@ +#import "ActionPopUpButtonCell.h" + +@implementation ActionPopUpButtonCell + +- (id) initTextCell: (NSString *) string pullsDown: (BOOL) pullDown +{ + if (self = [super initTextCell: string pullsDown: YES]) + { + fImage = [NSImage imageNamed: @"ActionButton.png"]; + [fImage setFlipped: YES]; + fImagePressed = [NSImage imageNamed: @"ActionButtonPressed.png"]; + [fImage setFlipped: YES]; + } + return self; +} + +- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView +{ + NSImage * image = [self isHighlighted] ? fImagePressed : fImage; + [image drawInRect: cellFrame fromRect: NSMakeRect(0.0, 0.0, [image size].width, [image size].height) + operation: NSCompositeSourceOver fraction: 1.0]; +} + +@end diff --git a/macosx/English.lproj/MainMenu.nib/classes.nib b/macosx/English.lproj/MainMenu.nib/classes.nib index fa26de374..1b94e7657 100644 --- a/macosx/English.lproj/MainMenu.nib/classes.nib +++ b/macosx/English.lproj/MainMenu.nib/classes.nib @@ -1,5 +1,11 @@ { IBClasses = ( + {CLASS = ActionPopUpButton; LANGUAGE = ObjC; SUPERCLASS = NSPopUpButton; }, + { + CLASS = ActionPopUpButtonCell; + LANGUAGE = ObjC; + SUPERCLASS = NSPopUpButtonCell; + }, {CLASS = BarButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; }, { ACTIONS = { @@ -94,7 +100,6 @@ SUPERCLASS = NSObject; }, {CLASS = ImageBackgroundView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, - {CLASS = MenuButton; LANGUAGE = ObjC; SUPERCLASS = NSButton; }, {CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; }, {CLASS = NameCell; LANGUAGE = ObjC; SUPERCLASS = NSCell; }, { diff --git a/macosx/English.lproj/MainMenu.nib/info.nib b/macosx/English.lproj/MainMenu.nib/info.nib index 1df7b3059..12392729c 100644 --- a/macosx/English.lproj/MainMenu.nib/info.nib +++ b/macosx/English.lproj/MainMenu.nib/info.nib @@ -31,7 +31,6 @@ 3 IBOpenObjects - 1041 21 IBSystem Version diff --git a/macosx/English.lproj/MainMenu.nib/keyedobjects.nib b/macosx/English.lproj/MainMenu.nib/keyedobjects.nib index c27358ecd..953609b35 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/MenuButton.h b/macosx/MenuButton.h deleted file mode 100644 index 5683863de..000000000 --- a/macosx/MenuButton.h +++ /dev/null @@ -1,30 +0,0 @@ -/****************************************************************************** - * $Id$ - * - * Copyright (c) 2006 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 MenuButton : NSButton -{ -} -@end diff --git a/macosx/MenuButton.m b/macosx/MenuButton.m deleted file mode 100644 index 9e94044e4..000000000 --- a/macosx/MenuButton.m +++ /dev/null @@ -1,60 +0,0 @@ -/****************************************************************************** - * $Id$ - * - * Copyright (c) 2006 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 "MenuButton.h" - -@implementation MenuButton - -- (void) mouseDown: (NSEvent *) event -{ - NSImage * image = [self image]; - [self setImage: [self alternateImage]]; - - //approximate height of menu...alright for now - /*float menuHeight = ((float)[[self menu] numberOfItems] + 2.0) * [NSMenuView menuBarHeight]; - BOOL moveToTop = menuHeight > [[self window] frame].origin.y;*/ - - NSPoint point = NSMakePoint(3.0, /*moveToTop ? [self frame].size.height + menuHeight :*/ -2.0); - - NSEvent * newEvent= [NSEvent mouseEventWithType: [event type] - location: point - modifierFlags: [event modifierFlags] - timestamp: [event timestamp] - windowNumber: [event windowNumber] - context: [event context] - eventNumber: [event eventNumber] - clickCount: [event clickCount] - pressure: [event pressure]]; - - [NSMenu popUpContextMenu: [self menu] withEvent: newEvent forView: self]; - - [self setImage: image]; -} - -- (NSMenu *) menuForEvent: (NSEvent *) event -{ - return nil; -} - -@end