Use represented object

This commit is contained in:
Gregory John Casamento 2020-05-06 10:38:24 -04:00
parent 7764903d6d
commit 0e7f729f1f
4 changed files with 21 additions and 21 deletions

View file

@ -272,11 +272,7 @@ static NSNotificationCenter *nc = nil;
- (void) _doMenuAction: (id)sender
{
NSArray *cells = [self pathComponentCells];
NSUInteger c = [cells count];
NSUInteger i = [[sender menu] indexOfItem: sender];
NSUInteger ci = (c - i) + 1;
NSPathComponentCell *cc = [cells objectAtIndex: ci];
NSPathComponentCell *cc = (NSPathComponentCell *)[sender representedObject];
[_cell _setClickedPathComponentCell: cc];
if ([[self cell] action])
@ -351,6 +347,7 @@ static NSNotificationCenter *nc = nil;
[i setTitle: s];
[i setTarget: self];
[i setAction: @selector(_doMenuAction:)];
[i setRepresentedObject: c];
[menu insertItem: i
atIndex: 0];
@ -369,6 +366,9 @@ static NSNotificationCenter *nc = nil;
[menu insertItem: i
atIndex: 0];
RELEASE(i);
[self setMenu: menu];
RELEASE(menu);
if (_delegate)
{
@ -497,6 +497,7 @@ static NSNotificationCenter *nc = nil;
- (void) encodeWithCoder: (NSCoder *)coder
{
[super encodeWithCoder: coder];
if ([coder allowsKeyedCoding])
{
[coder encodeObject: [self backgroundColor]