1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-10 06:02:57 +00:00

holding down the mouse on the progress field and the minimal status field will cause them to become gray, indicating the toggle

This commit is contained in:
Mitchell Livingston 2008-01-22 05:19:18 +00:00
parent d4128740d1
commit 055d067d7e
4 changed files with 67 additions and 26 deletions

View file

@ -3825,14 +3825,14 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
- (BOOL) ipcAddTorrentFileAutostart: (NSString *) path directory: (NSString *) directory autostart: (BOOL) autostart
{
NSArray * torrents;
NSArray * torrents = nil;
if (autostart)
torrents = [fTorrents copy];
BOOL success = [self ipcAddTorrentFile: path directory: directory];
if (success && autostart)
{
NSEnumerator * enumerator = [torrents objectEnumerator];
NSEnumerator * enumerator = [torrents reverseObjectEnumerator];
Torrent * torrent;
while ((torrent = [enumerator nextObject]))
if (![torrents containsObject: torrent])

View file

@ -32,14 +32,16 @@
NSMutableDictionary * fTitleAttributes, * fStatusAttributes;
BOOL fTracking, fMouseDownControlButton, fMouseDownRevealButton, fMouseDownActionButton,
fHoverControl, fHoverReveal, fHoverAction;
fHoverControl, fHoverReveal, fHoverAction,
fMouseDownProgressField, fMouseDownMinimalStatusField;
NSColor * fBarOverlayColor;
CTGradient * fWhiteGradient, * fGrayGradient, * fLightGrayGradient, * fBlueGradient, * fDarkBlueGradient,
* fGreenGradient, * fLightGreenGradient, * fDarkGreenGradient, * fYellowGradient, * fRedGradient,
* fTransparentGradient;
NSColor * fGrayColor, * fBlueColor, * fBlue1Color, * fBlue2Color, * fBlue3Color, * fBlue4Color, * fOrangeColor;
NSColor * fGrayColor, * fBlueColor, * fBlue1Color, * fBlue2Color, * fBlue3Color, * fBlue4Color, * fOrangeColor,
* fFieldBackColor;
NSBitmapImageRep * fBitmap;
}

View file

@ -107,6 +107,8 @@
fOrangeColor = [[NSColor orangeColor] retain];
fBarOverlayColor = [[NSColor colorWithDeviceWhite: 0.0 alpha: 0.2] retain];
fFieldBackColor = [[NSColor colorWithDeviceWhite: 0.5 alpha: 0.5] retain];
}
return self;
}
@ -255,7 +257,9 @@
NSPoint point = [controlView convertPoint: [event locationInWindow] fromView: nil];
if (NSMouseInRect(point, [self controlButtonRectForBounds: cellFrame], [controlView isFlipped])
|| NSMouseInRect(point, [self revealButtonRectForBounds: cellFrame], [controlView isFlipped]))
|| NSMouseInRect(point, [self revealButtonRectForBounds: cellFrame], [controlView isFlipped])
|| NSMouseInRect(point, [self progressRectForBounds: cellFrame], [controlView isFlipped])
|| NSMouseInRect(point, [self minimalStatusRectForBounds: cellFrame], [controlView isFlipped]))
return NSCellHitContentArea | NSCellHitTrackableArea;
return NSCellHitContentArea;
@ -274,14 +278,18 @@
NSPoint point = [controlView convertPoint: [event locationInWindow] fromView: nil];
fMouseDownControlButton = NO;
NSRect controlRect= [self controlButtonRectForBounds: cellFrame];
BOOL checkControl = NSMouseInRect(point, controlRect, [controlView isFlipped]);
fMouseDownRevealButton = NO;
NSRect revealRect = [self revealButtonRectForBounds: cellFrame];
BOOL checkReveal = NSMouseInRect(point, revealRect, [controlView isFlipped]);
NSRect progressRect = [self progressRectForBounds: cellFrame];
BOOL checkProgress = NSMouseInRect(point, progressRect, [controlView isFlipped]);
NSRect minimalStatusRect = [self minimalStatusRectForBounds: cellFrame];
BOOL checkMinStatus = NSMouseInRect(point, minimalStatusRect, [controlView isFlipped]);
[(TorrentTableView *)controlView removeButtonTrackingAreas];
while ([event type] != NSLeftMouseUp)
@ -306,6 +314,24 @@
[controlView setNeedsDisplayInRect: cellFrame];
}
}
else if (checkProgress)
{
BOOL inProgressField = NSMouseInRect(point, progressRect, [controlView isFlipped]);
if (fMouseDownProgressField != inProgressField)
{
fMouseDownProgressField = inProgressField;
[controlView setNeedsDisplayInRect: cellFrame];
}
}
else if (checkMinStatus)
{
BOOL inMinStatusField = NSMouseInRect(point, minimalStatusRect, [controlView isFlipped]);
if (fMouseDownMinimalStatusField != inMinStatusField)
{
fMouseDownMinimalStatusField = inMinStatusField;
[controlView setNeedsDisplayInRect: cellFrame];
}
}
else;
//send events to where necessary
@ -320,7 +346,6 @@
if (fMouseDownControlButton)
{
fMouseDownControlButton = NO;
[controlView setNeedsDisplayInRect: cellFrame];
[(TorrentTableView *)controlView toggleControlForTorrent: [self representedObject]];
}
@ -331,6 +356,20 @@
[[self representedObject] revealData];
}
else if (fMouseDownProgressField)
{
fMouseDownProgressField = NO;
[fDefaults setBool: ![fDefaults boolForKey: @"DisplayStatusProgressSelected"] forKey: @"DisplayStatusProgressSelected"];
[(TorrentTableView *)controlView reloadData];
}
else if (fMouseDownMinimalStatusField)
{
fMouseDownMinimalStatusField = NO;
[fDefaults setBool: ![fDefaults boolForKey: @"DisplaySmallStatusRegular"] forKey: @"DisplaySmallStatusRegular"];
[(TorrentTableView *)controlView reloadData];
}
else;
if ([NSApp isOnLeopardOrBetter])
@ -482,6 +521,12 @@
NSAttributedString * minimalString = [self attributedStatusString: [self minimalStatusString] withColor: statusColor];
minimalStatusRect = [self rectForMinimalStatusWithString: minimalString inBounds: cellFrame];
if (fMouseDownMinimalStatusField)
{
[fFieldBackColor set];
[[NSBezierPath bezierPathWithRoundedRect: NSInsetRect(minimalStatusRect, -4.0, 0.0) radius: 5.0] fill];
}
[minimalString drawInRect: minimalStatusRect];
}
@ -495,6 +540,13 @@
{
NSAttributedString * progressString = [self attributedStatusString: [torrent progressString] withColor: statusColor];
NSRect progressRect = [self rectForProgressWithString: progressString inBounds: cellFrame];
if (fMouseDownProgressField)
{
[fFieldBackColor set];
[[NSBezierPath bezierPathWithRoundedRect: NSInsetRect(progressRect, -4.0, 0.0) radius: 5.0] fill];
}
[progressString drawInRect: progressRect];
}

