diff --git a/cocoa/base/PyDupeGuru.h b/cocoa/base/PyDupeGuru.h index 96af479f..6dc809e3 100644 --- a/cocoa/base/PyDupeGuru.h +++ b/cocoa/base/PyDupeGuru.h @@ -29,7 +29,6 @@ http://www.hardcoded.net/licenses/hs_license - (void)markNone; - (void)addSelectedToIgnoreList; -- (void)removeSelected; - (void)openSelected; - (void)revealSelected; - (void)makeSelectedReference; diff --git a/cocoa/base/PyResultTree.h b/cocoa/base/PyResultTree.h index 9979be69..bbfebba7 100644 --- a/cocoa/base/PyResultTree.h +++ b/cocoa/base/PyResultTree.h @@ -19,5 +19,6 @@ http://www.hardcoded.net/licenses/hs_license - (BOOL)renameSelected:(NSString *)aNewName; - (void)sortBy:(NSInteger)aIdentifier ascending:(BOOL)aAscending; - (void)markSelected; +- (void)removeSelected; - (NSArray *)rootChildrenCounts; @end \ No newline at end of file diff --git a/cocoa/base/ResultOutline.h b/cocoa/base/ResultOutline.h index eb37b627..12aa4998 100644 --- a/cocoa/base/ResultOutline.h +++ b/cocoa/base/ResultOutline.h @@ -22,6 +22,5 @@ http://www.hardcoded.net/licenses/hs_license - (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode; - (void)setDeltaColumns:(NSIndexSet *)aDeltaColumns; - (NSInteger)selectedDupeCount; - -- (IBAction)markSelected:(id)sender; +- (void)removeSelected; @end; \ No newline at end of file diff --git a/cocoa/base/ResultOutline.m b/cocoa/base/ResultOutline.m index 8048174e..ae70a9bd 100644 --- a/cocoa/base/ResultOutline.m +++ b/cocoa/base/ResultOutline.m @@ -68,7 +68,7 @@ http://www.hardcoded.net/licenses/hs_license else { NSInteger r = 0; for (NSArray *path in selected) { - if ([path count] == 1) { + if ([path count] == 2) { r++; } } @@ -76,9 +76,15 @@ http://www.hardcoded.net/licenses/hs_license } } -- (IBAction)markSelected:(id)sender +- (void)removeSelected { - [[self py] markSelected]; + NSInteger selectedDupeCount = [self selectedDupeCount]; + if (!selectedDupeCount) + return; + NSString *msg = [NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",selectedDupeCount]; + if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO + return; + [[self py] removeSelected]; } /* Datasource */ @@ -161,6 +167,18 @@ http://www.hardcoded.net/licenses/hs_license } } +- (BOOL)tableViewHadDeletePressed:(NSTableView *)tableView +{ + [self removeSelected]; + return YES; +} + +- (BOOL)tableViewHadSpacePressed:(NSTableView *)tableView +{ + [[self py] markSelected]; + return YES; +} + /* don't calls saveEdits and cancelEdits */ - (void)outlineViewDidEndEditing:(HSOutlineView *)outlineView { diff --git a/cocoa/base/ResultWindow.h b/cocoa/base/ResultWindow.h index 13ad4c55..4d18c3d5 100644 --- a/cocoa/base/ResultWindow.h +++ b/cocoa/base/ResultWindow.h @@ -12,17 +12,13 @@ http://www.hardcoded.net/licenses/hs_license #import "ResultOutline.h" #import "PyDupeGuru.h" -@interface MatchesView : HSOutlineView -- (void)keyDown:(NSEvent *)theEvent; -@end - @interface ResultWindowBase : NSWindowController { @protected IBOutlet PyDupeGuruBase *py; IBOutlet id app; IBOutlet NSSegmentedControl *deltaSwitch; - IBOutlet MatchesView *matches; + IBOutlet HSOutlineView *matches; IBOutlet NSSegmentedControl *pmSwitch; IBOutlet NSTextField *stats; IBOutlet NSMenu *columnsMenu; @@ -63,6 +59,7 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)resetColumnsToDefault:(id)sender; - (IBAction)revealSelected:(id)sender; - (IBAction)showPreferencesPanel:(id)sender; +- (IBAction)startDuplicateScan:(id)sender; - (IBAction)switchSelected:(id)sender; - (IBAction)toggleColumn:(id)sender; - (IBAction)toggleDelta:(id)sender; diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index c080309c..3de22ecc 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -14,22 +14,6 @@ http://www.hardcoded.net/licenses/hs_license #import "AppDelegate.h" #import "Consts.h" -@implementation MatchesView -- (void)keyDown:(NSEvent *)theEvent -{ - unichar key = [[theEvent charactersIgnoringModifiers] characterAtIndex:0]; - // get flags and strip the lower 16 (device dependant) bits - NSUInteger flags = ( [theEvent modifierFlags] & 0x00FF ); - if (((key == NSDeleteFunctionKey) || (key == NSDeleteCharacter)) && (flags == 0)) - [self sendAction:@selector(removeSelected:) to:[self delegate]]; - else - if ((key == 0x20) && (flags == 0)) // Space - [self sendAction:@selector(markSelected:) to:[self delegate]]; - else - [super keyDown:theEvent]; -} -@end - @implementation ResultWindowBase - (void)awakeFromNib { @@ -155,7 +139,6 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)changePowerMarker:(id)sender { [outline setPowerMarkerMode:[pmSwitch selectedSegment] == 1]; - // [self outlineView:matches didClickTableColumn:nil]; } - (IBAction)copyMarked:(id)sender @@ -279,13 +262,7 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)removeSelected:(id)sender { - NSInteger selectedDupeCount = [outline selectedDupeCount]; - if (!selectedDupeCount) - return; - NSString *msg = [NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",selectedDupeCount]; - if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO - return; - [py removeSelected]; + [outline removeSelected]; } - (IBAction)renameSelected:(id)sender @@ -310,6 +287,11 @@ http://www.hardcoded.net/licenses/hs_license [preferencesPanel showWindow:sender]; } +- (IBAction)startDuplicateScan:(id)sender +{ + // Virtual +} + - (IBAction)switchSelected:(id)sender { [py makeSelectedReference]; diff --git a/cocoa/base/xib/MainMenu.xib b/cocoa/base/xib/MainMenu.xib index 3186594d..686991fa 100644 --- a/cocoa/base/xib/MainMenu.xib +++ b/cocoa/base/xib/MainMenu.xib @@ -12,7 +12,7 @@ YES - + @@ -1668,14 +1668,6 @@ 212 - - - matches - - - - 245 - initialFirstResponder @@ -1684,14 +1676,6 @@ 279 - - - delegate - - - - 410 - stats @@ -1932,14 +1916,6 @@ 758 - - - py - - - - 764 - removeSelected: @@ -2220,6 +2196,14 @@ 1175 + + + matches + + + + 1176 + @@ -3399,7 +3383,7 @@ {340, 340} com.apple.InterfaceBuilder.CocoaPlugin - MatchesView + HSOutlineView com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3577,7 +3561,7 @@ - 1175 + 1176 @@ -3656,7 +3640,7 @@ IBProjectSource - dgbase/AppDelegate.h + ../base/AppDelegate.h @@ -3668,19 +3652,22 @@ - MatchesView - OutlineView - + HSOutlineView + NSOutlineView + IBProjectSource - dgbase/ResultWindow.h + ../views/HSOutlineView.h - MatchesView - OutlineView - - IBUserSource - + NSObject + + + + NSObject + + IBProjectSource + ../views/NSTableViewAdditions.h @@ -3692,31 +3679,15 @@ - OutlineView - NSOutlineView - - py - PyApp - - - IBProjectSource - cocoalib/Outline.h - - - - OutlineView - NSOutlineView - - IBUserSource - - + NSTableView + PyApp PyRegistrable IBProjectSource - cocoalib/PyApp.h + ../PyApp.h @@ -3748,7 +3719,7 @@ PyApp IBProjectSource - dgbase/PyDupeGuru.h + ../base/PyDupeGuru.h @@ -3756,7 +3727,7 @@ NSObject IBProjectSource - cocoalib/PyRegistrable.h + ../PyRegistrable.h @@ -3790,7 +3761,7 @@ IBProjectSource - cocoalib/RecentDirectories.h + ../RecentDirectories.h @@ -3805,123 +3776,14 @@ ResultWindow ResultWindowBase - YES - - YES - clearIgnoreList: - filter: - ignoreSelected: - markAll: - markInvert: - markNone: - markSelected: - markToggle: - openSelected: - refresh: - removeMarked: - removeSelected: - renameSelected: - resetColumnsToDefault: - revealSelected: - startDuplicateScan: - toggleDelta: - - - YES - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - id - - - - filterField - NSSearchField + removeDeadTracks: + id IBProjectSource ResultWindow.h - - ResultWindow - ResultWindowBase - - YES - - YES - changeDelta: - changePowerMarker: - collapseAll: - copyMarked: - deleteMarked: - expandAll: - exportToXHTML: - moveMarked: - switchSelected: - togglePowerMarker: - - - YES - id - id - id - id - id - id - id - id - id - id - - - - YES - - YES - actionMenuView - app - deltaSwitch - deltaSwitchView - filterFieldView - matches - pmSwitch - pmSwitchView - py - stats - - - YES - NSView - id - NSSegmentedControl - NSView - NSView - MatchesView - NSSegmentedControl - NSView - PyDupeGuru - NSTextField - - - - IBUserSource - - - ResultWindowBase NSWindowController @@ -3931,15 +3793,29 @@ YES changeDelta: changePowerMarker: + clearIgnoreList: copyMarked: deleteMarked: - expandAll: exportToXHTML: + filter: + ignoreSelected: + markAll: + markInvert: + markNone: + markSelected: moveMarked: + openClicked: + openSelected: + removeMarked: + removeSelected: + renameSelected: resetColumnsToDefault: + revealSelected: showPreferencesPanel: + startDuplicateScan: switchSelected: toggleColumn: + toggleDelta: toggleDetailsPanel: togglePowerMarker: @@ -3958,6 +3834,20 @@ id id id + id + id + id + id + id + id + id + id + id + id + id + id + id + id @@ -3967,6 +3857,7 @@ app columnsMenu deltaSwitch + filterField matches pmSwitch py @@ -3977,13 +3868,17 @@ id NSMenu NSSegmentedControl - MatchesView + NSSearchField + HSOutlineView NSSegmentedControl PyDupeGuruBase NSTextField - + + IBProjectSource + ../base/ResultWindow.h + SUUpdater @@ -4605,7 +4500,7 @@ YES - ../../dupeguru.xcodeproj + ../../me/dupeguru.xcodeproj 3 diff --git a/cocoa/me/ResultWindow.h b/cocoa/me/ResultWindow.h index 8fe6ca8a..69756e7a 100644 --- a/cocoa/me/ResultWindow.h +++ b/cocoa/me/ResultWindow.h @@ -12,5 +12,4 @@ http://www.hardcoded.net/licenses/hs_license @interface ResultWindow : ResultWindowBase {} - (IBAction)removeDeadTracks:(id)sender; -- (IBAction)startDuplicateScan:(id)sender; @end diff --git a/core/app.py b/core/app.py index 73e31991..247dcd12 100644 --- a/core/app.py +++ b/core/app.py @@ -275,7 +275,7 @@ class DupeGuru(RegistrableApplication, Broadcaster): pass def remove_duplicates(self, duplicates): - self.results.remove_duplicates(duplicates) + self.results.remove_duplicates(self.without_ref(duplicates)) self.notify('results_changed') def remove_marked(self): diff --git a/core/app_cocoa_inter.py b/core/app_cocoa_inter.py index 2c95bfd9..0f319eaf 100644 --- a/core/app_cocoa_inter.py +++ b/core/app_cocoa_inter.py @@ -87,9 +87,6 @@ class PyDupeGuruBase(PyRegistrable): def removeMarked(self): self.py.remove_marked() - def removeSelected(self): - self.py.remove_selected() - def renameSelected_(self,newname): return self.py.rename_selected(newname) @@ -182,6 +179,9 @@ class PyResultOutline(PyOutline): def markSelected(self): self.py.app.toggle_selected_mark_state() + def removeSelected(self): + self.py.app.remove_selected() + def rootChildrenCounts(self): return self.py.root_children_counts()