mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 17:59:50 +00:00
[#93 state:fixed] Straightened out selection and matches reloading.
This commit is contained in:
parent
2d80b0e12f
commit
d193eed519
@ -43,6 +43,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (void)updatePySelection;
|
- (void)updatePySelection;
|
||||||
- (void)performPySelection:(NSArray *)aIndexPaths;
|
- (void)performPySelection:(NSArray *)aIndexPaths;
|
||||||
- (void)refreshStats;
|
- (void)refreshStats;
|
||||||
|
- (void)reloadMatches;
|
||||||
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;
|
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
@ -51,7 +52,6 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (IBAction)changePowerMarker:(id)sender;
|
- (IBAction)changePowerMarker:(id)sender;
|
||||||
- (IBAction)copyMarked:(id)sender;
|
- (IBAction)copyMarked:(id)sender;
|
||||||
- (IBAction)deleteMarked:(id)sender;
|
- (IBAction)deleteMarked:(id)sender;
|
||||||
- (IBAction)expandAll:(id)sender;
|
|
||||||
- (IBAction)exportToXHTML:(id)sender;
|
- (IBAction)exportToXHTML:(id)sender;
|
||||||
- (IBAction)filter:(id)sender;
|
- (IBAction)filter:(id)sender;
|
||||||
- (IBAction)ignoreSelected:(id)sender;
|
- (IBAction)ignoreSelected:(id)sender;
|
||||||
|
@ -101,13 +101,9 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
//Returns an array of identifiers, in order.
|
//Returns an array of identifiers, in order.
|
||||||
- (NSArray *)getColumnsOrder
|
- (NSArray *)getColumnsOrder
|
||||||
{
|
{
|
||||||
NSTableColumn *col;
|
|
||||||
NSString *colId;
|
|
||||||
NSMutableArray *result = [NSMutableArray array];
|
NSMutableArray *result = [NSMutableArray array];
|
||||||
NSEnumerator *e = [[matches tableColumns] objectEnumerator];
|
for (NSTableColumn *col in [matches tableColumns]) {
|
||||||
while (col = [e nextObject])
|
NSString *colId = [col identifier];
|
||||||
{
|
|
||||||
colId = [col identifier];
|
|
||||||
[result addObject:colId];
|
[result addObject:colId];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -116,14 +112,9 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (NSDictionary *)getColumnsWidth
|
- (NSDictionary *)getColumnsWidth
|
||||||
{
|
{
|
||||||
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
NSMutableDictionary *result = [NSMutableDictionary dictionary];
|
||||||
NSTableColumn *col;
|
for (NSTableColumn *col in [matches tableColumns]) {
|
||||||
NSString *colId;
|
NSString *colId = [col identifier];
|
||||||
NSNumber *width;
|
NSNumber *width = [NSNumber numberWithDouble:[col width]];
|
||||||
NSEnumerator *e = [[matches tableColumns] objectEnumerator];
|
|
||||||
while (col = [e nextObject])
|
|
||||||
{
|
|
||||||
colId = [col identifier];
|
|
||||||
width = [NSNumber numberWithDouble:[col width]];
|
|
||||||
[result setObject:width forKey:colId];
|
[result setObject:width forKey:colId];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -151,10 +142,9 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
{
|
{
|
||||||
NSMutableArray *r = [NSMutableArray array];
|
NSMutableArray *r = [NSMutableArray array];
|
||||||
NSArray *selected = [self getSelected:aDupesOnly];
|
NSArray *selected = [self getSelected:aDupesOnly];
|
||||||
NSEnumerator *e = [selected objectEnumerator];
|
for (OVNode *node in selected) {
|
||||||
OVNode *node;
|
|
||||||
while (node = [e nextObject])
|
|
||||||
[r addObject:p2a([node indexPath])];
|
[r addObject:p2a([node indexPath])];
|
||||||
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,49 +155,46 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth
|
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth
|
||||||
{
|
{
|
||||||
NSTableColumn *col;
|
for (NSMenuItem *mi in [columnsMenu itemArray]) {
|
||||||
NSString *colId;
|
if ([mi state] == NSOnState) {
|
||||||
NSNumber *width;
|
|
||||||
NSMenuItem *mi;
|
|
||||||
//Remove all columns
|
|
||||||
NSEnumerator *e = [[columnsMenu itemArray] objectEnumerator];
|
|
||||||
while (mi = [e nextObject])
|
|
||||||
{
|
|
||||||
if ([mi state] == NSOnState)
|
|
||||||
[self toggleColumn:mi];
|
|
||||||
}
|
|
||||||
//Add columns and set widths
|
|
||||||
e = [aColumnsOrder objectEnumerator];
|
|
||||||
while (colId = [e nextObject])
|
|
||||||
{
|
|
||||||
if (![colId isEqual:@"mark"])
|
|
||||||
{
|
|
||||||
col = [_resultColumns objectAtIndex:[colId intValue]];
|
|
||||||
width = [aColumnsWidth objectForKey:[col identifier]];
|
|
||||||
mi = [columnsMenu itemWithTag:[colId intValue]];
|
|
||||||
if (width)
|
|
||||||
[col setWidth:[width floatValue]];
|
|
||||||
[self toggleColumn:mi];
|
[self toggleColumn:mi];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//Add columns and set widths
|
||||||
|
for (NSString *colId in aColumnsOrder) {
|
||||||
|
if ([colId isEqual:@"mark"]) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
NSTableColumn *col = [_resultColumns objectAtIndex:[colId intValue]];
|
||||||
|
NSNumber *width = [aColumnsWidth objectForKey:[col identifier]];
|
||||||
|
NSMenuItem *mi = [columnsMenu itemWithTag:[colId intValue]];
|
||||||
|
if (width) {
|
||||||
|
[col setWidth:[width floatValue]];
|
||||||
|
}
|
||||||
|
[self toggleColumn:mi];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updatePySelection
|
- (void)updatePySelection
|
||||||
{
|
{
|
||||||
NSArray *selection;
|
NSArray *selection;
|
||||||
if (_powerMode)
|
if (_powerMode) {
|
||||||
selection = [py selectedPowerMarkerNodePaths];
|
selection = [py selectedPowerMarkerNodePaths];
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
selection = [py selectedResultNodePaths];
|
selection = [py selectedResultNodePaths];
|
||||||
|
}
|
||||||
[matches selectNodePaths:selection];
|
[matches selectNodePaths:selection];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)performPySelection:(NSArray *)aIndexPaths
|
- (void)performPySelection:(NSArray *)aIndexPaths
|
||||||
{
|
{
|
||||||
if (_powerMode)
|
if (_powerMode) {
|
||||||
[py selectPowerMarkerNodePaths:aIndexPaths];
|
[py selectPowerMarkerNodePaths:aIndexPaths];
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
[py selectResultNodePaths:aIndexPaths];
|
[py selectResultNodePaths:aIndexPaths];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)refreshStats
|
- (void)refreshStats
|
||||||
@ -215,6 +202,16 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[stats setStringValue:[py getStatLine]];
|
[stats setStringValue:[py getStatLine]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reload the matches outline and restore selection from py */
|
||||||
|
- (void)reloadMatches
|
||||||
|
{
|
||||||
|
[matches setDelegate:nil];
|
||||||
|
[matches reloadData];
|
||||||
|
[matches expandItem:nil expandChildren:YES];
|
||||||
|
[matches setDelegate:self];
|
||||||
|
[self updatePySelection];
|
||||||
|
}
|
||||||
|
|
||||||
/* Actions */
|
/* Actions */
|
||||||
- (IBAction)clearIgnoreList:(id)sender
|
- (IBAction)clearIgnoreList:(id)sender
|
||||||
{
|
{
|
||||||
@ -230,8 +227,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
{
|
{
|
||||||
_displayDelta = [deltaSwitch selectedSegment] == 1;
|
_displayDelta = [deltaSwitch selectedSegment] == 1;
|
||||||
[py setDisplayDeltaValues:b2n(_displayDelta)];
|
[py setDisplayDeltaValues:b2n(_displayDelta)];
|
||||||
[matches reloadData];
|
[self reloadMatches];
|
||||||
[self expandAll:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)changePowerMarker:(id)sender
|
- (IBAction)changePowerMarker:(id)sender
|
||||||
@ -241,7 +237,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[matches setTag:2];
|
[matches setTag:2];
|
||||||
else
|
else
|
||||||
[matches setTag:0];
|
[matches setTag:0];
|
||||||
[self expandAll:nil];
|
[matches expandItem:nil expandChildren:YES];
|
||||||
[self outlineView:matches didClickTableColumn:nil];
|
[self outlineView:matches didClickTableColumn:nil];
|
||||||
[self updatePySelection];
|
[self updatePySelection];
|
||||||
}
|
}
|
||||||
@ -277,12 +273,6 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[py deleteMarked];
|
[py deleteMarked];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)expandAll:(id)sender
|
|
||||||
{
|
|
||||||
for (NSInteger i=0;i < [matches numberOfRows];i++)
|
|
||||||
[matches expandItem:[matches itemAtRow:i]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (IBAction)exportToXHTML:(id)sender
|
- (IBAction)exportToXHTML:(id)sender
|
||||||
{
|
{
|
||||||
NSString *exported = [py exportToXHTMLwithColumns:[self getColumnsOrder]];
|
NSString *exported = [py exportToXHTMLwithColumns:[self getColumnsOrder]];
|
||||||
@ -480,7 +470,6 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Delegate */
|
/* Delegate */
|
||||||
|
|
||||||
- (void)outlineView:(NSOutlineView *)outlineView didClickTableColumn:(NSTableColumn *)tableColumn
|
- (void)outlineView:(NSOutlineView *)outlineView didClickTableColumn:(NSTableColumn *)tableColumn
|
||||||
{
|
{
|
||||||
if ([[outlineView sortDescriptors] count] < 1)
|
if ([[outlineView sortDescriptors] count] < 1)
|
||||||
@ -490,8 +479,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
[py sortDupesBy:i2n([[sd key] intValue]) ascending:b2n([sd ascending])];
|
[py sortDupesBy:i2n([[sd key] intValue]) ascending:b2n([sd ascending])];
|
||||||
else
|
else
|
||||||
[py sortGroupsBy:i2n([[sd key] intValue]) ascending:b2n([sd ascending])];
|
[py sortGroupsBy:i2n([[sd key] intValue]) ascending:b2n([sd ascending])];
|
||||||
[matches reloadData];
|
[self reloadMatches];
|
||||||
[self expandAll:nil];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
@ -548,7 +536,6 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
NSString *desc = [ui valueForKey:@"desc"];
|
NSString *desc = [ui valueForKey:@"desc"];
|
||||||
[[ProgressController mainProgressController] setJobDesc:desc];
|
[[ProgressController mainProgressController] setJobDesc:desc];
|
||||||
NSString *jobid = [ui valueForKey:@"jobid"];
|
NSString *jobid = [ui valueForKey:@"jobid"];
|
||||||
// NSLog(jobid);
|
|
||||||
[[ProgressController mainProgressController] setJobId:jobid];
|
[[ProgressController mainProgressController] setJobId:jobid];
|
||||||
[[ProgressController mainProgressController] showSheetForParent:[self window]];
|
[[ProgressController mainProgressController] showSheetForParent:[self window]];
|
||||||
}
|
}
|
||||||
@ -566,9 +553,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
|
|
||||||
- (void)resultsChanged:(NSNotification *)aNotification
|
- (void)resultsChanged:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
[matches reloadData];
|
[self reloadMatches];
|
||||||
[self expandAll:nil];
|
|
||||||
[self outlineViewSelectionDidChange:nil];
|
|
||||||
[self refreshStats];
|
[self refreshStats];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user