Skip to content

Commit

Permalink
Removed using of _iterationCount variable in TUITableView and double …
Browse files Browse the repository at this point in the history
…cell selection in TUITableViewCell. Because I don't understatnd why this code was added. I'll return it if we have problems.
  • Loading branch information
Serhey Tkachenko committed Apr 1, 2013
1 parent dc1c81f commit 57a6f05
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/UIKit/TUITableView.h
Expand Up @@ -86,7 +86,7 @@ typedef NS_ENUM(NSInteger, TUITableViewInsertionMethod) {
NSMutableArray * _arrayOfSelectedIndexes;
BOOL _multipleSelectionKeyIsPressed;
BOOL _extendMultipleSelectionKeyIsPressed;
NSUInteger _iterationCount;
// NSUInteger _iterationCount;

NSIndexPath * _selectedIndexPath;
NSIndexPath * _indexPathShouldBeFirstResponder;
Expand Down
26 changes: 13 additions & 13 deletions lib/UIKit/TUITableView.m
Expand Up @@ -1116,7 +1116,7 @@ - (void)_makeRowAtIndexPathFirstResponder:(NSIndexPath *)indexPath
- (void)justSelectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(TUITableViewScrollPosition)scrollPosition
{
[self selectRowAtIndexPath:indexPath animated:animated scrollPosition:scrollPosition];
_iterationCount = 0;
// _iterationCount = 0;
}


Expand All @@ -1129,13 +1129,13 @@ - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated sc
*/

NSIndexPath *oldIndexPath = [self indexPathForSelectedRow];
if([indexPath isEqual:oldIndexPath] && _iterationCount != 0)
{
_iterationCount = 0;
}
else if (_iterationCount == 0)
{
// if([indexPath isEqual:oldIndexPath] && _iterationCount != 0)
// {
// _iterationCount = 0;
// }
// else if (_iterationCount == 0)
// {

/*!
* check for the current event only if the multiple selection
* is enabled to avoid uselesss computations.
Expand All @@ -1150,8 +1150,8 @@ - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated sc
// grab the tableview cell
TUITableViewCell *cell = [self cellForRowAtIndexPath:indexPath]; // may be nil

_iterationCount++;
// _iterationCount++;

// if it allows multiple selection
if (_allowsMultipleSelection)
{
Expand Down Expand Up @@ -1187,7 +1187,7 @@ - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated sc
if([self.delegate respondsToSelector:@selector(tableView:didSelectRowAtIndexPath:)]){
[self.delegate tableView:self didSelectRowAtIndexPath:indexPath];
}
}
// }

NSResponder *firstResponder = [self.nsWindow firstResponder];
if(firstResponder == self || firstResponder == [self cellForRowAtIndexPath:oldIndexPath]) {
Expand Down Expand Up @@ -1292,7 +1292,7 @@ - (BOOL)performKeyAction:(NSEvent *)event
}
}

_iterationCount = 0;
// _iterationCount = 0;
return [NSIndexPath indexPathForRow:row inSection:section];
});

Expand All @@ -1319,7 +1319,7 @@ - (BOOL)performKeyAction:(NSEvent *)event
}
}

_iterationCount = 0;
// _iterationCount = 0;
return [NSIndexPath indexPathForRow:row inSection:section];
});

Expand Down
2 changes: 1 addition & 1 deletion lib/UIKit/TUITableViewCell.m
Expand Up @@ -244,7 +244,7 @@ - (void)mouseUp:(NSEvent *)event {
[self.tableView __mouseUpInCell:self offset:_mouseOffset event:event];

[self.nsWindow makeFirstResponder:self.tableView];
[self.tableView selectRowAtIndexPath:self.indexPath animated:YES scrollPosition:TUITableViewScrollPositionNone];
// [self.tableView selectRowAtIndexPath:self.indexPath animated:YES scrollPosition:TUITableViewScrollPositionNone];
[super mouseUp:event];

// We were selected, so we are no longer highlighted.
Expand Down

0 comments on commit 57a6f05

Please sign in to comment.