|
@@ -106,7 +106,9 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
|
required init?(coder: NSCoder) {
|
|
|
super.init(coder: coder)
|
|
|
}
|
|
|
-
|
|
|
+ deinit {
|
|
|
+ NSLog("===SKPresentationOptionsSheetController==")
|
|
|
+ }
|
|
|
override func windowDidLoad() {
|
|
|
super.windowDidLoad()
|
|
|
|
|
@@ -265,8 +267,8 @@ class SKPresentationOptionsSheetController: KMBaseWindowController {
|
|
|
info.label = "\(tn?.label ?? "")"+"→"+"\(next.label)"
|
|
|
info.properties = ((ptEnum?.nextObject()) != nil) ? ptEnum?.nextObject() as? NSDictionary : dictionary
|
|
|
array.append(info)
|
|
|
- (cell as AnyObject).setStringValue(info.label)
|
|
|
- labelWidth = max(labelWidth, ceil(((cell as AnyObject).cellSize?.width) ?? 0))
|
|
|
+// (cell as AnyObject).setStringValue(info.label)
|
|
|
+// labelWidth = max(labelWidth, ceil(((cell as AnyObject).cellSize?.width) ?? 0))
|
|
|
}
|
|
|
tn = next
|
|
|
}
|
|
@@ -606,27 +608,51 @@ extension SKPresentationOptionsSheetController: NSTableViewDelegate, NSTableView
|
|
|
return self.transitions?.count ?? 0
|
|
|
}
|
|
|
|
|
|
- func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
|
|
+// func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
|
|
|
+// 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 info?.label ?? ""
|
|
|
+// } 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))
|
|
|
+// let image = page?.thumbnail(of: page?.bounds.size ?? .zero)
|
|
|
+//
|
|
|
+//// cell?.image = image
|
|
|
+// return image
|
|
|
+//// if let data = page?.PDFListViewTIFFData(for: page?.bounds ?? .zero) {
|
|
|
+//// let image = NSImage(data: data)
|
|
|
+//// cell?.image = image
|
|
|
+//// return image
|
|
|
+//// }
|
|
|
+// }
|
|
|
+// return nil
|
|
|
+// }
|
|
|
+//
|
|
|
+ func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
|
|
|
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 info?.label ?? ""
|
|
|
- } else if let id = identifier?.rawValue, id == IMAGE_COLUMNID {
|
|
|
- let cell = tableColumn?.dataCell as? NSImageCell
|
|
|
+
|
|
|
+ var cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier("KMPresentTableViewCell"), owner: self)
|
|
|
+ if cell == nil {
|
|
|
+ cell = KMPresentTableViewCell(type: .text)
|
|
|
+ }
|
|
|
+ let myCellView: KMPresentTableViewCell = cell! as! KMPresentTableViewCell
|
|
|
+// if let id = identifier?.rawValue, id == PAGE_COLUMNID {
|
|
|
+// let cellView = KMPresentTableViewCell(type: .text)
|
|
|
+ myCellView.label?.stringValue = info?.label ?? ""
|
|
|
+// return cellView
|
|
|
+// } else if let id = identifier?.rawValue, id == IMAGE_COLUMNID {
|
|
|
+// let cellView = KMPresentTableViewCell(type: .img)
|
|
|
let page = self.controller?.listView.document.page(at: UInt(info?.thumbnail?.pageIndex ?? 0))
|
|
|
let image = page?.thumbnail(of: page?.bounds.size ?? .zero)
|
|
|
- cell?.image = image
|
|
|
- return image
|
|
|
-// if let data = page?.PDFListViewTIFFData(for: page?.bounds ?? .zero) {
|
|
|
-// let image = NSImage(data: data)
|
|
|
-// cell?.image = image
|
|
|
-// return image
|
|
|
-// }
|
|
|
- }
|
|
|
- return nil
|
|
|
+ myCellView.iv?.image = image
|
|
|
+// return cellView
|
|
|
+// }
|
|
|
+ return myCellView;
|
|
|
}
|
|
|
|
|
|
func tableViewSelectionDidChange(_ notification: Notification) {
|