diff --git a/macosx/English.lproj/InfoWindow.nib/info.nib b/macosx/English.lproj/InfoWindow.nib/info.nib index 8eb201fb5..deb3e720f 100644 --- a/macosx/English.lproj/InfoWindow.nib/info.nib +++ b/macosx/English.lproj/InfoWindow.nib/info.nib @@ -7,7 +7,7 @@ IBEditorPositions 549 - 565 283 144 118 0 0 1152 842 + 565 283 174 149 0 0 1152 842 IBFramework Version 446.1 @@ -21,7 +21,6 @@ IBOpenObjects - 549 5 IBSystem Version diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib index 24dd0b328..88b55fa13 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/InfoWindowController.h b/macosx/InfoWindowController.h index b1add683d..faa0de8ba 100644 --- a/macosx/InfoWindowController.h +++ b/macosx/InfoWindowController.h @@ -73,6 +73,7 @@ - (void) setPreviousTab; - (void) setPiecesView: (id) sender; +- (void) setPiecesViewForAvailable: (BOOL) available; - (void) revealTorrentFile: (id) sender; - (void) revealDataFile: (id) sender; diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m index 028beaddf..0e236c2da 100644 --- a/macosx/InfoWindowController.m +++ b/macosx/InfoWindowController.m @@ -100,10 +100,6 @@ [fTabView selectTabViewItemWithIdentifier: identifier]; [self setWindowForTab: identifier animate: NO]; - //set pieces control - [fPiecesControl setSelectedSegment: [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"] - ? PIECES_CONTROL_AVAILABLE : PIECES_CONTROL_PROGRESS]; - //initially sort peer table by IP if ([[fPeerTable sortDescriptors] count] == 0) [fPeerTable setSortDescriptors: [NSArray arrayWithObject: [[fPeerTable tableColumnWithIdentifier: @"IP"] @@ -223,6 +219,11 @@ [fPiecesControl setEnabled: NO]; [fPiecesView setTorrent: nil]; + [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_AVAILABLE]; + [fPiecesControl setSelected: NO forSegment: PIECES_CONTROL_PROGRESS]; + [fPiecesControl setEnabled: NO]; + [fPiecesView setTorrent: nil]; + if (fPeers) { [fPeers release]; @@ -285,7 +286,12 @@ [fTorrentLocationField setSelectable: YES]; [fDataLocationField setSelectable: YES]; + //set pieces view + BOOL piecesAvailableSegment = [[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]; + [fPiecesControl setSelected: piecesAvailableSegment forSegment: PIECES_CONTROL_AVAILABLE]; + [fPiecesControl setSelected: !piecesAvailableSegment forSegment: PIECES_CONTROL_PROGRESS]; [fPiecesControl setEnabled: YES]; + [fPiecesView setTorrent: torrent]; //set file table @@ -993,8 +999,15 @@ - (void) setPiecesView: (id) sender { - [[NSUserDefaults standardUserDefaults] setBool: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE - forKey: @"PiecesViewShowAvailability"]; + [self setPiecesViewForAvailable: [sender selectedSegment] == PIECES_CONTROL_AVAILABLE]; +} + +- (void) setPiecesViewForAvailable: (BOOL) available +{ + [fPiecesControl setSelected: available forSegment: PIECES_CONTROL_AVAILABLE]; + [fPiecesControl setSelected: !available forSegment: PIECES_CONTROL_PROGRESS]; + + [[NSUserDefaults standardUserDefaults] setBool: available forKey: @"PiecesViewShowAvailability"]; [fPiecesView updateView: YES]; } diff --git a/macosx/PiecesView.m b/macosx/PiecesView.m index 6c7a1b6b0..68e7075c4 100644 --- a/macosx/PiecesView.m +++ b/macosx/PiecesView.m @@ -23,6 +23,7 @@ *****************************************************************************/ #import "PiecesView.h" +#import "InfoWindowController.h" #define MAX_ACROSS 18 #define BETWEEN 1.0 @@ -375,4 +376,17 @@ free(piecesPercent); } +- (BOOL) acceptsFirstMouse: (NSEvent *) event +{ + return YES; +} + +- (void) mouseDown: (NSEvent *) event +{ + if (fTorrent) + [[[self window] windowController] setPiecesViewForAvailable: + ![[NSUserDefaults standardUserDefaults] boolForKey: @"PiecesViewShowAvailability"]]; + [super mouseDown: event]; +} + @end