|
@@ -85,8 +85,8 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
|
}
|
|
|
}
|
|
|
var undoRedoManager = UndoManager()
|
|
|
- var controller: KMMainViewController?
|
|
|
- var transitionController: SKTransitionController!
|
|
|
+ weak var controller: KMMainViewController?
|
|
|
+ weak var transitionController: SKTransitionController?
|
|
|
|
|
|
private weak var proxyDelegate_: SKTransitionControllerDelegate?
|
|
|
|
|
@@ -128,6 +128,7 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
|
let transitionController = self.controller?.listView.transitionController
|
|
|
self.proxyDelegate_ = transitionController?.delegate
|
|
|
transitionController?.delegate = self
|
|
|
+ self.transitionController = transitionController
|
|
|
self.transition.transitionStyle = transitionController?.transitionStyle ?? .noTransition
|
|
|
self.transition.duration = Float(transitionController?.duration ?? 0)
|
|
|
self.transition.shouldRestrict = transitionController?.shouldRestrict ?? false
|
|
@@ -249,7 +250,7 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
|
|
|
|
var array = [Any]()
|
|
|
let dictionary: NSDictionary? = self.transition.properties
|
|
|
- let arr: NSArray? = transitionController.pageTransitions as NSArray?
|
|
|
+ let arr: NSArray? = self.transitionController?.pageTransitions as NSArray?
|
|
|
let ptEnum = arr?.objectEnumerator()
|
|
|
var tn: KMThumbnail? = nil
|
|
|
|
|
@@ -378,6 +379,9 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
|
self.separate = sender.state == .on
|
|
|
|
|
|
self.changePageTransitionType()
|
|
|
+ Task { @MainActor in
|
|
|
+ self.tableView.reloadData()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@IBAction func changeDurationSlider(_ sender: NSSlider) {
|
|
@@ -483,18 +487,33 @@ extension SKPresentationOptionsSheetController: SKTransitionControllerDelegate {
|
|
|
|
|
|
extension SKPresentationOptionsSheetController: NSTableViewDelegate, NSTableViewDataSource {
|
|
|
func numberOfRows(in tableView: NSTableView) -> Int {
|
|
|
- return transitions?.count ?? 0
|
|
|
+ return self.transitions?.count ?? 0
|
|
|
+ }
|
|
|
+
|
|
|
+ func tableView(_ tableView: NSTableView, dataCellFor tableColumn: NSTableColumn?, row: Int) -> NSCell? {
|
|
|
+ let identifier = tableColumn?.identifier
|
|
|
+ let info = transitions?[row] as? KMTransitionInfo
|
|
|
+
|
|
|
+ if let id = identifier?.rawValue, id == PAGE_COLUMNID {
|
|
|
+ let cell = tableColumn?.dataCell as? NSTextFieldCell
|
|
|
+ cell?.stringValue = info?.label ?? ""
|
|
|
+ return cell
|
|
|
+ } else if let id = identifier?.rawValue, id == IMAGE_COLUMNID {
|
|
|
+ let cell = tableColumn?.dataCell as? NSImageCell
|
|
|
+ let page = self.controller?.listView.document.page(at: UInt(info?.thumbnail?.pageIndex ?? 0))
|
|
|
+// self.controller?.listView.pdflist
|
|
|
+ if let data = page?.PDFListViewTIFFData(for: page?.bounds ?? .zero) {
|
|
|
+ let image = NSImage(data: data)
|
|
|
+ cell?.image = image
|
|
|
+ }
|
|
|
+ return cell
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+
|
|
|
+ func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
|
|
+ return nil
|
|
|
}
|
|
|
-// func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
|
|
-// let identifier = tableColumn!.identifier
|
|
|
-// let info = transitions?[row]
|
|
|
-// if identifier.rawValue == PAGE_COLUMNID {
|
|
|
-//
|
|
|
-// } else if identifier.rawValue == IMAGE_COLUMNID {
|
|
|
-//
|
|
|
-// }
|
|
|
-// return nil
|
|
|
-// }
|
|
|
func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
|
|
return nil
|
|
|
}
|