Browse Source

Height adjustments.

pull/92/head
Abhishek 4 years ago
parent
commit
a2dc27a6d3
  1. 1
      Clocker/AppDelegate.swift
  2. 1
      Clocker/Panel/PanelController.swift
  3. 5
      Clocker/Panel/ParentPanelController.swift
  4. 3
      Clocker/Panel/UI/TimezoneCellView.swift
  5. 10
      Clocker/Panel/UI/TimezoneDataSource.swift

1
Clocker/AppDelegate.swift

@ -163,6 +163,7 @@ open class AppDelegate: NSObject, NSApplicationDelegate {
var activationPolicy: NSApplication.ActivationPolicy = defaults.integer(forKey: CLAppDislayOptions) == 0 ? .accessory : .regular
#if DEBUG
UserDefaults.standard.set(1, forKey: CLAppDislayOptions)
activationPolicy = .regular
#endif

1
Clocker/Panel/PanelController.swift

@ -66,7 +66,6 @@ class PanelController: ParentPanelController {
}
window?.setFrameTopLeftPoint(NSPoint(x: xPoint, y: yPoint))
window?.invalidateShadow()
}

5
Clocker/Panel/ParentPanelController.swift

@ -359,6 +359,7 @@ class ParentPanelController: NSWindowController {
private func getAdjustedRowHeight(for object: TimezoneData?, _ currentHeight: CGFloat) -> CGFloat {
let userFontSize: NSNumber = DataStore.shared().retrieve(key: CLUserFontSizePreference) as? NSNumber ?? 4
let shouldShowSunrise = DataStore.shared().shouldDisplay(.sunrise)
var newHeight = currentHeight
@ -382,6 +383,10 @@ class ParentPanelController: NSWindowController {
}
}
if shouldShowSunrise, object?.selectionType == .city {
newHeight += 8.0
}
newHeight += mainTableView.intercellSpacing.height
return newHeight

3
Clocker/Panel/UI/TimezoneCellView.swift

@ -64,7 +64,6 @@ class TimezoneCellView: NSTableCellView {
}
// If sunrise/sunset times are shown, adjust the time's top space to be closer to cell's top
if !sunriseSetTime.isHidden, relativeDate.isHidden {
for constraint in constraints where constraint.identifier == "time-top-space" {
if constraint.constant == -5.0 {
@ -89,7 +88,7 @@ class TimezoneCellView: NSTableCellView {
if !sunriseSetTime.isHidden {
for constraint in constraints where constraint.identifier == "time-top-space" {
if constraint.constant == -5.0 {
constraint.constant -= 10.0
constraint.constant -= 15.0
}
}
} else {

10
Clocker/Panel/UI/TimezoneDataSource.swift

@ -77,6 +77,7 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate {
if let userFontSize = DataStore.shared().retrieve(key: CLUserFontSizePreference) as? NSNumber, timezones.count > row, let relativeDisplay = DataStore.shared().retrieve(key: CLRelativeDateKey) as? NSNumber {
let model = timezones[row]
let shouldShowSunrise = DataStore.shared().shouldDisplay(.sunrise)
var rowHeight: Int = userFontSize == 4 ? 60 : 65
@ -84,11 +85,16 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate {
rowHeight -= 5
}
if shouldShowSunrise, model.selectionType == .city {
rowHeight += 8
}
if let note = model.note, !note.isEmpty {
return CGFloat(rowHeight + userFontSize.intValue + 25)
rowHeight += userFontSize.intValue + 25
}
return CGFloat(rowHeight + (userFontSize.intValue * 2))
rowHeight += (userFontSize.intValue * 2)
return CGFloat(rowHeight)
}
return 0

Loading…
Cancel
Save