diff --git a/Transmission.xcodeproj/project.pbxproj b/Transmission.xcodeproj/project.pbxproj index e7a60392e..f48ce0774 100644 --- a/Transmission.xcodeproj/project.pbxproj +++ b/Transmission.xcodeproj/project.pbxproj @@ -82,8 +82,11 @@ A21F5B890AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A21F5B870AF25FB6008CE5CE /* ActionMenuRatioToDisplayRatioTransformer.m */; }; A21F5C040AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A21F5C020AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m */; }; A2265F420B5EF5F40093DDA5 /* FileNameCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A2265F400B5EF5F40093DDA5 /* FileNameCell.m */; }; + A22A067E0CB83507009694FE /* InfoTabBack.tif in Resources */ = {isa = PBXBuildFile; fileRef = A22A067D0CB83507009694FE /* InfoTabBack.tif */; }; + A22A06980CB83880009694FE /* InfoTabBorder.tif in Resources */ = {isa = PBXBuildFile; fileRef = A22A06970CB83880009694FE /* InfoTabBorder.tif */; }; A22A8D560AEEAFA5007E9CB9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A22A8D540AEEAFA5007E9CB9 /* Localizable.strings */; }; A22BC9A30C5BBCF100F5FB72 /* BottomBorder.png in Resources */ = {isa = PBXBuildFile; fileRef = A22BC9A20C5BBCF100F5FB72 /* BottomBorder.png */; }; + A22D602E0CB67E4A00F67A8B /* InfoTabBackAqua.tif in Resources */ = {isa = PBXBuildFile; fileRef = A22D602C0CB67E4A00F67A8B /* InfoTabBackAqua.tif */; }; A232D29E0A70903E00973B12 /* Filter.png in Resources */ = {isa = PBXBuildFile; fileRef = A232D29D0A70903E00973B12 /* Filter.png */; }; A234D0D20C79FB3600A82373 /* NSMenuAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = A234D0D00C79FB3600A82373 /* NSMenuAdditions.m */; }; A2385DD40BFE06C800B24EF6 /* DragOverlayWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */; }; @@ -112,6 +115,8 @@ A261A8260C6A0D68003BAFDA /* Error.png in Resources */ = {isa = PBXBuildFile; fileRef = A261A8250C6A0D68003BAFDA /* Error.png */; }; A261F1DC0A69A1610002815A /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; }; A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; }; + A26E75880CB6AA7500226674 /* InfoOptions.png in Resources */ = {isa = PBXBuildFile; fileRef = A26E75870CB6AA7500226674 /* InfoOptions.png */; }; + A26E75960CB6AB4800226674 /* InfoGeneral.png in Resources */ = {isa = PBXBuildFile; fileRef = A26E75950CB6AB4800226674 /* InfoGeneral.png */; }; A2710E770A86796000CE4F7D /* PrefsWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2710E750A86796000CE4F7D /* PrefsWindow.m */; }; A277DA0B0C693D9C00DA2CD4 /* ActionOn.png in Resources */ = {isa = PBXBuildFile; fileRef = A277DA090C693D9C00DA2CD4 /* ActionOn.png */; }; A277DA0C0C693D9C00DA2CD4 /* ActionOff.png in Resources */ = {isa = PBXBuildFile; fileRef = A277DA0A0C693D9C00DA2CD4 /* ActionOff.png */; }; @@ -140,6 +145,7 @@ A2D4F0830A915F6600890C32 /* RedDot.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2D4F0820A915F6600890C32 /* RedDot.tiff */; }; A2D4F0850A915F7200890C32 /* GreenDot.tiff in Resources */ = {isa = PBXBuildFile; fileRef = A2D4F0840A915F7200890C32 /* GreenDot.tiff */; }; A2DF37070C220D03006523C1 /* CreatorWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A2DF37050C220D03006523C1 /* CreatorWindowController.m */; }; + A2E23AC60CB5E1930002BB25 /* InfoTabButtonCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */; }; A2E9AA760C249AF400085DCF /* Create.png in Resources */ = {isa = PBXBuildFile; fileRef = A2E9AA750C249AF400085DCF /* Create.png */; }; A2EF7DEC0C96297400FA9811 /* PurpleDot.png in Resources */ = {isa = PBXBuildFile; fileRef = A2EF7DEB0C96297400FA9811 /* PurpleDot.png */; }; A2F011990C27418800576FC0 /* CreateLarge.png in Resources */ = {isa = PBXBuildFile; fileRef = A2F011980C27418800576FC0 /* CreateLarge.png */; }; @@ -388,6 +394,8 @@ A21F5C020AF26DD5008CE5CE /* ActionMenuSpeedToDisplayLimitTransformer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = ActionMenuSpeedToDisplayLimitTransformer.m; path = macosx/ActionMenuSpeedToDisplayLimitTransformer.m; sourceTree = ""; }; A2265F3F0B5EF5F40093DDA5 /* FileNameCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FileNameCell.h; path = macosx/FileNameCell.h; sourceTree = ""; }; A2265F400B5EF5F40093DDA5 /* FileNameCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FileNameCell.m; path = macosx/FileNameCell.m; sourceTree = ""; }; + A22A067D0CB83507009694FE /* InfoTabBack.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = InfoTabBack.tif; path = macosx/Images/InfoTabBack.tif; sourceTree = ""; }; + A22A06970CB83880009694FE /* InfoTabBorder.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = InfoTabBorder.tif; path = macosx/Images/InfoTabBorder.tif; sourceTree = ""; }; A22A7EBC0C627FC200E30364 /* Greek */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Greek; path = macosx/Greek.lproj/InfoPlist.strings; sourceTree = ""; }; A22A7EBD0C627FC200E30364 /* Greek */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Greek; path = macosx/Greek.lproj/InfoWindow.nib; sourceTree = ""; }; A22A7EBE0C627FC200E30364 /* Greek */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Greek; path = macosx/Greek.lproj/Localizable.strings; sourceTree = ""; }; @@ -407,6 +415,7 @@ A22BCA310C5D5CDA00F5FB72 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = macosx/Italian.lproj/MainMenu.nib; sourceTree = ""; }; A22BCA320C5D5CDA00F5FB72 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = macosx/Italian.lproj/MessageWindow.nib; sourceTree = ""; }; A22BCA330C5D5CDA00F5FB72 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = macosx/Italian.lproj/PrefsWindow.nib; sourceTree = ""; }; + A22D602C0CB67E4A00F67A8B /* InfoTabBackAqua.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = InfoTabBackAqua.tif; path = macosx/Images/InfoTabBackAqua.tif; sourceTree = ""; }; A232D29D0A70903E00973B12 /* Filter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Filter.png; path = macosx/Images/Filter.png; sourceTree = ""; }; A234D0CF0C79FB3600A82373 /* NSMenuAdditions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NSMenuAdditions.h; path = macosx/NSMenuAdditions.h; sourceTree = ""; }; A234D0D00C79FB3600A82373 /* NSMenuAdditions.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSMenuAdditions.m; path = macosx/NSMenuAdditions.m; sourceTree = ""; }; @@ -448,6 +457,8 @@ A2603A030C6338FB00F5FDFD /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = macosx/Spanish.lproj/PrefsWindow.nib; sourceTree = ""; }; A261A8250C6A0D68003BAFDA /* Error.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Error.png; path = macosx/Images/Error.png; sourceTree = ""; }; A261F1DB0A69A1610002815A /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = macosx/Growl.framework; sourceTree = ""; }; + A26E75870CB6AA7500226674 /* InfoOptions.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoOptions.png; path = macosx/Images/InfoOptions.png; sourceTree = ""; }; + A26E75950CB6AB4800226674 /* InfoGeneral.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoGeneral.png; path = macosx/Images/InfoGeneral.png; sourceTree = ""; }; A2710E740A86796000CE4F7D /* PrefsWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PrefsWindow.h; path = macosx/PrefsWindow.h; sourceTree = ""; }; A2710E750A86796000CE4F7D /* PrefsWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PrefsWindow.m; path = macosx/PrefsWindow.m; sourceTree = ""; }; A27431D80A68538400FA780A /* FilterBarButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FilterBarButton.h; path = macosx/FilterBarButton.h; sourceTree = ""; }; @@ -506,6 +517,8 @@ A2D6891B0CB4990E009BEC3A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = macosx/English.lproj/Localizable.strings; sourceTree = ""; }; A2DF37040C220D03006523C1 /* CreatorWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CreatorWindowController.h; path = macosx/CreatorWindowController.h; sourceTree = ""; }; A2DF37050C220D03006523C1 /* CreatorWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CreatorWindowController.m; path = macosx/CreatorWindowController.m; sourceTree = ""; }; + A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = InfoTabButtonCell.h; path = macosx/InfoTabButtonCell.h; sourceTree = ""; }; + A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = InfoTabButtonCell.m; path = macosx/InfoTabButtonCell.m; sourceTree = ""; }; A2E9AA750C249AF400085DCF /* Create.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Create.png; path = macosx/Images/Create.png; sourceTree = ""; }; A2EF7DEB0C96297400FA9811 /* PurpleDot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PurpleDot.png; path = macosx/Images/PurpleDot.png; sourceTree = ""; }; A2F011980C27418800576FC0 /* CreateLarge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CreateLarge.png; path = macosx/Images/CreateLarge.png; sourceTree = ""; }; @@ -719,6 +732,8 @@ A21282A60CA6C66800EAEE0F /* StatusBarView.m */, A257C17F0CAD3003004E121C /* PeerTableView.h */, A257C1800CAD3003004E121C /* PeerTableView.m */, + A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */, + A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */, ); name = Sources; sourceTree = ""; @@ -820,6 +835,11 @@ A29597340A72A9E10057248B /* StatusBarBackground.png */, A232D29D0A70903E00973B12 /* Filter.png */, A253F6F20A698970008EE24F /* FilterBarBackground.png */, + A22D602C0CB67E4A00F67A8B /* InfoTabBackAqua.tif */, + A22A067D0CB83507009694FE /* InfoTabBack.tif */, + A22A06970CB83880009694FE /* InfoTabBorder.tif */, + A26E75950CB6AB4800226674 /* InfoGeneral.png */, + A26E75870CB6AA7500226674 /* InfoOptions.png */, ); name = Resources; sourceTree = ""; @@ -1355,6 +1375,11 @@ A24872B60C9B6BB9000F5B92 /* Advanced.png in Resources */, A2A6E3A00CA7E4C900F10FEF /* AboutWindow.nib in Resources */, A2BC19850CA9AF5A00DD302A /* CompleteCheck.png in Resources */, + A22D602E0CB67E4A00F67A8B /* InfoTabBackAqua.tif in Resources */, + A26E75880CB6AA7500226674 /* InfoOptions.png in Resources */, + A26E75960CB6AB4800226674 /* InfoGeneral.png in Resources */, + A22A067E0CB83507009694FE /* InfoTabBack.tif in Resources */, + A22A06980CB83880009694FE /* InfoTabBorder.tif in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1491,6 +1516,7 @@ A234D0D20C79FB3600A82373 /* NSMenuAdditions.m in Sources */, A21282A80CA6C66800EAEE0F /* StatusBarView.m in Sources */, A257C1820CAD3003004E121C /* PeerTableView.m in Sources */, + A2E23AC60CB5E1930002BB25 /* InfoTabButtonCell.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/macosx/English.lproj/InfoWindow.nib/classes.nib b/macosx/English.lproj/InfoWindow.nib/classes.nib index d876d8147..88ee1dffb 100644 --- a/macosx/English.lproj/InfoWindow.nib/classes.nib +++ b/macosx/English.lproj/InfoWindow.nib/classes.nib @@ -2,6 +2,8 @@ IBClasses = ( {CLASS = FileOutlineView; LANGUAGE = ObjC; SUPERCLASS = NSOutlineView; }, {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, + {CLASS = ImageBackgroundView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, + {CLASS = InfoTabButtonCell; LANGUAGE = ObjC; SUPERCLASS = NSButtonCell; }, { ACTIONS = { revealDataFile = id; @@ -16,10 +18,12 @@ setRatioSetting = id; setSpeedLimit = id; setSpeedMode = id; + setTab = id; }; CLASS = InfoWindowController; LANGUAGE = ObjC; OUTLETS = { + fActivityView = NSView; fCommentView = NSTextView; fCompletedFromTrackerField = NSTextField; fConnectedPeersField = NSTextField; @@ -43,13 +47,17 @@ fFilePriorityNormal = NSMenuItem; fFileTableStatusField = NSTextField; fFileUncheckItem = NSMenuItem; + fFilesView = NSView; fHashField = NSTextField; fHaveField = NSTextField; fImageView = NSImageView; + fInfoView = NSView; fKnownField = NSTextField; fLeechersField = NSTextField; fNameField = NSTextField; + fOptionsView = NSView; fPeerTable = NSTableView; + fPeersView = NSView; fPexCheck = NSButton; fPiecesControl = NSSegmentedControl; fPiecesField = NSTextField; @@ -65,7 +73,8 @@ fSizeField = NSTextField; fStateField = NSTextField; fSwarmSpeedField = NSTextField; - fTabView = NSTabView; + fTabBackBar = ImageBackgroundView; + fTabMatrix = NSMatrix; fTorrentLocationField = NSTextField; fTrackerField = NSTextField; fUploadLimitField = NSTextField; diff --git a/macosx/English.lproj/InfoWindow.nib/info.nib b/macosx/English.lproj/InfoWindow.nib/info.nib index f896dc03c..0170f87c2 100644 --- a/macosx/English.lproj/InfoWindow.nib/info.nib +++ b/macosx/English.lproj/InfoWindow.nib/info.nib @@ -6,15 +6,23 @@ 58 88 356 240 0 0 1680 1028 IBEditorPositions + 1030 + 297 229 360 384 0 0 1680 1028 + 1057 + 505 337 360 389 0 0 1680 1028 + 1066 + 665 601 349 202 0 0 1680 1028 549 - 565 283 174 149 0 0 1152 842 + 870 359 174 149 0 0 1680 1028 + 965 + 229 571 370 310 0 0 1680 1028 + 995 + 301 527 370 332 0 0 1680 1028 IBFramework Version 446.1 IBLockedObjects - - 5 - + IBLockedTabItems 332 @@ -22,6 +30,7 @@ IBOpenObjects 5 + 1066 IBSystem Version 8R4031 diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index 25ced93b9..8bab1fe74 100644 Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ diff --git a/macosx/Images/InfoGeneral.png b/macosx/Images/InfoGeneral.png new file mode 100644 index 000000000..7c33c4cbe Binary files /dev/null and b/macosx/Images/InfoGeneral.png differ diff --git a/macosx/Images/InfoOptions.png b/macosx/Images/InfoOptions.png new file mode 100644 index 000000000..1493008a2 Binary files /dev/null and b/macosx/Images/InfoOptions.png differ diff --git a/macosx/Images/InfoTabBack.tif b/macosx/Images/InfoTabBack.tif new file mode 100644 index 000000000..111ca262f Binary files /dev/null and b/macosx/Images/InfoTabBack.tif differ diff --git a/macosx/Images/InfoTabBackAqua.tif b/macosx/Images/InfoTabBackAqua.tif new file mode 100644 index 000000000..13b7fb286 Binary files /dev/null and b/macosx/Images/InfoTabBackAqua.tif differ diff --git a/macosx/Images/InfoTabBorder.tif b/macosx/Images/InfoTabBorder.tif new file mode 100644 index 000000000..24db674dc Binary files /dev/null and b/macosx/Images/InfoTabBorder.tif differ diff --git a/macosx/InfoTabButtonCell.h b/macosx/InfoTabButtonCell.h new file mode 100644 index 000000000..1dc083486 --- /dev/null +++ b/macosx/InfoTabButtonCell.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 InfoTabButtonCell : NSButtonCell +{ + NSImage * fRegularImage, * fSelectedImage; +} +@end diff --git a/macosx/InfoTabButtonCell.m b/macosx/InfoTabButtonCell.m new file mode 100644 index 000000000..3002ba444 --- /dev/null +++ b/macosx/InfoTabButtonCell.m @@ -0,0 +1,88 @@ +/****************************************************************************** + * $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 "InfoTabButtonCell.h" + +@implementation InfoTabButtonCell + +- (void) dealloc +{ + [fRegularImage release]; + [fSelectedImage release]; + [super dealloc]; +} + +- (void) setImage: (NSImage *) image +{ + //create regular back image + if (fRegularImage) + [fRegularImage release]; + fRegularImage = [[NSImage imageNamed: @"InfoTabBack.tif"] copy]; + [fRegularImage setFlipped: YES]; + + //create selected back image + if (fSelectedImage) + [fSelectedImage release]; + fSelectedImage = [[NSImage imageNamed: @"InfoTabBackAqua.tif"] copy]; + [fSelectedImage setFlipped: YES]; + + //composite image to back images + if (image) + { + NSSize imageSize = [image size]; + NSRect imageRect = NSMakeRect(0, 0, [fRegularImage size].width, [fRegularImage size].height); + NSRect rect = NSMakeRect(imageRect.origin.x + (imageRect.size.width - imageSize.width) * 0.5, + imageRect.origin.y + (imageRect.size.height - imageSize.height) * 0.5, imageSize.width, imageSize.height); + + [fRegularImage lockFocus]; + [image drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; + [fRegularImage unlockFocus]; + + [fSelectedImage lockFocus]; + [image drawInRect: rect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; + [fSelectedImage unlockFocus]; + } +} + +- (void) drawWithFrame: (NSRect) cellFrame inView: (NSView *) controlView +{ + NSImage * image; + if ([(NSMatrix *)controlView selectedCell] == self) + { + if (!fSelectedImage) + [self setImage: nil]; + image = fSelectedImage; + } + else + { + if (!fRegularImage) + [self setImage: nil]; + image = fRegularImage; + } + + [image drawInRect: cellFrame fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; + //[super drawWithFrame: cellFrame inView: controlView]; +} + +@end diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h index 885e8f598..0d24b9096 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -25,6 +25,7 @@ #import #import "Torrent.h" #import "FileOutlineView.h" +#import "ImageBackgroundView.h" #import "PiecesView.h" #import @@ -33,9 +34,13 @@ NSArray * fTorrents, * fPeers, * fFiles; NSImage * fAppIcon, * fLockImage; + #warning need? BOOL fCanResizeVertical; - IBOutlet NSTabView * fTabView; + IBOutlet NSView * fInfoView, * fActivityView, * fPeersView, * fFilesView, * fOptionsView; + NSView * fCurrentView; + IBOutlet NSMatrix * fTabMatrix; + IBOutlet ImageBackgroundView * fTabBackBar; IBOutlet NSImageView * fImageView; IBOutlet NSTextField * fNameField, * fSizeField, * fTrackerField, @@ -71,6 +76,8 @@ - (Torrent *) selectedTorrent; - (void) updateInfoStats; +- (void) setTab: (id) sender; + - (void) setNextTab; - (void) setPreviousTab; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 7a82039c6..a7ab091ef 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -33,11 +33,7 @@ #define TAB_FILES_IDENT @"Files" #define TAB_OPTIONS_IDENT @"Options" -//15 spacing at the bottom of each tab -#define TAB_INFO_HEIGHT 268.0 -#define TAB_ACTIVITY_HEIGHT 290.0 -#define TAB_OPTIONS_HEIGHT 158.0 -#define TAB_RESIZABLE_MIN_HEIGHT 279.0 +#define TAB_MIN_HEIGHT 250 #define PIECES_CONTROL_PROGRESS 0 #define PIECES_CONTROL_AVAILABLE 1 @@ -48,13 +44,22 @@ #define INVALID -99 +typedef enum +{ + TAB_INFO_TAG = 0, + TAB_ACTIVITY_TAG, + TAB_PEERS_TAG, + TAB_FILES_TAG, + TAB_OPTIONS_TAG, +} tabTag; + @interface InfoWindowController (Private) - (void) updateInfoGeneral; - (void) updateInfoActivity; - (void) updateInfoPeers; - (void) updateInfoFiles; -- (void) updateInfoSettings; +- (void) updateInfoOptions; - (void) setWindowForTab: (NSString *) identifier animate: (BOOL) animate; - (NSArray *) peerSortDescriptors; @@ -71,22 +76,49 @@ //window location and size NSPanel * window = (NSPanel *)[self window]; - [window setFrameAutosaveName: @"InspectorWindowFrame"]; - [window setFrameUsingName: @"InspectorWindowFrame"]; + /*[window setFrameAutosaveName: @"InspectorWindowFrame"]; + [window setFrameUsingName: @"InspectorWindowFrame"];*/ [window setBecomesKeyOnlyIfNeeded: YES]; [window setAcceptsMouseMovedEvents: YES]; - //select tab + //set selected tab + fCanResizeVertical = NO; NSString * identifier = [[NSUserDefaults standardUserDefaults] stringForKey: @"InspectorSelected"]; + int tag; + if ([identifier isEqualToString: TAB_INFO_IDENT]) + tag = TAB_INFO_TAG; + else if ([identifier isEqualToString: TAB_ACTIVITY_IDENT]) + tag = TAB_ACTIVITY_TAG; + else if ([identifier isEqualToString: TAB_PEERS_IDENT]) + tag = TAB_PEERS_TAG; + else if ([identifier isEqualToString: TAB_FILES_IDENT]) + tag = TAB_FILES_TAG; + else if ([identifier isEqualToString: TAB_OPTIONS_IDENT]) + tag = TAB_OPTIONS_TAG; + else //safety + { + [[NSUserDefaults standardUserDefaults] setObject: TAB_INFO_IDENT forKey: @"InspectorSelected"]; + tag = TAB_INFO_TAG; + } + [fTabMatrix selectCellWithTag: tag]; + [self setTab: nil]; - if (!identifier || [fTabView indexOfTabViewItemWithIdentifier: identifier] == NSNotFound) - identifier = TAB_INFO_IDENT; + //set tab images and tooltips + [fTabBackBar setBackgroundImage: [NSImage imageNamed: @"InfoTabBorder.tif"]]; + [[fTabMatrix cellWithTag: TAB_INFO_TAG] setImage: [NSImage imageNamed: @"InfoGeneral.png"]]; + [[fTabMatrix cellWithTag: TAB_OPTIONS_TAG] setImage: [NSImage imageNamed: @"InfoOptions.png"]]; - fCanResizeVertical = [identifier isEqualToString: TAB_PEERS_IDENT] || [identifier isEqualToString: TAB_FILES_IDENT]; - - [fTabView selectTabViewItemWithIdentifier: identifier]; - [self setWindowForTab: identifier animate: NO]; + [fTabMatrix setToolTip: NSLocalizedString(@"General Info", "Inspector -> tab tooltip") + forCell: [fTabMatrix cellWithTag: TAB_INFO_TAG]]; + [fTabMatrix setToolTip: NSLocalizedString(@"Activity", "Inspector -> tab tooltip") + forCell: [fTabMatrix cellWithTag: TAB_ACTIVITY_TAG]]; + [fTabMatrix setToolTip: NSLocalizedString(@"Peers", "Inspector -> tab tooltip") + forCell: [fTabMatrix cellWithTag: TAB_PEERS_TAG]]; + [fTabMatrix setToolTip: NSLocalizedString(@"Files", "Inspector -> tab tooltip") + forCell: [fTabMatrix cellWithTag: TAB_FILES_TAG]]; + [fTabMatrix setToolTip: NSLocalizedString(@"Options", "Inspector -> tab tooltip") + forCell: [fTabMatrix cellWithTag: TAB_OPTIONS_TAG]]; //initially sort peer table by IP if ([[fPeerTable sortDescriptors] count] == 0) @@ -112,8 +144,7 @@ - (void) dealloc { if (fCanResizeVertical) - [[NSUserDefaults standardUserDefaults] setFloat: [[[fTabView selectedTabViewItem] view] frame].size.height - forKey: @"InspectorHeight"]; + [[NSUserDefaults standardUserDefaults] setFloat: [fCurrentView frame].size.height forKey: @"InspectorContentHeight"]; [[NSNotificationCenter defaultCenter] removeObserver: self]; @@ -339,18 +370,24 @@ - (void) updateInfoStats { - NSString * ident = [[fTabView selectedTabViewItem] identifier]; - if ([ident isEqualToString: TAB_ACTIVITY_IDENT]) - [self updateInfoActivity]; - else if ([ident isEqualToString: TAB_PEERS_IDENT]) - [self updateInfoPeers]; - else if ([ident isEqualToString: TAB_INFO_IDENT]) - [self updateInfoGeneral]; - else if ([ident isEqualToString: TAB_FILES_IDENT]) - [self updateInfoFiles]; - else if ([ident isEqualToString: TAB_OPTIONS_IDENT]) - [self updateInfoSettings]; - else; + switch ([fTabMatrix selectedTag]) + { + case TAB_INFO_TAG: + [self updateInfoGeneral]; + break; + case TAB_ACTIVITY_TAG: + [self updateInfoActivity]; + break; + case TAB_PEERS_TAG: + [self updateInfoPeers]; + break; + case TAB_FILES_TAG: + [self updateInfoFiles]; + break; + case TAB_OPTIONS_TAG: + [self updateInfoOptions]; + break; + } } - (void) updateInfoGeneral @@ -492,7 +529,7 @@ } } -- (void) updateInfoSettings +- (void) updateInfoOptions { if ([fTorrents count] == 0) return; @@ -624,7 +661,7 @@ if (action == @selector(revealFile:)) { - if (![[[fTabView selectedTabViewItem] identifier] isEqualToString: TAB_FILES_IDENT]) + if ([fTabMatrix selectedTag] != TAB_FILES_TAG) return NO; NSString * downloadFolder = [[fTorrents objectAtIndex: 0] downloadFolder]; @@ -721,7 +758,7 @@ [[NSUserDefaults standardUserDefaults] setObject: identifier forKey: @"InspectorSelected"]; } -- (void) setWindowForTab: (NSString *) identifier animate: (BOOL) animate +/*- (void) setWindowForTab: (NSString *) identifier animate: (BOOL) animate { [self updateInfoStats]; @@ -772,22 +809,124 @@ [window setMaxSize: NSMakeSize(FLT_MAX, !canResizeVertical ? windowFrame.size.height : FLT_MAX)]; fCanResizeVertical = canResizeVertical; +}*/ + +- (void) setTab: (id) sender +{ + [self updateInfoStats]; + + BOOL oldCanResizeVertical = fCanResizeVertical; + + NSView * view; + NSString * identifier; + switch ([fTabMatrix selectedTag]) + { + case TAB_INFO_TAG: + view = fInfoView; + identifier = TAB_INFO_IDENT; + fCanResizeVertical = NO; + break; + case TAB_ACTIVITY_TAG: + view = fActivityView; + identifier = TAB_ACTIVITY_IDENT; + fCanResizeVertical = NO; + + [fPiecesView updateView: YES]; + break; + case TAB_PEERS_TAG: + view = fPeersView; + identifier = TAB_PEERS_IDENT; + fCanResizeVertical = YES; + break; + case TAB_FILES_TAG: + view = fFilesView; + identifier = TAB_FILES_IDENT; + fCanResizeVertical = YES; + break; + case TAB_OPTIONS_TAG: + view = fOptionsView; + identifier = TAB_OPTIONS_IDENT; + fCanResizeVertical = NO; + break; + default: + return; + } + + [[NSUserDefaults standardUserDefaults] setObject: identifier forKey: @"InspectorSelected"]; + + NSWindow * window = [self window]; + + float oldHeight = 0; + if (fCurrentView) + { + if (fCurrentView == view) + return; + + [fCurrentView setHidden: YES]; + [fCurrentView removeFromSuperview]; + + oldHeight = [fCurrentView frame].size.height; + } + + NSRect windowRect = [window frame], viewRect = [view frame]; + + //save old size + if (oldCanResizeVertical) + [[NSUserDefaults standardUserDefaults] setFloat: [fCurrentView frame].size.height forKey: @"InspectorContentHeight"]; + + if (fCanResizeVertical) + { + float height = [[NSUserDefaults standardUserDefaults] floatForKey: @"InspectorContentHeight"]; + if (height != 0) + viewRect.size.height = MAX(height, TAB_MIN_HEIGHT); + } + + float difference = (viewRect.size.height - oldHeight) * [window userSpaceScaleFactor]; + windowRect.origin.y -= difference; + windowRect.size.height += difference; + + if (fCanResizeVertical) + { + if (!oldCanResizeVertical) + { + [window setMinSize: NSMakeSize([window minSize].width, windowRect.size.height - viewRect.size.height + TAB_MIN_HEIGHT)]; + [window setMaxSize: NSMakeSize(FLT_MAX, FLT_MAX)]; + } + } + else + { + [window setMinSize: NSMakeSize([window minSize].width, windowRect.size.height)]; + [window setMaxSize: NSMakeSize(FLT_MAX, windowRect.size.height)]; + } + + viewRect.size.width = windowRect.size.width; + [view setFrame: viewRect]; + + [window setFrame: windowRect display: YES animate: fCurrentView != nil]; + [[window contentView] addSubview: view]; + [view setHidden: NO]; + + fCurrentView = view; } - (void) setNextTab { - if ([fTabView selectedTabViewItem] == [fTabView tabViewItemAtIndex: [fTabView numberOfTabViewItems] - 1]) - [fTabView selectFirstTabViewItem: nil]; - else - [fTabView selectNextTabViewItem: nil]; + int tag = [fTabMatrix selectedTag]+1; + if (tag >= [fTabMatrix numberOfColumns]) + tag = 0; + + [fTabMatrix selectCellWithTag: tag]; + [self setTab: nil]; } - (void) setPreviousTab { - if ([fTabView selectedTabViewItem] == [fTabView tabViewItemAtIndex: 0]) - [fTabView selectLastTabViewItem: nil]; - else - [fTabView selectPreviousTabViewItem: nil]; + int tag = [fTabMatrix selectedTag]-1; + if (tag < 0) + tag = [fTabMatrix numberOfColumns]-1; + + [fTabMatrix selectCellWithTag: tag]; + [self setTab: nil]; } - (int) numberOfRowsInTableView: (NSTableView *) tableView @@ -1027,11 +1166,11 @@ return [outlineView rowHeight]; } -- (void) mouseMoved: (NSEvent *) event +/*- (void) mouseMoved: (NSEvent *) event { [fFileOutline setHoverRowForEvent: [[[fTabView selectedTabViewItem] identifier] isEqualToString: TAB_FILES_IDENT] ? event : nil]; -} +}*/ - (void) setPiecesView: (id) sender {