     }
     
     // MARK:- Drag-n-Drop
-    
+	
     func draggingEntered(_ sender: NSDraggingInfo!) -> NSDragOperation {
         let pasteboard = sender.draggingPasteboard()
 

            NotificationCenter.default.post(notif)
        }
        else
        if let selectedPlaylist = playlistArrayController.selectedObjects.first as? String {
			let list: Array<PlayItem> = playlists[selectedPlaylist] as! Array
			
            if list.count > 0 {
                super.dismiss(sender)

    }
}

class PlayTableView : NSTableView {
	override func keyDown(with event: NSEvent) {
		if event.charactersIgnoringModifiers! == String(Character(UnicodeScalar(NSDeleteCharacter)!)) ||
		   event.charactersIgnoringModifiers! == String(Character(UnicodeScalar(NSDeleteFunctionKey)!)) {
			// Take action in the delegate.
			let delegate: PlaylistViewController = self.delegate as! PlaylistViewController
			
			delegate.removePlaylist(self)
		}
		else
		{
			// still here?
			super.keyDown(with: event)
		}
	}
	
	func tableViewColumnDidResize(notification: NSNotification ) {
		// Pay attention to column resizes and aggressively force the tableview's
		// cornerview to redraw.
		self.cornerView?.needsDisplay = true
	}

}

class PlayItemCornerView : NSView {
	@IBOutlet weak var playitemTableView: PlayTableView!
	override func draw(_ dirtyRect: NSRect) {
		let tote = NSImage.init(imageLiteralResourceName: "NSRefreshTemplate")
		let alignRect = tote.alignmentRect
		
		NSGraphicsContext.saveGraphicsState()
		tote.draw(in: NSMakeRect(2, 5, 7, 11), from: alignRect, operation: .sourceOver, fraction: 1)
		NSGraphicsContext.restoreGraphicsState()
	}
	
	override func mouseDown(with event: NSEvent) {
		playitemTableView.beginUpdates()
		// Renumber playlist items
		for row in 0...playitemTableView.numberOfRows {
			for col in 0...playitemTableView.numberOfColumns {
				if let cell = playitemTableView.view(atColumn: col, row: row, makeIfNecessary: true) {
					Swift.print("cell is \(cell)")
					if cell.identifier == "rank" {
						Swift.print("cell is \(cell)")
					}
				}
			}
		}
		playitemTableView.endUpdates()
	}
}

extension NSURL {
	
	func compare(_ other: URL ) -> ComparisonResult {
		return (self.absoluteString?.compare(other.absoluteString))!
	}
}

class PlaylistViewController: NSViewController,NSTableViewDataSource,NSTableViewDelegate {

	@IBOutlet var playlistArrayController: NSDictionaryController!
    @IBOutlet var playitemArrayController: NSArrayController!

    @IBOutlet var playlistTableView: PlayTableView!
    @IBOutlet var playitemTableView: PlayTableView!
    @IBOutlet var playlistSplitView: NSSplitView!

    //    cache playlists read and saved to defaults
