Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe68c5c01d |
@@ -1,4 +1,5 @@
|
|||||||
import AppKit
|
import AppKit
|
||||||
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
/// SPEC §9 — three-pane window: thumbnails | canvas | inspector.
|
/// SPEC §9 — three-pane window: thumbnails | canvas | inspector.
|
||||||
|
|
||||||
@@ -211,7 +212,15 @@ final class PreviewWindowController: NSWindowController {
|
|||||||
let panel = NSOpenPanel()
|
let panel = NSOpenPanel()
|
||||||
panel.allowsMultipleSelection = true
|
panel.allowsMultipleSelection = true
|
||||||
panel.canChooseDirectories = false
|
panel.canChooseDirectories = false
|
||||||
panel.allowedFileTypes = ["tif", "tiff", "targetjob", "json"]
|
if #available(macOS 12.0, *) {
|
||||||
|
var types: [UTType] = [.tiff, .json]
|
||||||
|
if let jobType = UTType(filenameExtension: "targetjob") {
|
||||||
|
types.append(jobType)
|
||||||
|
}
|
||||||
|
panel.allowedContentTypes = types
|
||||||
|
} else {
|
||||||
|
panel.allowedFileTypes = ["tif", "tiff", "targetjob", "json"]
|
||||||
|
}
|
||||||
panel.begin { result in
|
panel.begin { result in
|
||||||
if result == .OK { completion(panel.urls) }
|
if result == .OK { completion(panel.urls) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,11 +82,16 @@ enum ColorMatching {
|
|||||||
static func stripColorMatchingAccessories(from panel: NSPrintPanel) {
|
static func stripColorMatchingAccessories(from panel: NSPrintPanel) {
|
||||||
let accessories = panel.accessoryControllers
|
let accessories = panel.accessoryControllers
|
||||||
for ac in accessories {
|
for ac in accessories {
|
||||||
let title = (ac.title ?? "") + " " + (ac.nibName ?? "")
|
let cls = NSStringFromClass(type(of: ac))
|
||||||
|
let title = (ac.title ?? "") + " " + (ac.nibName ?? "") + " " + cls
|
||||||
let hay = title.lowercased()
|
let hay = title.lowercased()
|
||||||
if hay.contains("color matching") || hay.contains("colour matching") || hay.contains("colormatch") {
|
if hay.contains("color matching") || hay.contains("colour matching") || hay.contains("colormatch") {
|
||||||
panel.removeAccessoryController(ac)
|
// SDK types this as NSViewController; removeAccessoryController
|
||||||
TPLog.info("Removed print-panel accessory: \(title)")
|
// requires NSPrintPanelAccessorizing (SPEC §7.2).
|
||||||
|
if let accessor = ac as? (NSViewController & NSPrintPanelAccessorizing) {
|
||||||
|
panel.removeAccessoryController(accessor)
|
||||||
|
TPLog.info("Removed print-panel accessory: \(title)")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user