From 6d799f0f8911f1c9ec3f7fa3be9429a23c7fa353 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Tue, 15 Jan 2008 16:19:16 +0000 Subject: [PATCH] if a button is pushed, don't hilight other buttons when hovered over --- macosx/TorrentCell.m | 4 ++++ macosx/TorrentTableView.h | 2 ++ macosx/TorrentTableView.m | 25 +++++++++++++++---------- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/macosx/TorrentCell.m b/macosx/TorrentCell.m index d6309a49f..b1bcb186c 100644 --- a/macosx/TorrentCell.m +++ b/macosx/TorrentCell.m @@ -297,6 +297,8 @@ NSRect revealRect = [self revealButtonRectForBounds: cellFrame]; BOOL checkReveal = NSMouseInRect(point, revealRect, [controlView isFlipped]); + [(TorrentTableView *)controlView removeButtonTrackingAreas]; + while ([event type] != NSLeftMouseUp) { point = [controlView convertPoint: [event locationInWindow] fromView: nil]; @@ -346,6 +348,8 @@ } else; + [controlView updateTrackingAreas]; + return YES; } diff --git a/macosx/TorrentTableView.h b/macosx/TorrentTableView.h index f93e886e3..0a2ae9575 100644 --- a/macosx/TorrentTableView.h +++ b/macosx/TorrentTableView.h @@ -48,6 +48,8 @@ - (void) setTorrents: (NSArray *) torrents; +- (void) removeButtonTrackingAreas; + - (void) toggleControlForTorrent: (Torrent *) torrent; - (void) displayTorrentMenuForEvent: (NSEvent *) event; diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 72c8a4fa8..8c2fa2e44 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -94,16 +94,7 @@ { [super updateTrackingAreas]; - fMouseControlRow = -1; - fMouseRevealRow = -1; - - NSEnumerator * enumerator = [[self trackingAreas] objectEnumerator]; - NSTrackingArea * area; - while ((area = [enumerator nextObject])) - { - if ([area owner] == self && [[area userInfo] objectForKey: @"Row"]) - [self removeTrackingArea: area]; - } + [self removeButtonTrackingAreas]; NSRange visibleRows = [self rowsInRect: [self visibleRect]]; if (visibleRows.length == 0) @@ -123,6 +114,20 @@ } } +- (void) removeButtonTrackingAreas +{ + fMouseControlRow = -1; + fMouseRevealRow = -1; + + NSEnumerator * enumerator = [[self trackingAreas] objectEnumerator]; + NSTrackingArea * area; + while ((area = [enumerator nextObject])) + { + if ([area owner] == self && [[area userInfo] objectForKey: @"Row"]) + [self removeTrackingArea: area]; + } +} + - (void) mouseEntered: (NSEvent *) event { NSDictionary * dict = (NSDictionary *)[event userData];