diff --git a/jmc.xcodeproj/project.xcworkspace/xcuserdata/johnmoody.xcuserdatad/UserInterfaceState.xcuserstate b/jmc.xcodeproj/project.xcworkspace/xcuserdata/johnmoody.xcuserdatad/UserInterfaceState.xcuserstate index ff130ac..566067c 100644 Binary files a/jmc.xcodeproj/project.xcworkspace/xcuserdata/johnmoody.xcuserdatad/UserInterfaceState.xcuserstate and b/jmc.xcodeproj/project.xcworkspace/xcuserdata/johnmoody.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/jmc/Delegate:Main Window Controller/AppDelegate.swift b/jmc/Delegate:Main Window Controller/AppDelegate.swift index 67f8f5d..cee78d0 100644 --- a/jmc/Delegate:Main Window Controller/AppDelegate.swift +++ b/jmc/Delegate:Main Window Controller/AppDelegate.swift @@ -93,7 +93,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { self.setupWindowController = InitialSetupWindowController(windowNibName: "InitialSetupWindowController") self.setupWindowController?.setupForNilLibrary() } - self.locationManager = LocationManager(delegate: self) + //self.locationManager = LocationManager(delegate: self) self.addFilesQueueLoop = AddFilesQueueLoop(delegate: self) self.locationManager?.initializeEventStream() self.lastFMDelegate = LastFMDelegate() @@ -245,7 +245,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate { } //NotificationCenter.default.addObserver(self, selector: #selector(managedObjectsDidChangeDebug), name: Notification.Name.NSManagedObjectContextObjectsDidChange, object: managedObjectContext) NotificationCenter.default.addObserver(self, selector: #selector(managedObjectsDidUndo), name: Notification.Name.NSUndoManagerDidUndoChange, object: managedObjectContext.undoManager) - self.mediaKeyListener = MediaKeyListener(self) + //self.mediaKeyListener = MediaKeyListener(self) } func managedObjectsDidUndo() { diff --git a/jmc/Main Interface Components/Main Table View/DragAndDropArrayController.swift b/jmc/Main Interface Components/Main Table View/DragAndDropArrayController.swift index ea53d0f..1ea489e 100644 --- a/jmc/Main Interface Components/Main Table View/DragAndDropArrayController.swift +++ b/jmc/Main Interface Components/Main Table View/DragAndDropArrayController.swift @@ -224,25 +224,32 @@ class DragAndDropArrayController: NSArrayController, NSTableViewDataSource, NSTa func tableView(_ tableView: NSTableView, writeRowsWith rowIndexes: IndexSet, to pboard: NSPasteboard) -> Bool { print("table view writerows called") let rows = NSMutableArray() - var filenames = [String]() + var fileURLs = [NSURL]() for index in rowIndexes { - let trackView = (self.arrangedObjects as! [TrackView])[index] + let trackView = (self.arrangedObjects as! NSArray)[index] as! TrackView rows.add(trackView.track!.objectID.uriRepresentation()) - filenames.append(URL(string: trackView.track!.location!)!.path) + fileURLs.append(URL(string: trackView.track!.location!)! as NSURL) } - pboard.setPropertyList(filenames, forType: NSFilenamesPboardType) + print("writing urls") + //pboard.addTypes([NSURLPboardType], owner: nil) + pboard.writeObjects(fileURLs) draggedRowIndexes = rowIndexes let encodedIDs = NSKeyedArchiver.archivedData(withRootObject: rows) let context = mainWindow?.currentSourceListItem?.name print("context is \(context)") if context != nil { - pboard.setString(context!, forType: "context") + //pboard.setString(context!, forType: "context") } if mainWindow?.currentSourceListItem?.is_network == true { print("settin network pboard data") pboard.setData(encodedIDs, forType: "NetworkTrack") } else { - pboard.setData(encodedIDs, forType: "Track") + //pboard.setData(encodedIDs, forType: "Track") + } + print(pboard.types) + for item in pboard.pasteboardItems! { + print(item.types) + print(item.data(forType: "public.file-url")) } return true } @@ -253,10 +260,6 @@ class DragAndDropArrayController: NSArrayController, NSTableViewDataSource, NSTa return array[index] as? TrackView } - func tableView(_ tableView: NSTableView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forRowIndexes rowIndexes: IndexSet) { - print("dragypoo called") - } - func tableView(_ tableView: NSTableView, acceptDrop info: NSDraggingInfo, row: Int, dropOperation: NSTableViewDropOperation) -> Bool { if info.draggingPasteboard().types!.contains(NSFilenamesPboardType) { let files = info.draggingPasteboard().propertyList(forType: NSFilenamesPboardType) as! NSArray @@ -298,7 +301,7 @@ class DragAndDropArrayController: NSArrayController, NSTableViewDataSource, NSTa } func tableView(_ tableView: NSTableView, validateDrop info: NSDraggingInfo, proposedRow row: Int, proposedDropOperation dropOperation: NSTableViewDropOperation) -> NSDragOperation { - if info.draggingPasteboard().types!.contains(NSFilenamesPboardType) { + /*if info.draggingPasteboard().types!.contains(NSFilenamesPboardType) { print("doingle") tableView.setDropRow(-1, dropOperation: NSTableViewDropOperation.on) return .copy @@ -307,6 +310,7 @@ class DragAndDropArrayController: NSArrayController, NSTableViewDataSource, NSTa return .move } else { return NSDragOperation() - } + }*/ + return [] } }