mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#138] Added drag & drop re-ordering capabilities to the pri-pist (Cocoa).
This commit is contained in:
parent
880f0787ce
commit
5a26f1c2ae
@ -18,4 +18,6 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
#define jobMove @"job_move"
|
#define jobMove @"job_move"
|
||||||
#define jobDelete @"job_delete"
|
#define jobDelete @"job_delete"
|
||||||
|
|
||||||
|
#define DGPrioritizeIndexPasteboardType @"DGPrioritizeIndexPasteboardType"
|
||||||
|
|
||||||
#define TR(s) NSLocalizedString(s, @"")
|
#define TR(s) NSLocalizedString(s, @"")
|
@ -12,6 +12,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
#import "PyPrioritizeDialog.h"
|
#import "PyPrioritizeDialog.h"
|
||||||
#import "HSPopUpList.h"
|
#import "HSPopUpList.h"
|
||||||
#import "HSSelectableList.h"
|
#import "HSSelectableList.h"
|
||||||
|
#import "PrioritizeList.h"
|
||||||
|
|
||||||
@interface PrioritizeDialog : HSWindowController
|
@interface PrioritizeDialog : HSWindowController
|
||||||
{
|
{
|
||||||
@ -21,7 +22,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
|
|
||||||
HSPopUpList *categoryPopUp;
|
HSPopUpList *categoryPopUp;
|
||||||
HSSelectableList *criteriaList;
|
HSSelectableList *criteriaList;
|
||||||
HSSelectableList *prioritizationList;
|
PrioritizeList *prioritizationList;
|
||||||
}
|
}
|
||||||
- (id)initWithPy:(PyApp *)aPy;
|
- (id)initWithPy:(PyApp *)aPy;
|
||||||
- (PyPrioritizeDialog *)py;
|
- (PyPrioritizeDialog *)py;
|
||||||
|
@ -15,7 +15,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[self window];
|
[self window];
|
||||||
categoryPopUp = [[HSPopUpList alloc] initWithPy:[[self py] categoryList] view:categoryPopUpView];
|
categoryPopUp = [[HSPopUpList alloc] initWithPy:[[self py] categoryList] view:categoryPopUpView];
|
||||||
criteriaList = [[HSSelectableList alloc] initWithPy:[[self py] criteriaList] view:criteriaTableView];
|
criteriaList = [[HSSelectableList alloc] initWithPy:[[self py] criteriaList] view:criteriaTableView];
|
||||||
prioritizationList = [[HSSelectableList alloc] initWithPy:[[self py] prioritizationList] view:prioritizationTableView];
|
prioritizationList = [[PrioritizeList alloc] initWithPy:[[self py] prioritizationList] view:prioritizationTableView];
|
||||||
[self connect];
|
[self connect];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -25,6 +25,7 @@ http://www.hardcoded.net/licenses/bsd_license
|
|||||||
[self disconnect];
|
[self disconnect];
|
||||||
[categoryPopUp release];
|
[categoryPopUp release];
|
||||||
[criteriaList release];
|
[criteriaList release];
|
||||||
|
[prioritizationList release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
cocoa/base/PrioritizeList.h
Normal file
15
cocoa/base/PrioritizeList.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
||||||
|
|
||||||
|
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||||
|
which should be included with this package. The terms are also available at
|
||||||
|
http://www.hardcoded.net/licenses/bsd_license
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import "HSSelectableList.h"
|
||||||
|
#import "PyPrioritizeList.h"
|
||||||
|
|
||||||
|
@interface PrioritizeList : HSSelectableList {}
|
||||||
|
- (PyPrioritizeList *)py;
|
||||||
|
@end
|
51
cocoa/base/PrioritizeList.m
Normal file
51
cocoa/base/PrioritizeList.m
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
||||||
|
|
||||||
|
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||||
|
which should be included with this package. The terms are also available at
|
||||||
|
http://www.hardcoded.net/licenses/bsd_license
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import "PrioritizeList.h"
|
||||||
|
#import "Utils.h"
|
||||||
|
#import "Consts.h"
|
||||||
|
|
||||||
|
@implementation PrioritizeList
|
||||||
|
- (PyPrioritizeList *)py
|
||||||
|
{
|
||||||
|
return (PyPrioritizeList *)py;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setView:(NSTableView *)aTableView
|
||||||
|
{
|
||||||
|
[super setView:aTableView];
|
||||||
|
[[self view] registerForDraggedTypes:[NSArray arrayWithObject:DGPrioritizeIndexPasteboardType]];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard
|
||||||
|
{
|
||||||
|
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes];
|
||||||
|
[pboard declareTypes:[NSArray arrayWithObject:DGPrioritizeIndexPasteboardType] owner:self];
|
||||||
|
[pboard setData:data forType:DGPrioritizeIndexPasteboardType];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row
|
||||||
|
proposedDropOperation:(NSTableViewDropOperation)op
|
||||||
|
{
|
||||||
|
if (op == NSTableViewDropAbove) {
|
||||||
|
return NSDragOperationMove;
|
||||||
|
}
|
||||||
|
return NSDragOperationNone;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)tableView:(NSTableView *)aTableView acceptDrop:(id <NSDraggingInfo>)info
|
||||||
|
row:(NSInteger)row dropOperation:(NSTableViewDropOperation)operation
|
||||||
|
{
|
||||||
|
NSPasteboard* pboard = [info draggingPasteboard];
|
||||||
|
NSData* rowData = [pboard dataForType:DGPrioritizeIndexPasteboardType];
|
||||||
|
NSIndexSet* rowIndexes = [NSKeyedUnarchiver unarchiveObjectWithData:rowData];
|
||||||
|
[[self py] moveIndexes:[Utils indexSet2Array:rowIndexes] toIndex:row];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
@end
|
14
cocoa/base/PyPrioritizeList.h
Normal file
14
cocoa/base/PyPrioritizeList.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
||||||
|
|
||||||
|
This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||||
|
which should be included with this package. The terms are also available at
|
||||||
|
http://www.hardcoded.net/licenses/bsd_license
|
||||||
|
*/
|
||||||
|
|
||||||
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#import "PySelectableList.h"
|
||||||
|
|
||||||
|
@interface PyPrioritizeList : PySelectableList
|
||||||
|
- (void)moveIndexes:(NSArray *)indexes toIndex:(NSInteger)destIndex;
|
||||||
|
@end
|
@ -43,6 +43,7 @@
|
|||||||
CE81135012E5CE4D00A36C80 /* ResultWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE81134A12E5CE4D00A36C80 /* ResultWindow.xib */; };
|
CE81135012E5CE4D00A36C80 /* ResultWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE81134A12E5CE4D00A36C80 /* ResultWindow.xib */; };
|
||||||
CE81135812E5CE6D00A36C80 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE81135612E5CE6D00A36C80 /* Preferences.xib */; };
|
CE81135812E5CE6D00A36C80 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE81135612E5CE6D00A36C80 /* Preferences.xib */; };
|
||||||
CE8113EB12E5CE9A00A36C80 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE8113E912E5CE9A00A36C80 /* Localizable.strings */; };
|
CE8113EB12E5CE9A00A36C80 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = CE8113E912E5CE9A00A36C80 /* Localizable.strings */; };
|
||||||
|
CE89240A14239CC30024CE4E /* PrioritizeList.m in Sources */ = {isa = PBXBuildFile; fileRef = CE89240714239CC30024CE4E /* PrioritizeList.m */; };
|
||||||
CE8C53BC117324CE0011B41F /* HSTable.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8C53BB117324CE0011B41F /* HSTable.m */; };
|
CE8C53BC117324CE0011B41F /* HSTable.m in Sources */ = {isa = PBXBuildFile; fileRef = CE8C53BB117324CE0011B41F /* HSTable.m */; };
|
||||||
CE91F216113BC22D0010360B /* StatsLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = CE91F214113BC22D0010360B /* StatsLabel.m */; };
|
CE91F216113BC22D0010360B /* StatsLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = CE91F214113BC22D0010360B /* StatsLabel.m */; };
|
||||||
CE9777CD141F8C2500C13FB5 /* PrioritizeDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CE9777CC141F8C2500C13FB5 /* PrioritizeDialog.m */; };
|
CE9777CD141F8C2500C13FB5 /* PrioritizeDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = CE9777CC141F8C2500C13FB5 /* PrioritizeDialog.m */; };
|
||||||
@ -169,6 +170,10 @@
|
|||||||
CE81135912E5CE7B00A36C80 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/Preferences.xib; sourceTree = "<group>"; };
|
CE81135912E5CE7B00A36C80 /* fr */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = fr; path = fr.lproj/Preferences.xib; sourceTree = "<group>"; };
|
||||||
CE8113EA12E5CE9A00A36C80 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = ../base/en.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; };
|
CE8113EA12E5CE9A00A36C80 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = ../base/en.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; };
|
||||||
CE8113EC12E5CEA800A36C80 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = ../base/fr.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; };
|
CE8113EC12E5CEA800A36C80 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = ../base/fr.lproj/Localizable.strings; sourceTree = SOURCE_ROOT; };
|
||||||
|
CE89240614239CC30024CE4E /* PrioritizeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PrioritizeList.h; path = ../base/PrioritizeList.h; sourceTree = "<group>"; };
|
||||||
|
CE89240714239CC30024CE4E /* PrioritizeList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PrioritizeList.m; path = ../base/PrioritizeList.m; sourceTree = "<group>"; };
|
||||||
|
CE89240814239CC30024CE4E /* PyPrioritizeDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PyPrioritizeDialog.h; path = ../base/PyPrioritizeDialog.h; sourceTree = "<group>"; };
|
||||||
|
CE89240914239CC30024CE4E /* PyPrioritizeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PyPrioritizeList.h; path = ../base/PyPrioritizeList.h; sourceTree = "<group>"; };
|
||||||
CE8C53B61173248F0011B41F /* PyTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PyTable.h; sourceTree = "<group>"; };
|
CE8C53B61173248F0011B41F /* PyTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PyTable.h; sourceTree = "<group>"; };
|
||||||
CE8C53BB117324CE0011B41F /* HSTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSTable.m; sourceTree = "<group>"; };
|
CE8C53BB117324CE0011B41F /* HSTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HSTable.m; sourceTree = "<group>"; };
|
||||||
CE91F210113BC22D0010360B /* PyStatsLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PyStatsLabel.h; path = ../base/PyStatsLabel.h; sourceTree = SOURCE_ROOT; };
|
CE91F210113BC22D0010360B /* PyStatsLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PyStatsLabel.h; path = ../base/PyStatsLabel.h; sourceTree = SOURCE_ROOT; };
|
||||||
@ -455,6 +460,10 @@
|
|||||||
CE665B2F13225ADD003F5CFB /* PyExtraFairwareReminder.h */,
|
CE665B2F13225ADD003F5CFB /* PyExtraFairwareReminder.h */,
|
||||||
CE9777CB141F8C2500C13FB5 /* PrioritizeDialog.h */,
|
CE9777CB141F8C2500C13FB5 /* PrioritizeDialog.h */,
|
||||||
CE9777CC141F8C2500C13FB5 /* PrioritizeDialog.m */,
|
CE9777CC141F8C2500C13FB5 /* PrioritizeDialog.m */,
|
||||||
|
CE89240814239CC30024CE4E /* PyPrioritizeDialog.h */,
|
||||||
|
CE89240614239CC30024CE4E /* PrioritizeList.h */,
|
||||||
|
CE89240714239CC30024CE4E /* PrioritizeList.m */,
|
||||||
|
CE89240914239CC30024CE4E /* PyPrioritizeList.h */,
|
||||||
);
|
);
|
||||||
name = dgbase;
|
name = dgbase;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -579,6 +588,7 @@
|
|||||||
CE9777CD141F8C2500C13FB5 /* PrioritizeDialog.m in Sources */,
|
CE9777CD141F8C2500C13FB5 /* PrioritizeDialog.m in Sources */,
|
||||||
CE9777D5141F9D7600C13FB5 /* HSPopUpList.m in Sources */,
|
CE9777D5141F9D7600C13FB5 /* HSPopUpList.m in Sources */,
|
||||||
CE41672D141FE1E5004F3F0B /* HSSelectableList.m in Sources */,
|
CE41672D141FE1E5004F3F0B /* HSSelectableList.m in Sources */,
|
||||||
|
CE89240A14239CC30024CE4E /* PrioritizeList.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -282,7 +282,7 @@ class PyPrioritizeDialog(PyGUIObject):
|
|||||||
|
|
||||||
def prioritizationList(self):
|
def prioritizationList(self):
|
||||||
if not hasattr(self, '_prioritizationList'):
|
if not hasattr(self, '_prioritizationList'):
|
||||||
self._prioritizationList = PySelectableList.alloc().initWithPy_(self.py.prioritization_list)
|
self._prioritizationList = PyPrioritizeList.alloc().initWithPy_(self.py.prioritization_list)
|
||||||
return self._prioritizationList
|
return self._prioritizationList
|
||||||
|
|
||||||
def addSelected(self):
|
def addSelected(self):
|
||||||
@ -293,3 +293,9 @@ class PyPrioritizeDialog(PyGUIObject):
|
|||||||
|
|
||||||
def performReprioritization(self):
|
def performReprioritization(self):
|
||||||
self.py.perform_reprioritization()
|
self.py.perform_reprioritization()
|
||||||
|
|
||||||
|
class PyPrioritizeList(PySelectableList):
|
||||||
|
@signature('v@:@i')
|
||||||
|
def moveIndexes_toIndex_(self, indexes, dest_index):
|
||||||
|
self.py.move_indexes(indexes, dest_index)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user