Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe68c5c01d |
@@ -1,4 +1,5 @@
|
||||
import AppKit
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
/// SPEC §9 — three-pane window: thumbnails | canvas | inspector.
|
||||
|
||||
@@ -211,7 +212,15 @@ final class PreviewWindowController: NSWindowController {
|
||||
let panel = NSOpenPanel()
|
||||
panel.allowsMultipleSelection = true
|
||||
panel.canChooseDirectories = false
|
||||
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
|
||||
if result == .OK { completion(panel.urls) }
|
||||
}
|
||||
|
||||
@@ -82,12 +82,17 @@ enum ColorMatching {
|
||||
static func stripColorMatchingAccessories(from panel: NSPrintPanel) {
|
||||
let accessories = panel.accessoryControllers
|
||||
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()
|
||||
if hay.contains("color matching") || hay.contains("colour matching") || hay.contains("colormatch") {
|
||||
panel.removeAccessoryController(ac)
|
||||
// SDK types this as NSViewController; removeAccessoryController
|
||||
// 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