Skip to content

Commit

Permalink
More renaming “cycle between divisions” to “cycle sizes”
Browse files Browse the repository at this point in the history
  • Loading branch information
Eskils committed Aug 8, 2024
1 parent 7adba60 commit 49415a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions Rectangle/CycleSize.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ enum CycleSize: Int, CaseIterable {
// For example if all cycles are used, the order should be:
// 1/2, 2/3, 3/4, 1/4, 1/3
static var sortedSizes: [CycleSize] = {
let sortedDivisions = Self.allCases.sorted(by: { $0.fraction < $1.fraction })
let sortedSizes = Self.allCases.sorted(by: { $0.fraction < $1.fraction })

guard let firstDivisionIndex = sortedDivisions.firstIndex(of: firstSize) else {
return sortedDivisions
guard let firstSizeIndex = sortedSizes.firstIndex(of: firstSize) else {
return sortedSizes
}

let lessThanFistDivision = sortedDivisions[0..<firstDivisionIndex]
let greaterThanFistDivision = sortedDivisions[(firstDivisionIndex + 1)..<sortedDivisions.count]
let lessThanFistSizes = sortedSizes[0..<firstSizeIndex]
let greaterThanFistSizes = sortedSizes[(firstSizeIndex + 1)..<sortedSizes.count]

return [firstSize] + greaterThanFistDivision + lessThanFistDivision
return [firstSize] + greaterThanFistSizes + lessThanFistSizes
}()
}

Expand Down
10 changes: 5 additions & 5 deletions Rectangle/PrefsWindow/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SettingsViewController: NSViewController {
}

Defaults.subsequentExecutionMode.value = mode
initializeCycleBetweenOptionsView(animated: true)
initializeCycleSizesView(animated: true)
}

@IBAction func gapSliderChanged(_ sender: NSSlider) {
Expand Down Expand Up @@ -246,12 +246,12 @@ class SettingsViewController: NSViewController {
}
self.cycleSizeCheckboxes = cycleSizeCheckboxes

initializeCycleBetweenOptionsView(animated: false)
initializeCycleSizesView(animated: false)

Notification.Name.configImported.onPost(using: {_ in
self.initializeTodoModeSettings()
self.initializeToggles()
self.initializeCycleBetweenOptionsView(animated: false)
self.initializeCycleSizesView(animated: false)
})

Notification.Name.menuBarIconHidden.onPost(using: {_ in
Expand Down Expand Up @@ -314,7 +314,7 @@ class SettingsViewController: NSViewController {
setToggleStatesForCycleSizeCheckboxes()
}

private func initializeCycleBetweenOptionsView(animated: Bool = false) {
private func initializeCycleSizesView(animated: Bool = false) {
let showOptionsView = Defaults.subsequentExecutionMode.value == .resize

if showOptionsView {
Expand Down Expand Up @@ -359,7 +359,7 @@ class SettingsViewController: NSViewController {
let rawValue = checkbox.tag

guard let cycleSize = CycleSize(rawValue: rawValue) else {
Logger.log("Expected tag of cycle between checkbox to match a value of CycleBetweenDivision. Got: \(String(describing: rawValue))")
Logger.log("Expected tag of cycle size checkbox to match a value of CycleSize. Got: \(String(describing: rawValue))")
return
}

Expand Down

0 comments on commit 49415a3

Please sign in to comment.