|
@@ -10,7 +10,7 @@ import Cocoa
|
|
|
@objc protocol KMToolbarRightViewDelegate {
|
|
|
@objc func pdfRightSegmentedControlAction(_ sender: KMSegmentedBox?)
|
|
|
@objc func userInfoButtonAction(_ sender: NSButton)
|
|
|
- @objc func homeRefreshButtonAction(_ sender: NSButton)
|
|
|
+ @objc func homeRefreshButtonAction(_ sender: NSButton?)
|
|
|
@objc func homeUploadButtonAction(_ sender: NSButton)
|
|
|
@objc func homeMenuSortAction(_ sender: NSPopUpButton)
|
|
|
@objc func homeMenuFilterAction(_ sender: NSPopUpButton)
|
|
@@ -63,15 +63,7 @@ import Cocoa
|
|
|
}
|
|
|
|
|
|
if self.rightSegmentControlConstraint != nil {
|
|
|
- let paragraphStyle = NSMutableParagraphStyle()
|
|
|
- paragraphStyle.lineHeightMultiple = 1.32
|
|
|
- paragraphStyle.alignment = .right
|
|
|
- let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
|
|
|
- NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0)]
|
|
|
- let title: NSString = NSLocalizedString("Enjoy Advanced Features", comment: "") as NSString
|
|
|
- let size = title.boundingRect(with: CGSize(width: 300, height: 24) ,
|
|
|
- attributes: attributes).size
|
|
|
-
|
|
|
+ let size = self.fetchAdvancedViewSize()
|
|
|
self.rightSegmentControlConstraint.constant = size.width + 20
|
|
|
}
|
|
|
} else {
|
|
@@ -98,11 +90,29 @@ import Cocoa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ func fetchAdvancedViewSize() -> CGSize {
|
|
|
+ let paragraphStyle = NSMutableParagraphStyle()
|
|
|
+ paragraphStyle.lineHeightMultiple = 1.32
|
|
|
+ paragraphStyle.alignment = .right
|
|
|
+ let attributes = [NSAttributedString.Key.paragraphStyle: paragraphStyle,
|
|
|
+ NSAttributedString.Key.font : NSFont.SFProTextRegular(12.0)]
|
|
|
+ let title: NSString = NSLocalizedString("Enjoy Advanced Features", comment: "") as NSString
|
|
|
+ let size = title.boundingRect(with: CGSize(width: 300, height: 24) ,
|
|
|
+ attributes: attributes).size
|
|
|
+
|
|
|
+ return size
|
|
|
+ }
|
|
|
+
|
|
|
func addNotification() {
|
|
|
self.removeNotification()
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
|
|
|
- NotificationCenter.default.addObserver(self, selector: #selector(updateView), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: ADVANCED_NOTIFICATION), object: nil)
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: USER_INFO_CHANGE_NOTIFICATION), object: nil)
|
|
|
+ NotificationCenter.default.addObserver(self, selector: #selector(updateAdvancedContentView), name: NSNotification.Name(rawValue: USER_LOGINSTATE_NOTIFICATION), object: nil)
|
|
|
+ }
|
|
|
+
|
|
|
+ func updateAdvancedContentView() {
|
|
|
+ self.updateView()
|
|
|
+ self.delete?.homeRefreshButtonAction(nil)
|
|
|
}
|
|
|
|
|
|
func removeNotification() {
|