|
@@ -27,6 +27,7 @@ protocol KMEditImagePropertyViewControllerDelegate: NSObject {
|
|
|
|
|
|
class KMEditImagePropertyViewController: NSViewController {
|
|
|
|
|
|
+ @IBOutlet weak var backgroundView: NSView!
|
|
|
@IBOutlet weak var titleLabel: NSTextField!
|
|
|
@IBOutlet weak var editImageView: NSImageView!
|
|
|
|
|
@@ -88,6 +89,41 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
}
|
|
|
|
|
|
weak var delegate: KMEditImagePropertyViewControllerDelegate?
|
|
|
+
|
|
|
+
|
|
|
+ func addNotification() {
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(changeEffectiveAppearance), name: NSNotification.Name(rawValue: "kEffectiveAppearance"), object: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ func removeNotification() {
|
|
|
+ NotificationCenter.default.removeObserver(self)
|
|
|
+ DistributedNotificationCenter.default().removeObserver(self)
|
|
|
+ }
|
|
|
+
|
|
|
+ @objc func changeEffectiveAppearance() {
|
|
|
+ print("changeEffectiveAppearance")
|
|
|
+ let isDarkModel = KMAdvertisementConfig.isDarkModel()
|
|
|
+ if isDarkModel {
|
|
|
+ self.view.appearance = NSAppearance(named: .darkAqua)
|
|
|
+ } else {
|
|
|
+ self.view.appearance = NSAppearance(named: .aqua)
|
|
|
+ }
|
|
|
+ self.updateUI()
|
|
|
+ }
|
|
|
+
|
|
|
+ func updateUI() {
|
|
|
+ let isDarkModel = KMAdvertisementConfig.isDarkModel()
|
|
|
+ if isDarkModel {
|
|
|
+ self.backgroundView.backgroundColor(NSColor.km_init(hex: "#252526"))
|
|
|
+ } else {
|
|
|
+ self.backgroundView.backgroundColor(NSColor.km_init(hex: "#FAFAFA"))
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ deinit {
|
|
|
+ self.removeNotification()
|
|
|
+ }
|
|
|
+
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
|
|
@@ -96,6 +132,8 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
self.updateLanguage()
|
|
|
self.updateButtonState(hidden: true)
|
|
|
self.reloadData()
|
|
|
+ self.addNotification()
|
|
|
+ self.updateUI()
|
|
|
}
|
|
|
|
|
|
func initData() {
|
|
@@ -104,28 +142,38 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
|
|
|
func setup() {
|
|
|
self.titleLabel.font = NSFont.SFProTextSemiboldFont(14.0)
|
|
|
- self.titleLabel.textColor = NSColor.km_init(hex: "#252629")
|
|
|
+// self.titleLabel.textColor = NSColor.km_init(hex: "#252629")
|
|
|
+ self.titleLabel.textColor = KMAppearance.Layout.h0Color()
|
|
|
|
|
|
self.opacityTitleLabel.font = NSFont.SFProTextSemiboldFont(12.0)
|
|
|
- self.opacityTitleLabel.textColor = NSColor.km_init(hex: "#616469")
|
|
|
+// self.opacityTitleLabel.textColor = NSColor.km_init(hex: "#616469")
|
|
|
+ self.opacityTitleLabel.textColor = KMAppearance.Layout.h0Color()
|
|
|
|
|
|
self.imageBox.borderWidth = 1
|
|
|
self.imageBox.borderColor = NSColor.km_init(hex: "#DFE1E5")
|
|
|
self.imageBox.cornerRadius = 4
|
|
|
self.imageBox.fillColor = NSColor.km_init(hex: "#FFFFFF")
|
|
|
|
|
|
+ self.imageBox.borderColor = KMAppearance.Interactive.s0Color()
|
|
|
+ self.imageBox.fillColor = KMAppearance.Layout.l1Color()
|
|
|
+ self.imageBox.backgroundColor(KMAppearance.Layout.l1Color())
|
|
|
+
|
|
|
self.alignmentView.didChange = {[unowned self] view, areasArray, boundsArray in
|
|
|
self.changeAreasAlign(areas: areasArray, newBounds: boundsArray)
|
|
|
}
|
|
|
|
|
|
- imageBox.backgroundColor(NSColor.km_init(hex: "#FFFFFF"))
|
|
|
-
|
|
|
opacityVC = KMDesignSelect.init(withType: .PopButton)
|
|
|
opacityBox.contentView = opacityVC?.view
|
|
|
- opacityBox.fillColor = NSColor.clear
|
|
|
+ opacityBox.fillColor = KMAppearance.Layout.bgDrakColor()
|
|
|
opacityVC?.addItems(withObjectValues: ["25%","50%","75%","100%"])
|
|
|
opacityVC?.selectItem(at: 0)
|
|
|
opacityVC?.delete = self
|
|
|
+// opacityVC?.background = KMAppearance.Layout.l1Color()
|
|
|
+// opacityVC?.background_hov = KMAppearance.Layout.l1Color()
|
|
|
+// opacityVC?.textColor = KMAppearance.Layout.h0Color()
|
|
|
+// opacityVC?.textColor_hov = KMAppearance.Layout.h0Color()
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//alignment
|
|
|
rotateLeftVC = KMDesignPropertySelector.init(withType: .Icon_Btn)
|
|
@@ -181,6 +229,11 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
cropVC?.button(type: .Sec, size: .m)
|
|
|
cropVC?.stringValue = NSLocalizedString("Crop", comment: "")
|
|
|
cropVC?.updateUI()
|
|
|
+// cropVC?.textColor = KMAppearance.Layout.h0Color()
|
|
|
+// cropVC?.textColor_hov = KMAppearance.Layout.h0Color()
|
|
|
+// cropVC?.background = KMAppearance.Layout.l1Color()
|
|
|
+// cropVC?.background_hov = KMAppearance.Layout.l1Color()
|
|
|
+
|
|
|
|
|
|
confirmVC = KMDesignButton.init(withType: .Text)
|
|
|
confirmBox.contentView = confirmVC?.view
|
|
@@ -191,6 +244,11 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
confirmVC?.stringValue = NSLocalizedString("Confirm Cut", comment: "")
|
|
|
confirmVC?.updateUI()
|
|
|
confirmVC?.button.keyEquivalent = KMKeyEquivalent.enter
|
|
|
+// confirmVC?.textColor = KMAppearance.Layout.h0Color()
|
|
|
+// confirmVC?.textColor_hov = KMAppearance.Layout.h0Color()
|
|
|
+// confirmVC?.background = KMAppearance.Layout.l1Color()
|
|
|
+// confirmVC?.background_hov = KMAppearance.Layout.l1Color()
|
|
|
+
|
|
|
|
|
|
cancelVC = KMDesignButton.init(withType: .Text)
|
|
|
cancelBox.contentView = cancelVC?.view
|
|
@@ -200,6 +258,10 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
cancelVC?.button(type: .Sec, size: .m)
|
|
|
cancelVC?.stringValue = NSLocalizedString("Cancel", comment: "")
|
|
|
cancelVC?.updateUI()
|
|
|
+// cancelVC?.textColor = KMAppearance.Layout.h0Color()
|
|
|
+// cancelVC?.textColor_hov = KMAppearance.Layout.h0Color()
|
|
|
+// cancelVC?.background = KMAppearance.Layout.l1Color()
|
|
|
+// cancelVC?.background_hov = KMAppearance.Layout.l1Color()
|
|
|
|
|
|
replaceVC = KMDesignButton.init(withType: .Text)
|
|
|
replaceBox.contentView = replaceVC?.view
|
|
@@ -209,6 +271,10 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
replaceVC?.button(type: .Sec, size: .m)
|
|
|
replaceVC?.stringValue = NSLocalizedString("Replace", comment: "")
|
|
|
replaceVC?.updateUI()
|
|
|
+// replaceVC?.textColor = KMAppearance.Layout.h0Color()
|
|
|
+// replaceVC?.textColor_hov = KMAppearance.Layout.h0Color()
|
|
|
+// replaceVC?.background = KMAppearance.Layout.l1Color()
|
|
|
+// replaceVC?.background_hov = KMAppearance.Layout.l1Color()
|
|
|
|
|
|
exportVC = KMDesignButton.init(withType: .Text)
|
|
|
exportBox.contentView = exportVC?.view
|
|
@@ -218,6 +284,10 @@ class KMEditImagePropertyViewController: NSViewController {
|
|
|
exportVC?.button(type: .Sec, size: .m)
|
|
|
exportVC?.stringValue = NSLocalizedString("Export", comment: "")
|
|
|
exportVC?.updateUI()
|
|
|
+// exportVC?.textColor = KMAppearance.Layout.h0Color()
|
|
|
+// exportVC?.textColor_hov = KMAppearance.Layout.h0Color()
|
|
|
+// exportVC?.background = KMAppearance.Layout.l1Color()
|
|
|
+// exportVC?.background_hov = KMAppearance.Layout.l1Color()
|
|
|
|
|
|
self.noTitleLabel.textColor = NSColor.km_init(hex: "#616469")
|
|
|
self.noTitleLabel.font = NSFont.SFProTextRegularFont(14)
|