Fix document window drag & drop.
This commit is contained in:
3 files changed
+12
-3
No files matched your search
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14087.3" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14092" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14087.3"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14092"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
@@ -188,6 +188,9 @@
|
|||||||
<toolbarItem reference="uiq-J2-uPs"/>
|
<toolbarItem reference="uiq-J2-uPs"/>
|
||||||
</defaultToolbarItems>
|
</defaultToolbarItems>
|
||||||
</toolbar>
|
</toolbar>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="-2" id="ifJ-VT-BdP"/>
|
||||||
|
</connections>
|
||||||
<point key="canvasLocation" x="1024" y="-701"/>
|
<point key="canvasLocation" x="1024" y="-701"/>
|
||||||
</window>
|
</window>
|
||||||
</objects>
|
</objects>
|
||||||
|
|||||||
@@ -598,7 +598,7 @@ class DocumentWindowController: NSWindowController, TracksViewControllerDelegate
|
|||||||
sender.draggingSourceOperationMask().contains(.copy)
|
sender.draggingSourceOperationMask().contains(.copy)
|
||||||
else { return [] }
|
else { return [] }
|
||||||
|
|
||||||
return []
|
return .copy
|
||||||
}
|
}
|
||||||
|
|
||||||
func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
|
func performDragOperation(_ sender: NSDraggingInfo) -> Bool {
|
||||||
|
|||||||
@@ -228,6 +228,10 @@ class TracksViewController: NSViewController, NSTableViewDataSource, NSTableView
|
|||||||
func tableView(_ tableView: NSTableView,
|
func tableView(_ tableView: NSTableView,
|
||||||
writeRowsWith rowIndexes: IndexSet,
|
writeRowsWith rowIndexes: IndexSet,
|
||||||
to pboard: NSPasteboard) -> Bool {
|
to pboard: NSPasteboard) -> Bool {
|
||||||
|
guard let firstRow = rowIndexes.first,
|
||||||
|
let track = track(at: firstRow), track.isMuxed == false
|
||||||
|
else { return false }
|
||||||
|
|
||||||
let data: Data = NSKeyedArchiver.archivedData(withRootObject: rowIndexes)
|
let data: Data = NSKeyedArchiver.archivedData(withRootObject: rowIndexes)
|
||||||
pboard.declareTypes([pasteboardType], owner: self)
|
pboard.declareTypes([pasteboardType], owner: self)
|
||||||
pboard.setData(data, forType: pasteboardType)
|
pboard.setData(data, forType: pasteboardType)
|
||||||
@@ -262,6 +266,8 @@ class TracksViewController: NSViewController, NSTableViewDataSource, NSTableView
|
|||||||
|
|
||||||
if let dragRow = rowIndexes.first {
|
if let dragRow = rowIndexes.first {
|
||||||
mp4.moveTrack(at: UInt(dragRow - 1), to: UInt(row - 1))
|
mp4.moveTrack(at: UInt(dragRow - 1), to: UInt(row - 1))
|
||||||
|
tableView.reloadData()
|
||||||
|
// TODO: Support multiple rows drag
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user