first commit of updated inspector...images are just placeholders currently

This commit is contained in:
Mitchell Livingston 2007-10-06 22:23:44 +00:00
parent c75f49bc26
commit a635077abd
13 changed files with 357 additions and 48 deletions

View File

@ -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 = "<group>"; };
A2265F3F0B5EF5F40093DDA5 /* FileNameCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FileNameCell.h; path = macosx/FileNameCell.h; sourceTree = "<group>"; };
A2265F400B5EF5F40093DDA5 /* FileNameCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = FileNameCell.m; path = macosx/FileNameCell.m; sourceTree = "<group>"; };
A22A067D0CB83507009694FE /* InfoTabBack.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = InfoTabBack.tif; path = macosx/Images/InfoTabBack.tif; sourceTree = "<group>"; };
A22A06970CB83880009694FE /* InfoTabBorder.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = InfoTabBorder.tif; path = macosx/Images/InfoTabBorder.tif; sourceTree = "<group>"; };
A22A7EBC0C627FC200E30364 /* Greek */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = Greek; path = macosx/Greek.lproj/InfoPlist.strings; sourceTree = "<group>"; };
A22A7EBD0C627FC200E30364 /* Greek */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Greek; path = macosx/Greek.lproj/InfoWindow.nib; sourceTree = "<group>"; };
A22A7EBE0C627FC200E30364 /* Greek */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Greek; path = macosx/Greek.lproj/Localizable.strings; sourceTree = "<group>"; };
@ -407,6 +415,7 @@
A22BCA310C5D5CDA00F5FB72 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = macosx/Italian.lproj/MainMenu.nib; sourceTree = "<group>"; };
A22BCA320C5D5CDA00F5FB72 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = macosx/Italian.lproj/MessageWindow.nib; sourceTree = "<group>"; };
A22BCA330C5D5CDA00F5FB72 /* Italian */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Italian; path = macosx/Italian.lproj/PrefsWindow.nib; sourceTree = "<group>"; };
A22D602C0CB67E4A00F67A8B /* InfoTabBackAqua.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = InfoTabBackAqua.tif; path = macosx/Images/InfoTabBackAqua.tif; sourceTree = "<group>"; };
A232D29D0A70903E00973B12 /* Filter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Filter.png; path = macosx/Images/Filter.png; sourceTree = "<group>"; };
A234D0CF0C79FB3600A82373 /* NSMenuAdditions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = NSMenuAdditions.h; path = macosx/NSMenuAdditions.h; sourceTree = "<group>"; };
A234D0D00C79FB3600A82373 /* NSMenuAdditions.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = NSMenuAdditions.m; path = macosx/NSMenuAdditions.m; sourceTree = "<group>"; };
@ -448,6 +457,8 @@
A2603A030C6338FB00F5FDFD /* Spanish */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = Spanish; path = macosx/Spanish.lproj/PrefsWindow.nib; sourceTree = "<group>"; };
A261A8250C6A0D68003BAFDA /* Error.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Error.png; path = macosx/Images/Error.png; sourceTree = "<group>"; };
A261F1DB0A69A1610002815A /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = macosx/Growl.framework; sourceTree = "<group>"; };
A26E75870CB6AA7500226674 /* InfoOptions.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoOptions.png; path = macosx/Images/InfoOptions.png; sourceTree = "<group>"; };
A26E75950CB6AB4800226674 /* InfoGeneral.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = InfoGeneral.png; path = macosx/Images/InfoGeneral.png; sourceTree = "<group>"; };
A2710E740A86796000CE4F7D /* PrefsWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = PrefsWindow.h; path = macosx/PrefsWindow.h; sourceTree = "<group>"; };
A2710E750A86796000CE4F7D /* PrefsWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = PrefsWindow.m; path = macosx/PrefsWindow.m; sourceTree = "<group>"; };
A27431D80A68538400FA780A /* FilterBarButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = FilterBarButton.h; path = macosx/FilterBarButton.h; sourceTree = "<group>"; };
@ -506,6 +517,8 @@
A2D6891B0CB4990E009BEC3A /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = macosx/English.lproj/Localizable.strings; sourceTree = "<group>"; };
A2DF37040C220D03006523C1 /* CreatorWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CreatorWindowController.h; path = macosx/CreatorWindowController.h; sourceTree = "<group>"; };
A2DF37050C220D03006523C1 /* CreatorWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CreatorWindowController.m; path = macosx/CreatorWindowController.m; sourceTree = "<group>"; };
A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = InfoTabButtonCell.h; path = macosx/InfoTabButtonCell.h; sourceTree = "<group>"; };
A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = InfoTabButtonCell.m; path = macosx/InfoTabButtonCell.m; sourceTree = "<group>"; };
A2E9AA750C249AF400085DCF /* Create.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Create.png; path = macosx/Images/Create.png; sourceTree = "<group>"; };
A2EF7DEB0C96297400FA9811 /* PurpleDot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PurpleDot.png; path = macosx/Images/PurpleDot.png; sourceTree = "<group>"; };
A2F011980C27418800576FC0 /* CreateLarge.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = CreateLarge.png; path = macosx/Images/CreateLarge.png; sourceTree = "<group>"; };
@ -719,6 +732,8 @@
A21282A60CA6C66800EAEE0F /* StatusBarView.m */,
A257C17F0CAD3003004E121C /* PeerTableView.h */,
A257C1800CAD3003004E121C /* PeerTableView.m */,
A2E23AC30CB5E1930002BB25 /* InfoTabButtonCell.h */,
A2E23AC40CB5E1930002BB25 /* InfoTabButtonCell.m */,
);
name = Sources;
sourceTree = "<group>";
@ -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 = "<group>";
@ -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;
};

View File

@ -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;

View File

@ -6,15 +6,23 @@
<string>58 88 356 240 0 0 1680 1028 </string>
<key>IBEditorPositions</key>
<dict>
<key>1030</key>
<string>297 229 360 384 0 0 1680 1028 </string>
<key>1057</key>
<string>505 337 360 389 0 0 1680 1028 </string>
<key>1066</key>
<string>665 601 349 202 0 0 1680 1028 </string>
<key>549</key>
<string>565 283 174 149 0 0 1152 842 </string>
<string>870 359 174 149 0 0 1680 1028 </string>
<key>965</key>
<string>229 571 370 310 0 0 1680 1028 </string>
<key>995</key>
<string>301 527 370 332 0 0 1680 1028 </string>
</dict>
<key>IBFramework Version</key>
<string>446.1</string>
<key>IBLockedObjects</key>
<array>
<integer>5</integer>
</array>
<array/>
<key>IBLockedTabItems</key>
<array>
<integer>332</integer>
@ -22,6 +30,7 @@
<key>IBOpenObjects</key>
<array>
<integer>5</integer>
<integer>1066</integer>
</array>
<key>IBSystem Version</key>
<string>8R4031</string>

Binary file not shown.

After

Width:  |  Height:  |  Size: 928 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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 <Cocoa/Cocoa.h>
@interface InfoTabButtonCell : NSButtonCell
{
NSImage * fRegularImage, * fSelectedImage;
}
@end

View File

@ -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

View File

@ -25,6 +25,7 @@
#import <Cocoa/Cocoa.h>
#import "Torrent.h"
#import "FileOutlineView.h"
#import "ImageBackgroundView.h"
#import "PiecesView.h"
#import <transmission.h>
@ -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;

View File

@ -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
{