mirror of
https://github.com/transmission/transmission
synced 2025-03-03 02:05:19 +00:00
when dragging torrents, dim the main window
This commit is contained in:
parent
133faaec31
commit
8e7559a1c6
7 changed files with 175 additions and 54 deletions
|
@ -109,6 +109,7 @@
|
|||
A2305AAC0A3DCCEF00AB2D77 /* ProgressBarEndGreen.png in Resources */ = {isa = PBXBuildFile; fileRef = A2305AA70A3DCCEF00AB2D77 /* ProgressBarEndGreen.png */; };
|
||||
A2305AAD0A3DCCEF00AB2D77 /* ProgressBarEndGray.png in Resources */ = {isa = PBXBuildFile; fileRef = A2305AA80A3DCCEF00AB2D77 /* ProgressBarEndGray.png */; };
|
||||
A232D29E0A70903E00973B12 /* Filter.png in Resources */ = {isa = PBXBuildFile; fileRef = A232D29D0A70903E00973B12 /* Filter.png */; };
|
||||
A2385DD40BFE06C800B24EF6 /* DragOverlayWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */; };
|
||||
A23BBEB70A9BBE77003F7274 /* BarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A27431D90A68538400FA780A /* BarButton.m */; };
|
||||
A24103070AF80E390001C8D0 /* FilterButtonPressedLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = A253F7140A699178008EE24F /* FilterButtonPressedLeft.png */; };
|
||||
A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; };
|
||||
|
@ -328,6 +329,8 @@
|
|||
A2305AA70A3DCCEF00AB2D77 /* ProgressBarEndGreen.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ProgressBarEndGreen.png; path = macosx/Images/ProgressBarEndGreen.png; sourceTree = "<group>"; };
|
||||
A2305AA80A3DCCEF00AB2D77 /* ProgressBarEndGray.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ProgressBarEndGray.png; path = macosx/Images/ProgressBarEndGray.png; sourceTree = "<group>"; };
|
||||
A232D29D0A70903E00973B12 /* Filter.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Filter.png; path = macosx/Images/Filter.png; sourceTree = "<group>"; };
|
||||
A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = DragOverlayWindow.m; path = macosx/DragOverlayWindow.m; sourceTree = "<group>"; };
|
||||
A2385DD30BFE06C800B24EF6 /* DragOverlayWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = DragOverlayWindow.h; path = macosx/DragOverlayWindow.h; sourceTree = "<group>"; };
|
||||
A2440F9C0BD331A2006A687A /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = macosx/German.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
A2440F9D0BD331A2006A687A /* German */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = German; path = macosx/German.lproj/InfoWindow.nib; sourceTree = "<group>"; };
|
||||
A2440F9E0BD331A2006A687A /* German */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = German; path = macosx/German.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
|
@ -452,6 +455,8 @@
|
|||
080E96DDFE201D6D7F000001 /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A2385DD20BFE06C800B24EF6 /* DragOverlayWindow.m */,
|
||||
A2385DD30BFE06C800B24EF6 /* DragOverlayWindow.h */,
|
||||
A2265F3F0B5EF5F40093DDA5 /* FileBrowserCell.h */,
|
||||
A2265F400B5EF5F40093DDA5 /* FileBrowserCell.m */,
|
||||
A2BF078F0B066E0800757C92 /* SpeedLimitToTurtleIconTransformer.m */,
|
||||
|
@ -993,6 +998,7 @@
|
|||
A24999230B49F1B5001EADA3 /* ActionPopUpButton.m in Sources */,
|
||||
A2265F420B5EF5F40093DDA5 /* FileBrowserCell.m in Sources */,
|
||||
A2A1CB7A0BF29D5500AE959F /* PeerProgressIndicatorCell.m in Sources */,
|
||||
A2385DD40BFE06C800B24EF6 /* DragOverlayWindow.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#import "PrefsController.h"
|
||||
#import "InfoWindowController.h"
|
||||
#import "MessageWindowController.h"
|
||||
#import "DragOverlayWindow.h"
|
||||
#import "Badger.h"
|
||||
#import "ImageBackgroundView.h"
|
||||
#import "BarButton.h"
|
||||
|
@ -51,6 +52,7 @@
|
|||
MessageWindowController * fMessageController;
|
||||
|
||||
IBOutlet NSWindow * fWindow;
|
||||
DragOverlayWindow * fOverlayWindow;
|
||||
IBOutlet NSScrollView * fScrollView;
|
||||
IBOutlet TorrentTableView * fTableView;
|
||||
NSToolbar * fToolbar;
|
||||
|
|
|
@ -187,6 +187,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[fTorrents release];
|
||||
[fDisplayedTorrents release];
|
||||
[fBadger release];
|
||||
[fOverlayWindow release];
|
||||
|
||||
[fAutoImportedNames release];
|
||||
[fPendingTorrentDownloads release];
|
||||
|
@ -201,6 +202,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[fFilterBar setBackgroundImage: [NSImage imageNamed: @"FilterBarBackground.png"]];
|
||||
|
||||
[fWindow setAcceptsMouseMovedEvents: YES]; //ensure filter buttons display correctly
|
||||
fOverlayWindow = [[DragOverlayWindow alloc] init];
|
||||
|
||||
fToolbar = [[NSToolbar alloc] initWithIdentifier: @"Transmission Toolbar"];
|
||||
[fToolbar setDelegate: self];
|
||||
|
@ -267,8 +269,9 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[fTableView setTorrents: fDisplayedTorrents];
|
||||
[[fTableView tableColumnWithIdentifier: @"Torrent"] setDataCell: [[TorrentCell alloc] init]];
|
||||
|
||||
[fTableView registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType,
|
||||
NSURLPboardType, TORRENT_TABLE_VIEW_DATA_TYPE, nil]];
|
||||
[fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
|
||||
[fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType,
|
||||
NSURLPboardType, nil]];
|
||||
|
||||
//register for sleep notifications
|
||||
IONotificationPortRef notify;
|
||||
|
@ -521,6 +524,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
tr_natTraversalEnable(fLib, 0);
|
||||
|
||||
//remember window states and close all windows
|
||||
#warning needed here?
|
||||
[fDefaults setBool: [[fInfoController window] isVisible] forKey: @"InfoVisible"];
|
||||
[[NSApp windows] makeObjectsPerformSelector: @selector(close)];
|
||||
[self showStatusBar: NO animate: NO];
|
||||
|
@ -2005,30 +2009,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
proposedRow: (int) row proposedDropOperation: (NSTableViewDropOperation) operation
|
||||
{
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: NSFilenamesPboardType])
|
||||
{
|
||||
//check if any files can be added
|
||||
NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
|
||||
NSString * file;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
tr_torrent_t * tempTor;
|
||||
int error;
|
||||
if ((tempTor = tr_torrentInit(fLib, [file UTF8String], NULL, 0, &error)))
|
||||
{
|
||||
tr_torrentClose(fLib, tempTor);
|
||||
|
||||
[fTableView setDropRow: -1 dropOperation: NSTableViewDropOn];
|
||||
return NSDragOperationGeneric;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([[pasteboard types] containsObject: NSURLPboardType])
|
||||
{
|
||||
[fTableView setDropRow: -1 dropOperation: NSTableViewDropOn];
|
||||
return NSDragOperationGeneric;
|
||||
}
|
||||
else if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
{
|
||||
[fTableView setDropRow: row dropOperation: NSTableViewDropAbove];
|
||||
return NSDragOperationGeneric;
|
||||
|
@ -2042,33 +2023,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
row: (int) newRow dropOperation: (NSTableViewDropOperation) operation
|
||||
{
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: NSFilenamesPboardType])
|
||||
{
|
||||
//create an array of files that can be opened
|
||||
NSMutableArray * filesToOpen = [[NSMutableArray alloc] init];
|
||||
NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
|
||||
NSString * file;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
tr_torrent_t * tempTor;
|
||||
int error;
|
||||
if ((tempTor = tr_torrentInit(fLib, [file UTF8String], NULL, 0, &error)))
|
||||
{
|
||||
tr_torrentClose(fLib, tempTor);
|
||||
[filesToOpen addObject: file];
|
||||
}
|
||||
}
|
||||
|
||||
[self application: NSApp openFiles: filesToOpen];
|
||||
[filesToOpen release];
|
||||
}
|
||||
else if ([[pasteboard types] containsObject: NSURLPboardType])
|
||||
{
|
||||
NSURL * url;
|
||||
if ((url = [NSURL URLFromPasteboard: pasteboard]))
|
||||
[self openURL: url];
|
||||
}
|
||||
else if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
{
|
||||
//remember selected rows if needed
|
||||
NSArray * selectedTorrents = nil;
|
||||
|
@ -2130,6 +2085,87 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
[fInfoController updateInfoForTorrents: [fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]]];
|
||||
}
|
||||
|
||||
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) info
|
||||
{
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: NSFilenamesPboardType])
|
||||
{
|
||||
//check if any files can be added
|
||||
NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
|
||||
NSString * file;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
tr_torrent_t * tempTor;
|
||||
int error;
|
||||
if ((tempTor = tr_torrentInit(fLib, [file UTF8String], NULL, 0, &error)))
|
||||
{
|
||||
tr_torrentClose(fLib, tempTor);
|
||||
|
||||
[fOverlayWindow setFrame: [fWindow frame] display: YES];
|
||||
[fOverlayWindow orderWindow: NSWindowAbove relativeTo: [fWindow windowNumber]];
|
||||
|
||||
return NSDragOperationGeneric;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ([[pasteboard types] containsObject: NSURLPboardType])
|
||||
{
|
||||
[fOverlayWindow setFrame: [fWindow frame] display: YES];
|
||||
[fOverlayWindow orderWindow: NSWindowAbove relativeTo: [fWindow windowNumber]];
|
||||
|
||||
return NSDragOperationGeneric;
|
||||
}
|
||||
else;
|
||||
|
||||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
- (void) draggingExited: (id <NSDraggingInfo>) sender
|
||||
{
|
||||
[fOverlayWindow close];
|
||||
}
|
||||
|
||||
- (BOOL) performDragOperation: (id <NSDraggingInfo>) info
|
||||
{
|
||||
[fOverlayWindow close];
|
||||
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: NSFilenamesPboardType])
|
||||
{
|
||||
//create an array of files that can be opened
|
||||
NSMutableArray * filesToOpen = [[NSMutableArray alloc] init];
|
||||
NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
|
||||
NSString * file;
|
||||
while ((file = [enumerator nextObject]))
|
||||
{
|
||||
tr_torrent_t * tempTor;
|
||||
int error;
|
||||
if ((tempTor = tr_torrentInit(fLib, [file UTF8String], NULL, 0, &error)))
|
||||
{
|
||||
tr_torrentClose(fLib, tempTor);
|
||||
[filesToOpen addObject: file];
|
||||
}
|
||||
}
|
||||
|
||||
[self application: NSApp openFiles: filesToOpen];
|
||||
[filesToOpen release];
|
||||
|
||||
return YES;
|
||||
}
|
||||
else if ([[pasteboard types] containsObject: NSURLPboardType])
|
||||
{
|
||||
NSURL * url;
|
||||
if ((url = [NSURL URLFromPasteboard: pasteboard]))
|
||||
{
|
||||
[self openURL: url];
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
else;
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) toggleSmallView: (id) sender
|
||||
{
|
||||
BOOL makeSmall = [fDefaults boolForKey: @"SmallView"];
|
||||
|
|
31
macosx/DragOverlayWindow.h
Normal file
31
macosx/DragOverlayWindow.h
Normal 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 DragOverlayWindow : NSWindow
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
46
macosx/DragOverlayWindow.m
Normal file
46
macosx/DragOverlayWindow.m
Normal file
|
@ -0,0 +1,46 @@
|
|||
/******************************************************************************
|
||||
* $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 "DragOverlayWindow.h"
|
||||
|
||||
@implementation DragOverlayWindow
|
||||
|
||||
- (id) init
|
||||
{
|
||||
if (self = ([super initWithContentRect: NSMakeRect(0, 0, 0, 0) styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreBuffered defer: NO]))
|
||||
{
|
||||
[self setBackgroundColor: [NSColor blackColor]];
|
||||
[self setLevel: NSStatusWindowLevel];
|
||||
[self setAlphaValue: 0.5];
|
||||
[self setOpaque: NO];
|
||||
[self setHasShadow: NO];
|
||||
|
||||
[self setReleasedWhenClosed: NO];
|
||||
[self setIgnoresMouseEvents: YES];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -32,7 +32,7 @@
|
|||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>1041</integer>
|
||||
<integer>21</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8P135</string>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Reference in a new issue