|
@@ -28,71 +28,34 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
@IBOutlet var tableView: KMBotaTableView!
|
|
|
@IBOutlet var separateCheckButton: NSButton!
|
|
|
@IBOutlet var boxes, transitionLabels, transitionControls, buttons: NSArray!
|
|
|
- @IBOutlet var arrayController: NSArrayController!
|
|
|
+// @IBOutlet var arrayController: NSArrayController!
|
|
|
@IBOutlet var effectPopUpButton: NSPopUpButton!
|
|
|
-
|
|
|
-
|
|
|
+ @IBOutlet var effectLabel: NSTextField!
|
|
|
+ @IBOutlet var durationLabel: NSTextField!
|
|
|
+ @IBOutlet var durationSlider: NSSlider!
|
|
|
+ @IBOutlet var durationTF: NSTextField!
|
|
|
+ @IBOutlet var extentLabel: NSTextField!
|
|
|
+ @IBOutlet var screeBtn: NSButtonCell!
|
|
|
+ @IBOutlet var pageBtn: NSButtonCell!
|
|
|
+ @IBOutlet var synchoronizBox: NSBox!
|
|
|
+ @IBOutlet var cancelBtn: NSButton!
|
|
|
+ @IBOutlet var okBtn: NSButton!
|
|
|
+ @IBOutlet var pageTransitionBox: NSBox!
|
|
|
|
|
|
var closeCallBack: closePresentationControllerCallBack?
|
|
|
- var separate = false{
|
|
|
- willSet{
|
|
|
- if newValue != separate {
|
|
|
-// SKImageToolTipWindow.sharedToolTipWindow().orderOut(nil)
|
|
|
-
|
|
|
- let window = self.window
|
|
|
- let isVisible = window?.isVisible ?? false
|
|
|
- var frame = window?.frame ?? NSRect.zero
|
|
|
- let scrollView = tableView?.enclosingScrollView
|
|
|
- var extraWidth: CGFloat
|
|
|
- let firstResponder = window?.firstResponder
|
|
|
- var editor: NSTextView? = nil
|
|
|
-
|
|
|
- if let textView = firstResponder as? NSTextView {
|
|
|
- editor = textView
|
|
|
- if textView.isFieldEditor {
|
|
|
-// firstResponder = textView.delegate
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if arrayController.commitEditing(), let editor = editor, window?.firstResponder != editor {
|
|
|
- window?.makeFirstResponder(firstResponder)
|
|
|
- }
|
|
|
-
|
|
|
- if separate {
|
|
|
- makeTransitions()
|
|
|
-
|
|
|
- extraWidth = (scrollView?.frame.width ?? 0) + TABLE_OFFSET
|
|
|
- frame.size.width += extraWidth
|
|
|
- frame.origin.x -= floor(0.5 * extraWidth)
|
|
|
- window?.setFrame(frame, display: isVisible, animate: isVisible)
|
|
|
- scrollView?.isHidden = false
|
|
|
- } else {
|
|
|
- scrollView?.isHidden = true
|
|
|
- extraWidth = (scrollView?.frame.width ?? 0) + TABLE_OFFSET
|
|
|
- frame.size.width -= extraWidth
|
|
|
- frame.origin.x += floor(0.5 * extraWidth)
|
|
|
- window?.setFrame(frame, display: isVisible, animate: isVisible)
|
|
|
- }
|
|
|
-
|
|
|
-// (undoRedoManager.prepare(withInvocationTarget: self) as AnyObject).separate = sparate == fasle
|
|
|
- }
|
|
|
- }
|
|
|
- didSet{
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ var separate = false
|
|
|
var transition: KMTransitionInfo = KMTransitionInfo()
|
|
|
var transitions: NSArray?{
|
|
|
willSet{
|
|
|
- if newValue != transitions {
|
|
|
+
|
|
|
+ }
|
|
|
+ didSet{
|
|
|
+ if transitions != oldValue {
|
|
|
// (undoRedoManager?.prepare(withInvocationTarget: self) as AnyObject).transitions = transitions
|
|
|
stopObservingTransitions(infos: transitions as! [KMTransitionInfo])
|
|
|
startObservingTransitions(transitions as! [KMTransitionInfo])
|
|
|
}
|
|
|
}
|
|
|
- didSet{
|
|
|
-
|
|
|
- }
|
|
|
}
|
|
|
var currentTransitions: NSArray?{
|
|
|
get{
|
|
@@ -209,10 +172,10 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
let count = SKTransitionController.transitionNames().count
|
|
|
// let transitionStylePopUpButton = transitionControls[0] as! NSPopUpButton
|
|
|
// transitionStylePopUpButton.removeAllItems()
|
|
|
-// for i in 0..<count {
|
|
|
-// transitionStylePopUpButton.addItem(withTitle: SKTransitionController.localizedName(for: SKAnimationTransitionStyle(rawValue: UInt(i)) ?? .noTransition))
|
|
|
-// transitionStylePopUpButton.lastItem?.tag = i
|
|
|
-// }
|
|
|
+ for i in 0..<count {
|
|
|
+ effectPopUpButton.addItem(withTitle: SKTransitionController.localizedName(for: SKAnimationTransitionStyle(rawValue: UInt(i)) ?? .noTransition))
|
|
|
+ effectPopUpButton.lastItem?.tag = i
|
|
|
+ }
|
|
|
|
|
|
notesDocumentPopUpButton.item(at: 0)?.title = NSLocalizedString("None", comment: "Menu item title")
|
|
|
|
|
@@ -273,15 +236,16 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- func makeTransitions() { if transitions != nil { return }
|
|
|
+ func makeTransitions() {
|
|
|
+ if transitions != nil { return }
|
|
|
let tableColumn = tableView?.tableColumn(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: PAGE_COLUMNID))
|
|
|
let cell = tableColumn?.dataCell
|
|
|
var labelWidth: CGFloat = 0.0
|
|
|
|
|
|
var array = [Any]()
|
|
|
- let dictionary = transition.properties
|
|
|
- let arr: NSArray = transitionController.pageTransitions! as NSArray
|
|
|
- let ptEnum = arr.objectEnumerator()
|
|
|
+ _ = transition.properties
|
|
|
+ let arr: NSArray? = transitionController.pageTransitions as NSArray?
|
|
|
+ let ptEnum = arr?.objectEnumerator()
|
|
|
var tn: KMThumbnail? = nil
|
|
|
|
|
|
for next in (controller?.leftSideViewController.thumbnails)! {
|
|
@@ -289,7 +253,7 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
let info = KMTransitionInfo()
|
|
|
info.thumbnail = tn
|
|
|
info.label = "\(tn!.label)\(RIGHTARROW_CHARACTER)\(next.label)"
|
|
|
- info.properties = ptEnum.nextObject() as! NSDictionary
|
|
|
+ info.properties = ptEnum?.nextObject() as? NSDictionary
|
|
|
array.append(info)
|
|
|
(cell as AnyObject).setStringValue(info.label)
|
|
|
labelWidth = max(labelWidth, ceil(((cell as AnyObject).cellSize?.width)!))
|
|
@@ -303,7 +267,7 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
tableColumn?.width = labelWidth
|
|
|
|
|
|
var frame: NSRect = tableView?.enclosingScrollView?.frame ?? .zero
|
|
|
- let wi: CGFloat = tableColumn?.value(forKeyPath: "@sum.width") as! CGFloat
|
|
|
+ let wi: CGFloat = 61//tableColumn?.value(forKeyPath: "@sum.width") as! CGFloat
|
|
|
frame.size.width = 19.0 + wi
|
|
|
tableView?.enclosingScrollView?.frame = frame
|
|
|
|
|
@@ -312,7 +276,58 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
override var windowNibName: NSNib.Name?{
|
|
|
return "TransitionSheet"
|
|
|
}
|
|
|
+
|
|
|
+ func changePageTransitionType() {
|
|
|
+// SKImageToolTipWindow.sharedToolTipWindow().orderOut(nil)
|
|
|
+ let window = self.window
|
|
|
+ let isVisible = window?.isVisible ?? false
|
|
|
+ var frame = window?.frame ?? NSRect.zero
|
|
|
+ let scrollView = tableView?.enclosingScrollView
|
|
|
+ var extraWidth: CGFloat
|
|
|
+ let firstResponder = window?.firstResponder
|
|
|
+ var editor: NSTextView? = nil
|
|
|
+
|
|
|
+ if let textView = firstResponder as? NSTextView {
|
|
|
+ editor = textView
|
|
|
+ if textView.isFieldEditor {
|
|
|
+ // firstResponder = textView.delegate
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if let editor = editor, window?.firstResponder != editor {
|
|
|
+ window?.makeFirstResponder(firstResponder)
|
|
|
+ }
|
|
|
+
|
|
|
+ if separate {
|
|
|
+ makeTransitions()
|
|
|
+
|
|
|
+ extraWidth = (scrollView?.frame.width ?? 0) + TABLE_OFFSET
|
|
|
+ frame.size.width += extraWidth
|
|
|
+ frame.origin.x -= floor(0.5 * extraWidth)
|
|
|
+ window?.setFrame(frame, display: isVisible, animate: isVisible)
|
|
|
+ scrollView?.isHidden = false
|
|
|
+ } else {
|
|
|
+ scrollView?.isHidden = true
|
|
|
+ extraWidth = (scrollView?.frame.width ?? 0) + TABLE_OFFSET
|
|
|
+ frame.size.width -= extraWidth
|
|
|
+ frame.origin.x += floor(0.5 * extraWidth)
|
|
|
+ window?.setFrame(frame, display: isVisible, animate: isVisible)
|
|
|
+ }
|
|
|
+
|
|
|
+ // (undoRedoManager.prepare(withInvocationTarget: self) as AnyObject).separate = sparate == fasle
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
+ @IBAction func pageTransitionAction(_ sender: NSButton) {
|
|
|
+ separate = sender.state == .on
|
|
|
+
|
|
|
+ changePageTransitionType()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @IBAction func changeDurationSlider(_ sender: NSSlider) {
|
|
|
+ self.durationTF.stringValue = sender.stringValue
|
|
|
+ }
|
|
|
@IBAction func cancelAction(_ sender: Any) {
|
|
|
if let handle = closeCallBack {
|
|
|
handle(self)
|
|
@@ -393,7 +408,7 @@ class SKPresentationOptionsSheetController: NSWindowController, NSWindowDelegate
|
|
|
guard let infos = pboard.readObjects(forClasses: [KMTransitionInfo.self], options: [:]) as? [KMTransitionInfo], infos.count > 0 else {
|
|
|
return false
|
|
|
}
|
|
|
- let propertie: NSDictionary = infos[0].properties
|
|
|
+ let propertie: NSDictionary? = infos[0].properties
|
|
|
|
|
|
if row == -1 {
|
|
|
transitions?.setValue(propertie, forKey: PROPERTIES_KEY)
|