View file

@ -216,8 +216,8 @@
NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
//if pushing a button, don't change the selected rows
if ([NSApp isOnLeopardOrBetter] && ([self pointInControlRect: point] || [self pointInRevealRect: point]
|| [self pointInActionRect: point]))
if ([self pointInControlRect: point] || [self pointInRevealRect: point] || [self pointInActionRect: point]
|| [self pointInProgressRect: point] || [self pointInMinimalStatusRect: point])
fSelectedTorrents = [[fTorrents objectsAtIndexes: [self selectedRowIndexes]] retain];
[super mouseDown: event];
@ -238,21 +238,8 @@
fActionPushedRow = -1;
[self setNeedsDisplayInRect: [self rectOfRow: row]];
}
else if ([self pointInMinimalStatusRect: point])
{
[fDefaults setBool: ![fDefaults boolForKey: @"DisplaySmallStatusRegular"] forKey: @"DisplaySmallStatusRegular"];
[self reloadData];
}
else if ([event clickCount] == 2) //double click
{
if ([self pointInProgressRect: point])
{
[fDefaults setBool: ![fDefaults boolForKey: @"DisplayStatusProgressSelected"] forKey: @"DisplayStatusProgressSelected"];
[self reloadData];
}
else
[fController showInfo: nil];
}
[fController showInfo: nil];
else;
}
@ -478,13 +465,12 @@
item = [menu itemWithTag: ACTION_MENU_GLOBAL_TAG];
[item setState: mode == NSMixedState ? NSOnState : NSOffState];
}
else if ([menu supermenu]) //assume the menu is part of the file list
else //assume the menu is part of the file list
{
NSMenu * supermenu = [menu supermenu];
[self updateFileMenu: menu forFiles: [[[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]]
representedObject] objectForKey: @"Children"]];
}
else;
}
- (void) setQuickLimitMode: (id) sender
@ -627,6 +613,7 @@
return NSPointInRect(point, [cell progressRectForBounds: [self frameOfCellAtColumn: 0 row: row]]);
}
#warning remove
- (BOOL) pointInMinimalStatusRect: (NSPoint) point
{
int row = [self rowAtPoint: point];