[#29] Moving reference switching cocoa code to dgbase before modifying it.

--HG--
extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4043
This commit is contained in:
hsoft 2009-06-14 14:48:47 +00:00
parent a03e5e1d27
commit d3ce49db6b
2 changed files with 54 additions and 0 deletions

View File

@ -22,13 +22,22 @@
BOOL _powerMode;
BOOL _displayDelta;
}
/* Override */
- (NSString *)logoImageName;
/* Helpers */
- (NSArray *)getSelected:(BOOL)aDupesOnly;
- (NSArray *)getSelectedPaths:(BOOL)aDupesOnly;
- (void)performPySelection:(NSArray *)aIndexPaths;
/* Actions */
- (IBAction)changeDelta:(id)sender;
- (IBAction)copyMarked:(id)sender;
- (IBAction)deleteMarked:(id)sender;
- (IBAction)expandAll:(id)sender;
- (IBAction)moveMarked:(id)sender;
- (IBAction)switchSelected:(id)sender;
/* Notifications */
- (void)jobCompleted:(NSNotification *)aNotification;
@end

View File

@ -63,6 +63,44 @@
return @"dg_logo32";
}
/* Helpers */
- (NSArray *)getSelected:(BOOL)aDupesOnly
{
if (_powerMode)
aDupesOnly = NO;
NSIndexSet *indexes = [matches selectedRowIndexes];
NSMutableArray *nodeList = [NSMutableArray array];
OVNode *node;
int i = [indexes firstIndex];
while (i != NSNotFound)
{
node = [matches itemAtRow:i];
if (!aDupesOnly || ([node level] > 1))
[nodeList addObject:node];
i = [indexes indexGreaterThanIndex:i];
}
return nodeList;
}
- (NSArray *)getSelectedPaths:(BOOL)aDupesOnly
{
NSMutableArray *r = [NSMutableArray array];
NSArray *selected = [self getSelected:aDupesOnly];
NSEnumerator *e = [selected objectEnumerator];
OVNode *node;
while (node = [e nextObject])
[r addObject:p2a([node indexPath])];
return r;
}
- (void)performPySelection:(NSArray *)aIndexPaths
{
if (_powerMode)
[py selectPowerMarkerNodePaths:aIndexPaths];
else
[py selectResultNodePaths:aIndexPaths];
}
/* Actions */
- (IBAction)changeDelta:(id)sender
{
@ -129,6 +167,13 @@
}
}
- (IBAction)switchSelected:(id)sender
{
[self performPySelection:[self getSelectedPaths:YES]];
[py makeSelectedReference];
[[NSNotificationCenter defaultCenter] postNotificationName:ResultsChangedNotification object:self];
}
/* Delegate */
- (void)outlineView:(NSOutlineView *)outlineView didClickTableColumn:(NSTableColumn *)tableColumn