M Telegram-Mac/Appearance.swift => Telegram-Mac/Appearance.swift +2 -2
@@ 1679,7 1679,7 @@ private func generateIcons(from palette: ColorPalette, bubbled: Bool) -> Telegra
chatSearch: { #imageLiteral(resourceName: "Icon_SearchChatMessages").precomposed(palette.accentIcon) },
chatSearchActive: { #imageLiteral(resourceName: "Icon_SearchChatMessages").precomposed(palette.accentIcon) },
chatCall: { #imageLiteral(resourceName: "Icon_callNavigationHeader").precomposed(palette.accentIcon) },
- chatActions: { generateChatAction(#imageLiteral(resourceName: "Icon_ChatActionsActive").precomposed(palette.accentIcon), background: palette.background) },
+ chatActions: { #imageLiteral(resourceName: "Icon_ChatActionsActive").precomposed(palette.toolbarIconColor) },
chatFailedCall_incoming: { #imageLiteral(resourceName: "Icon_MessageCallIncoming").precomposed(palette.redUI) },
chatFailedCall_outgoing: { #imageLiteral(resourceName: "Icon_MessageCallOutgoing").precomposed(palette.redUI) },
chatCall_incoming: { #imageLiteral(resourceName: "Icon_MessageCallIncoming").precomposed(palette.greenUI) },
@@ 1865,7 1865,7 @@ private func generateIcons(from palette: ColorPalette, bubbled: Bool) -> Telegra
chatActionClearHistory: { #imageLiteral(resourceName: "Icon_ClearChat").precomposed(palette.accentIcon) },
chatActionDeleteChat: { #imageLiteral(resourceName: "Icon_MessageActionPanelDelete").precomposed(palette.accentIcon) },
dismissPinned: { #imageLiteral(resourceName: "Icon_ChatSearchCancel").precomposed(palette.accentIcon) },
- chatActionsActive: { generateChatAction(#imageLiteral(resourceName: "Icon_ChatActionsActive").precomposed(palette.accentIcon), background: palette.grayIcon.withAlphaComponent(0.1)) },
+ chatActionsActive: { #imageLiteral(resourceName: "Icon_ChatActionsActive").precomposed(palette.toolbarIconActiveColor) },
chatEntertainmentSticker: { #imageLiteral(resourceName: "Icon_ChatEntertainmentSticker").precomposed(palette.grayIcon) },
chatEmpty: { #imageLiteral(resourceName: "Icon_EmptyChat").precomposed(palette.grayForeground) },
stickerPackClose: { #imageLiteral(resourceName: "Icon_ChatSearchCancel").precomposed(palette.accentIcon) },
M Telegram-Mac/ParseAppearanceColors.swift => Telegram-Mac/ParseAppearanceColors.swift +7 -1
@@ 535,7 535,13 @@ func importPalette(_ path: String) -> ColorPalette? {
listBackground: colors["listBackground"] ?? parent.palette.listBackground,
listGrayText: colors["listGrayText"] ?? parent.palette.listGrayText,
grayHighlight: colors["grayHighlight"] ?? parent.palette.grayHighlight,
- focusAnimationColor: colors["focusAnimationColor"] ?? parent.palette.focusAnimationColor)
+ focusAnimationColor: colors["focusAnimationColor"] ?? parent.palette.focusAnimationColor,
+ toolbarBackgroundTop: colors["toolbarBackgroundTop"] ?? parent.palette.toolbarBackgroundTop,
+ toolbarBackgroundBottom: colors["toolbarBackgroundBottom"] ?? parent.palette.toolbarBackgroundBottom,
+ toolbarInactiveBackground: colors["toolbarInactiveBackground"] ?? parent.palette.toolbarInactiveBackground,
+ separatorColor: colors["separatorColor"] ?? parent.palette.separatorColor,
+ separatorInactiveColor: colors["separatorInactiveColor"] ?? parent.palette.separatorInactiveColor,
+ toolbarIconColor: colors["toolbarIconColor"] ?? parent.palette.toolbarIconColor)
}
}
M Telegram-Mac/ThemeSettings.swift => Telegram-Mac/ThemeSettings.swift +7 -1
@@ 340,7 340,13 @@ extension ColorPalette {
listBackground: parseColor(decoder, "listBackground") ?? palette.listBackground,
listGrayText: parseColor(decoder, "listGrayText") ?? palette.listGrayText,
grayHighlight: parseColor(decoder, "grayHighlight") ?? palette.grayHighlight,
- focusAnimationColor: parseColor(decoder, "focusAnimationColor") ?? palette.focusAnimationColor
+ focusAnimationColor: parseColor(decoder, "focusAnimationColor") ?? palette.focusAnimationColor,
+ toolbarBackgroundTop: parseColor(decoder, "toolbarBackgroundTop") ?? palette.toolbarBackgroundTop,
+ toolbarBackgroundBottom: parseColor(decoder, "toolbarBackgroundBottom") ?? palette.toolbarBackgroundBottom,
+ toolbarInactiveBackground: parseColor(decoder, "toolbarInactiveBackground") ?? palette.toolbarInactiveBackground,
+ separatorColor: parseColor(decoder, "separatorColor") ?? palette.separatorColor,
+ separatorInactiveColor: parseColor(decoder, "separatorInactiveColor") ?? palette.separatorInactiveColor,
+ toolbarIconColor: parseColor(decoder, "toolbarIconColor") ?? palette.toolbarIconColor
)
}
}
M submodules/TGUIKit/TGUIKit/ImageButton.swift => submodules/TGUIKit/TGUIKit/ImageButton.swift +2 -1
@@ 47,7 47,8 @@ open class ImageButton: Button {
override func prepare() {
super.prepare()
- imageView.animates = true
+// imageView.animates = true
+ imageView.animates = false
//imageView.isEventLess = true
self.addSubview(imageView)
}
M submodules/TGUIKit/TGUIKit/NavigationBarView.swift => submodules/TGUIKit/TGUIKit/NavigationBarView.swift +44 -452
@@ 21,23 21,26 @@ public struct NavigationBarStyle {
}
}
-public class NavigationBarView: NSVisualEffectView {
-
- private var bottomBorder:View = View()
+public class NavigationBarView: NSView {
private var leftView:BarView = BarView(frame: NSZeroRect)
private var centerView:BarView = BarView(frame: NSZeroRect)
private var rightView:BarView = BarView(frame: NSZeroRect)
+ private var isBorderHidden = false
+
required override init(frame frameRect: NSRect) {
super.init(frame: frameRect)
self.bounds = bounds
- self.blendingMode = .withinWindow
- self.material = .titlebar
self.wantsLayer = true
+ self.layer?.masksToBounds = true
updateLocalizationAndTheme(theme: presentation)
+
+ // Add observers to redraw this view on focus or blur
+ NotificationCenter.default.addObserver(self, selector: #selector(self.windowChangedFocus(_:)) , name: NSWindow.didBecomeKeyNotification, object: self.window)
+ NotificationCenter.default.addObserver(self, selector: #selector(self.windowChangedFocus(_:)) , name: NSWindow.didResignKeyNotification, object: self.window)
}
required init?(coder: NSCoder) {
@@ 45,14 48,6 @@ public class NavigationBarView: NSVisualEffectView {
}
public func updateLocalizationAndTheme(theme: PresentationTheme) {
- if #available(OSX 10.14, *) {
- bottomBorder.backgroundColor = NSColor.separatorColor
- } else {
- // Fallback on earlier versions
- bottomBorder.backgroundColor = presentation.colors.border
- }
- self.appearance = NSAppearance(named: presentation.colors.isDark ? .vibrantDark : .vibrantLight)
-
for subview in subviews {
if let subview = subview as? AppearanceViewProtocol {
subview.updateLocalizationAndTheme(theme: theme)
@@ 60,13 55,38 @@ public class NavigationBarView: NSVisualEffectView {
}
}
+ public override func draw(_ dirtyRect: NSRect) {
+
+ guard let ctx = NSGraphicsContext.current?.cgContext else {
+ return
+ }
+
+ let gradient = NSGradient(starting: presentation.colors.toolbarBackgroundTop, ending: presentation.colors.toolbarBackgroundBottom)!
+
+ if self.window?.isKeyWindow == true {
+ gradient.draw(in: self.bounds, angle: 270)
+ } else {
+ ctx.setFillColor(presentation.colors.toolbarInactiveBackground.cgColor)
+ ctx.fill(self.bounds)
+ }
+
+ if !self.isBorderHidden {
+ if self.window?.isKeyWindow == true {
+ ctx.setFillColor(presentation.colors.separatorColor.cgColor)
+ } else {
+ ctx.setFillColor(presentation.colors.separatorInactiveColor.cgColor)
+ }
+ ctx.fill(NSMakeRect(0, 0, NSWidth(self.frame), .borderSize))
+ }
+ }
+
+ @objc func windowChangedFocus(_ sender: Any?) {
+ self.needsDisplay = true
+ }
+
override public func layout() {
super.layout()
- self.bottomBorder.setNeedsDisplay()
- self.bottomBorder.frame = NSMakeRect(0, 0, frame.width, .borderSize)
-
self.layout(left: leftView, center: centerView, right: rightView)
-
}
override public func setFrameSize(_ newSize: NSSize) {
@@ 240,7 260,9 @@ public class NavigationBarView: NSVisualEffectView {
NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: centerView)
NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: rightView)
- self.bottomBorder.isHidden = !controller.bar.enableBorder
+ self.isBorderHidden = !controller.bar.enableBorder
+ self.needsDisplay = true
+
if style != .none {
@@ 252,7 274,6 @@ public class NavigationBarView: NSVisualEffectView {
self.addSubview(center)
self.addSubview(right)
}
- self.addSubview(bottomBorder)
left.setNeedsDisplay()
@@ 392,7 413,6 @@ public class NavigationBarView: NSVisualEffectView {
self.addSubview(left)
self.addSubview(center)
self.addSubview(right)
- self.addSubview(bottomBorder)
self.leftView = left
self.centerView = center
@@ 418,436 438,8 @@ public class NavigationBarView: NSVisualEffectView {
}
+ deinit {
+ NotificationCenter.default.removeObserver(self)
+ }
+
}
-
-//public class NavigationBarView: View {
-//
-// private var bottomBorder:View = View()
-//
-// var blurredBackground = true
-//
-// private var visualEffectView: NSVisualEffectView?
-// private var leftView:BarView = BarView(frame: NSZeroRect)
-// private var centerView:BarView = BarView(frame: NSZeroRect)
-// private var rightView:BarView = BarView(frame: NSZeroRect)
-//
-// override init() {
-// super.init()
-// // self.autoresizingMask = [.width]
-// initBackground()
-// updateLocalizationAndTheme(theme: presentation)
-// }
-//
-// required public init(frame frameRect: NSRect) {
-// super.init(frame: frameRect)
-// // self.autoresizingMask = [.width]
-// initBackground()
-// updateLocalizationAndTheme(theme: presentation)
-// }
-//
-// override public func updateLocalizationAndTheme(theme: PresentationTheme) {
-// super.updateLocalizationAndTheme(theme: theme)
-// bottomBorder.backgroundColor = presentation.colors.border
-// if blurredBackground {
-// if let v = visualEffectView {
-// v.appearance = NSAppearance(named: presentation.colors.isDark ? .vibrantDark : .vibrantLight)
-// }
-// } else {
-// backgroundColor = presentation.colors.background
-// }
-// }
-//
-// required public init?(coder: NSCoder) {
-// fatalError("init(coder:) has not been implemented")
-// }
-//
-// func initBackground() {
-// if blurredBackground {
-// visualEffectView = NSVisualEffectView()
-// visualEffectView?.bounds = bounds
-// visualEffectView?.blendingMode = .withinWindow
-// visualEffectView?.material = .titlebar
-// //visualEffectView?.wantsLayer = true
-// addSubview(visualEffectView!)
-// self.setNeedsDisplay()
-// } else {
-// visualEffectView = nil
-// }
-// }
-//
-// public func addToView(_ view: NSView) {
-// if blurredBackground {
-// if let v = visualEffectView {
-// v.addSubview(view)
-// }
-// } else {
-// self.addSubview(view)
-// }
-// }
-//
-// public func removeAllFromView() {
-// if blurredBackground {
-// if let v = visualEffectView {
-// v.removeAllSubviews()
-// }
-// } else {
-// self.removeAllSubviews()
-// }
-// }
-//
-// public override func draw(_ layer: CALayer, in ctx: CGContext) {
-//
-// super.draw(layer, in: ctx)
-//// ctx.setFillColor(NSColor.white.cgColor)
-//// ctx.fill(self.bounds)
-////
-//// ctx.setFillColor(theme.colors.border.cgColor)
-//// ctx.fill(NSMakeRect(0, NSHeight(self.frame) - .borderSize, NSWidth(self.frame), .borderSize))
-// }
-//
-// override public func layout() {
-// super.layout()
-// self.bottomBorder.setNeedsDisplay()
-// self.bottomBorder.frame = NSMakeRect(0, frame.height - .borderSize, frame.width, .borderSize)
-//
-// self.layout(left: leftView, center: centerView, right: rightView)
-//
-// }
-//
-// override public func setFrameSize(_ newSize: NSSize) {
-// super.setFrameSize(newSize)
-//
-// // guard let window = window as? Window, !window.inLiveSwiping else {return}
-//
-// }
-//
-// public override var mouseDownCanMoveWindow: Bool {
-// return true
-// }
-//
-//
-// func layout(left: BarView, center: BarView, right: BarView, force: Bool = false) -> Void {
-//
-// //
-//
-// if frame.height > 0 {
-// //proportions = 50 / 25 / 25
-//
-// let leftWidth = left.isFitted ? left.frame.width : left.fit(to: (right.frame.width == right.minWidth ? frame.width / 3 : frame.width / 4))
-// let rightWidth = right.isFitted ? right.frame.width : right.fit(to: (left.frame.width == left.minWidth ? frame.width / 3 : frame.width / 4))
-//
-// left.frame = NSMakeRect(0, 0, leftWidth, frame.height - .borderSize);
-// center.frame = NSMakeRect(left.frame.maxX, 0, frame.width - (leftWidth + rightWidth), frame.height - .borderSize);
-// right.frame = NSMakeRect(center.frame.maxX, 0, rightWidth, frame.height - .borderSize);
-// }
-// }
-//
-// // ! PUSH !
-// // left from center
-// // right cross fade
-// // center from right
-//
-// // ! POP !
-// // old left -> new center
-// // old center -> right
-// // old right -> fade
-//
-// @objc func viewFrameChanged(_ notification:Notification) {
-// guard let window = window as? Window, !window.inLiveSwiping else {return}
-// layout(left: leftView, center: centerView, right: rightView)
-// }
-//
-// func startMoveViews(left:BarView, center:BarView, right:BarView, direction: SwipeDirection) {
-// addToView(left)
-// addToView(center)
-// addToView(right)
-//
-// NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: leftView)
-// NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: centerView)
-// NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: rightView)
-//
-//
-// var nLeft_from:CGFloat = 0, nRight_from:CGFloat = 0, nCenter_from:CGFloat = 0
-//
-// switch direction {
-// case .right:
-//
-// nLeft_from = round(frame.width - left.frame.width)/2.0
-// nCenter_from = left.frame.width + right.frame.width
-// nRight_from = right.frame.minX
-//
-// case .left:
-// nLeft_from = 0
-// nCenter_from = 0
-// nRight_from = right.frame.minX
-//
-// case .none:
-// break
-// }
-//
-// left.setFrameOrigin(nLeft_from, left.frame.minY)
-// center.setFrameOrigin(nCenter_from, center.frame.minY)
-// right.setFrameOrigin(nRight_from, right.frame.minY)
-//
-// left.setNeedsDisplay()
-// center.setNeedsDisplay()
-// right.setNeedsDisplay()
-//
-//
-// left.layer?.opacity = 0
-// center.layer?.opacity = 0
-// right.layer?.opacity = 0
-//
-// layout(left: left, center: center, right: right)
-//
-// }
-//
-// func moveViews(left:BarView, center:BarView, right:BarView, direction: SwipeDirection, percent: CGFloat, animationStyle:AnimationStyle? = nil) {
-//
-// var pLeft_to:CGFloat = 0, pRight_to:CGFloat = 0, pCenter_to:CGFloat = 0
-// var nLeft_to:CGFloat = 0, nRight_to:CGFloat = 0, nCenter_to:CGFloat = 0
-//
-// switch direction {
-// case .right:
-//
-//
-// //center
-// nLeft_to = round(frame.width - left.frame.width)/2.0 - (round(frame.width - left.frame.width)/2.0) * percent
-// nCenter_to = left.frame.maxX + right.frame.width - (right.frame.width * percent)
-// nRight_to = left.frame.width + center.frame.width
-//
-// pLeft_to = self.leftView.frame.minX
-// pCenter_to = self.leftView.frame.width * (1.0 - percent)
-// pRight_to = self.leftView.frame.width + self.centerView.frame.width
-//
-// break
-// case .left:
-//
-// nLeft_to = 0
-// nCenter_to = left.frame.maxX * percent
-// nRight_to = left.frame.width + center.frame.width
-//
-// pLeft_to = self.leftView.frame.minX
-// pCenter_to = self.leftView.frame.width + self.centerView.frame.width * percent
-// pRight_to = self.leftView.frame.width + self.centerView.frame.width
-// break
-// case .none:
-// break
-// }
-//
-//
-//
-// left.change(pos: NSMakePoint(floorToScreenPixels(backingScaleFactor, nLeft_to), left.frame.minY), animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear, completion: { [weak left] completed in
-// if completed && animationStyle != nil {
-// left?.removeFromSuperview()
-// }
-// })
-// center.change(pos: NSMakePoint(floorToScreenPixels(backingScaleFactor, nCenter_to), center.frame.minY), animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear, completion: { [weak center] completed in
-// if completed && animationStyle != nil {
-// center?.removeFromSuperview()
-// }
-// })
-// right.change(pos: NSMakePoint(floorToScreenPixels(backingScaleFactor, nRight_to), right.frame.minY), animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear, completion: { [weak right] completed in
-// if completed && animationStyle != nil {
-// right?.removeFromSuperview()
-// }
-// })
-//
-//
-// self.leftView.change(pos: NSMakePoint(floorToScreenPixels(backingScaleFactor, pLeft_to), self.leftView.frame.minY), animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-// self.centerView.change(pos: NSMakePoint(floorToScreenPixels(backingScaleFactor, pCenter_to), self.centerView.frame.minY), animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-// self.rightView.change(pos: NSMakePoint(floorToScreenPixels(backingScaleFactor, pRight_to), self.rightView.frame.minY), animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-//
-//
-//
-// left.change(opacity: percent, animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-// center.change(opacity: percent, animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-// right.change(opacity: percent, animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-//
-// self.leftView.change(opacity: 1.0 - percent, animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-// self.centerView.change(opacity: 1.0 - percent, animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-// self.rightView.change(opacity: 1.0 - percent, animated: animationStyle != nil, duration: animationStyle?.duration ?? 0, timingFunction: animationStyle?.function ?? .linear)
-//
-// }
-//
-// public func switchViews(left:BarView, center:BarView, right:BarView, controller:ViewController, style:ViewControllerStyle, animationStyle:AnimationStyle, liveSwiping: Bool) {
-//
-// // var animationStyle = AnimationStyle.init(duration: 3.0, function: animationStyle.function)
-//
-//
-//
-// if !liveSwiping {
-// layout(left: left, center: center, right: right)
-// }
-//
-//
-// NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: leftView)
-// NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: centerView)
-// NotificationCenter.default.removeObserver(self, name: NSView.frameDidChangeNotification, object: rightView)
-//
-// self.bottomBorder.isHidden = !controller.bar.enableBorder
-// if style != .none {
-//
-//
-//
-// CATransaction.begin()
-//
-// if !liveSwiping {
-// self.addToView(left)
-// self.addToView(center)
-// self.addToView(right)
-// }
-// self.addSubview(bottomBorder)
-//
-//
-// self.visualEffectView?.layer?.setNeedsDisplay()
-// left.setNeedsDisplay()
-// center.setNeedsDisplay()
-// right.setNeedsDisplay()
-//
-// let pLeft = self.leftView
-// let pCenter = self.centerView
-// let pRight = self.rightView
-//
-// if !liveSwiping {
-// left.layer?.opacity = 0
-// center.layer?.opacity = 0
-// right.layer?.opacity = 0
-// }
-//
-// pLeft.updateLocalizationAndTheme(theme: presentation)
-// pCenter.updateLocalizationAndTheme(theme: presentation)
-// pRight.updateLocalizationAndTheme(theme: presentation)
-//
-// self.leftView = left
-// self.centerView = center
-// self.rightView = right
-//
-// var pLeft_from:CGFloat = 0,pRight_from:CGFloat = 0, pCenter_from:CGFloat = 0, pLeft_to:CGFloat = 0, pRight_to:CGFloat = 0, pCenter_to:CGFloat = 0
-// var nLeft_from:CGFloat = 0, nRight_from:CGFloat = 0, nCenter_from:CGFloat = 0, nLeft_to:CGFloat = 0, nRight_to:CGFloat = 0, nCenter_to:CGFloat = 0
-//
-// switch style {
-// case .push:
-//
-// //left
-// pLeft_from = liveSwiping ? pLeft.frame.minX : 0
-// pLeft_to = 0
-// nLeft_from = liveSwiping ? left.frame.minX : round(frame.width - left.frame.width)/2.0
-// nLeft_to = 0
-//
-// //center
-// pCenter_from = liveSwiping ? pCenter.frame.minX : pLeft.frame.width
-// pCenter_to = 0
-//
-// nCenter_from = liveSwiping ? center.frame.minX : left.frame.width + center.frame.width
-// nCenter_to = left.frame.width
-//
-// //right
-// pRight_from = right.frame.minX
-// pRight_to = right.frame.minX
-// nRight_from = right.frame.minX
-// nRight_to = right.frame.minX
-//
-// break
-// case .pop:
-//
-// //left
-// pLeft_from = liveSwiping ? pLeft.frame.minX : 0
-// pLeft_to = 0
-// nLeft_from = liveSwiping ? left.frame.minX : 0
-// nLeft_to = 0
-//
-// //center
-// pCenter_from = liveSwiping ? pCenter.frame.minX : center.frame.minX
-// pCenter_to = left.frame.width + center.frame.width
-// nCenter_from = liveSwiping ? center.frame.minX : 0
-// nCenter_to = left.frame.maxX
-//
-// //right
-// pRight_from = liveSwiping ? pRight.frame.minX : right.frame.minX
-// pRight_to = right.frame.minX
-// nRight_from = right.frame.minX
-// nRight_to = right.frame.minX
-//
-//
-// break
-// case .none:
-// break
-// }
-//
-//
-//
-// left.setFrameOrigin(nLeft_from, left.frame.minY)
-// center.setFrameOrigin(nCenter_from, center.frame.minY)
-// right.setFrameOrigin(nRight_from, right.frame.minY)
-//
-// pLeft.setFrameOrigin(pLeft_from, left.frame.minY)
-// // pCenter.setFrameOrigin(pCenter_from, pCenter.frame.minY)
-// pRight.setFrameOrigin(pRight_from, pRight.frame.minY)
-//
-//
-////
-// // old
-// pLeft.change(opacity: 0.0, duration: animationStyle.duration, timingFunction: animationStyle.function, completion:{ [weak pLeft] completed in
-// if completed {
-// pLeft?.removeFromSuperview()
-// }
-// })
-// pLeft.change(pos: NSMakePoint(pLeft_to, pLeft.frame.minY), animated: true, duration: animationStyle.duration, timingFunction: animationStyle.function)
-//
-// pCenter.change(opacity: 0.0, duration: animationStyle.duration, timingFunction: animationStyle.function, completion:{ [weak pCenter] completed in
-// if completed {
-// pCenter?.removeFromSuperview()
-// }
-// })
-// // pCenter.change(pos: NSMakePoint(pCenter_to, pCenter.frame.minY), animated: true, duration: animationStyle.duration, timingFunction: animationStyle.function)
-//
-//
-// pRight.change(opacity: 0.0, duration: animationStyle.duration, timingFunction: animationStyle.function, completion:{ [weak pRight] completed in
-// if completed {
-// pRight?.removeFromSuperview()
-// }
-// })
-// pRight.change(pos: NSMakePoint(pRight_to, pRight.frame.minY), animated: true, duration: animationStyle.duration, timingFunction: animationStyle.function)
-//
-// // new
-// if !left.isHidden {
-// left.change(opacity: 1.0, duration: animationStyle.duration, timingFunction: animationStyle.function)
-// }
-// left.change(pos: NSMakePoint(nLeft_to, left.frame.minY), animated: true, duration: animationStyle.duration, timingFunction: animationStyle.function)
-//
-//
-// if !center.isHidden {
-// center.change(opacity: 1.0, duration: animationStyle.duration, timingFunction: animationStyle.function)
-// }
-//
-// center.change(pos: NSMakePoint(nCenter_to, center.frame.minY), animated: true, duration: animationStyle.duration, timingFunction: animationStyle.function)
-//
-//
-// if !right.isHidden {
-// right.change(opacity: 1.0, duration: animationStyle.duration, timingFunction: animationStyle.function)
-// }
-// right.change(pos: NSMakePoint(nRight_to, right.frame.minY), animated: true, duration: animationStyle.duration, timingFunction: animationStyle.function)
-//
-//
-//
-// CATransaction.commit()
-//
-// } else {
-// self.removeAllFromView()
-// self.addToView(left)
-// self.addToView(center)
-// self.addToView(right)
-//
-// self.leftView = left
-// self.centerView = center
-// self.rightView = right
-// }
-//
-// NotificationCenter.default.addObserver(self, selector: #selector(viewFrameChanged(_:)), name: NSView.frameDidChangeNotification, object: left)
-// NotificationCenter.default.addObserver(self, selector: #selector(viewFrameChanged(_:)), name: NSView.frameDidChangeNotification, object: center)
-// NotificationCenter.default.addObserver(self, selector: #selector(viewFrameChanged(_:)), name: NSView.frameDidChangeNotification, object: right)
-//
-// }
-//
-//}
M submodules/TGUIKit/TGUIKit/PresentationTheme.swift => submodules/TGUIKit/TGUIKit/PresentationTheme.swift +102 -11
@@ 623,6 623,36 @@ public class ColorPalette : Equatable {
return self._focusAnimationColor
}
+ private let _toolbarBackgroundTop: NSColor
+ public var toolbarBackgroundTop: NSColor {
+ return self._toolbarBackgroundTop
+ }
+ private let _toolbarBackgroundBottom: NSColor
+ public var toolbarBackgroundBottom: NSColor {
+ return self._toolbarBackgroundBottom
+ }
+ private let _toolbarInactiveBackground: NSColor
+ public var toolbarInactiveBackground: NSColor {
+ return self._toolbarInactiveBackground
+ }
+
+ private let _separatorColor: NSColor
+ public var separatorColor: NSColor {
+ return self._separatorColor
+ }
+ private let _separatorInactiveColor: NSColor
+ public var separatorInactiveColor: NSColor {
+ return self._separatorInactiveColor
+ }
+
+ private let _toolbarIconColor: NSColor
+ public var toolbarIconColor: NSColor {
+ return self._toolbarIconColor
+ }
+// private let _toolbarIconActiveColor: NSColor
+ public var toolbarIconActiveColor: NSColor {
+ return self.toolbarIconColor.darker(amount: 0.3)
+ }
public var underSelectedColor: NSColor {
@@ 800,7 830,13 @@ public class ColorPalette : Equatable {
listBackground: NSColor,
listGrayText: NSColor,
grayHighlight: NSColor,
- focusAnimationColor: NSColor) {
+ focusAnimationColor: NSColor,
+ toolbarBackgroundTop: NSColor,
+ toolbarBackgroundBottom: NSColor,
+ toolbarInactiveBackground: NSColor,
+ separatorColor: NSColor,
+ separatorInactiveColor: NSColor,
+ toolbarIconColor: NSColor) {
let background: NSColor = background.withAlphaComponent(1.0)
let grayBackground: NSColor = grayBackground.withAlphaComponent(1.0)
@@ 1008,6 1044,13 @@ public class ColorPalette : Equatable {
self._listGrayText = listGrayText
self._grayHighlight = grayHighlight
self._focusAnimationColor = focusAnimationColor
+
+ self._toolbarBackgroundTop = toolbarBackgroundTop
+ self._toolbarBackgroundBottom = toolbarBackgroundBottom
+ self._toolbarInactiveBackground = toolbarInactiveBackground
+ self._separatorColor = separatorColor
+ self._separatorInactiveColor = separatorInactiveColor
+ self._toolbarIconColor = toolbarIconColor
}
public func listProperties(reflect: Mirror? = nil) -> [String] {
@@ 1173,7 1216,13 @@ public class ColorPalette : Equatable {
listBackground: listBackground,
listGrayText: listGrayText,
grayHighlight: grayHighlight,
- focusAnimationColor: focusAnimationColor)
+ focusAnimationColor: focusAnimationColor,
+ toolbarBackgroundTop: toolbarBackgroundTop,
+ toolbarBackgroundBottom: toolbarBackgroundBottom,
+ toolbarInactiveBackground: toolbarInactiveBackground,
+ separatorColor: separatorColor,
+ separatorInactiveColor: separatorInactiveColor,
+ toolbarIconColor: toolbarIconColor)
}
public func withUpdatedWallpaper(_ wallpaper: PaletteWallpaper) -> ColorPalette {
@@ 1302,7 1351,13 @@ public class ColorPalette : Equatable {
listBackground: listBackground,
listGrayText: listGrayText,
grayHighlight: grayHighlight,
- focusAnimationColor: focusAnimationColor)
+ focusAnimationColor: focusAnimationColor,
+ toolbarBackgroundTop: toolbarBackgroundTop,
+ toolbarBackgroundBottom: toolbarBackgroundBottom,
+ toolbarInactiveBackground: toolbarInactiveBackground,
+ separatorColor: separatorColor,
+ separatorInactiveColor: separatorInactiveColor,
+ toolbarIconColor: toolbarIconColor)
}
public func withAccentColor(_ color: PaletteAccentColor, disableTint: Bool = false) -> ColorPalette {
@@ 1575,7 1630,13 @@ public class ColorPalette : Equatable {
listBackground: listBackground,
listGrayText: listGrayText,
grayHighlight: grayHighlight,
- focusAnimationColor: focusAnimationColor)
+ focusAnimationColor: focusAnimationColor,
+ toolbarBackgroundTop: toolbarBackgroundTop,
+ toolbarBackgroundBottom: toolbarBackgroundBottom,
+ toolbarInactiveBackground: toolbarInactiveBackground,
+ separatorColor: separatorColor,
+ separatorInactiveColor: separatorInactiveColor,
+ toolbarIconColor: toolbarIconColor)
}
}
@@ 1806,7 1867,13 @@ public let whitePalette = ColorPalette(isNative: true, isDark: false,
listBackground: NSColor(0xefeff3),
listGrayText: NSColor(0x6D6D71),
grayHighlight: NSColor(0xF8F8F8),
- focusAnimationColor: NSColor(0x68A8E2)
+ focusAnimationColor: NSColor(0x68A8E2),
+ toolbarBackgroundTop: NSColor(0xF4F4F4),
+ toolbarBackgroundBottom: NSColor(0xCBCBCB),
+ toolbarInactiveBackground: NSColor(0xF6F6F6),
+ separatorColor: NSColor(0xA0A0A0),
+ separatorInactiveColor: NSColor(0xD1D1D1),
+ toolbarIconColor: NSColor(0x565656)
)
@@ 1953,7 2020,13 @@ public let nightAccentPalette = ColorPalette(isNative: true, isDark: true,
listBackground: NSColor(0x131415),
listGrayText: NSColor(0xb1c3d5),
grayHighlight: NSColor(0x18222d).darker(amount: 0.08),
- focusAnimationColor: NSColor(0x68A8E2)
+ focusAnimationColor: NSColor(0x68A8E2),
+ toolbarBackgroundTop: NSColor(0xF4F4F4),
+ toolbarBackgroundBottom: NSColor(0xCBCBCB),
+ toolbarInactiveBackground: NSColor(0xF6F6F6),
+ separatorColor: NSColor(0xA0A0A0),
+ separatorInactiveColor: NSColor(0xD1D1D1),
+ toolbarIconColor: NSColor(0x565656)
)
public let dayClassicPalette = ColorPalette(isNative: true,
isDark: false,
@@ 2087,7 2160,13 @@ public let dayClassicPalette = ColorPalette(isNative: true,
listBackground: NSColor(0xefeff3),
listGrayText: NSColor(0x6D6D71),
grayHighlight: NSColor(0xF8F8F8),
- focusAnimationColor: NSColor(0x68A8E2)
+ focusAnimationColor: NSColor(0x68A8E2),
+ toolbarBackgroundTop: NSColor(0xF4F4F4),
+ toolbarBackgroundBottom: NSColor(0xCBCBCB),
+ toolbarInactiveBackground: NSColor(0xF6F6F6),
+ separatorColor: NSColor(0xA0A0A0),
+ separatorInactiveColor: NSColor(0xD1D1D1),
+ toolbarIconColor: NSColor(0x565656)
)
public let darkPalette = ColorPalette(isNative: true, isDark:true,
@@ 2222,7 2301,13 @@ public let darkPalette = ColorPalette(isNative: true, isDark:true,
listBackground: NSColor(0x131415),
listGrayText: NSColor(0x8699a3),
grayHighlight: NSColor(0x292b36).darker(amount: 0.08),
- focusAnimationColor: NSColor(0x68A8E2)
+ focusAnimationColor: NSColor(0x68A8E2),
+ toolbarBackgroundTop: NSColor(0xF4F4F4),
+ toolbarBackgroundBottom: NSColor(0xCBCBCB),
+ toolbarInactiveBackground: NSColor(0xF6F6F6),
+ separatorColor: NSColor(0xA0A0A0),
+ separatorInactiveColor: NSColor(0xD1D1D1),
+ toolbarIconColor: NSColor(0x565656)
)
@available(macOS 10.14, *)
@@ 2252,7 2337,7 @@ private final class MojavePalette : ColorPalette {
private var controlBackgroundColor: NSColor {
return NSColor(0x1E1E1E)
}
- private var separatorColor: NSColor {
+ private var separatorColor2: NSColor {
return NSColor(0x3d3d3d)
}
private var textColor: NSColor {
@@ 2308,7 2393,7 @@ private final class MojavePalette : ColorPalette {
return controlBackgroundColor
}
override var border: NSColor {
- return separatorColor
+ return separatorColor2
}
override var accentSelect: NSColor {
return controlAccentColor.darker(amount: 0.2)
@@ 2523,7 2608,13 @@ public let systemPalette: ColorPalette = {
listBackground: NSColor(0x131415),
listGrayText: NSColor(0xb1c3d5),
grayHighlight: NSColor(0x292a2f).darker(amount: 0.08),
- focusAnimationColor: NSColor(0x68A8E2)
+ focusAnimationColor: NSColor(0x68A8E2),
+ toolbarBackgroundTop: NSColor(0xF4F4F4),
+ toolbarBackgroundBottom: NSColor(0xCBCBCB),
+ toolbarInactiveBackground: NSColor(0xF6F6F6),
+ separatorColor: NSColor(0xA0A0A0),
+ separatorInactiveColor: NSColor(0xD1D1D1),
+ toolbarIconColor: NSColor(0x565656)
)
M submodules/TGUIKit/TGUIKit/TGSplitView.swift => submodules/TGUIKit/TGUIKit/TGSplitView.swift +1 -1
@@ 139,7 139,7 @@ fileprivate class SplitMinimisizeView : Control {
super.draw(layer, in: ctx)
if let splitView = splitView {
if let drawBorder = splitView.delegate?.splitViewDrawBorder(), drawBorder {
- ctx.setFillColor(presentation.colors.border.cgColor)
+ ctx.setFillColor(presentation.colors.separatorColor.cgColor)
ctx.fill(NSMakeRect(floorToScreenPixels(backingScaleFactor, frame.width / 2), 0, .borderSize, frame.height))
}
}