mirror of
https://github.com/transmission/transmission
synced 2025-02-22 06:00:41 +00:00
when in minimal view the transfer icon will show the action menu, other cleanup
This commit is contained in:
parent
d2cbbe01fa
commit
4c7d5256fa
2 changed files with 34 additions and 14 deletions
|
@ -194,7 +194,6 @@
|
||||||
NSSize iconSize = [icon size];
|
NSSize iconSize = [icon size];
|
||||||
|
|
||||||
pen.x += PADDING;
|
pen.x += PADDING;
|
||||||
#warning use constant
|
|
||||||
pen.y += (cellFrame.size.height - (iconSize.height + ACTION_BUTTON_HEIGHT)) * 0.5;
|
pen.y += (cellFrame.size.height - (iconSize.height + ACTION_BUTTON_HEIGHT)) * 0.5;
|
||||||
|
|
||||||
[icon drawAtPoint: pen fromRect: NSMakeRect(0, 0, iconSize.width, iconSize.height)
|
[icon drawAtPoint: pen fromRect: NSMakeRect(0, 0, iconSize.width, iconSize.height)
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
@interface TorrentTableView (Private)
|
@interface TorrentTableView (Private)
|
||||||
|
|
||||||
|
- (NSRect) iconRectForRow: (int) row;
|
||||||
|
|
||||||
- (NSRect) pauseRectForRow: (int) row;
|
- (NSRect) pauseRectForRow: (int) row;
|
||||||
- (NSRect) revealRectForRow: (int) row;
|
- (NSRect) revealRectForRow: (int) row;
|
||||||
- (NSRect) actionRectForRow: (int) row;
|
- (NSRect) actionRectForRow: (int) row;
|
||||||
|
@ -355,6 +357,7 @@
|
||||||
torrent = [fTorrents objectAtIndex: i];
|
torrent = [fTorrents objectAtIndex: i];
|
||||||
rect = [self pauseRectForRow: i];
|
rect = [self pauseRectForRow: i];
|
||||||
|
|
||||||
|
//pause/resume icon
|
||||||
image = nil;
|
image = nil;
|
||||||
if ([torrent isActive])
|
if ([torrent isActive])
|
||||||
{
|
{
|
||||||
|
@ -375,22 +378,43 @@
|
||||||
if (image)
|
if (image)
|
||||||
[image compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) operation: NSCompositeSourceOver];
|
[image compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) operation: NSCompositeSourceOver];
|
||||||
|
|
||||||
|
//reveal icon
|
||||||
rect = [self revealRectForRow: i];
|
rect = [self revealRectForRow: i];
|
||||||
image = NSPointInRect(fClickPoint, rect) ? fRevealOnIcon : fRevealOffIcon;
|
image = NSPointInRect(fClickPoint, rect) ? fRevealOnIcon : fRevealOffIcon;
|
||||||
[image compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) operation: NSCompositeSourceOver];
|
[image compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) operation: NSCompositeSourceOver];
|
||||||
|
|
||||||
|
//action icon
|
||||||
#warning make change
|
#warning make change
|
||||||
|
if (![fDefaults boolForKey: @"SmallView"])
|
||||||
|
{
|
||||||
rect = [self actionRectForRow: i];
|
rect = [self actionRectForRow: i];
|
||||||
[fActionOffIcon compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) operation: NSCompositeSourceOver];
|
[fActionOffIcon compositeToPoint: NSMakePoint(rect.origin.x, NSMaxY(rect)) operation: NSCompositeSourceOver];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation TorrentTableView (Private)
|
@implementation TorrentTableView (Private)
|
||||||
|
|
||||||
|
- (NSRect) iconRectForRow: (int) row
|
||||||
|
{
|
||||||
|
if (row < 0)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
|
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
||||||
|
NSSize iconSize = [fDefaults boolForKey: @"SmallView"] ? [[[fTorrents objectAtIndex: row] iconSmall] size]
|
||||||
|
: [[[fTorrents objectAtIndex: row] iconFlipped] size];
|
||||||
|
|
||||||
|
return NSMakeRect(cellRect.origin.x + PADDING, cellRect.origin.y + (cellRect.size.height - iconSize.height) * 0.5,
|
||||||
|
iconSize.width, iconSize.height);
|
||||||
|
}
|
||||||
|
|
||||||
- (NSRect) pauseRectForRow: (int) row
|
- (NSRect) pauseRectForRow: (int) row
|
||||||
{
|
{
|
||||||
|
if (row < 0)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
||||||
|
|
||||||
float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
|
float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
|
||||||
|
@ -401,6 +425,9 @@
|
||||||
|
|
||||||
- (NSRect) revealRectForRow: (int) row
|
- (NSRect) revealRectForRow: (int) row
|
||||||
{
|
{
|
||||||
|
if (row < 0)
|
||||||
|
return NSZeroRect;
|
||||||
|
|
||||||
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
||||||
|
|
||||||
float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
|
float buttonToTop = [fDefaults boolForKey: @"SmallView"] ? BUTTON_TO_TOP_SMALL : BUTTON_TO_TOP_REGULAR;
|
||||||
|
@ -411,9 +438,11 @@
|
||||||
|
|
||||||
- (NSRect) actionRectForRow: (int) row
|
- (NSRect) actionRectForRow: (int) row
|
||||||
{
|
{
|
||||||
#warning return small icon rect
|
|
||||||
if ([fDefaults boolForKey: @"SmallView"])
|
if ([fDefaults boolForKey: @"SmallView"])
|
||||||
|
return [self iconRectForRow: row];
|
||||||
|
else if (row < 0)
|
||||||
return NSZeroRect;
|
return NSZeroRect;
|
||||||
|
else;
|
||||||
|
|
||||||
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
||||||
|
|
||||||
|
@ -429,15 +458,7 @@
|
||||||
if (row < 0)
|
if (row < 0)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
#warning move to own method
|
return NSPointInRect(point, [self iconRectForRow: row]);
|
||||||
NSRect cellRect = [self frameOfCellAtColumn: [self columnWithIdentifier: @"Torrent"] row: row];
|
|
||||||
NSSize iconSize = [fDefaults boolForKey: @"SmallView"] ? [[[fTorrents objectAtIndex: row] iconSmall] size]
|
|
||||||
: [[[fTorrents objectAtIndex: row] iconFlipped] size];
|
|
||||||
|
|
||||||
NSRect iconRect = NSMakeRect(cellRect.origin.x + 3.0, cellRect.origin.y + (cellRect.size.height - iconSize.height) * 0.5,
|
|
||||||
iconSize.width, iconSize.height);
|
|
||||||
|
|
||||||
return NSPointInRect(point, iconRect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) pointInMinimalStatusRect: (NSPoint) point
|
- (BOOL) pointInMinimalStatusRect: (NSPoint) point
|
||||||
|
|
Loading…
Reference in a new issue